bpf/verifier: rework value tracking
authorEdward Cree <ecree@solarflare.com>
Mon, 7 Aug 2017 14:26:19 +0000 (15:26 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Aug 2017 00:51:34 +0000 (17:51 -0700)
commitf1174f77b50c94eecaa658fdc56fa69b421de4b8
treed6e11577190ab47f4c371da21cf1f0f14da66db0
parente1cb90f2b83b6b48deeba0ac9f1920693cbad7e1
bpf/verifier: rework value tracking

Unifies adjusted and unadjusted register value types (e.g. FRAME_POINTER is
 now just a PTR_TO_STACK with zero offset).
Tracks value alignment by means of tracking known & unknown bits.  This
 also replaces the 'reg->imm' (leading zero bits) calculations for (what
 were) UNKNOWN_VALUEs.
If pointer leaks are allowed, and adjust_ptr_min_max_vals returns -EACCES,
 treat the pointer as an unknown scalar and try again, because we might be
 able to conclude something about the result (e.g. pointer & 0x40 is either
 0 or 0x40).
Verifier hooks in the netronome/nfp driver were changed to match the new
 data structures.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/bpf/verifier.c
include/linux/bpf.h
include/linux/bpf_verifier.h
include/linux/tnum.h [new file with mode: 0644]
kernel/bpf/Makefile
kernel/bpf/tnum.c [new file with mode: 0644]
kernel/bpf/verifier.c