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)
commit901334159419afc8c1b8556243fc53e9617472d2
tree85f3cee68edbfc230e11a2662cd0677b79944a44
parent417f1d9f217922d822b64e8323458d7d03a12d4f
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