bpf/verifier: Fix states_equal() comparison of pointer and UNKNOWN
authorBen Hutchings <ben@decadent.org.uk>
Sat, 23 Dec 2017 00:29:56 +0000 (00:29 +0000)
committerYves-Alexis Perez <corsac@debian.org>
Thu, 4 Jan 2018 11:12:40 +0000 (11:12 +0000)
commit432c476daac01901ffe17b58bdbc9fac94419b0b
tree00b67ca0c455e3558f5125424a7a330d0efc1553
parentd503bfadfaac2c1c31dda90c0887bddea11b39b0
bpf/verifier: Fix states_equal() comparison of pointer and UNKNOWN

An UNKNOWN_VALUE is not supposed to be derived from a pointer, unless
pointer leaks are allowed.  Therefore, states_equal() must not treat
a state with a pointer in a register as "equal" to a state with an
UNKNOWN_VALUE in that register.

This was fixed differently upstream, but the code around here was
largely rewritten in 4.14 by commit f1174f77b50c "bpf/verifier: rework
value tracking".  The bug can be detected by the bpf/verifier sub-test
"pointer/scalar confusion in state equality check (way 1)".

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: Edward Cree <ecree@solarflare.com>
Cc: Jann Horn <jannh@google.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name bpf-verifier-fix-states_equal-comparison-of-pointer-and-unknown.patch
kernel/bpf/verifier.c