Skip to content

Commit

Permalink
Merge tag 'linux-kselftest-4.19-rc7' of git://git.kernel.org/pub/scm/…
Browse files Browse the repository at this point in the history
…linux/kernel/git/shuah/linux-kselftest

Shuah writes:
  "kselftest fixes for 4.19-rc7

   This fixes update for 4.19-rc7 consists one fix to rseq test to
   prevent it from seg-faulting when compiled with -fpie."

* tag 'linux-kselftest-4.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  rseq/selftests: fix parametrized test with -fpie
  • Loading branch information
gregkh committed Oct 3, 2018
2 parents 6bebe37 + ce01a15 commit 95773dc
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions tools/testing/selftests/rseq/param_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,13 @@ unsigned int yield_mod_cnt, nr_abort;
printf(fmt, ## __VA_ARGS__); \
} while (0)

#if defined(__x86_64__) || defined(__i386__)
#ifdef __i386__

#define INJECT_ASM_REG "eax"

#define RSEQ_INJECT_CLOBBER \
, INJECT_ASM_REG

#ifdef __i386__

#define RSEQ_INJECT_ASM(n) \
"mov asm_loop_cnt_" #n ", %%" INJECT_ASM_REG "\n\t" \
"test %%" INJECT_ASM_REG ",%%" INJECT_ASM_REG "\n\t" \
Expand All @@ -76,20 +74,23 @@ unsigned int yield_mod_cnt, nr_abort;

#elif defined(__x86_64__)

#define INJECT_ASM_REG_P "rax"
#define INJECT_ASM_REG "eax"

#define RSEQ_INJECT_CLOBBER \
, INJECT_ASM_REG_P \
, INJECT_ASM_REG

#define RSEQ_INJECT_ASM(n) \
"lea asm_loop_cnt_" #n "(%%rip), %%" INJECT_ASM_REG "\n\t" \
"mov (%%" INJECT_ASM_REG "), %%" INJECT_ASM_REG "\n\t" \
"lea asm_loop_cnt_" #n "(%%rip), %%" INJECT_ASM_REG_P "\n\t" \
"mov (%%" INJECT_ASM_REG_P "), %%" INJECT_ASM_REG "\n\t" \
"test %%" INJECT_ASM_REG ",%%" INJECT_ASM_REG "\n\t" \
"jz 333f\n\t" \
"222:\n\t" \
"dec %%" INJECT_ASM_REG "\n\t" \
"jnz 222b\n\t" \
"333:\n\t"

#else
#error "Unsupported architecture"
#endif

#elif defined(__s390__)

#define RSEQ_INJECT_INPUT \
Expand Down

0 comments on commit 95773dc

Please sign in to comment.