All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org, linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH v2 0/2] Fix sockaddr handling in NFSD trace points
Date: Mon, 10 Jan 2022 11:05:35 -0500	[thread overview]
Message-ID: <20220110110535.25ca51bf@gandalf.local.home> (raw)
In-Reply-To: <164182978641.8391.8277203495236105391.stgit@bazille.1015granger.net>

On Mon, 10 Jan 2022 10:56:49 -0500
Chuck Lever <chuck.lever@oracle.com> wrote:

> The patches in this series address a simple buffer over-read bug in
> the Linux NFS server.
> 
> However I was thinking it would be nice to have trace helpers to
> deal safely with generic socket addresses. I'd like to be able to
> treat them the same way we currently treat strings. So for example:
> 
> 
> #define field_sockaddr(field, len)  __dynamic_array(u8, field, len)
> #define assign_sockaddr(dest, src, len)  memcpy(__get_dynamic_array(dest), src, len)
> #define __get_sockaddr(field)  ((struct sockaddr *)__get_dynamic_array(field))
> 
> TRACE_EVENT(sockaddr_example,
>         TP_PROTO(
>                 const struct sockaddr *sap,
>                 size_t salen
>         ),  
>         TP_ARGS(sap, salen),
>         TP_STRUCT__entry(
>                 __field_sockaddr(addr, salen)
>         ),  
>         TP_fast_assign(
>                 __assign_sockaddr(addr, sap, salen);
>         ),  
>         TP_printk("addr=%pIS", __get_sockaddr(addr))
> );
> 
> 
> should be able to store any address family in a dynamically-sized
> array field (addr).
> 
> I haven't quite been able to figure out how to handle the 
> TP_printk() part of this equation. `trace-cmd report` displays
> something like "addr=ARG TYPE NOT FIELD BUT 7". 
> 
> Thoughts or advice appreciated.

I'll take a look into it.

Thanks,

-- Steve

  parent reply	other threads:[~2022-01-10 16:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10 15:56 [PATCH v2 0/2] Fix sockaddr handling in NFSD trace points Chuck Lever
2022-01-10 15:56 ` [PATCH v2 1/2] SUNRPC: Fix sockaddr handling in the svc_xprt_create_error trace point Chuck Lever
2022-01-10 15:57 ` [PATCH v2 2/2] SUNRPC: Fix sockaddr handling in svcsock_accept_class trace points Chuck Lever
2022-01-10 16:05 ` Steven Rostedt [this message]
2022-01-10 23:31   ` [PATCH v2 0/2] Fix sockaddr handling in NFSD " Steven Rostedt
2022-01-11 15:40     ` Chuck Lever III

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=20220110110535.25ca51bf@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-trace-devel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.