diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-03 19:13:28 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-03 19:13:28 -0400 |
commit | 1a4a2bc460721bc8f91e4c1294d39b38e5af132f (patch) | |
tree | fe646d05f6e17f05601e0a32cc796bec718ab6e7 /tools | |
parent | 110a9e42b68719f584879c5c5c727bbae90d15f9 (diff) | |
parent | 1ef55be16ed69538f89e0a6508be5e62fdc9851c (diff) |
Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull low-level x86 updates from Ingo Molnar:
"In this cycle this topic tree has become one of those 'super topics'
that accumulated a lot of changes:
- Add CONFIG_VMAP_STACK=y support to the core kernel and enable it on
x86 - preceded by an array of changes. v4.8 saw preparatory changes
in this area already - this is the rest of the work. Includes the
thread stack caching performance optimization. (Andy Lutomirski)
- switch_to() cleanups and all around enhancements. (Brian Gerst)
- A large number of dumpstack infrastructure enhancements and an
unwinder abstraction. The secret long term plan is safe(r) live
patching plus maybe another attempt at debuginfo based unwinding -
but all these current bits are standalone enhancements in a frame
pointer based debug environment as well. (Josh Poimboeuf)
- More __ro_after_init and const annotations. (Kees Cook)
- Enable KASLR for the vmemmap memory region. (Thomas Garnier)"
[ The virtually mapped stack changes are pretty fundamental, and not
x86-specific per se, even if they are only used on x86 right now. ]
* 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (70 commits)
x86/asm: Get rid of __read_cr4_safe()
thread_info: Use unsigned long for flags
x86/alternatives: Add stack frame dependency to alternative_call_2()
x86/dumpstack: Fix show_stack() task pointer regression
x86/dumpstack: Remove dump_trace() and related callbacks
x86/dumpstack: Convert show_trace_log_lvl() to use the new unwinder
oprofile/x86: Convert x86_backtrace() to use the new unwinder
x86/stacktrace: Convert save_stack_trace_*() to use the new unwinder
perf/x86: Convert perf_callchain_kernel() to use the new unwinder
x86/unwind: Add new unwind interface and implementations
x86/dumpstack: Remove NULL task pointer convention
fork: Optimize task creation by caching two thread stacks per CPU if CONFIG_VMAP_STACK=y
sched/core: Free the stack early if CONFIG_THREAD_INFO_IN_TASK
lib/syscall: Pin the task stack in collect_syscall()
x86/process: Pin the target stack in get_wchan()
x86/dumpstack: Pin the target stack when dumping it
kthread: Pin the stack via try_get_task_stack()/put_task_stack() in to_live_kthread() function
sched/core: Add try_get_task_stack() and put_task_stack()
x86/entry/64: Fix a minor comment rebase error
iommu/amd: Don't put completion-wait semaphore on stack
...
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/x86/ptrace_syscall.c | 4 | ||||
-rw-r--r-- | tools/testing/selftests/x86/sigreturn.c | 16 |
2 files changed, 10 insertions, 10 deletions
diff --git a/tools/testing/selftests/x86/ptrace_syscall.c b/tools/testing/selftests/x86/ptrace_syscall.c index 421456784bc6..b037ce9cf116 100644 --- a/tools/testing/selftests/x86/ptrace_syscall.c +++ b/tools/testing/selftests/x86/ptrace_syscall.c | |||
@@ -147,7 +147,7 @@ static void test_sys32_regs(void (*do_syscall)(struct syscall_args32 *)) | |||
147 | if (args.nr != getpid() || | 147 | if (args.nr != getpid() || |
148 | args.arg0 != 10 || args.arg1 != 11 || args.arg2 != 12 || | 148 | args.arg0 != 10 || args.arg1 != 11 || args.arg2 != 12 || |
149 | args.arg3 != 13 || args.arg4 != 14 || args.arg5 != 15) { | 149 | args.arg3 != 13 || args.arg4 != 14 || args.arg5 != 15) { |
150 | printf("[FAIL]\tgetpid() failed to preseve regs\n"); | 150 | printf("[FAIL]\tgetpid() failed to preserve regs\n"); |
151 | nerrs++; | 151 | nerrs++; |
152 | } else { | 152 | } else { |
153 | printf("[OK]\tgetpid() preserves regs\n"); | 153 | printf("[OK]\tgetpid() preserves regs\n"); |
@@ -162,7 +162,7 @@ static void test_sys32_regs(void (*do_syscall)(struct syscall_args32 *)) | |||
162 | if (args.nr != 0 || | 162 | if (args.nr != 0 || |
163 | args.arg0 != getpid() || args.arg1 != SIGUSR1 || args.arg2 != 12 || | 163 | args.arg0 != getpid() || args.arg1 != SIGUSR1 || args.arg2 != 12 || |
164 | args.arg3 != 13 || args.arg4 != 14 || args.arg5 != 15) { | 164 | args.arg3 != 13 || args.arg4 != 14 || args.arg5 != 15) { |
165 | printf("[FAIL]\tkill(getpid(), SIGUSR1) failed to preseve regs\n"); | 165 | printf("[FAIL]\tkill(getpid(), SIGUSR1) failed to preserve regs\n"); |
166 | nerrs++; | 166 | nerrs++; |
167 | } else { | 167 | } else { |
168 | printf("[OK]\tkill(getpid(), SIGUSR1) preserves regs\n"); | 168 | printf("[OK]\tkill(getpid(), SIGUSR1) preserves regs\n"); |
diff --git a/tools/testing/selftests/x86/sigreturn.c b/tools/testing/selftests/x86/sigreturn.c index 8a577e7070c6..246145b84a12 100644 --- a/tools/testing/selftests/x86/sigreturn.c +++ b/tools/testing/selftests/x86/sigreturn.c | |||
@@ -106,7 +106,7 @@ asm (".pushsection .text\n\t" | |||
106 | ".type int3, @function\n\t" | 106 | ".type int3, @function\n\t" |
107 | ".align 4096\n\t" | 107 | ".align 4096\n\t" |
108 | "int3:\n\t" | 108 | "int3:\n\t" |
109 | "mov %ss,%eax\n\t" | 109 | "mov %ss,%ecx\n\t" |
110 | "int3\n\t" | 110 | "int3\n\t" |
111 | ".size int3, . - int3\n\t" | 111 | ".size int3, . - int3\n\t" |
112 | ".align 4096, 0xcc\n\t" | 112 | ".align 4096, 0xcc\n\t" |
@@ -306,7 +306,7 @@ static volatile sig_atomic_t sig_corrupt_final_ss; | |||
306 | #ifdef __x86_64__ | 306 | #ifdef __x86_64__ |
307 | # define REG_IP REG_RIP | 307 | # define REG_IP REG_RIP |
308 | # define REG_SP REG_RSP | 308 | # define REG_SP REG_RSP |
309 | # define REG_AX REG_RAX | 309 | # define REG_CX REG_RCX |
310 | 310 | ||
311 | struct selectors { | 311 | struct selectors { |
312 | unsigned short cs, gs, fs, ss; | 312 | unsigned short cs, gs, fs, ss; |
@@ -326,7 +326,7 @@ static unsigned short *csptr(ucontext_t *ctx) | |||
326 | #else | 326 | #else |
327 | # define REG_IP REG_EIP | 327 | # define REG_IP REG_EIP |
328 | # define REG_SP REG_ESP | 328 | # define REG_SP REG_ESP |
329 | # define REG_AX REG_EAX | 329 | # define REG_CX REG_ECX |
330 | 330 | ||
331 | static greg_t *ssptr(ucontext_t *ctx) | 331 | static greg_t *ssptr(ucontext_t *ctx) |
332 | { | 332 | { |
@@ -457,10 +457,10 @@ static void sigusr1(int sig, siginfo_t *info, void *ctx_void) | |||
457 | ctx->uc_mcontext.gregs[REG_IP] = | 457 | ctx->uc_mcontext.gregs[REG_IP] = |
458 | sig_cs == code16_sel ? 0 : (unsigned long)&int3; | 458 | sig_cs == code16_sel ? 0 : (unsigned long)&int3; |
459 | ctx->uc_mcontext.gregs[REG_SP] = (unsigned long)0x8badf00d5aadc0deULL; | 459 | ctx->uc_mcontext.gregs[REG_SP] = (unsigned long)0x8badf00d5aadc0deULL; |
460 | ctx->uc_mcontext.gregs[REG_AX] = 0; | 460 | ctx->uc_mcontext.gregs[REG_CX] = 0; |
461 | 461 | ||
462 | memcpy(&requested_regs, &ctx->uc_mcontext.gregs, sizeof(gregset_t)); | 462 | memcpy(&requested_regs, &ctx->uc_mcontext.gregs, sizeof(gregset_t)); |
463 | requested_regs[REG_AX] = *ssptr(ctx); /* The asm code does this. */ | 463 | requested_regs[REG_CX] = *ssptr(ctx); /* The asm code does this. */ |
464 | 464 | ||
465 | return; | 465 | return; |
466 | } | 466 | } |
@@ -482,7 +482,7 @@ static void sigtrap(int sig, siginfo_t *info, void *ctx_void) | |||
482 | unsigned short ss; | 482 | unsigned short ss; |
483 | asm ("mov %%ss,%0" : "=r" (ss)); | 483 | asm ("mov %%ss,%0" : "=r" (ss)); |
484 | 484 | ||
485 | greg_t asm_ss = ctx->uc_mcontext.gregs[REG_AX]; | 485 | greg_t asm_ss = ctx->uc_mcontext.gregs[REG_CX]; |
486 | if (asm_ss != sig_ss && sig == SIGTRAP) { | 486 | if (asm_ss != sig_ss && sig == SIGTRAP) { |
487 | /* Sanity check failure. */ | 487 | /* Sanity check failure. */ |
488 | printf("[FAIL]\tSIGTRAP: ss = %hx, frame ss = %hx, ax = %llx\n", | 488 | printf("[FAIL]\tSIGTRAP: ss = %hx, frame ss = %hx, ax = %llx\n", |
@@ -654,8 +654,8 @@ static int test_valid_sigreturn(int cs_bits, bool use_16bit_ss, int force_ss) | |||
654 | #endif | 654 | #endif |
655 | 655 | ||
656 | /* Sanity check on the kernel */ | 656 | /* Sanity check on the kernel */ |
657 | if (i == REG_AX && requested_regs[i] != resulting_regs[i]) { | 657 | if (i == REG_CX && requested_regs[i] != resulting_regs[i]) { |
658 | printf("[FAIL]\tAX (saved SP) mismatch: requested 0x%llx; got 0x%llx\n", | 658 | printf("[FAIL]\tCX (saved SP) mismatch: requested 0x%llx; got 0x%llx\n", |
659 | (unsigned long long)requested_regs[i], | 659 | (unsigned long long)requested_regs[i], |
660 | (unsigned long long)resulting_regs[i]); | 660 | (unsigned long long)resulting_regs[i]); |
661 | nerrs++; | 661 | nerrs++; |