From: Andrii Nakryiko <andrii@kernel.org>
To: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
martin.lau@kernel.org
Cc: andrii@kernel.org, kernel-team@meta.com,
Eduard Zingerman <eddyz87@gmail.com>
Subject: [PATCH v3 bpf-next 3/4] libbpf: add __arg_trusted and __arg_nullable tag macros
Date: Mon, 29 Jan 2024 16:06:47 -0800 [thread overview]
Message-ID: <20240130000648.2144827-4-andrii@kernel.org> (raw)
In-Reply-To: <20240130000648.2144827-1-andrii@kernel.org>
Add __arg_trusted to annotate global func args that accept trusted
PTR_TO_BTF_ID arguments.
Also add __arg_nullable to combine with __arg_trusted (and maybe other
tags in the future) to force global subprog itself (i.e., callee) to do
NULL checks, as opposed to default non-NULL semantics (and thus caller's
responsibility to ensure non-NULL values).
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
tools/lib/bpf/bpf_helpers.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/lib/bpf/bpf_helpers.h b/tools/lib/bpf/bpf_helpers.h
index 2324cc42b017..79eaa581be98 100644
--- a/tools/lib/bpf/bpf_helpers.h
+++ b/tools/lib/bpf/bpf_helpers.h
@@ -190,6 +190,8 @@ enum libbpf_tristate {
#define __arg_ctx __attribute__((btf_decl_tag("arg:ctx")))
#define __arg_nonnull __attribute((btf_decl_tag("arg:nonnull")))
+#define __arg_nullable __attribute((btf_decl_tag("arg:nullable")))
+#define __arg_trusted __attribute((btf_decl_tag("arg:trusted")))
#ifndef ___bpf_concat
#define ___bpf_concat(a, b) a ## b
--
2.34.1
next prev parent reply other threads:[~2024-01-30 0:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-30 0:06 [PATCH v3 bpf-next 0/4] Trusted PTR_TO_BTF_ID arg support in global subprogs Andrii Nakryiko
2024-01-30 0:06 ` [PATCH v3 bpf-next 1/4] bpf: add __arg_trusted global func arg tag Andrii Nakryiko
2024-01-30 0:06 ` [PATCH v3 bpf-next 2/4] bpf: add arg:nullable tag to be combined with trusted pointers Andrii Nakryiko
2024-01-30 0:06 ` Andrii Nakryiko [this message]
2024-01-30 0:06 ` [PATCH v3 bpf-next 4/4] selftests/bpf: add trusted global subprog arg tests Andrii Nakryiko
2024-01-30 17:50 ` [PATCH v3 bpf-next 0/4] Trusted PTR_TO_BTF_ID arg support in global subprogs patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240130000648.2144827-4-andrii@kernel.org \
--to=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=kernel-team@meta.com \
--cc=martin.lau@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox