From nobody Mon Feb 9 18:19:07 2026 Received: from out-176.mta1.migadu.com (out-176.mta1.migadu.com [95.215.58.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C66E350A3B; Fri, 23 Jan 2026 08:59:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769158750; cv=none; b=XYdyePQm9JuTIuMRpG8ezgAbUbmd5P8dTMoVKMViUDCnidDkRUjnwCDLXoMzg/8fP1AolYIX0T0+7K66MVG0VhqV/QQEZK6YriXaJt9opeKsX4FuXQxBl1yY4m944RWDeZlnNh8X1FhS+ffSFavXyjG7gV15cyDkEA2BtnhqDZE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769158750; c=relaxed/simple; bh=FOZgACDD42oP7q3Vatpm8aL6PwAkwL4upLYGHYnoYiY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r/EmRMdck9cQLu01LbQ+KPxe8wRVkdoHMPkTpv3F1HK3AmmgMQy9bJdahbEYPTUxFUvyUxln67jzu1Ohf7DJ1KxpXNbIV8D2gLivujumc+mWTjGrQPYvWL0+nBGy8eYJrxXdZ1EpPIlpZ1tzUgKRgWPD1eoFcPLed2w5/zM2SQQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=a7IIP/Es; arc=none smtp.client-ip=95.215.58.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="a7IIP/Es" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1769158746; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uLmLgIc/WysrcWe9//I7t11dZt4RG+riPvAd1pdlrBg=; b=a7IIP/EsFUJnD3r7OnHIdd2/eiTbPkC3e6yHe7BggslKBJxB4oQ47RRY0b98uf/B/WTkxM OQmGL1/JCv/S9EGgOwUTCr3OVVhK/BTpgiHN8sZ8WSgXM0gPOvPGTUX26n9gi3LG9mgpSZ nAR6Ug/78D3j1Ymvcl56/aRR5+vBNjw= From: Hui Zhu To: Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan , Peter Zijlstra , Miguel Ojeda , Nathan Chancellor , Kees Cook , Tejun Heo , Jeff Xu , mkoutny@suse.com, Jan Hendrik Farr , Christian Brauner , Randy Dunlap , Brian Gerst , Masahiro Yamada , davem@davemloft.net, Jakub Kicinski , Jesper Dangaard Brouer , JP Kobryn , Willem de Bruijn , Jason Xing , Paul Chaignon , Anton Protopopov , Amery Hung , Chen Ridong , Lance Yang , Jiayuan Chen , linux-kernel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, bpf@vger.kernel.org, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: Hui Zhu , Geliang Tang Subject: [RFC PATCH bpf-next v3 07/12] libbpf: Support passing user-defined flags for struct_ops Date: Fri, 23 Jan 2026 16:58:01 +0800 Message-ID: <006635a13eeae0fe8da56447bc5131f6a80a48bf.1769157382.git.zhuhui@kylinos.cn> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Hui Zhu Building on the previous change that added flags to the kernel's link creation path, this patch exposes this functionality through libbpf. The `bpf_struct_ops_opts` struct is extended with a `flags` member, which is then passed to the `bpf_link_create` syscall within `bpf_map__attach_struct_ops_opts`. This enables userspace applications to pass flags, such as `BPF_F_ALLOW_OVERRIDE`, when attaching struct_ops to cgroups, providing more control over the attachment behavior in nested hierarchies. Signed-off-by: Geliang Tang Signed-off-by: Hui Zhu --- tools/lib/bpf/libbpf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 37eb4f96b28e..089bd1325468 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -13508,6 +13508,7 @@ struct bpf_link *bpf_map__attach_struct_ops_opts(co= nst struct bpf_map *map, } =20 link_opts.cgroup.relative_fd =3D OPTS_GET(opts, relative_fd, 0); + link_opts.flags =3D OPTS_GET(opts, flags, 0); =20 fd =3D bpf_link_create(map->fd, 0, BPF_STRUCT_OPS, &link_opts); if (fd < 0) { --=20 2.43.0