bpf: Teach the verifier to recognize rdonly_mem as not null.
authorAlexei Starovoitov <ast@kernel.org>
Tue, 21 Mar 2023 20:38:52 +0000 (13:38 -0700)
committerAndrii Nakryiko <andrii@kernel.org>
Wed, 22 Mar 2023 16:31:05 +0000 (09:31 -0700)
commit1057d299459657b85e593a4b6294a000f920672a
treee962571e8ea2ef312a9b9584abac83db3ee98fa5
parenta18f721415b4d4edea23cb8c7d6276330302af14
bpf: Teach the verifier to recognize rdonly_mem as not null.

Teach the verifier to recognize PTR_TO_MEM | MEM_RDONLY as not NULL
otherwise if (!bpf_ksym_exists(known_kfunc)) doesn't go through
dead code elimination.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: David Vernet <void@manifault.com>
Link: https://lore.kernel.org/bpf/20230321203854.3035-3-alexei.starovoitov@gmail.com
kernel/bpf/verifier.c