arm64: bpf: fix div-by-zero case
authorZi Shen Lim <zlim.lnx@gmail.com>
Wed, 4 Nov 2015 06:56:44 +0000 (22:56 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 31 Jan 2016 19:23:39 +0000 (11:23 -0800)
commit40c5dde6eb7e1d23ab8f4152d28bd71b5e30f8f6
tree2bb7af008258690ba4874be56d5c65e3f048c60b
parent8831ded35abdb2ff1eaaa10c3e756a8d45a9d171
arm64: bpf: fix div-by-zero case

commit 251599e1d6906621f49218d7b474ddd159e58f3b upstream.

In the case of division by zero in a BPF program:
A = A / X;  (X == 0)
the expected behavior is to terminate with return value 0.

This is confirmed by the test case introduced in commit 86bf1721b226
("test_bpf: add tests checking that JIT/interpreter sets A and X to 0.").

Reported-by: Yang Shi <yang.shi@linaro.org>
Tested-by: Yang Shi <yang.shi@linaro.org>
CC: Xi Wang <xi.wang@gmail.com>
CC: Alexei Starovoitov <ast@plumgrid.com>
CC: linux-arm-kernel@lists.infradead.org
CC: linux-kernel@vger.kernel.org
Fixes: e54bcde3d69d ("arm64: eBPF JIT compiler")
Signed-off-by: Zi Shen Lim <zlim.lnx@gmail.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/net/bpf_jit.h
arch/arm64/net/bpf_jit_comp.c