]> Git Repo - linux.git/commit
kasan: don't emit builtin calls when sanitization is off
authorAndrey Konovalov <[email protected]>
Tue, 6 Feb 2018 23:36:00 +0000 (15:36 -0800)
committerLinus Torvalds <[email protected]>
Wed, 7 Feb 2018 02:32:42 +0000 (18:32 -0800)
commit0e410e158e5baa1300bdf678cea4f4e0cf9d8b94
treee857ad4dd093bff753dbecb2a4815a3ae84d0812
parente237f98a9c134c3d600353f21e07db915516875b
kasan: don't emit builtin calls when sanitization is off

With KASAN enabled the kernel has two different memset() functions, one
with KASAN checks (memset) and one without (__memset).  KASAN uses some
macro tricks to use the proper version where required.  For example
memset() calls in mm/slub.c are without KASAN checks, since they operate
on poisoned slab object metadata.

The issue is that clang emits memset() calls even when there is no
memset() in the source code.  They get linked with improper memset()
implementation and the kernel fails to boot due to a huge amount of KASAN
reports during early boot stages.

The solution is to add -fno-builtin flag for files with KASAN_SANITIZE :=
n marker.

Link: http://lkml.kernel.org/r/8ffecfffe04088c52c42b92739c2bd8a0bcb3f5e.1516384594.git.andreyknvl@google.com
Signed-off-by: Andrey Konovalov <[email protected]>
Acked-by: Nick Desaulniers <[email protected]>
Cc: Masahiro Yamada <[email protected]>
Cc: Michal Marek <[email protected]>
Cc: Andrey Ryabinin <[email protected]>
Cc: Alexander Potapenko <[email protected]>
Cc: Dmitry Vyukov <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Makefile
scripts/Makefile.kasan
scripts/Makefile.lib
This page took 0.053049 seconds and 4 git commands to generate.