linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: andrey.konovalov@linux.dev
To: Dmitry Vyukov <dvyukov@google.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Andrey Konovalov <andreyknvl@gmail.com>,
	Aleksandr Nogikh <nogikh@google.com>,
	Marco Elver <elver@google.com>,
	Alexander Potapenko <glider@google.com>,
	kasan-dev@googlegroups.com, linux-mm@kvack.org,
	Yury Norov <yury.norov@gmail.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] kcov: don't instrument lib/find_bit.c
Date: Tue, 23 Jul 2024 00:37:26 +0200	[thread overview]
Message-ID: <20240722223726.194658-1-andrey.konovalov@linux.dev> (raw)

From: Andrey Konovalov <andreyknvl@gmail.com>

This file produces large amounts of flaky coverage not useful for the
KCOV's intended use case (guiding the fuzzing process).

Signed-off-by: Andrey Konovalov <andreyknvl@gmail.com>

---

I noticed this while running one of the syzkaller's programs.

In one run of the program, the number of KCOV entries amounts to ~300k,
with the top ones:

 117285 /home/user/src/lib/find_bit.c:137 (discriminator 10)
 116752 /home/user/src/lib/find_bit.c:137 (discriminator 3)
   2455 /home/user/src/lib/vsprintf.c:2559
   2033 /home/user/src/fs/kernfs/dir.c:317
   1662 /home/user/src/fs/kernfs/kernfs-internal.h:72
   ...

In another run (that triggers exactly the same behavior in the kernel),
the amount of entries drops to ~110k:

   7141 /home/user/src/lib/find_bit.c:137 (discriminator 10)
   7110 /home/user/src/lib/find_bit.c:137 (discriminator 3)
   2455 /home/user/src/lib/vsprintf.c:2559
   2033 /home/user/src/fs/kernfs/dir.c:317
   1662 /home/user/src/fs/kernfs/kernfs-internal.h:72
    ...

With this patch applied, the amount of KCOV entries for the same program
remains somewhat stable at ~100k.
---
 lib/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/Makefile b/lib/Makefile
index 322bb127b4dc..0fde1c360f32 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -14,6 +14,7 @@ KCOV_INSTRUMENT_list_debug.o := n
 KCOV_INSTRUMENT_debugobjects.o := n
 KCOV_INSTRUMENT_dynamic_debug.o := n
 KCOV_INSTRUMENT_fault-inject.o := n
+KCOV_INSTRUMENT_find_bit.o := n
 
 # string.o implements standard library functions like memset/memcpy etc.
 # Use -ffreestanding to ensure that the compiler does not try to "optimize"
-- 
2.25.1



             reply	other threads:[~2024-07-22 22:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-22 22:37 andrey.konovalov [this message]
2024-07-23  7:56 ` Dmitry Vyukov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240722223726.194658-1-andrey.konovalov@linux.dev \
    --to=andrey.konovalov@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=nogikh@google.com \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox