]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - scripts/Makefile.lib
kasan: don't emit builtin calls when sanitization is off
authorAndrey Konovalov <andreyknvl@google.com>
Tue, 6 Feb 2018 23:36:00 +0000 (15:36 -0800)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 22 Feb 2018 14:18:49 +0000 (08:18 -0600)
commit691cb3fd124df43dd57c54793cf003370369a2ff
treea5279f197eee89c37cad566d0c6993339e5163d7
parent1fe3bca698bc06fa0f2bc08adf4a012ac83c5d8b
kasan: don't emit builtin calls when sanitization is off

BugLink: http://bugs.launchpad.net/bugs/1751064
commit 0e410e158e5baa1300bdf678cea4f4e0cf9d8b94 upstream.

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 <andreyknvl@google.com>
Acked-by: Nick Desaulniers <ndesaulniers@google.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Michal Marek <michal.lkml@markovi.net>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Makefile
scripts/Makefile.kasan
scripts/Makefile.lib