]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: fix 64-bit divide
authorAlexei Starovoitov <ast@plumgrid.com>
Mon, 27 Apr 2015 21:40:37 +0000 (14:40 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 28 Apr 2015 03:11:49 +0000 (23:11 -0400)
commitc2b2d2be08b08517480d6fb51e6b28d809283e08
tree6458c36e3f2c0cd2f2ca7c1dfcee6fc5b9c7dd19
parent3479e8f9e455404e192769f5c7b2c69ba9700c9d
bpf: fix 64-bit divide

ALU64_DIV instruction should be dividing 64-bit by 64-bit,
whereas do_div() does 64-bit by 32-bit divide.
x64 and arm64 JITs correctly implement 64 by 64 unsigned divide.
llvm BPF backend emits code assuming that ALU64_DIV does 64 by 64.

Fixes: 306b7f3fbc94 ("net: sock: allow eBPF programs to be attached to sockets")
Reported-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
kernel/bpf/core.c