]> git.baikalelectronics.ru Git - kernel.git/commit
bpf/verifier: allow all functions to read user provided context
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>
Tue, 6 Sep 2022 15:12:59 +0000 (17:12 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 7 Sep 2022 18:03:44 +0000 (11:03 -0700)
commit667b1fdb054954c528f2749d738823708f30802b
treede84b7fd33c63411952073682cdb27bcd3ac9829
parent2ed444670b6e6f7fad3122099f56db265f161f8f
bpf/verifier: allow all functions to read user provided context

When a function was trying to access data from context in a syscall eBPF
program, the verifier was rejecting the call unless it was accessing the
first element.
This is because the syscall context is not known at compile time, and
so we need to check this when actually accessing it.

Check for the valid memory access if there is no convert_ctx callback,
and allow such situation to happen.

Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Link: https://lore.kernel.org/r/20220906151303.2780789-4-benjamin.tissoires@redhat.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c