]> www.infradead.org Git - users/dwmw2/linux.git/commit
x86/boot/64: Avoid intentional absolute symbol references in .head.text
authorArd Biesheuvel <ardb@kernel.org>
Thu, 5 Dec 2024 11:28:08 +0000 (12:28 +0100)
committerIngo Molnar <mingo@kernel.org>
Thu, 5 Dec 2024 12:18:54 +0000 (13:18 +0100)
commit0d9b9a328cb605419ed046d341dc2a3d66ee0256
tree5b246d0516f00f458c16416bcbba3eb210315a64
parent093562198e1a6360672954293753f4c6cb9a3316
x86/boot/64: Avoid intentional absolute symbol references in .head.text

The code in .head.text executes from a 1:1 mapping and cannot generally
refer to global variables using their kernel virtual addresses. However,
there are some occurrences of such references that are valid: the kernel
virtual addresses of _text and _end are needed to populate the page
tables correctly, and some other section markers are used in a similar
way.

To avoid the need for making exceptions to the rule that .head.text must
not contain any absolute symbol references, derive these addresses from
the RIP-relative 1:1 mapped physical addresses, which can be safely
determined using RIP_REL_REF().

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Link: https://lore.kernel.org/r/20241205112804.3416920-12-ardb+git@google.com
arch/x86/kernel/head64.c