summaryrefslogtreecommitdiffstats
path: root/kernel/bpf
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@plumgrid.com>2014-10-20 14:54:57 -0700
committerDavid S. Miller <davem@davemloft.net>2014-10-21 21:43:46 -0400
commit32bf08a6257b9c7380dcd040af3c0858eee3ef05 (patch)
treeb5928993937cb9bc095f6c3e0393eb63f6471308 /kernel/bpf
parent78fd1d0ab072d4d9b5f0b7c14a1516665170b565 (diff)
downloadlinux-stable-32bf08a6257b9c7380dcd040af3c0858eee3ef05.tar.gz
linux-stable-32bf08a6257b9c7380dcd040af3c0858eee3ef05.tar.bz2
linux-stable-32bf08a6257b9c7380dcd040af3c0858eee3ef05.zip
bpf: fix bug in eBPF verifier
while comparing for verifier state equivalency the comparison was missing a check for uninitialized register. Make sure it does so and add a testcase. Fixes: f1bca824dabb ("bpf: add search pruning optimization to verifier") Cc: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: Alexei Starovoitov <ast@plumgrid.com> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/bpf')
-rw-r--r--kernel/bpf/verifier.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 801f5f3b9307..9f81818f2941 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -1409,7 +1409,8 @@ static bool states_equal(struct verifier_state *old, struct verifier_state *cur)
if (memcmp(&old->regs[i], &cur->regs[i],
sizeof(old->regs[0])) != 0) {
if (old->regs[i].type == NOT_INIT ||
- old->regs[i].type == UNKNOWN_VALUE)
+ (old->regs[i].type == UNKNOWN_VALUE &&
+ cur->regs[i].type != NOT_INIT))
continue;
return false;
}