Skip to content

x86-64: Stack protector and percpu improvements

Brian Gerst lkml llvm xen-devel 6 versions – Applied

Status from this message: The following commit has been merged into the x86/asm branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest15 patches 31 repliesApplied
  2. v516 patches 28 repliesApplied
  3. v416 patches 25 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v314 patches0 repliesSuperseded
v211 patches19 repliesSuperseded
v19 patches4 repliesSuperseded

Changes in v6 from the cover letter

- Rebased to current tip tree
- Dropped patches already applied
- Fixed typos in commit messages
- Added Reviewed-by tags

Patches in v6 Applied

#Subject and filesSizeRepliesApplied
1/15x86: Raise minimum GCC version to 8.1scripts/min-tool-version.sh+2 -00 replies
2/15x86/stackprotector: Remove stack protector test scriptsarch/x86/Kconfig scripts/gcc-x86_32-has-stack-protector.sh scripts/gcc-x86_64-has-stack-protector.sh+1 -220 replies
3/15x86/boot: Disable stack protector for early boot codearch/x86/kernel/Makefile+2 -00 replies
4/15x86/pvh: Use fixed_percpu_data for early boot GSBASEarch/x86/platform/pvh/head.S+9 -68 replies
5/15x86/relocs: Handle R_X86_64_REX_GOTPCRELX relocationsarch/x86/tools/relocs.c+7 -00 replies
6/15x86/module: Deal with GOT based stack cookie load on Clang < 17arch/x86/include/asm/elf.h arch/x86/kernel/module.c+17 -13 replies
7/15x86/stackprotector/64: Convert to normal percpu variablearch/x86/Makefile arch/x86/entry/entry.S arch/x86/entry/entry_64.S +6 more+23 -703 replies
8/15x86/percpu/64: Use relative percpu offsetsarch/x86/include/asm/processor.h arch/x86/kernel/head_64.S arch/x86/kernel/setup_percpu.c +5 more+27 -650 replies
9/15x86/percpu/64: Remove fixed_percpu_dataarch/x86/include/asm/processor.h arch/x86/kernel/cpu/common.c arch/x86/kernel/vmlinux.lds.S +1 more+0 -140 replies
10/15x86/boot/64: Remove inverse relocationsarch/x86/boot/compressed/misc.c arch/x86/tools/relocs.c+2 -1420 replies
11/15x86/percpu/64: Remove INIT_PER_CPU macrosarch/x86/include/asm/desc.h arch/x86/include/asm/percpu.h arch/x86/kernel/head64.c +3 more+1 -330 replies
12/15percpu: Remove PER_CPU_FIRST_SECTIONinclude/asm-generic/vmlinux.lds.h include/linux/percpu-defs.h+0 -130 replies
13/15percpu: Remove PERCPU_VADDR()include/asm-generic/vmlinux.lds.h+1 -350 replies
14/15percpu: Remove __per_cpu_loadinclude/asm-generic/sections.h include/asm-generic/vmlinux.lds.h mm/percpu.c+3 -40 replies
15/15kallsyms: Remove KALLSYMS_ABSOLUTE_PERCPUinit/Kconfig kernel/kallsyms.c scripts/kallsyms.c +1 more+14 -790 replies

Reviews trailers per patch

14 of 15 patches have a Reviewed-by or Acked-by.

PatchArd BiesheuvelUros Bizjak
1/15R-b
2/15R-b R-b
3/15R-b
4/15R-b
5/15R-b
6/15
7/15R-b R-b
8/15R-b R-b
9/15R-b R-b
10/15R-b
11/15R-b R-b
12/15R-b
13/15R-b
14/15R-b
15/15R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH v6 00/15] x86-64: Stack protector and percpu improvements

Currently, x86-64 uses an unusual percpu 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. This allows the percpu section to be linked normally, like other architectures. In turn, this allows removal of code that was needed to support the zero-based percpu section.

v6:
- Rebased to current tip tree
- Dropped patches already applied
- Fixed typos in commit messages
- Added Reviewed-by tags

Ard Biesheuvel (1):
x86/module: Deal with GOT based stack cookie load on Clang < 17

Brian Gerst (14):
x86: Raise minimum GCC version to 8.1 x86/stackprotector: Remove stack protector test scripts x86/boot: Disable stack protector for early boot code x86/pvh: Use fixed_percpu_data for early boot GSBASE x86/relocs: Handle R_X86_64_REX_GOTPCRELX relocations x86/stackprotector/64: Convert to normal percpu variable x86/percpu/64: Use relative percpu offsets x86/percpu/64: Remove fixed_percpu_data x86/boot/64: Remove inverse relocations x86/percpu/64: Remove INIT_PER_CPU macros
percpu: Remove PER_CPU_FIRST_SECTION
percpu: Remove PERCPU_VADDR()
percpu: Remove __per_cpu_load
kallsyms: Remove KALLSYMS_ABSOLUTE_PERCPU

 arch/x86/Kconfig                          |  11 +-
 arch/x86/Makefile                         |  20 +--
 arch/x86/boot/compressed/misc.c           |  14 +--
 arch/x86/entry/entry.S                    |   2 -
 arch/x86/entry/entry_64.S                 |   2 +-
 arch/x86/include/asm/desc.h               |   1 -
 arch/x86/include/asm/elf.h                |   3 +-
 arch/x86/include/asm/percpu.h             |  22 ----
 arch/x86/include/asm/processor.h          |  28 +----
 arch/x86/include/asm/stackprotector.h     |  36 +-----
 arch/x86/kernel/Makefile                  |   2 +
 arch/x86/kernel/asm-offsets_64.c          |   6 -
 arch/x86/kernel/cpu/common.c              |   9 +-
 arch/x86/kernel/head64.c                  |   2 +-
 arch/x86/kernel/head_64.S                 |  20 ++-
 arch/x86/kernel/irq_64.c                  |   1 -
 arch/x86/kernel/module.c                  |  15 +++
 arch/x86/kernel/setup_percpu.c            |  12 +-
 arch/x86/kernel/vmlinux.lds.S             |  35 ------
 arch/x86/platform/pvh/head.S              |  14 ++-
 arch/x86/tools/relocs.c                   | 147 ++--------------------
 arch/x86/xen/xen-head.S                   |  10 +-
 include/asm-generic/sections.h            |   2 +-
 include/asm-generic/vmlinux.lds.h         |  38 +-----
 include/linux/percpu-defs.h               |  12 --
 init/Kconfig                              |   5 -
 kernel/kallsyms.c                         |  12 +-
 mm/percpu.c                               |   4 +-
 scripts/gcc-x86_32-has-stack-protector.sh |   8 --
 scripts/gcc-x86_64-has-stack-protector.sh |   4 -
 scripts/kallsyms.c                        |  72 ++---------
 scripts/link-vmlinux.sh                   |   4 -
 scripts/min-tool-version.sh               |   2 +
 33 files changed, 100 insertions(+), 475 deletions(-)
 delete mode 100755 scripts/gcc-x86_32-has-stack-protector.sh
 delete mode 100755 scripts/gcc-x86_64-has-stack-protector.sh

base-commit: b79d90e018587507fd42c4c888956668692ff431

Signature · 1 line
2.47.1