bpf: Add bpf_dynptr_is_null and bpf_dynptr_is_rdonly
authorJoanne Koong <joannelkoong@gmail.com>
Thu, 20 Apr 2023 07:14:11 +0000 (00:14 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 27 Apr 2023 08:40:36 +0000 (10:40 +0200)
commit540ccf96ddbc173474c32e595787d5622253be3d
treec0228d85f2f719c4888102dd0605b7b87fb4369e
parent987d0242d189661f78b77cc4d77f843b15600fed
bpf: Add bpf_dynptr_is_null and bpf_dynptr_is_rdonly

bpf_dynptr_is_null returns true if the dynptr is null / invalid
(determined by whether ptr->data is NULL), else false if
the dynptr is a valid dynptr.

bpf_dynptr_is_rdonly returns true if the dynptr is read-only,
else false if the dynptr is read-writable. If the dynptr is
null / invalid, false is returned by default.

Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20230420071414.570108-3-joannelkoong@gmail.com
kernel/bpf/helpers.c