bpf: reject out-of-bounds stack pointer calculation
authorJann Horn <jannh@google.com>
Mon, 18 Dec 2017 19:34:03 +0000 (20:34 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 23 Dec 2017 00:39:51 +0000 (00:39 +0000)
commitd84291b592f9581b4b50cb47e9787886bcb340d2
treea12793552ee904b2df77dc691691973c8be47a79
parentd414607e1a90f7f5e7724d163440d895fd257a89
bpf: reject out-of-bounds stack pointer calculation

Reject programs that compute wildly out-of-bounds stack pointers.
Otherwise, pointers can be computed with an offset that doesn't fit into an
`int`, causing security issues in the stack memory access check (as well as
signed integer overflow during offset addition).

This is a fix specifically for the v4.9 stable tree because the mainline
code looks very different at this point.

Fixes: 7bca0a9702edf ("bpf: enhance verifier to understand stack pointer arithmetic")
Signed-off-by: Jann Horn <jannh@google.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name bpf-reject-out-of-bounds-stack-pointer-calculation.patch
kernel/bpf/verifier.c