summaryrefslogtreecommitdiff
path: root/include/linux/of_net.h
diff options
context:
space:
mode:
authorDave Marchevsky <davemarchevsky@fb.com>2022-09-12 18:45:44 +0300
committerAlexei Starovoitov <ast@kernel.org>2022-09-15 12:44:07 +0300
commit47e34cb74d376ddfeaef94abb1d6dfb3c905ee51 (patch)
tree7dc529478d51d5a2142c19b54413e5220dbd78d3 /include/linux/of_net.h
parent1bfe26fb082724be453e4d7fd9bb358e3ba669b2 (diff)
downloadlinux-47e34cb74d376ddfeaef94abb1d6dfb3c905ee51.tar.xz
bpf: Add verifier check for BPF_PTR_POISON retval and arg
BPF_PTR_POISON was added in commit c0a5a21c25f37 ("bpf: Allow storing referenced kptr in map") to denote a bpf_func_proto btf_id which the verifier will replace with a dynamically-determined btf_id at verification time. This patch adds verifier 'poison' functionality to BPF_PTR_POISON in order to prepare for expanded use of the value to poison ret- and arg-btf_id in ongoing work, namely rbtree and linked list patchsets [0, 1]. Specifically, when the verifier checks helper calls, it assumes that BPF_PTR_POISON'ed ret type will be replaced with a valid type before - or in lieu of - the default ret_btf_id logic. Similarly for arg btf_id. If poisoned btf_id reaches default handling block for either, consider this a verifier internal error and fail verification. Otherwise a helper w/ poisoned btf_id but no verifier logic replacing the type will cause a crash as the invalid pointer is dereferenced. Also move BPF_PTR_POISON to existing include/linux/posion.h header and remove unnecessary shift. [0]: lore.kernel.org/bpf/20220830172759.4069786-1-davemarchevsky@fb.com [1]: lore.kernel.org/bpf/20220904204145.3089-1-memxor@gmail.com Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com> Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Link: https://lore.kernel.org/r/20220912154544.1398199-1-davemarchevsky@fb.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include/linux/of_net.h')
0 files changed, 0 insertions, 0 deletions