]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit0acead26ceaef3f29b0327201cd966552adf4919
treeb583467f4aa9b030f49db5feab726942c681fb19
parentad9f1683296458dcec361b859d9d76ed3cc6801e
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: e3eda4e06685 ("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