summaryrefslogtreecommitdiff
path: root/net/xdp
diff options
context:
space:
mode:
authorJohn Fastabend <john.fastabend@gmail.com>2020-09-24 22:58:40 +0300
committerAlexei Starovoitov <ast@kernel.org>2020-09-26 03:05:14 +0300
commitba5f4cfeac77fca981b199ec7f2396a3616e5216 (patch)
tree38b830f22adca729f67c432bef9213b81a9127c9 /net/xdp
parent99d4def4d08507474b250dad6345d14715a4726b (diff)
downloadlinux-ba5f4cfeac77fca981b199ec7f2396a3616e5216.tar.xz
bpf: Add comment to document BTF type PTR_TO_BTF_ID_OR_NULL
The meaning of PTR_TO_BTF_ID_OR_NULL differs slightly from other types denoted with the *_OR_NULL type. For example the types PTR_TO_SOCKET and PTR_TO_SOCKET_OR_NULL can be used for branch analysis because the type PTR_TO_SOCKET is guaranteed to _not_ have a null value. In contrast PTR_TO_BTF_ID and BTF_TO_BTF_ID_OR_NULL have slightly different meanings. A PTR_TO_BTF_TO_ID may be a pointer to NULL value, but it is safe to read this pointer in the program context because the program context will handle any faults. The fallout is for PTR_TO_BTF_ID the verifier can assume reads are safe, but can not use the type in branch analysis. Additionally, authors need to be extra careful when passing PTR_TO_BTF_ID into helpers. In general helpers consuming type PTR_TO_BTF_ID will need to assume it may be null. Seeing the above is not obvious to readers without the back knowledge lets add a comment in the type definition. Editorial comment, as networking and tracing programs get closer and more tightly merged we may need to consider a new type that we can ensure is non-null for branch analysis and also passing into helpers. Signed-off-by: John Fastabend <john.fastabend@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Lorenz Bauer <lmb@cloudflare.com>
Diffstat (limited to 'net/xdp')
0 files changed, 0 insertions, 0 deletions