summaryrefslogtreecommitdiffstats
path: root/kernel/kcmp.c
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2017-01-15 01:34:25 +0100
committerDavid S. Miller <davem@davemloft.net>2017-01-16 14:41:42 -0500
commit2d071c643f1cd15a24172de4b5b7ae2adb93abbb (patch)
tree31fa22a277b92984067d77bb6d2f1edaae1d2adf /kernel/kcmp.c
parent019ec0032e821a7262995af0c81b242dc7e55c9f (diff)
downloadlinux-2d071c643f1cd15a24172de4b5b7ae2adb93abbb.tar.bz2
bpf, trace: make ctx access checks more robust
Make sure that ctx cannot potentially be accessed oob by asserting explicitly that ctx access size into pt_regs for BPF_PROG_TYPE_KPROBE programs must be within limits. In case some 32bit archs have pt_regs not being a multiple of 8, then BPF_DW access could cause such access. BPF_PROG_TYPE_KPROBE progs don't have a ctx conversion function since there's no extra mapping needed. kprobe_prog_is_valid_access() didn't enforce sizeof(long) as the only allowed access size, since LLVM can generate non BPF_W/BPF_DW access to regs from time to time. For BPF_PROG_TYPE_TRACEPOINT we don't have a ctx conversion either, so add a BUILD_BUG_ON() check to make sure that BPF_DW access will not be a similar issue in future (ctx works on event buffer as opposed to pt_regs there). Fixes: 2541517c32be ("tracing, perf: Implement BPF programs attached to kprobes") Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/kcmp.c')
0 files changed, 0 insertions, 0 deletions