bpf: reject out-of-bounds stack pointer calculation
authorJann Horn <jannh@google.com>
Mon, 18 Dec 2017 19:34:03 +0000 (20:34 +0100)
committerYves-Alexis Perez <corsac@debian.org>
Thu, 4 Jan 2018 11:12:40 +0000 (11:12 +0000)
commite75cfb7c65ccafa912ac9ef2920feeb65748a3ab
tree2e5f637b73ed84057f7c40c2197c7315e3b9bb02
parent672d3a209df157bb6e75ee227479029602080f6b
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