bpf: Extend check_uarg_tail_zero() checks
authorMickaël Salaün <mic@digikod.net>
Mon, 7 Aug 2017 18:45:20 +0000 (20:45 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Aug 2017 01:11:17 +0000 (18:11 -0700)
commit752ba56fb130b27c32c2ae6c82c8ef246b22106c
tree5ee1b20c2245bc4a75281a2323807642793ed49b
parent58291a7465f6b88248c9f34807c16705bd5698f8
bpf: Extend check_uarg_tail_zero() checks

The function check_uarg_tail_zero() was created from bpf(2) for
BPF_OBJ_GET_INFO_BY_FD without taking the access_ok() nor the PAGE_SIZE
checks. Make this checks more generally available while unlikely to be
triggered, extend the memory range check and add an explanation
including why the ToCToU should not be a security concern.

Signed-off-by: Mickaël Salaün <mic@digikod.net>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Kees Cook <keescook@chromium.org>
Cc: Martin KaFai Lau <kafai@fb.com>
Link: https://lkml.kernel.org/r/CAGXu5j+vRGFvJZmjtAcT8Hi8B+Wz0e1b6VKYZHfQP_=DXzC4CQ@mail.gmail.com
Signed-off-by: David S. Miller <davem@davemloft.net>
kernel/bpf/syscall.c