]> git.baikalelectronics.ru Git - kernel.git/commit
bpf, verifier: detect misconfigured mem, size argument pair
authorDaniel Borkmann <daniel@iogearbox.net>
Sat, 20 Jan 2018 00:24:29 +0000 (01:24 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 20 Jan 2018 02:36:59 +0000 (18:36 -0800)
commit78e3112ce71821294d08911c6d24897ed9a75a76
tree85f3cee68edbfc230e11a2662cd0677b79944a44
parent1c0f038cdd8a9f28a32b26638fc356edc68d6897
bpf, verifier: detect misconfigured mem, size argument pair

I've seen two patch proposals now for helper additions that used
ARG_PTR_TO_MEM or similar in reg_X but no corresponding ARG_CONST_SIZE
in reg_X+1. Verifier won't complain in such case, but it will omit
verifying the memory passed to the helper thus ending up badly.
Detect such buggy helper function signature and bail out during
verification rather than finding them through review.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c