On Mon, 10 Jan 2022 10:56:49 -0500 Chuck Lever <chuck.lever@xxxxxxxxxx> 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