x86: Don't abuse tss.sp1
Subsystems (3)
v4 cover x86: Don't abuse tss.sp1
From: Lai Jiangshan <[email protected]>
In x86_64, tss.sp1 is reused as cpu_current_top_of_stack. We'd better directly use percpu since CR3 and gs_base is correct when it is used.
In x86_32, tss.sp1 is resued as thread.sp0 in three places in entry code. We have the correct CR3 and %fs at two of the places. The last one is sysenter. This patchset makes %fs available earlier so that we can also use percpu in sysenter. And add a percpu cpu_current_thread_sp0 for thread.sp0 instead of tss.sp1
[V3]: https://lore.kernel.org/lkml/[email protected]/
[V2]: https://lore.kernel.org/lkml/[email protected]/
[V1]: https://lore.kernel.org/lkml/[email protected]/
Changed from V3:
Update subjects as Borislav's imperative request. ^_^ Update changelog as Borislav suggested.
Change EXPORT_PER_CPU_SYMBOL to EXPORT_PER_CPU_SYMBOL_GPL.
Changed from V2:
Add missing "%ss:" reported by Brian Gerst.
Changed from V1:
Requested from Andy to also fix sp1 for x86_32. Update comments in the x86_64 patch as Andy sugguested.
Lai Jiangshan (6):
x86/entry/64: Move cpu_current_top_of_stack out of TSS x86/entry/32: Use percpu instead of offset-calculation to get
thread.sp0 in SWITCH_TO_KERNEL_STACK
x86/entry/32: Switch to the task stack without emptying the entry
stack
x86/entry/32: Restore %fs before switching stack x86/entry/32: Use percpu to get thread.sp0 in SYSENTER x86/entry/32: Introduce cpu_current_thread_sp0 to replace
cpu_tss_rw.x86_tss.sp1
arch/x86/entry/entry_32.S | 38 +++++++++++++++++------------- arch/x86/include/asm/processor.h | 12 ++-------- arch/x86/include/asm/switch_to.h | 8 +------ arch/x86/include/asm/thread_info.h | 6 ----- arch/x86/kernel/asm-offsets.c | 1 - arch/x86/kernel/asm-offsets_32.c | 10 -------- arch/x86/kernel/cpu/common.c | 12 +++++++++- arch/x86/kernel/process.c | 7 ------ arch/x86/mm/pti.c | 7 +++--- 9 files changed, 39 insertions(+), 62 deletions(-)
Signature · 1 line
2.19.1.6.gb485710b
PATCH v4 1/6 x86/entry/64: Move cpu_current_top_of_stack out of TSS
From: Lai Jiangshan <[email protected]>
In x86_64, cpu_current_top_of_stack is an alias of cpu_tss_rw.x86_tss.sp1.
When the CPU has meltdown vulnerability(X86_BUG_CPU_MELTDOWN), it would become a coveted fruit even if kernel pagetable isolation is enabled since CPU TSS must also be in the user CR3. An attacker can fetch the kernel stack top from it through the said vulnerability and continue next steps of actions based on the kernel stack.
Besides the possible leakage of the address of the kernel stack, it is not necessary to be in TSS either. Although it is also heavily used in the entry code, it is only used when CR3 is already the kernel CR3 and gs_base is already the kernel gs_base which means it can be a normal percpu variable instead of an alias to a field in TSS.
The major reason it reuses a filed in TSS is performance because TSS is normally hot in cache and TLB since entry_SYSCALL_64 uses sp2 as scratch space to stash the user RSP value.
This patch makes it be a percpu variable near other hot percpu variables, such as current_task, __preempt_count, and they are in the same cache line.
---tools/testing/selftests/seccomp/seccomp_benchmark desn't show any performance lost in "getpid native" result. And actually, the result changes from 93ns before patch to 92ns after patch when !KPTI, and the test is very stable although the test desn't show a higher degree of precision but enough to know it doesn't cause degression for the test.
arch/x86/include/asm/processor.h | 10 ---------- arch/x86/include/asm/switch_to.h | 6 ------ arch/x86/include/asm/thread_info.h | 6 ------ arch/x86/kernel/cpu/common.c | 3 +++ arch/x86/kernel/process.c | 7 +------ arch/x86/mm/pti.c | 7 +++---- 6 files changed, 7 insertions(+), 32 deletions(-)
arch/x86/include/asm/processor.h +0 -10
@@ -316,11 +316,6 @@ struct x86_hw_tss {struct x86_hw_tss {u32 reserved1;u64 sp0; - -/* -* We store cpu_current_top_of_stack in sp1 so it's always accessible. -* Linux does not use ring 1, so sp1 is not otherwise needed. -*/ u64 sp1;/*
@@ -430,12 +425,7 @@ struct irq_stack { DECLARE_PER_CPU(struct irq_stack *, hardirq_stack_ptr); -#ifdef CONFIG_X86_32 DECLARE_PER_CPU(unsigned long, cpu_current_top_of_stack); -#else -/* The RO copy can't be accessed with this_cpu_xyz(), so use the RW copy. */ -#define cpu_current_top_of_stack cpu_tss_rw.x86_tss.sp1 -#endif #ifdef CONFIG_X86_64 struct fixed_percpu_data {
arch/x86/include/asm/switch_to.h +0 -6
@@ -71,12 +71,6 @@ static inline void update_task_stack(struct task_struct *task) else this_cpu_write(cpu_tss_rw.x86_tss.sp1, task->thread.sp0);#else -/* -* x86-64 updates x86_tss.sp1 via cpu_current_top_of_stack. That -* doesn't work on x86-32 because sp1 and -* cpu_current_top_of_stack have different values (because of -* the non-zero stack-padding on 32bit). -*/ if (static_cpu_has (X86_FEATURE_XENPV ))load_sp0 (task_top_of_stack (task));#endif
arch/x86/include/asm/thread_info.h +0 -6
@@ -199,12 +199,6 @@ static inline int arch_within_stack_frames(const void * const stack, #endif } -#else /* !__ASSEMBLY__ */ - -#ifdef CONFIG_X86_64 -# define cpu_current_top_of_stack (cpu_tss_rw + TSS_sp1) -#endif -#endif #ifdef CONFIG_COMPAT
arch/x86/kernel/cpu/common.c +3 -0
@@ -1748,6 +1748,9 @@ DEFINE_PER_CPU(unsigned int, irq_count) __visible = -1;DEFINE_PER_CPU (int, __preempt_count) =INIT_PREEMPT_COUNT ;EXPORT_PER_CPU_SYMBOL (__preempt_count); +DEFINE_PER_CPU(unsigned long, cpu_current_top_of_stack) = TOP_OF_INIT_STACK; +EXPORT_PER_CPU_SYMBOL_GPL (cpu_current_top_of_stack); +/* May not be marked __init: used by software suspend */ void syscall_init (void ) {
arch/x86/kernel/process.c +1 -6
@@ -63,14 +63,9 @@ __visible DEFINE_PER_CPU_PAGE_ALIGNED(struct tss_struct, cpu_tss_rw) = {*/ .sp0 = (1UL << (BITS_PER_LONG-1)) + 1, -/* -* .sp1 is cpu_current_top_of_stack. The init task never -* runs user code, but cpu_current_top_of_stack should still -* be well defined before the first context switch. -*/ +#ifdef CONFIG_X86_32 .sp1 =TOP_OF_INIT_STACK , -#ifdef CONFIG_X86_32 .ss0 = __KERNEL_DS, .ss1 = __KERNEL_CS, #endif
arch/x86/mm/pti.c +3 -4
@@ -440,10 +440,9 @@ static void __init pti_clone_user_shared(void)for_each_possible_cpu (cpu) {/* -* The SYSCALL64 entry code needs to be able to find the -* thread stack and needs one word of scratch space in which -* to spill a register. All of this lives in the TSS, in -* the sp1 and sp2 slots. +* The SYSCALL64 entry code needs one word of scratch space +* in which to spill a register. It lives in the sp2 slot +* of the CPU's TSS. * * This is done for all possible CPUs during boot to ensure * that it's propagated to all mms.
Signature · 1 line
2.19.1.6.gb485710b
PATCH v4 2/6 x86/entry/32: Use percpu instead of offset-calculation to get thread.sp0 in SWITCH_TO_KERNEL_STACK
In reply to Lai JiangshanFrom: Lai Jiangshan <[email protected]>
TSS_entry2task_stack is used to refer to tss.sp1 which is a copy of thread.sp0.
When TSS_entry2task_stack is used in SWITCH_TO_KERNEL_STACK, the CR3 is already kernel CR3 and the kernel segments are loaded.
So it directly uses percpu to get tss.sp1(thread.sp0) instead of the complicated offset-calculation via TSS_entry2task_stack.
--- arch/x86/entry/entry_32.S | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
arch/x86/entry/entry_32.S +2 -7
@@ -465,16 +465,11 @@ cmpl $SIZEOF_entry_stack, %ecx jae .Lend_\@ - /* Load stack pointer into %esi and %edi */ + /* Load stack pointer into %esi */ movl %esp, %esi - movl %esi, %edi - - /* Move %edi to the top of the entry stack */ - andl $(MASK_entry_stack), %edi - addl $(SIZEOF_entry_stack), %edi /* Load top of task-stack into %edi */ - movl TSS_entry2task_stack(%edi), %edi + movl PER_CPU_VAR(cpu_tss_rw + TSS_sp1), %edi /* Special case - entry from kernel mode via entry stack */ #ifdef CONFIG_VM86
Signature · 1 line
2.19.1.6.gb485710b
PATCH v4 3/6 x86/entry/32: Switch to the task stack without emptying the entry stack
In reply to Lai JiangshanFrom: Lai Jiangshan <[email protected]>
Like the way x86_64 uses the entry stack when switching to the task stack, entry_SYSENTER_32 can also save the entry stack pointer to a register and then switch to the task stack. So that it doesn't need to empty the entry stack by poping contents to registers and it has more space on the entry stack to save stuffs or scratch registers.
It is a preparation for next patches which need to save user %fs in the entry stack before restoring kernel %fs and loading the task stack for stack switching.
--- arch/x86/entry/entry_32.S | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
arch/x86/entry/entry_32.S +5 -6
@@ -905,19 +905,18 @@ SYM_FUNC_START(entry_SYSENTER_32) pushl %eax BUG_IF_WRONG_CR3 no_user_check=1 SWITCH_TO_KERNEL_CR3 scratch_reg=%eax - popl %eax - popfl - /* Stack empty again, switch to task stack */ - movl TSS_entry2task_stack(%esp), %esp + /* Switch to task stack */ + movl %esp, %eax + movl (2*4+TSS_entry2task_stack)(%esp), %esp .Lsysenter_past_esp: pushl $__USER_DS /* pt_regs->ss */ pushl $0 /* pt_regs->sp (placeholder) */ - pushfl /* pt_regs->flags (except IF = 0) */ + pushl %ss:4(%eax) /* pt_regs->flags (except IF = 0) */ pushl $__USER_CS /* pt_regs->cs */ pushl $0 /* pt_regs->ip = 0 (placeholder) */ - pushl %eax /* pt_regs->orig_ax */ + pushl %ss:(%eax) /* pt_regs->orig_ax */ SAVE_ALL pt_regs_ax=$-ENOSYS /* save rest, stack already switched */ /*
Signature · 1 line
2.19.1.6.gb485710b
PATCH v4 4/6 x86/entry/32: Restore %fs before switching stack
In reply to Lai JiangshanFrom: Lai Jiangshan <[email protected]>
entry_SYSENTER_32 saves the user %fs in the entry stack and restores the kernel %fs before loading the task stack for stack switching, so that it can use percpu before switching stack in the next patch.
--- arch/x86/entry/entry_32.S | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
arch/x86/entry/entry_32.S +17 -5
@@ -279,11 +279,13 @@ .Lfinished_frame_\@: .endm -.macro SAVE_ALL pt_regs_ax=%eax switch_stacks=0 skip_gs=0 unwind_espfix=0 +.macro SAVE_ALL pt_regs_ax=%eax switch_stacks=0 skip_gs=0 skip_fs=0 unwind_espfix=0 cld .if \skip_gs == 0 PUSH_GS .endif + +.if \skip_fs == 0 pushl %fs pushl %eax
@@ -293,6 +295,7 @@ UNWIND_ESPFIX_STACK .endif popl %eax +.endif FIXUP_FRAME pushl %es
@@ -906,18 +909,27 @@ SYM_FUNC_START(entry_SYSENTER_32) BUG_IF_WRONG_CR3 no_user_check=1 SWITCH_TO_KERNEL_CR3 scratch_reg=%eax + /* Restore kernel %fs, so that we can use PERCPU */ + pushl %fs + movl $(__KERNEL_PERCPU), %eax + movl %eax, %fs + /* Switch to task stack */ movl %esp, %eax - movl (2*4+TSS_entry2task_stack)(%esp), %esp + movl (3*4+TSS_entry2task_stack)(%esp), %esp .Lsysenter_past_esp: pushl $__USER_DS /* pt_regs->ss */ pushl $0 /* pt_regs->sp (placeholder) */ - pushl %ss:4(%eax) /* pt_regs->flags (except IF = 0) */ + pushl %ss:8(%eax) /* pt_regs->flags (except IF = 0) */ pushl $__USER_CS /* pt_regs->cs */ pushl $0 /* pt_regs->ip = 0 (placeholder) */ - pushl %ss:(%eax) /* pt_regs->orig_ax */ - SAVE_ALL pt_regs_ax=$-ENOSYS /* save rest, stack already switched */ + pushl %ss:4(%eax) /* pt_regs->orig_ax */ + PUSH_GS /* pt_regs->gs */ + pushl %ss:(%eax) /* pt_regs->fs */ + /* save rest, stack and %fs already switched */ + SAVE_ALL pt_regs_ax=$-ENOSYS skip_gs=1 skip_fs=1 + SET_KERNEL_GS %edx /* * SYSENTER doesn't filter flags, so we need to clear NT, AC
Signature · 1 line
2.19.1.6.gb485710b
PATCH v4 5/6 x86/entry/32: Use percpu to get thread.sp0 in SYSENTER
In reply to Lai JiangshanFrom: Lai Jiangshan <[email protected]>
TSS_entry2task_stack is used to refer to tss.sp1 which is a copy of thread.sp0.
When TSS_entry2task_stack is used in entry_SYSENTER_32, the CR3 is already kernel CR3 and the kernel %fs is loaded.
So it directly uses percpu instead of offset-calculation via TSS_entry2task_stack.
And we remove the unused TSS_entry2task_stack.
--- arch/x86/entry/entry_32.S | 2 +- arch/x86/kernel/asm-offsets_32.c | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-)
arch/x86/entry/entry_32.S +1 -1
@@ -916,7 +916,7 @@ SYM_FUNC_START(entry_SYSENTER_32) /* Switch to task stack */ movl %esp, %eax - movl (3*4+TSS_entry2task_stack)(%esp), %esp + movl PER_CPU_VAR(cpu_tss_rw + TSS_sp1), %esp .Lsysenter_past_esp: pushl $__USER_DS /* pt_regs->ss */
arch/x86/kernel/asm-offsets_32.c +0 -10
@@ -43,16 +43,6 @@ void foo(void)OFFSET (saved_context_gdt_desc, saved_context, gdt_desc);BLANK (); -/* -* Offset from the entry stack to task stack stored in TSS. Kernel entry -* happens on the per-cpu entry-stack, and the asm code switches to the -* task-stack pointer stored in x86_tss.sp1, which is a copy of -* task->thread.sp0 where entry code can find it. -*/ -DEFINE (TSS_entry2task_stack, - offsetof(struct cpu_entry_area, tss.x86_tss.sp1) - - offsetofend(struct cpu_entry_area, entry_stack_page.stack)); -#ifdef CONFIG_STACKPROTECTOR BLANK ();OFFSET (stack_canary_offset, stack_canary, canary);
Signature · 1 line
2.19.1.6.gb485710b
PATCH v4 6/6 x86/entry/32: Introduce cpu_current_thread_sp0 to replace cpu_tss_rw.x86_tss.sp1
In reply to Lai JiangshanFrom: Lai Jiangshan <[email protected]>
TSS sp1 is not used by hardware and is used as a copy of thread.sp0.
It should just use a percpu variable instead, so we introduce cpu_current_thread_sp0 for it.
And we remove the unneeded TSS_sp1.
--- arch/x86/entry/entry_32.S | 6 +++--- arch/x86/include/asm/processor.h | 2 ++ arch/x86/include/asm/switch_to.h | 2 +- arch/x86/kernel/asm-offsets.c | 1 - arch/x86/kernel/cpu/common.c | 9 ++++++++- arch/x86/kernel/process.c | 2 -- 6 files changed, 14 insertions(+), 8 deletions(-)
arch/x86/entry/entry_32.S +3 -3
@@ -472,7 +472,7 @@ movl %esp, %esi /* Load top of task-stack into %edi */ - movl PER_CPU_VAR(cpu_tss_rw + TSS_sp1), %edi + movl PER_CPU_VAR(cpu_current_thread_sp0), %edi /* Special case - entry from kernel mode via entry stack */ #ifdef CONFIG_VM86
@@ -658,7 +658,7 @@ movl PER_CPU_VAR(cpu_tss_rw + TSS_sp0), %edi /* Bytes on the task-stack to ecx */ - movl PER_CPU_VAR(cpu_tss_rw + TSS_sp1), %ecx + movl PER_CPU_VAR(cpu_current_thread_sp0), %ecx subl %esi, %ecx /* Allocate stack-frame on entry-stack */
@@ -916,7 +916,7 @@ SYM_FUNC_START(entry_SYSENTER_32) /* Switch to task stack */ movl %esp, %eax - movl PER_CPU_VAR(cpu_tss_rw + TSS_sp1), %esp + movl PER_CPU_VAR(cpu_current_thread_sp0), %esp .Lsysenter_past_esp: pushl $__USER_DS /* pt_regs->ss */
arch/x86/include/asm/processor.h +2 -0
@@ -776,6 +776,8 @@ static inline void spin_lock_prefetch(const void *x)#define KSTK_ESP (task) (task_pt_regs(task)->sp) +DECLARE_PER_CPU(unsigned long, cpu_current_thread_sp0); +#else #define INIT_THREAD { }
arch/x86/include/asm/switch_to.h +1 -1
@@ -69,7 +69,7 @@ static inline void update_task_stack(struct task_struct *task)if (static_cpu_has (X86_FEATURE_XENPV ))load_sp0 (task->thread.sp0);else -this_cpu_write (cpu_tss_rw.x86_tss.sp1, task->thread.sp0); +this_cpu_write (cpu_current_thread_sp0, task->thread.sp0);#else if (static_cpu_has (X86_FEATURE_XENPV ))load_sp0 (task_top_of_stack (task));
arch/x86/kernel/asm-offsets.c +0 -1
@@ -98,6 +98,5 @@ static void __used common(void)/* Offset for fields in tss_struct */ OFFSET (TSS_sp0, tss_struct, x86_tss.sp0); -OFFSET (TSS_sp1, tss_struct, x86_tss.sp1);OFFSET (TSS_sp2, tss_struct, x86_tss.sp2); }
arch/x86/kernel/cpu/common.c +8 -1
@@ -1792,12 +1792,19 @@ EXPORT_PER_CPU_SYMBOL(__preempt_count);/* * On x86_32, vm86 modifies tss.sp0, so sp0 isn't a reliable way to find * the top of the kernel stack. Use an extra percpu variable to track the -* top of the kernel stack directly. +* top of the kernel stack directly and an percpu variable to track the +* thread.sp0 for using in entry code. cpu_current_top_of_stack and +* cpu_current_thread_sp0 are different value because of the non-zero +* stack-padding on 32bit. See more comment at TOP_OF_KERNEL_STACK_PADDING +* and vm86. */ DEFINE_PER_CPU(unsigned long, cpu_current_top_of_stack) = (unsigned long )&init_thread_union +THREAD_SIZE ;EXPORT_PER_CPU_SYMBOL (cpu_current_top_of_stack); +DEFINE_PER_CPU(unsigned long, cpu_current_thread_sp0) = TOP_OF_INIT_STACK; +EXPORT_PER_CPU_SYMBOL_GPL (cpu_current_thread_sp0); +#ifdef CONFIG_STACKPROTECTOR DEFINE_PER_CPU_ALIGNED(struct stack_canary, stack_canary);#endif
arch/x86/kernel/process.c +0 -2
@@ -64,8 +64,6 @@ __visible DEFINE_PER_CPU_PAGE_ALIGNED(struct tss_struct, cpu_tss_rw) = { .sp0 = (1UL << (BITS_PER_LONG-1)) + 1,#ifdef CONFIG_X86_32 - .sp1 =TOP_OF_INIT_STACK , - .ss0 = __KERNEL_DS, .ss1 = __KERNEL_CS,#endif
Signature · 1 line
2.19.1.6.gb485710b
Quoted 4 lines · Lai Jiangshan
From: Lai Jiangshan <[email protected]>
In
x86_64, tss.sp1 is reused ascpu_current_top_of_stack. We'd better directly use percpu since CR3 andgs_baseis correct when it is used.
Be more direct if not using percpu is incorrect in some way.
Quoted 2 lines
In
x86_32, tss.sp1 is resued as thread.sp0 in three places in entry
s/resued/reused
Quoted 46 lines
code. We have the correct CR3 and %fs at two of the places. The last one is sysenter. This patchset makes %fs available earlier so that we can also use percpu in sysenter. And add a percpu
cpu_current_thread_sp0for thread.sp0 instead of tss.sp1[V3]: https://lore.kernel.org/lkml/[email protected]/
[V2]: https://lore.kernel.org/lkml/[email protected]/
[V1]: https://lore.kernel.org/lkml/[email protected]/Changed from V3:
Update subjects as Borislav's imperative request. ^_^ Update changelog as Borislav suggested.
ChangeEXPORT_PER_CPU_SYMBOLtoEXPORT_PER_CPU_SYMBOL_GPL.Changed from V2:
Add missing "%ss:" reported by Brian Gerst.Changed from V1:
Requested from Andy to also fix sp1 forx86_32. Update comments in thex86_64patch as Andy sugguested.Lai Jiangshan (6):
x86/entry/64: Movecpu_current_top_of_stackout of TSS x86/entry/32: Use percpu instead of offset-calculation to get
thread.sp0 inSWITCH_TO_KERNEL_STACK
x86/entry/32: Switch to the task stack without emptying the entry
stack
x86/entry/32: Restore %fs before switching stack x86/entry/32: Use percpu to get thread.sp0 in SYSENTER x86/entry/32: Introducecpu_current_thread_sp0to replacecpu_tss_rw.x86_tss.sp1arch/x86/entry/entry_32.S | 38 +++++++++++++++++------------- arch/x86/include/asm/processor.h | 12 ++-------- arch/x86/include/asm/switch_to.h | 8 +------ arch/x86/include/asm/thread_info.h | 6 ----- arch/x86/kernel/asm-offsets.c | 1 - arch/x86/kernel/asm-offsets_32.c | 10 -------- arch/x86/kernel/cpu/common.c | 12 +++++++++- arch/x86/kernel/process.c | 7 ------ arch/x86/mm/pti.c | 7 +++--- 9 files changed, 39 insertions(+), 62 deletions(-)Signature · 1 line
2.19.1.6.gb485710b
Hi Mark
Thank you for your reply.
Quoted 7 lines · mark gross
Quoted 4 lines · Lai Jiangshan
From: Lai Jiangshan <[email protected]>
In
x86_64, tss.sp1 is reused ascpu_current_top_of_stack. We'd better directly use percpu since CR3 andgs_baseis correct when it is used.Be more direct if not using percpu is incorrect in some way.
Sure, I will abstract the most important reason from changelogs to cover letter in the future.
Quoted 3 lines
Quoted 2 lines
In
x86_32, tss.sp1 is resued as thread.sp0 in three places in entrys/resued/reused
Sorry, I made it wrong in every cover letter even I noticed it after V2 was sent. I forgot to use a spellchecker on the cover letter.
Quoted 46 lines
Quoted 46 lines
code. We have the correct CR3 and %fs at two of the places. The last one is sysenter. This patchset makes %fs available earlier so that we can also use percpu in sysenter. And add a percpu
cpu_current_thread_sp0for thread.sp0 instead of tss.sp1[V3]: https://lore.kernel.org/lkml/[email protected]/
[V2]: https://lore.kernel.org/lkml/[email protected]/
[V1]: https://lore.kernel.org/lkml/[email protected]/Changed from V3:
Update subjects as Borislav's imperative request. ^_^ Update changelog as Borislav suggested.
ChangeEXPORT_PER_CPU_SYMBOLtoEXPORT_PER_CPU_SYMBOL_GPL.Changed from V2:
Add missing "%ss:" reported by Brian Gerst.Changed from V1:
Requested from Andy to also fix sp1 forx86_32. Update comments in thex86_64patch as Andy sugguested.Lai Jiangshan (6):
x86/entry/64: Movecpu_current_top_of_stackout of TSS x86/entry/32: Use percpu instead of offset-calculation to get
thread.sp0 inSWITCH_TO_KERNEL_STACK
x86/entry/32: Switch to the task stack without emptying the entry
stack
x86/entry/32: Restore %fs before switching stack x86/entry/32: Use percpu to get thread.sp0 in SYSENTER x86/entry/32: Introducecpu_current_thread_sp0to replacecpu_tss_rw.x86_tss.sp1arch/x86/entry/entry_32.S | 38 +++++++++++++++++------------- arch/x86/include/asm/processor.h | 12 ++-------- arch/x86/include/asm/switch_to.h | 8 +------ arch/x86/include/asm/thread_info.h | 6 ----- arch/x86/kernel/asm-offsets.c | 1 - arch/x86/kernel/asm-offsets_32.c | 10 -------- arch/x86/kernel/cpu/common.c | 12 +++++++++- arch/x86/kernel/process.c | 7 ------ arch/x86/mm/pti.c | 7 +++--- 9 files changed, 39 insertions(+), 62 deletions(-)--
2.19.1.6.gb485710b