[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250722130429.7418520b@batman.local.home>
Date: Tue, 22 Jul 2025 13:04:29 -0400
From: Steven Rostedt <rostedt@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
linux-kbuild@...r.kernel.org, llvm@...ts.linux.dev, Masami Hiramatsu
<mhiramat@...nel.org>, Mark Rutland <mark.rutland@....com>, Mathieu
Desnoyers <mathieu.desnoyers@...icios.com>, Andrew Morton
<akpm@...ux-foundation.org>, Arnd Bergmann <arnd@...db.de>, Masahiro Yamada
<masahiroy@...nel.org>, Nathan Chancellor <nathan@...nel.org>, Nicolas
Schier <nicolas.schier@...ux.dev>, Nick Desaulniers
<nick.desaulniers+lkml@...il.com>, Catalin Marinas
<catalin.marinas@....com>
Subject: Re: [PATCH v3 1/5] tracepoints: Add verifier that makes sure all
defined tracepoints are used
On Tue, 22 Jul 2025 09:16:49 -0700
Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> On Tue, 22 Jul 2025 at 08:21, Steven Rostedt <rostedt@...nel.org> wrote:
> >
> > Add a verifier that injects a pointer to the tracepoint structure in the
> > functions that are used and added to a section called __tracepoint_check.
> > Then on boot up, iterate over this section and for every tracepoint
> > descriptor that is pointed to, update its ".funcs" field to (void *)1, as
> > the .funcs field is only set when a tracepoint is registered. At this
> > time, no tracepoints should be registered.
>
> Why?
>
> Doing this at runtime seems completely bass-ackwards.
>
> If you want to do this verification, why don't you do it at build-time?
The second patch does that, but is much more complex due to having to
parse the elf file. It hooks into the sorttable code as that already
does most of the parsing that was needed. It uses the same trick as the
runtime verifier by checking tracepoints against the __tracepoint_check
section (but not with the '.func' test, but instead it sorts it and
does a binary search).
I kept this to verify that the build time worked too, as the runtime
check is so much simpler and easier to implement. Basically, I use this
to verify that the build time works. That's why if you enable this it
will select the build time version. It was used to catch bugs in the
build version as I developed it.
And currently neither tests modules (I run this against an
allyesconfig), but the runtime version could easily be modified to test
modules too, whereas the build time would require adding another elf
parser as the sorttable isn't run on module code.
I can remove the runtime check if you prefer.
-- Steve
Powered by blists - more mailing lists