libbpf: add __arg_trusted and __arg_nullable tag macros
authorAndrii Nakryiko <andrii@kernel.org>
Tue, 30 Jan 2024 00:06:47 +0000 (16:06 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 30 Jan 2024 17:41:50 +0000 (09:41 -0800)
commitd28bb1a86e68a3d523e0acee8281bb904dd7f451
tree68c3f0fffa3d5b2c2394a9f3e7dca317d20c2546
parent8f2b44cd9d69ec36c9ce9623993978babb575ee8
libbpf: add __arg_trusted and __arg_nullable tag macros

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>
Link: https://lore.kernel.org/r/20240130000648.2144827-4-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/lib/bpf/bpf_helpers.h