From nobody Mon Feb 9 07:56:25 2026 Received: from out-181.mta0.migadu.com (out-181.mta0.migadu.com [91.218.175.181]) (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 6594B39E171 for ; Wed, 4 Feb 2026 09:00:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770195655; cv=none; b=av9N9e1yrCF9qGifEl7PpN/bqLcRcTy+VVGz6omIfNm0ZWzDRLu3fs+dPHa8d04l3TWxZM7phCEPTFkV0a00J0par5Yz2Blw+XwFYeA/FioHnKcKJCFn5M8LqmtpWsG5MoiAjiaKAwK3Z+wgnwZZ3rj6b6a9tdeI6eBqJ0w8E3k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770195655; c=relaxed/simple; bh=9PcymUN+ZCg2e50rgIRHOfTXaJvfmhQQChu88MTol/Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XCfzQCJhxcErKKfMGhhgd4tyqp9cpE12WoXivGkWAa+pJwKhgfoGZnxdwOHXwhW1yjIbkgGLICKnAQPReolS7AniBnLZLxIeuwxXsN8nQr98b9yM2hXDWwzEB1Cf81aXtlv/IqRdDyeLCjdAw6SUgJN/UPkyPEwcXDEvy31Bq0A= 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=rsU4nWb7; arc=none smtp.client-ip=91.218.175.181 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="rsU4nWb7" 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=1770195638; 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=li2p2tnFJJjJ5INNx6uZKzhFQ5sqAQSEauna4Y+cr5o=; b=rsU4nWb7WJ8rYospxU0vNqr3LLdJyM/YNdPohzbJxDWOBLrJ/szm5aeVmgcq2S3C4ITKXL Ax2iSO3sWa/rRry4nXzQQ/VHmoSq2v/BGNPDG0gwX4i2hzWflMUCGYw+W4z8EhpGOp+8Kx 6aTRyHlevDOSD1t4CgRo5ymJU2OHQrM= 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 v6 07/12] libbpf: Support passing user-defined flags for struct_ops Date: Wed, 4 Feb 2026 17:00:03 +0800 Message-ID: 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 70a00da54ff5..06c936bad211 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -13511,6 +13511,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