From: Steven Rostedt <rostedt@goodmis.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: Justin Stitt <justinstitt@google.com>,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Jeff Layton <jlayton@kernel.org>, Neil Brown <neilb@suse.de>,
Olga Kornievskaia <kolga@netapp.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org, linux-nfs@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH] trace: events: cleanup deprecated strncpy uses
Date: Wed, 10 Apr 2024 11:56:17 -0400 [thread overview]
Message-ID: <20240410115617.14804133@gandalf.local.home> (raw)
In-Reply-To: <ZhazHrz4SxBs+BFD@tissot.1015granger.net>
On Wed, 10 Apr 2024 11:41:18 -0400
Chuck Lever <chuck.lever@oracle.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
prev parent reply other threads:[~2024-04-10 15:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-01 23:48 [PATCH] trace: events: cleanup deprecated strncpy uses Justin Stitt
2024-04-03 13:30 ` Chuck Lever
2024-04-10 15:36 ` Steven Rostedt
2024-04-10 15:41 ` Chuck Lever
2024-04-10 15:56 ` Steven Rostedt [this message]
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=20240410115617.14804133@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=Dai.Ngo@oracle.com \
--cc=andrew@lunn.ch \
--cc=chuck.lever@oracle.com \
--cc=hkallweit1@gmail.com \
--cc=jlayton@kernel.org \
--cc=justinstitt@google.com \
--cc=kolga@netapp.com \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=neilb@suse.de \
--cc=netdev@vger.kernel.org \
--cc=tom@talpey.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).