* [PATCH] SUNRPC: Fix rpcgss_context trace event acceptor field
@ 2024-04-10 16:38 Steven Rostedt
2024-04-10 16:38 ` Chuck Lever
0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2024-04-10 16:38 UTC (permalink / raw
To: LKML, Linux Trace Kernel
Cc: Masami Hiramatsu, Mathieu Desnoyers, Chuck Lever, Jeff Layton,
Anna Schumaker, linux-nfs
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
The rpcgss_context trace event acceptor field is a dynamically sized
string that records the "data" parameter. But this parameter is also
dependent on the "len" field to determine the size of the data.
It needs to use __string_len() helper macro where the length can be passed
in. It also incorrectly uses strncpy() to save it instead of
__assign_str(). As these macros can change, it is not wise to open code
them in trace events.
As of commit c759e609030c ("tracing: Remove __assign_str_len()"),
__assign_str() can be used for both __string() and __string_len() fields.
Before that commit, __assign_str_len() is required to be used. This needs
to be noted for backporting. (In actuality, commit c1fa617caeb0 ("tracing:
Rework __assign_str() and __string() to not duplicate getting the string")
is the commit that makes __string_str_len() obsolete).
Cc: stable@vger.kernel.org
Fixes: 0c77668ddb4e7 ("SUNRPC: Introduce trace points in rpc_auth_gss.ko")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
include/trace/events/rpcgss.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/trace/events/rpcgss.h b/include/trace/events/rpcgss.h
index ba2d96a1bc2f..f50fcafc69de 100644
--- a/include/trace/events/rpcgss.h
+++ b/include/trace/events/rpcgss.h
@@ -609,7 +609,7 @@ TRACE_EVENT(rpcgss_context,
__field(unsigned int, timeout)
__field(u32, window_size)
__field(int, len)
- __string(acceptor, data)
+ __string_len(acceptor, data, len)
),
TP_fast_assign(
@@ -618,7 +618,7 @@ TRACE_EVENT(rpcgss_context,
__entry->timeout = timeout;
__entry->window_size = window_size;
__entry->len = len;
- strncpy(__get_str(acceptor), data, len);
+ __assign_str(acceptor, data);
),
TP_printk("win_size=%u expiry=%lu now=%lu timeout=%u acceptor=%.*s",
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] SUNRPC: Fix rpcgss_context trace event acceptor field
2024-04-10 16:38 [PATCH] SUNRPC: Fix rpcgss_context trace event acceptor field Steven Rostedt
@ 2024-04-10 16:38 ` Chuck Lever
2024-04-10 17:07 ` Steven Rostedt
0 siblings, 1 reply; 5+ messages in thread
From: Chuck Lever @ 2024-04-10 16:38 UTC (permalink / raw
To: Steven Rostedt
Cc: LKML, Linux Trace Kernel, Masami Hiramatsu, Mathieu Desnoyers,
Jeff Layton, Anna Schumaker, linux-nfs
On Wed, Apr 10, 2024 at 12:38:13PM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
>
> The rpcgss_context trace event acceptor field is a dynamically sized
> string that records the "data" parameter. But this parameter is also
> dependent on the "len" field to determine the size of the data.
>
> It needs to use __string_len() helper macro where the length can be passed
> in. It also incorrectly uses strncpy() to save it instead of
> __assign_str(). As these macros can change, it is not wise to open code
> them in trace events.
>
> As of commit c759e609030c ("tracing: Remove __assign_str_len()"),
> __assign_str() can be used for both __string() and __string_len() fields.
> Before that commit, __assign_str_len() is required to be used. This needs
> to be noted for backporting. (In actuality, commit c1fa617caeb0 ("tracing:
> Rework __assign_str() and __string() to not duplicate getting the string")
> is the commit that makes __string_str_len() obsolete).
>
> Cc: stable@vger.kernel.org
> Fixes: 0c77668ddb4e7 ("SUNRPC: Introduce trace points in rpc_auth_gss.ko")
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Acked-by: Chuck Lever <chuck.lever@oracle.com>
> ---
> include/trace/events/rpcgss.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/trace/events/rpcgss.h b/include/trace/events/rpcgss.h
> index ba2d96a1bc2f..f50fcafc69de 100644
> --- a/include/trace/events/rpcgss.h
> +++ b/include/trace/events/rpcgss.h
> @@ -609,7 +609,7 @@ TRACE_EVENT(rpcgss_context,
> __field(unsigned int, timeout)
> __field(u32, window_size)
> __field(int, len)
> - __string(acceptor, data)
> + __string_len(acceptor, data, len)
> ),
>
> TP_fast_assign(
> @@ -618,7 +618,7 @@ TRACE_EVENT(rpcgss_context,
> __entry->timeout = timeout;
> __entry->window_size = window_size;
> __entry->len = len;
> - strncpy(__get_str(acceptor), data, len);
> + __assign_str(acceptor, data);
> ),
>
> TP_printk("win_size=%u expiry=%lu now=%lu timeout=%u acceptor=%.*s",
> --
> 2.43.0
>
--
Chuck Lever
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] SUNRPC: Fix rpcgss_context trace event acceptor field
2024-04-10 17:07 ` Steven Rostedt
@ 2024-04-10 17:07 ` Chuck Lever
2024-04-10 17:57 ` Steven Rostedt
0 siblings, 1 reply; 5+ messages in thread
From: Chuck Lever @ 2024-04-10 17:07 UTC (permalink / raw
To: Steven Rostedt
Cc: LKML, Linux Trace Kernel, Masami Hiramatsu, Mathieu Desnoyers,
Jeff Layton, Anna Schumaker, linux-nfs
On Wed, Apr 10, 2024 at 01:07:41PM -0400, Steven Rostedt wrote:
> On Wed, 10 Apr 2024 12:38:53 -0400
> Chuck Lever <chuck.lever@oracle.com> wrote:
>
> > On Wed, Apr 10, 2024 at 12:38:13PM -0400, Steven Rostedt wrote:
> > > From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> > >
> > > The rpcgss_context trace event acceptor field is a dynamically sized
> > > string that records the "data" parameter. But this parameter is also
> > > dependent on the "len" field to determine the size of the data.
> > >
> > > It needs to use __string_len() helper macro where the length can be passed
> > > in. It also incorrectly uses strncpy() to save it instead of
> > > __assign_str(). As these macros can change, it is not wise to open code
> > > them in trace events.
> > >
> > > As of commit c759e609030c ("tracing: Remove __assign_str_len()"),
> > > __assign_str() can be used for both __string() and __string_len() fields.
> > > Before that commit, __assign_str_len() is required to be used. This needs
> > > to be noted for backporting. (In actuality, commit c1fa617caeb0 ("tracing:
> > > Rework __assign_str() and __string() to not duplicate getting the string")
> > > is the commit that makes __string_str_len() obsolete).
> > >
> > > Cc: stable@vger.kernel.org
> > > Fixes: 0c77668ddb4e7 ("SUNRPC: Introduce trace points in rpc_auth_gss.ko")
> > > Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> >
> > Acked-by: Chuck Lever <chuck.lever@oracle.com>
> >
>
> Thanks, but feel free to take it if you want. Unless you rather have me
> take it through my tree?
Well I guess I could test it for you. I'll take it for nfsd v6.9-rc.
--
Chuck Lever
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] SUNRPC: Fix rpcgss_context trace event acceptor field
2024-04-10 16:38 ` Chuck Lever
@ 2024-04-10 17:07 ` Steven Rostedt
2024-04-10 17:07 ` Chuck Lever
0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2024-04-10 17:07 UTC (permalink / raw
To: Chuck Lever
Cc: LKML, Linux Trace Kernel, Masami Hiramatsu, Mathieu Desnoyers,
Jeff Layton, Anna Schumaker, linux-nfs
On Wed, 10 Apr 2024 12:38:53 -0400
Chuck Lever <chuck.lever@oracle.com> wrote:
> On Wed, Apr 10, 2024 at 12:38:13PM -0400, Steven Rostedt wrote:
> > From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> >
> > The rpcgss_context trace event acceptor field is a dynamically sized
> > string that records the "data" parameter. But this parameter is also
> > dependent on the "len" field to determine the size of the data.
> >
> > It needs to use __string_len() helper macro where the length can be passed
> > in. It also incorrectly uses strncpy() to save it instead of
> > __assign_str(). As these macros can change, it is not wise to open code
> > them in trace events.
> >
> > As of commit c759e609030c ("tracing: Remove __assign_str_len()"),
> > __assign_str() can be used for both __string() and __string_len() fields.
> > Before that commit, __assign_str_len() is required to be used. This needs
> > to be noted for backporting. (In actuality, commit c1fa617caeb0 ("tracing:
> > Rework __assign_str() and __string() to not duplicate getting the string")
> > is the commit that makes __string_str_len() obsolete).
> >
> > Cc: stable@vger.kernel.org
> > Fixes: 0c77668ddb4e7 ("SUNRPC: Introduce trace points in rpc_auth_gss.ko")
> > Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
>
> Acked-by: Chuck Lever <chuck.lever@oracle.com>
>
Thanks, but feel free to take it if you want. Unless you rather have me
take it through my tree?
-- Steve
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] SUNRPC: Fix rpcgss_context trace event acceptor field
2024-04-10 17:07 ` Chuck Lever
@ 2024-04-10 17:57 ` Steven Rostedt
0 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2024-04-10 17:57 UTC (permalink / raw
To: Chuck Lever
Cc: LKML, Linux Trace Kernel, Masami Hiramatsu, Mathieu Desnoyers,
Jeff Layton, Anna Schumaker, linux-nfs
On Wed, 10 Apr 2024 13:07:20 -0400
Chuck Lever <chuck.lever@oracle.com> wrote:
> Well I guess I could test it for you. I'll take it for nfsd v6.9-rc.
Thanks!
-- Steve
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-04-10 17:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-10 16:38 [PATCH] SUNRPC: Fix rpcgss_context trace event acceptor field Steven Rostedt
2024-04-10 16:38 ` Chuck Lever
2024-04-10 17:07 ` Steven Rostedt
2024-04-10 17:07 ` Chuck Lever
2024-04-10 17:57 ` Steven Rostedt
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).