bpf: reject out-of-bounds stack pointer calculation
authorDaniel Borkmann <daniel@iogearbox.net>
Fri, 22 Dec 2017 15:29:04 +0000 (16:29 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Dec 2017 13:23:47 +0000 (14:23 +0100)
commitd75d3ee237cee9068022117e059b64bbab617f3d
tree787369e2a9360b16329b5fcee3007ab063003155
parent7b5b73ea87a06236fa124bdebed1390d362d3439
bpf: reject out-of-bounds stack pointer calculation

From: Jann Horn <jannh@google.com>

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/bpf/verifier.c