lkml.org 
[lkml]   [2021]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.11 607/775] MIPS: compressed: fix build with enabled UBSAN
    Date
    From: Alexander Lobakin <alobakin@pm.me>

    commit fc4cac4cfc437659ce445c3c47b807e1cc625b66 upstream.

    Commit 1e35918ad9d1 ("MIPS: Enable Undefined Behavior Sanitizer
    UBSAN") added a possibility to build the entire kernel with UBSAN
    instrumentation for MIPS, with the exception for VDSO.
    However, self-extracting head wasn't been added to exceptions, so
    this occurs:

    mips-alpine-linux-musl-ld: arch/mips/boot/compressed/decompress.o:
    in function `FSE_buildDTable_wksp':
    decompress.c:(.text.FSE_buildDTable_wksp+0x278): undefined reference
    to `__ubsan_handle_shift_out_of_bounds'
    mips-alpine-linux-musl-ld: decompress.c:(.text.FSE_buildDTable_wksp+0x2a8):
    undefined reference to `__ubsan_handle_shift_out_of_bounds'
    mips-alpine-linux-musl-ld: decompress.c:(.text.FSE_buildDTable_wksp+0x2c4):
    undefined reference to `__ubsan_handle_shift_out_of_bounds'
    mips-alpine-linux-musl-ld: arch/mips/boot/compressed/decompress.o:
    decompress.c:(.text.FSE_buildDTable_raw+0x9c): more undefined references
    to `__ubsan_handle_shift_out_of_bounds' follow

    Add UBSAN_SANITIZE := n to mips/boot/compressed/Makefile to exclude
    it from instrumentation scope and fix this issue.

    Fixes: 1e35918ad9d1 ("MIPS: Enable Undefined Behavior Sanitizer UBSAN")
    Cc: stable@vger.kernel.org # 5.0+
    Signed-off-by: Alexander Lobakin <alobakin@pm.me>
    Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    arch/mips/boot/compressed/Makefile | 1 +
    1 file changed, 1 insertion(+)

    --- a/arch/mips/boot/compressed/Makefile
    +++ b/arch/mips/boot/compressed/Makefile
    @@ -37,6 +37,7 @@ KBUILD_AFLAGS := $(KBUILD_AFLAGS) -D__AS
    # Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
    KCOV_INSTRUMENT := n
    GCOV_PROFILE := n
    +UBSAN_SANITIZE := n

    # decompressor objects (linked with vmlinuz)
    vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o

    \
     
     \ /
      Last update: 2021-03-02 14:39    [W:4.680 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site