bpf: Allow initializing dynptrs in kfuncs
authorJoanne Koong <joannelkoong@gmail.com>
Wed, 1 Mar 2023 15:49:46 +0000 (07:49 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 1 Mar 2023 17:55:23 +0000 (09:55 -0800)
commit1d18feb2c915c5ad0a9a61d04b8560e8efb78ce8
tree00a07809e818100cbfa544d80a19a0fec7b5470c
parent7e0dac2807e6c4ae8c56941d74971fdb0763b4f9
bpf: Allow initializing dynptrs in kfuncs

This change allows kfuncs to take in an uninitialized dynptr as a
parameter. Before this change, only helper functions could successfully
use uninitialized dynptrs. This change moves the memory access check
(including stack state growing and slot marking) into
process_dynptr_func(), which both helpers and kfuncs call into.

Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
Link: https://lore.kernel.org/r/20230301154953.641654-4-joannelkoong@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c