lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Mon, 10 Jun 2024 15:25:34 -0500
From: Yan Zhai <yan@...udflare.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>, 
	Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, 
	Simon Horman <horms@...nel.org>, David Ahern <dsahern@...nel.org>, 
	Abhishek Chauhan <quic_abchauha@...cinc.com>, Mina Almasry <almasrymina@...gle.com>, 
	Florian Westphal <fw@...len.de>, Alexander Lobakin <aleksander.lobakin@...el.com>, 
	David Howells <dhowells@...hat.com>, Jiri Pirko <jiri@...nulli.us>, 
	Daniel Borkmann <daniel@...earbox.net>, Sebastian Andrzej Siewior <bigeasy@...utronix.de>, 
	Lorenzo Bianconi <lorenzo@...nel.org>, Pavel Begunkov <asml.silence@...il.com>, 
	linux-kernel@...r.kernel.org, kernel-team@...udflare.com, 
	Jesper Dangaard Brouer <hawk@...nel.org>, Masami Hiramatsu <mhiramat@...nel.org>, 
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>, Neil Horman <nhorman@...driver.com>, 
	linux-trace-kernel@...r.kernel.org, Dan Carpenter <dan.carpenter@...aro.org>
Subject: Re: [RFC v3 net-next 1/7] net: add rx_sk to trace_kfree_skb

On Mon, Jun 10, 2024 at 11:54 AM Steven Rostedt <rostedt@...dmis.org> wrote:
>
> On Thu, 6 Jun 2024 10:37:46 -0500
> Yan Zhai <yan@...udflare.com> wrote:
>
> > > name: kfree_skb
> > > ID: 1799
> > > format:
> > >         field:unsigned short common_type;       offset:0;       size:2; signed:0;
> > >         field:unsigned char common_flags;       offset:2;       size:1; signed:0;
> > >         field:unsigned char common_preempt_count;       offset:3;       size:1; signed:0;
> > >         field:int common_pid;   offset:4;       size:4; signed:1;
> > >
> > >         field:void * skbaddr;   offset:8;       size:8; signed:0;
> > >         field:void * location;  offset:16;      size:8; signed:0;
> > >         field:unsigned short protocol;  offset:24;      size:2; signed:0;
> > >         field:enum skb_drop_reason reason;      offset:28;      size:4; signed:0;
> > >
> > > Notice that "protocol" is 2 bytes in size at offset 24, but "reason" starts
> > > at offset 28. This means at offset 26, there's a 2 byte hole.
> > >
> > The reason I added the pointer as the last argument is trying to
> > minimize the surprise to existing TP users, because for common ABIs
> > it's fine to omit later arguments when defining a function, but it
> > needs change and recompilation if the order of arguments changed.
>
> Nothing should be hard coding the offsets of the fields. This is
> exported to user space so that tools can see where the fields are.
> That's the purpose of libtraceevent. The fields should be movable and
> not affect anything. There should be no need to recompile.
>
Oh I misunderstood previously. I was also thinking about the argument
order in TP_PROTO, but what you mentioned is just the order in
TP_STRUCT__entry, correct? I'd prefer to not change the argument order
but the struct field order can definitely be aligned better here.

Yan

> >
> > Looking at the actual format after the change, it does not add a new
> > hole since protocol and reason are already packed into the same 8-byte
> > block, so rx_skaddr starts at 8-byte aligned offset:
> >
> > # cat /sys/kernel/debug/tracing/events/skb/kfree_skb/format
> > name: kfree_skb
> > ID: 2260
> > format:
> >         field:unsigned short common_type;       offset:0;
> > size:2; signed:0;
> >         field:unsigned char common_flags;       offset:2;
> > size:1; signed:0;
> >         field:unsigned char common_preempt_count;       offset:3;
> >  size:1; signed:0;
> >         field:int common_pid;   offset:4;       size:4; signed:1;
> >
> >         field:void * skbaddr;   offset:8;       size:8; signed:0;
> >         field:void * location;  offset:16;      size:8; signed:0;
> >         field:unsigned short protocol;  offset:24;      size:2; signed:0;
> >         field:enum skb_drop_reason reason;      offset:28;
> > size:4; signed:0;
> >         field:void * rx_skaddr; offset:32;      size:8; signed:0;
> >
> > Do you think we still need to change the order?
>
> Up to you, just wanted to point it out.
>
> -- Steve
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ