lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250828182754.733989525@kernel.org>
Date: Thu, 28 Aug 2025 14:27:54 -0400
From: Steven Rostedt <rostedt@...nel.org>
To: linux-kernel@...r.kernel.org,
 Stephen Rothwell <sfr@...b.auug.org.au>
Cc: Masami Hiramatsu <mhiramat@...nel.org>,
 Mark Rutland <mark.rutland@....com>,
 Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
 Andrew Morton <akpm@...ux-foundation.org>,
 Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [for-next][PATCH 0/3] tracing: Trigger a warning on build if a tracepoint is defined but unused


Stephen,

I plan on pushing this to my for-next branch, which will add this to the
linux-next tree. When the kconfig option "TRACEPOINT_WARN_ON_UNUSED" is
enabled, it will warn whenever a tracepoint is created but not used. This is
similar to adding a static variable or function and not using it. This means
that an allmodconfig and allyesconfig builds may start having warnings that
will get bisected down to this commit. The bug is not this commit though, but
whatever has created an event but never used it. As tracepoints can take up to
5K of memory, even when not used, this is a waste and should be fixed.

I hope that adding this to linux-next will start the push to clean up these
unused tracepoints that are in the kernel, as well as prevent new ones from
being added. Hopefully by the time the merge window rolls around, most of
these will be cleaned up and this can be merged upstream without triggering
warnings.

I built this against all archs in my tree (26 of them) with a allyesconfig.
Unfortunately, only 10 build successfully with that (they all build
successfully with defconfig and this option with tracing enabled). This
detected 178 unique tracepoints that are defined and not used:

$ grep '^warning:' /work/autotest/cross-unused-traceevnts.log | sort -u |wc -l
178

Among them, 78 tracepoints were created and never referenced.

$ grep '^warning:' /work/autotest/cross-unused-traceevents.log | sort -u |cut -d"'" -f2 |
    while read a ; do if ! git grep -q trace_$a ; then echo $a; fi ; done | wc -l
78

The 100 remaining are likely in strange #ifdef CONFIG combinations where an
allyesconfig defines the tracepoint but doesn't enable the code that uses
them.

Expect even more warnings with different combos of config settings, as this
will warn whenever a tracepoint is defined but not used.

-- Steve

  git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
unused-tracepoints/for-next

Head SHA1: d492e79ec6892ce1928a4c929ea29c0d5986e117


Steven Rostedt (3):
      sorttable: Move ELF parsing into scripts/elf-parse.[ch]
      tracing: Add a tracepoint verification check at build time
      tracepoint: Do not warn for unused event that is exported

----
 include/asm-generic/vmlinux.lds.h |   1 +
 include/linux/tracepoint.h        |  12 +
 kernel/trace/Kconfig              |  10 +
 scripts/Makefile                  |   6 +
 scripts/Makefile.vmlinux          |   2 +
 scripts/elf-parse.c               | 198 ++++++++++++++++
 scripts/elf-parse.h               | 305 ++++++++++++++++++++++++
 scripts/link-vmlinux.sh           |   4 +
 scripts/sorttable.c               | 477 +++-----------------------------------
 scripts/tracepoint-update.c       | 232 ++++++++++++++++++
 10 files changed, 804 insertions(+), 443 deletions(-)
 create mode 100644 scripts/elf-parse.c
 create mode 100644 scripts/elf-parse.h
 create mode 100644 scripts/tracepoint-update.c

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ