lkml.org 
[lkml]   [2020]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v6 23/29] x86/build: Enforce an empty .got.plt section
    Date
    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>
    ---
    arch/x86/kernel/vmlinux.lds.S | 14 +++++++++++++-
    1 file changed, 13 insertions(+), 1 deletion(-)

    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
    /*
    --
    2.25.1
    \
     
     \ /
      Last update: 2020-08-21 21:45    [W:2.823 / U:1.192 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site