Linux MM tree latest commits
 help / color / mirror / Atom feed
* + kcov-dont-instrument-with-ubsan.patch added to -mm tree
@ 2020-12-09 23:49 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2020-12-09 23:49 UTC (permalink / raw)
  To: mm-commits, sfr, keescook, elver, andreyknvl, dvyukov


The patch titled
     Subject: kcov: don't instrument with UBSAN
has been added to the -mm tree.  Its filename is
     kcov-dont-instrument-with-ubsan.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/kcov-dont-instrument-with-ubsan.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/kcov-dont-instrument-with-ubsan.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Dmitry Vyukov <dvyukov@google.com>
Subject: kcov: don't instrument with UBSAN

Both KCOV and UBSAN use compiler instrumentation.  If UBSAN detects a bug
in KCOV, it may cause infinite recursion via printk and other common
functions.  We already don't instrument KCOV with KASAN/KCSAN for this
reason, don't instrument it with UBSAN as well.

As a side effect this also resolves the following gcc warning:

conflicting types for built-in function '__sanitizer_cov_trace_switch';
expected 'void(long unsigned int, void *)'
[-Wbuiltin-declaration-mismatch]

It's only reported when kcov.c is compiled with any of the sanitizers
enabled.  Size of the arguments is correct, it's just that gcc uses 'long'
on 64-bit arches and 'long long' on 32-bit arches, while kernel type is
always 'long long'.

Link: https://lkml.kernel.org/r/20201209100152.2492072-1-dvyukov@google.com
Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Suggested-by: Marco Elver <elver@google.com>
Acked-by: Marco Elver <elver@google.com>
Reviewed-by: Andrey Konovalov <andreyknvl@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 kernel/Makefile |    3 +++
 1 file changed, 3 insertions(+)

--- a/kernel/Makefile~kcov-dont-instrument-with-ubsan
+++ a/kernel/Makefile
@@ -34,8 +34,11 @@ KCOV_INSTRUMENT_extable.o := n
 KCOV_INSTRUMENT_stacktrace.o := n
 # Don't self-instrument.
 KCOV_INSTRUMENT_kcov.o := n
+# If sanitizers detect any issues in kcov, it may lead to recursion
+# via printk, etc.
 KASAN_SANITIZE_kcov.o := n
 KCSAN_SANITIZE_kcov.o := n
+UBSAN_SANITIZE_kcov.o := n
 CFLAGS_kcov.o := $(call cc-option, -fno-conserve-stack) -fno-stack-protector
 
 obj-y += sched/
_

Patches currently in -mm which might be from dvyukov@google.com are

kcov-dont-instrument-with-ubsan.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-09 23:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-09 23:49 + kcov-dont-instrument-with-ubsan.patch added to -mm tree akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox