]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Verifier cleanups
authorJoanne Koong <joannelkoong@gmail.com>
Tue, 2 Aug 2022 21:46:38 +0000 (14:46 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 8 Aug 2022 15:54:06 +0000 (17:54 +0200)
commit10f23ff51f58551035b0bed91bf7e0a9d57694fc
treef8280d59151514ccdfd2284e31a2441da7da7d4e
parent74fa4aa3f78ff0eb6fbbb820d68679f73aea5474
bpf: Verifier cleanups

This patch cleans up a few things in the verifier:

  * type_is_pkt_pointer():
    Future work (skb + xdp dynptrs [0]) will be using the reg type
    PTR_TO_PACKET | PTR_MAYBE_NULL. type_is_pkt_pointer() should return
    true for any type whose base type is PTR_TO_PACKET, regardless of
    flags attached to it.

  * reg_type_may_be_refcounted_or_null():
    Get the base type at the start of the function to avoid
    having to recompute it / improve readability

  * check_func_proto(): remove unnecessary 'meta' arg

  * check_helper_call():
    Use switch casing on the base type of return value instead of
    nested ifs on the full type

There are no functional behavior changes.

  [0] https://lore.kernel.org/bpf/20220726184706.954822-1-joannelkoong@gmail.com/

Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/bpf/20220802214638.3643235-1-joannelkoong@gmail.com
kernel/bpf/verifier.c