powerpc/bpf: use unsigned division instruction for 64-bit operations
authorNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Wed, 12 Jun 2019 18:51:40 +0000 (00:21 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 25 Jun 2019 03:36:00 +0000 (11:36 +0800)
commit48ee85dc9c529ddde5bad311fd880b30579619fa
treea40a0fead1855b48aebd50015e0fa0ece9ecf1a5
parenta96ac5cb8a56ad24c663dd67f8865df30f4f7b84
powerpc/bpf: use unsigned division instruction for 64-bit operations

commit 758f2046ea040773ae8ea7f72dd3bbd8fa984501 upstream.

BPF_ALU64 div/mod operations are currently using signed division, unlike
BPF_ALU32 operations. Fix the same. DIV64 and MOD64 overflow tests pass
with this fix.

Fixes: 156d0e290e969c ("powerpc/ebpf/jit: Implement JIT compiler for extended BPF")
Cc: stable@vger.kernel.org # v4.8+
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/include/asm/ppc-opcode.h
arch/powerpc/net/bpf_jit.h
arch/powerpc/net/bpf_jit_comp64.c