bpf: Disallow bpf programs call prog_run command.
authorAlexei Starovoitov <ast@kernel.org>
Tue, 9 Aug 2022 03:58:09 +0000 (20:58 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 10 Aug 2022 16:43:07 +0000 (09:43 -0700)
commit86f44fcec22ce2979507742bc53db8400e454f46
treeb583467f4aa9b030f49db5feab726942c681fb19
parentaada476655461a9ab491d8298a415430cdd10278
bpf: Disallow bpf programs call prog_run command.

The verifier cannot perform sufficient validation of bpf_attr->test.ctx_in
pointer, therefore bpf programs should not be allowed to call BPF_PROG_RUN
command from within the program.
To fix this issue split bpf_sys_bpf() bpf helper into normal kern_sys_bpf()
kernel function that can only be used by the kernel light skeleton directly.

Reported-by: YiFei Zhu <zhuyifei@google.com>
Fixes: b1d18a7574d0 ("bpf: Extend sys_bpf commands for bpf_syscall programs.")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/syscall.c
tools/lib/bpf/skel_internal.h