diff options
author | Kees Cook <keescook@chromium.org> | 2020-08-21 12:43:04 -0700 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2020-09-01 10:03:18 +0200 |
commit | 815d680771ae09080d2da83dac2647c08cdf99ce (patch) | |
tree | 10cba521880a8bf6442aa3faad6c25813dfb3d71 /arch/x86/kernel/vmlinux.lds.S | |
parent | a850958c072404f75dd41782cb4ff34b8625b47d (diff) | |
download | linux-815d680771ae09080d2da83dac2647c08cdf99ce.tar.bz2 |
x86/build: Enforce an empty .got.plt section
The .got.plt section should always be zero (or filled only with the
linker-generated lazy dispatch entry). Enforce this with an assert and
mark the section as INFO. This is more sensitive than just blindly
discarding the section.
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20200821194310.3089815-24-keescook@chromium.org
Diffstat (limited to 'arch/x86/kernel/vmlinux.lds.S')
-rw-r--r-- | arch/x86/kernel/vmlinux.lds.S | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index 0cc035cb15f1..4b1b936a6e7d 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -414,8 +414,20 @@ SECTIONS ELF_DETAILS DISCARDS -} + /* + * Make sure that the .got.plt is either completely empty or it + * contains only the lazy dispatch entries. + */ + .got.plt (INFO) : { *(.got.plt) } + ASSERT(SIZEOF(.got.plt) == 0 || +#ifdef CONFIG_X86_64 + SIZEOF(.got.plt) == 0x18, +#else + SIZEOF(.got.plt) == 0xc, +#endif + "Unexpected GOT/PLT entries detected!") +} #ifdef CONFIG_X86_32 /* |