OpenCloudOS-Kernel/arch/sparc/net
David S. Miller e3bf4c61da sparc64: Fix BPF JIT wrt. branches and ldimm64 instructions.
Like other JITs, sparc64 maintains an array of instruction offsets but
stores the entries off by one.  This is done because jumps to the
exit block are indexed to one past the last BPF instruction.

So if we size the array by the program length, we need to record
the previous instruction in order to stay within the array bounds.

This is explained in ARM JIT commit 8eee539dde ("arm64: bpf: fix
out-of-bounds read in bpf2a64_offset()").

But this scheme requires a little bit of careful handling when
the instruction before the branch destination is a 64-bit load
immediate.  It takes up 2 BPF instruction slots.

Therefore, we have to fill in the array entry for the second
half of the 64-bit load immediate instruction rather than for
the one for the beginning of that instruction.

Fixes: 7a12b5031c ("sparc64: Add eBPF JIT.")
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-05-01 20:48:36 -07:00
..
Makefile sparc: Split BPF JIT into 32-bit and 64-bit. 2017-04-22 12:10:52 -07:00
bpf_jit_32.h sparc64: Add eBPF JIT. 2017-04-22 12:10:52 -07:00
bpf_jit_64.h sparc64: Add eBPF JIT. 2017-04-22 12:10:52 -07:00
bpf_jit_asm_32.S sparc64: Add eBPF JIT. 2017-04-22 12:10:52 -07:00
bpf_jit_asm_64.S sparc64: Add eBPF JIT. 2017-04-22 12:10:52 -07:00
bpf_jit_comp_32.c sparc64: Add eBPF JIT. 2017-04-22 12:10:52 -07:00
bpf_jit_comp_64.c sparc64: Fix BPF JIT wrt. branches and ldimm64 instructions. 2017-05-01 20:48:36 -07:00