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]
Message-ID: <9393fab5-2b8a-4e56-aa5a-5f601d570b47@iogearbox.net>
Date: Wed, 9 Jul 2025 15:15:40 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: Tao Chen <chen.dylane@...ux.dev>, razor@...ckwall.org,
 andrew+netdev@...n.ch, davem@...emloft.net, edumazet@...gle.com,
 kuba@...nel.org, pabeni@...hat.com, ast@...nel.org, andrii@...nel.org,
 martin.lau@...ux.dev, eddyz87@...il.com, song@...nel.org,
 yonghong.song@...ux.dev, john.fastabend@...il.com, kpsingh@...nel.org,
 sdf@...ichev.me, haoluo@...gle.com, jolsa@...nel.org,
 mattbobrowski@...gle.com, rostedt@...dmis.org, mhiramat@...nel.org,
 mathieu.desnoyers@...icios.com, horms@...nel.org, willemb@...gle.com,
 jakub@...udflare.com, pablo@...filter.org, kadlec@...filter.org,
 hawk@...nel.org
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org,
 linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
 netfilter-devel@...r.kernel.org, coreteam@...filter.org
Subject: Re: [PATCH bpf-next v3 1/7] bpf: Add attach_type in bpf_link

On 7/9/25 5:07 AM, Tao Chen wrote:
> Attach_type will be set when link created from user, it is better
> to record attach_type in bpf_link directly suggested by Andrii. So
> add the attach_type field in bpf_link and move the sleepable field to
> the end just to fill the byte hole.
> 
> Acked-by: Jiri Olsa <jolsa@...nel.org>
> Signed-off-by: Tao Chen <chen.dylane@...ux.dev>
> ---
>   drivers/net/netkit.c           |  2 +-
>   include/linux/bpf.h            | 28 ++++++++++++++++-----------
>   kernel/bpf/bpf_iter.c          |  3 ++-
>   kernel/bpf/bpf_struct_ops.c    |  5 +++--
>   kernel/bpf/cgroup.c            |  4 ++--
>   kernel/bpf/net_namespace.c     |  2 +-
>   kernel/bpf/syscall.c           | 35 +++++++++++++++++++++-------------
>   kernel/bpf/tcx.c               |  3 ++-
>   kernel/bpf/trampoline.c        | 10 ++++++----
>   kernel/trace/bpf_trace.c       |  4 ++--
>   net/bpf/bpf_dummy_struct_ops.c |  3 ++-
>   net/core/dev.c                 |  3 ++-
>   net/core/sock_map.c            |  3 ++-
>   net/netfilter/nf_bpf_link.c    |  3 ++-
>   14 files changed, 66 insertions(+), 42 deletions(-)
[...]

> diff --git a/include/linux/bpf.h b/include/linux/bpf.h
> index 34dd90ec7fa..dd5070039de 100644
> --- a/include/linux/bpf.h
> +++ b/include/linux/bpf.h
> @@ -1729,12 +1729,10 @@ struct bpf_link {
>   	enum bpf_link_type type;
>   	const struct bpf_link_ops *ops;
>   	struct bpf_prog *prog;
> -	/* whether BPF link itself has "sleepable" semantics, which can differ
> -	 * from underlying BPF program having a "sleepable" semantics, as BPF
> -	 * link's semantics is determined by target attach hook
> -	 */
> -	bool sleepable;
> +
>   	u32 flags;
> +	enum bpf_attach_type attach_type;
> +
>   	/* rcu is used before freeing, work can be used to schedule that
>   	 * RCU-based freeing before that, so they never overlap
>   	 */
> @@ -1742,6 +1740,11 @@ struct bpf_link {
>   		struct rcu_head rcu;
>   		struct work_struct work;
>   	};
> +	/* whether BPF link itself has "sleepable" semantics, which can differ
> +	 * from underlying BPF program having a "sleepable" semantics, as BPF
> +	 * link's semantics is determined by target attach hook
> +	 */
> +	bool sleepable;
>   };

lgtm, it looks a bit weird at the end here after rcu/work but in future if other
attributes get added to the link obj and a new hole frees up we can move it up
again. Definitely good the rationale for the move is documented in the commit msg.

Acked-by: Daniel Borkmann <daniel@...earbox.net>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ