]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
x86/xen: Avoid relocatable quantities in Xen ELF notes
authorArd Biesheuvel <ardb@kernel.org>
Wed, 9 Oct 2024 16:04:43 +0000 (18:04 +0200)
committerJuergen Gross <jgross@suse.com>
Tue, 29 Oct 2024 16:23:36 +0000 (17:23 +0100)
commit223abe96ac0d227b22d48ab447dd9384b7a6c9fa
tree9ec716c33a504df72e4034152ac354d01f8f7cec
parentd5835423046c504d2b3c32cb9284d4465a7f28b1
x86/xen: Avoid relocatable quantities in Xen ELF notes

Xen puts virtual and physical addresses into ELF notes that are treated
by the linker as relocatable by default. Doing so is not only pointless,
given that the ELF notes are only intended for consumption by Xen before
the kernel boots. It is also a KASLR leak, given that the kernel's ELF
notes are exposed via the world readable /sys/kernel/notes.

So emit these constants in a way that prevents the linker from marking
them as relocatable. This involves place-relative relocations (which
subtract their own virtual address from the symbol value) and linker
provided absolute symbols that add the address of the place to the
desired value.

Tested-by: Jason Andryuk <jason.andryuk@amd.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Message-ID: <20241009160438.3884381-11-ardb+git@google.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
arch/x86/kernel/vmlinux.lds.S
arch/x86/platform/pvh/head.S
arch/x86/tools/relocs.c
arch/x86/xen/xen-head.S