From: Brian Gerst <brgerst@gmail.com>
To: linux-kernel@vger.kernel.org, x86@kernel.org
Cc: Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@alien8.de>,
Thomas Gleixner <tglx@linutronix.de>,
"H . Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@kernel.org>,
Brian Gerst <brgerst@gmail.com>
Subject: [PATCH 0/3] x86-64: Stack protector and percpu improvements
Date: Sat, 13 Nov 2021 07:40:32 -0500 [thread overview]
Message-ID: <20211113124035.9180-1-brgerst@gmail.com> (raw)
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
next reply other threads:[~2021-11-13 12:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-13 12:40 Brian Gerst [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211113124035.9180-1-brgerst@gmail.com \
--to=brgerst@gmail.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox