[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240410115617.14804133@gandalf.local.home>
Date: Wed, 10 Apr 2024 11:56:17 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Chuck Lever <chuck.lever@...cle.com>
Cc: Justin Stitt <justinstitt@...gle.com>, Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>, Russell King
<linux@...linux.org.uk>, Masami Hiramatsu <mhiramat@...nel.org>, Mathieu
Desnoyers <mathieu.desnoyers@...icios.com>, Jeff Layton
<jlayton@...nel.org>, Neil Brown <neilb@...e.de>, Olga Kornievskaia
<kolga@...app.com>, Dai Ngo <Dai.Ngo@...cle.com>, Tom Talpey
<tom@...pey.com>, netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org, linux-nfs@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] trace: events: cleanup deprecated strncpy uses
On Wed, 10 Apr 2024 11:41:18 -0400
Chuck Lever <chuck.lever@...cle.com> wrote:
> > If anything, it needs to be:
> >
> > __string_len(acceptor, data, len)
> >
> > as the macro code has changed recently, and the current code will crash!
>
> A general question:
>
> Is there a test suite we should run regularly to build some
> confidence in the kernel's observability apparatus? We're building
> a menagerie of tests around kdevops, and one area where we know
> there is a testing gap is the tracepoints in NFSD and SunRPC.
I try to add self tests within the macros. As __assign_str() is going to
turn into just __assign_str(field) (instead of __assign_str(field, src)), I
added a test to make sure what was passed to __string() is also what
__assign_str() gets. But using strcpy() in place of __assign_str() really
is doing something that one should not be doing.
There's checks in the tracepoint code as well for things like referencing a
pointer that was not saved in the event, and other things. But a generic
test on a custom trace event, I don't really have.
Note, you could enable CONFIG_TRACE_EVENT_INJECT where an "inject" file is
created, and you can write into it:
# cd /sys/kernel/tracing
# echo 1 > events/rpcgss/rpcgss_context/enable
# echo 'expiry=123456 now=222' > events/rpcgss/rpcgss_context/inject
# cat trace
bash-843 [001] ..... 720.083189: rpcgss_context: win_size=0 expiry=123456 now=222 timeout=0 acceptor=
And you could use that for testing.
-- Steve
Powered by blists - more mailing lists