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>
Wed, 10 Jul 2019 07:55:33 +0000 (09:55 +0200)
commite90a7ecde5f361a7044e169fe6000036ceb69794
tree6bd416e1dd3588c65b93dfe3f253c5e2b4c7f55e
parenta97e26569b454c4243eb225d61d08751fe39c024
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