]> git.baikalelectronics.ru Git - kernel.git/commit
bpf, riscv: Fix tail call count off by one in RV32 BPF JIT
authorLuke Nelson <lukenels@cs.washington.edu>
Tue, 21 Apr 2020 00:28:04 +0000 (17:28 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 26 Apr 2020 15:40:01 +0000 (08:40 -0700)
commit9d7076dd3c4ebf6a8e5a1cf551f610ad32aa5690
tree7317971ec5e492834da0e4e0b0abd564995f32f8
parent678dc255c714d43af67ee75681e95f97571451c6
bpf, riscv: Fix tail call count off by one in RV32 BPF JIT

This patch fixes an off by one error in the RV32 JIT handling for BPF
tail call. Currently, the code decrements TCC before checking if it
is less than zero. This limits the maximum number of tail calls to 32
instead of 33 as in other JITs. The fix is to instead check the old
value of TCC before decrementing.

Fixes: 79893c6b8e8c ("riscv, bpf: Add RV32G eBPF JIT")
Signed-off-by: Luke Nelson <luke.r.nels@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Xi Wang <xi.wang@gmail.com>
Link: https://lore.kernel.org/bpf/20200421002804.5118-1-luke.r.nels@gmail.com
arch/riscv/net/bpf_jit_comp32.c