Skip to content

x86-64: Stack protector and percpu improvements

Brian Gerst lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest6 patches 3 repliesIn review
  2. v13 patches 7 repliesSuperseded

Changes in v2 from the cover letter

- Remove fixed location stack protector support

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6x86: Remove stack protector test scriptsarch/x86/Kconfig scripts/gcc-x86_32-has-stack-protector.sh scripts/gcc-x86_64-has-stack-protector.sh+3 -160 replies
2/6x86-64: Convert stack protector to normal percpu variablearch/x86/Kconfig arch/x86/Makefile arch/x86/entry/entry_64.S +8 more+39 -883 replies
3/6x86-64: Use relative per-cpu offsetsarch/x86/include/asm/percpu.h arch/x86/kernel/head_64.S arch/x86/kernel/irq_64.c +4 more+6 -1980 replies
4/6x86-64: Remove inverse relocationsarch/x86/boot/compressed/misc.c arch/x86/tools/relocs.c+1 -220 replies
5/6kallsyms: Remove KALLSYMS_ABSOLUTE_PERCPUinit/Kconfig kernel/kallsyms.c scripts/kallsyms.c +1 more+12 -820 replies
6/6percpu: Remove PER_CPU_FIRST_SECTIONinclude/asm-generic/vmlinux.lds.h include/linux/percpu-defs.h+0 -130 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/6] x86-64: Stack protector and percpu improvements

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 how the percpu section is linked.

Changes from v1:
- Remove fixed location stack protector support

Brian Gerst (6):
x86: Remove stack protector test scripts
x86-64: Convert stack protector to normal percpu variable
x86-64: Use relative per-cpu offsets
x86-64: Remove inverse relocations
kallsyms: Remove KALLSYMS_ABSOLUTE_PERCPU
percpu: Remove PER_CPU_FIRST_SECTION

 arch/x86/Kconfig                          |   7 +-
 arch/x86/Makefile                         |  19 +--
 arch/x86/boot/compressed/misc.c           |  14 +--
 arch/x86/entry/entry_64.S                 |   2 +-
 arch/x86/include/asm/percpu.h             |  22 ----
 arch/x86/include/asm/processor.h          |  25 +---
 arch/x86/include/asm/stackprotector.h     |  36 ++----
 arch/x86/kernel/asm-offsets_64.c          |   6 -
 arch/x86/kernel/cpu/common.c              |   8 +-
 arch/x86/kernel/head_64.S                 |  10 +-
 arch/x86/kernel/irq_64.c                  |   1 -
 arch/x86/kernel/setup_percpu.c            |  12 +-
 arch/x86/kernel/vmlinux.lds.S             |  33 -----
 arch/x86/tools/relocs.c                   | 145 +---------------------
 arch/x86/xen/xen-head.S                   |  10 +-
 include/asm-generic/vmlinux.lds.h         |   1 -
 include/linux/percpu-defs.h               |  12 --
 init/Kconfig                              |  11 +-
 kernel/kallsyms.c                         |  12 +-
 scripts/gcc-x86_32-has-stack-protector.sh |   8 --
 scripts/gcc-x86_64-has-stack-protector.sh |   4 -
 scripts/kallsyms.c                        |  68 ++--------
 scripts/link-vmlinux.sh                   |   4 -
 23 files changed, 56 insertions(+), 414 deletions(-)
 delete mode 100755 scripts/gcc-x86_32-has-stack-protector.sh
 delete mode 100755 scripts/gcc-x86_64-has-stack-protector.sh
Signature · 1 line
2.31.1