mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH V3 0/6] x86: don't abuse tss.sp1
@ 2021-01-27 16:32 Lai Jiangshan
  2021-01-27 16:32 ` [PATCH V3 1/6] x86_64: move cpu_current_top_of_stack out of TSS Lai Jiangshan
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Lai Jiangshan @ 2021-01-27 16:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Lai Jiangshan, Andy Lutomirski, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, x86, H. Peter Anvin, Dave Hansen,
	Peter Zijlstra, Al Viro, Vincenzo Frascino, Joerg Roedel,
	Ricardo Neri, Reinette Chatre, Andrew Morton,
	Gabriel Krisman Bertazi, Kees Cook, Frederic Weisbecker,
	Jens Axboe, Arvind Sankar, Brian Gerst, Ard Biesheuvel,
	Andi Kleen, Mike Rapoport, Mike Hommey, Mark Gross, Fenghua Yu,
	Tony Luck, Anthony Steinhauser, Jay Lang, Chang S. Bae

From: Lai Jiangshan <laijs@linux.alibaba.com>

In x86_64, tss.sp1 is reused as cpu_current_top_of_stack.  But we can
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

[V2]: https://lore.kernel.org/lkml/20210125173444.22696-1-jiangshanlai@gmail.com/
[V1]: https://lore.kernel.org/lkml/20210123084900.3118-1-jiangshanlai@gmail.com/

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_64: move cpu_current_top_of_stack out of TSS
  x86_32: use percpu instead of offset-calculation to get thread.sp0
    when SWITCH_TO_KERNEL_STACK
  x86_32/sysenter: switch to the task stack without emptying the entry
    stack
  x86_32/sysenter: restore %fs before switching stack
  x86_32/sysenter: use percpu to get thread.sp0 when sysenter
  x86_32: use cpu_current_thread_sp0 instead of 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   |  9 ++-----
 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, 40 insertions(+), 62 deletions(-)

-- 
2.19.1.6.gb485710b


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-02-08 20:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-27 16:32 [PATCH V3 0/6] x86: don't abuse tss.sp1 Lai Jiangshan
2021-01-27 16:32 ` [PATCH V3 1/6] x86_64: move cpu_current_top_of_stack out of TSS Lai Jiangshan
2021-02-04 16:46   ` Borislav Petkov
2021-01-27 16:32 ` [PATCH V3 2/6] x86_32: use percpu instead of offset-calculation to get thread.sp0 when SWITCH_TO_KERNEL_STACK Lai Jiangshan
2021-02-08 19:21   ` Borislav Petkov
2021-01-27 16:32 ` [PATCH V3 3/6] x86_32/sysenter: switch to the task stack without emptying the entry stack Lai Jiangshan
2021-01-27 16:32 ` [PATCH V3 4/6] x86_32/sysenter: restore %fs before switching stack Lai Jiangshan
2021-01-27 16:32 ` [PATCH V3 5/6] x86_32/sysenter: use percpu to get thread.sp0 when sysenter Lai Jiangshan
2021-01-27 16:32 ` [PATCH V3 6/6] x86_32: use cpu_current_thread_sp0 instead of cpu_tss_rw.x86_tss.sp1 Lai Jiangshan
     [not found] ` <CAJhGHyA1U9M2Lv_=Wa2NPzBNevZKOrLaG1FDwbmySMOR_x_GRQ@mail.gmail.com>
2021-01-29 16:43   ` [PATCH V3 0/6] x86: don't abuse tss.sp1 Borislav Petkov
2021-01-30  2:53     ` Lai Jiangshan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®