]> 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)
commit2c240c676d29014ec4743cfc8e29fb4c675a089c
treeb583467f4aa9b030f49db5feab726942c681fb19
parente9cf67af962c994c603ad704c8b56b2b585acd77
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: 499a34e85d72 ("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