summaryrefslogtreecommitdiff
path: root/net/core/sock.c
diff options
context:
space:
mode:
authorLuke Nelson <lukenels@cs.washington.edu>2020-04-08 18:12:29 +0000
committerDaniel Borkmann <daniel@iogearbox.net>2020-04-09 01:05:53 +0200
commitbb9562cf5c67813034c96afb50bd21130a504441 (patch)
tree438bbc341bfc83f012c0a77517064f907ae71f54 /net/core/sock.c
parent8e368dc72e86ad1e1a612416f32d5ad22dca88bc (diff)
arm, bpf: Fix bugs with ALU64 {RSH, ARSH} BPF_K shift by 0
The current arm BPF JIT does not correctly compile RSH or ARSH when the immediate shift amount is 0. This causes the "rsh64 by 0 imm" and "arsh64 by 0 imm" BPF selftests to hang the kernel by reaching an instruction the verifier determines to be unreachable. The root cause is in how immediate right shifts are encoded on arm. For LSR and ASR (logical and arithmetic right shift), a bit-pattern of 00000 in the immediate encodes a shift amount of 32. When the BPF immediate is 0, the generated code shifts by 32 instead of the expected behavior (a no-op). This patch fixes the bugs by adding an additional check if the BPF immediate is 0. After the change, the above mentioned BPF selftests pass. Fixes: 39c13c204bb11 ("arm: eBPF JIT compiler") Co-developed-by: Xi Wang <xi.wang@gmail.com> Signed-off-by: Xi Wang <xi.wang@gmail.com> Signed-off-by: Luke Nelson <luke.r.nels@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20200408181229.10909-1-luke.r.nels@gmail.com
Diffstat (limited to 'net/core/sock.c')
0 files changed, 0 insertions, 0 deletions