All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mips-fixes] MIPS: compressed: fix build with enabled UBSAN
@ 2021-02-08 12:37 Alexander Lobakin
  2021-02-09 12:38 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Lobakin @ 2021-02-08 12:37 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: Paul Cercueil, Alexander Lobakin, Youling Tang, Jiaxun Yang,
	Xingxing Su, Huacai Chen, Paul Burton, Hassan Naveed, linux-mips,
	stable, linux-kernel

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>
---
 arch/mips/boot/compressed/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index 47cd9dc7454a..f93f72bcba97 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -37,6 +37,7 @@ KBUILD_AFLAGS := $(KBUILD_AFLAGS) -D__ASSEMBLY__ \
 # 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
-- 
2.30.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH mips-fixes] MIPS: compressed: fix build with enabled UBSAN
  2021-02-08 12:37 [PATCH mips-fixes] MIPS: compressed: fix build with enabled UBSAN Alexander Lobakin
@ 2021-02-09 12:38 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2021-02-09 12:38 UTC (permalink / raw)
  To: Alexander Lobakin
  Cc: Paul Cercueil, Youling Tang, Jiaxun Yang, Xingxing Su,
	Huacai Chen, Paul Burton, Hassan Naveed, linux-mips, stable,
	linux-kernel

On Mon, Feb 08, 2021 at 12:37:42PM +0000, Alexander Lobakin wrote:
> 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>
> ---
>  arch/mips/boot/compressed/Makefile | 1 +
>  1 file changed, 1 insertion(+)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-09 12:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-08 12:37 [PATCH mips-fixes] MIPS: compressed: fix build with enabled UBSAN Alexander Lobakin
2021-02-09 12:38 ` Thomas Bogendoerfer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.