public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] x86-64: Stack protector and percpu improvements
@ 2021-11-13 12:40 Brian Gerst
  2021-11-13 12:40 ` [PATCH 1/3] x86-64: Use per-cpu stack canary if supported by compiler Brian Gerst
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Brian Gerst @ 2021-11-13 12:40 UTC (permalink / raw)
  To: linux-kernel, x86
  Cc: Andy Lutomirski, Borislav Petkov, Thomas Gleixner,
	H . Peter Anvin, Ingo Molnar, Brian Gerst

Currently, x86-64 uses an unusual per-cpu layout, where the percpu section
is linked at absolute address 0.  The reason behind this is that older GCC
versions placed the stack protector (if enabled) at a fixed offset from the
GS segment base.  Since the GS segement is also used for percpu variables,
this forced the current layout.

GCC since version 8.1 supports a configurable location for the stack
protector value, which allows removal of the restriction on where the percpu
data is linked.  Compatibility with older compilers is maintained until
the minimum compiler version is raised.

Brian Gerst (3):
  x86-64: Use per-cpu stack canary if supported by compiler
  x86/relocs: Make absolute percpu relocations conditional
  x86_64: Use relative per-cpu offsets

 arch/x86/Kconfig                      |  9 +++++++++
 arch/x86/Makefile                     | 21 ++++++++++++++-------
 arch/x86/boot/compressed/Makefile     |  3 ++-
 arch/x86/entry/entry_64.S             |  6 +++++-
 arch/x86/include/asm/percpu.h         |  4 ++--
 arch/x86/include/asm/processor.h      | 14 +++++++++++---
 arch/x86/include/asm/stackprotector.h | 17 ++++++-----------
 arch/x86/kernel/asm-offsets_64.c      |  2 +-
 arch/x86/kernel/cpu/common.c          | 14 ++++++++------
 arch/x86/kernel/head_64.S             | 12 ++++++++----
 arch/x86/kernel/setup_percpu.c        |  2 +-
 arch/x86/kernel/vmlinux.lds.S         | 16 +++++++---------
 arch/x86/tools/relocs.c               |  4 ++--
 arch/x86/tools/relocs.h               |  4 ++--
 arch/x86/tools/relocs_common.c        | 11 ++++++++---
 arch/x86/xen/xen-head.S               | 10 ++++------
 init/Kconfig                          |  1 -
 17 files changed, 90 insertions(+), 60 deletions(-)

-- 
2.31.1


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

end of thread, other threads:[~2021-11-16  0:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-13 12:40 [PATCH 0/3] x86-64: Stack protector and percpu improvements Brian Gerst
2021-11-13 12:40 ` [PATCH 1/3] x86-64: Use per-cpu stack canary if supported by compiler Brian Gerst
2021-11-13 12:40 ` [PATCH 2/3] x86/relocs: Make absolute percpu relocations conditional Brian Gerst
2021-11-13 12:40 ` [PATCH 3/3] x86_64: Use relative per-cpu offsets Brian Gerst
2021-11-14  1:18   ` Andy Lutomirski
2021-11-14  4:24     ` H. Peter Anvin
2021-11-14  4:54     ` Brian Gerst
2021-11-14 11:03       ` Peter Zijlstra
2021-11-14 18:29         ` Brian Gerst
2021-11-15 18:12           ` Andy Lutomirski
2021-11-15 20:44           ` Peter Zijlstra

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