mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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 ...
This commit is contained in:
commit
1a4a2bc460
114 changed files with 1751 additions and 1137 deletions
|
@ -147,7 +147,7 @@ static void test_sys32_regs(void (*do_syscall)(struct syscall_args32 *))
|
|||
if (args.nr != getpid() ||
|
||||
args.arg0 != 10 || args.arg1 != 11 || args.arg2 != 12 ||
|
||||
args.arg3 != 13 || args.arg4 != 14 || args.arg5 != 15) {
|
||||
printf("[FAIL]\tgetpid() failed to preseve regs\n");
|
||||
printf("[FAIL]\tgetpid() failed to preserve regs\n");
|
||||
nerrs++;
|
||||
} else {
|
||||
printf("[OK]\tgetpid() preserves regs\n");
|
||||
|
@ -162,7 +162,7 @@ static void test_sys32_regs(void (*do_syscall)(struct syscall_args32 *))
|
|||
if (args.nr != 0 ||
|
||||
args.arg0 != getpid() || args.arg1 != SIGUSR1 || args.arg2 != 12 ||
|
||||
args.arg3 != 13 || args.arg4 != 14 || args.arg5 != 15) {
|
||||
printf("[FAIL]\tkill(getpid(), SIGUSR1) failed to preseve regs\n");
|
||||
printf("[FAIL]\tkill(getpid(), SIGUSR1) failed to preserve regs\n");
|
||||
nerrs++;
|
||||
} else {
|
||||
printf("[OK]\tkill(getpid(), SIGUSR1) preserves regs\n");
|
||||
|
|
|
@ -106,7 +106,7 @@ asm (".pushsection .text\n\t"
|
|||
".type int3, @function\n\t"
|
||||
".align 4096\n\t"
|
||||
"int3:\n\t"
|
||||
"mov %ss,%eax\n\t"
|
||||
"mov %ss,%ecx\n\t"
|
||||
"int3\n\t"
|
||||
".size int3, . - int3\n\t"
|
||||
".align 4096, 0xcc\n\t"
|
||||
|
@ -306,7 +306,7 @@ static volatile sig_atomic_t sig_corrupt_final_ss;
|
|||
#ifdef __x86_64__
|
||||
# define REG_IP REG_RIP
|
||||
# define REG_SP REG_RSP
|
||||
# define REG_AX REG_RAX
|
||||
# define REG_CX REG_RCX
|
||||
|
||||
struct selectors {
|
||||
unsigned short cs, gs, fs, ss;
|
||||
|
@ -326,7 +326,7 @@ static unsigned short *csptr(ucontext_t *ctx)
|
|||
#else
|
||||
# define REG_IP REG_EIP
|
||||
# define REG_SP REG_ESP
|
||||
# define REG_AX REG_EAX
|
||||
# define REG_CX REG_ECX
|
||||
|
||||
static greg_t *ssptr(ucontext_t *ctx)
|
||||
{
|
||||
|
@ -457,10 +457,10 @@ static void sigusr1(int sig, siginfo_t *info, void *ctx_void)
|
|||
ctx->uc_mcontext.gregs[REG_IP] =
|
||||
sig_cs == code16_sel ? 0 : (unsigned long)&int3;
|
||||
ctx->uc_mcontext.gregs[REG_SP] = (unsigned long)0x8badf00d5aadc0deULL;
|
||||
ctx->uc_mcontext.gregs[REG_AX] = 0;
|
||||
ctx->uc_mcontext.gregs[REG_CX] = 0;
|
||||
|
||||
memcpy(&requested_regs, &ctx->uc_mcontext.gregs, sizeof(gregset_t));
|
||||
requested_regs[REG_AX] = *ssptr(ctx); /* The asm code does this. */
|
||||
requested_regs[REG_CX] = *ssptr(ctx); /* The asm code does this. */
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -482,7 +482,7 @@ static void sigtrap(int sig, siginfo_t *info, void *ctx_void)
|
|||
unsigned short ss;
|
||||
asm ("mov %%ss,%0" : "=r" (ss));
|
||||
|
||||
greg_t asm_ss = ctx->uc_mcontext.gregs[REG_AX];
|
||||
greg_t asm_ss = ctx->uc_mcontext.gregs[REG_CX];
|
||||
if (asm_ss != sig_ss && sig == SIGTRAP) {
|
||||
/* Sanity check failure. */
|
||||
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)
|
|||
#endif
|
||||
|
||||
/* Sanity check on the kernel */
|
||||
if (i == REG_AX && requested_regs[i] != resulting_regs[i]) {
|
||||
printf("[FAIL]\tAX (saved SP) mismatch: requested 0x%llx; got 0x%llx\n",
|
||||
if (i == REG_CX && requested_regs[i] != resulting_regs[i]) {
|
||||
printf("[FAIL]\tCX (saved SP) mismatch: requested 0x%llx; got 0x%llx\n",
|
||||
(unsigned long long)requested_regs[i],
|
||||
(unsigned long long)resulting_regs[i]);
|
||||
nerrs++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue