summaryrefslogtreecommitdiff
path: root/tools/lib/python
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2026-09-24 18:23:53 +0000
committerKumar Kartikeya Dwivedi <memxor@gmail.com>2026-09-25 04:43:27 +0200
commitad139384ecddb6f3e7e3c3c12765aafae0e39670 (patch)
tree39052902e3e4c10510ae1f9fd4d96d6b07b28a1e /tools/lib/python
parent5fc5768c7ca92895ccd1de94dc521e5a55ae7896 (diff)
downloadlinux-next-ad139384ecddb6f3e7e3c3c12765aafae0e39670.tar.gz
linux-next-ad139384ecddb6f3e7e3c3c12765aafae0e39670.zip
bpf: Fix overflow of jump offset in constant blinding
bpf_jit_blind_insn() rewrites 'if rX op imm goto off' into: AX = imm ^ rnd AX ^= rnd if rX op AX goto off and subtracts 2 from off when the jump is backward. off is s16, so -32767 and -32768 wrap and the jump goes 32767 insns forward, past the end of the prog. The jump is inside the patch, hence bpf_adj_branches() doesn't check it. The kernel crashes when such prog runs with bpf_jit_harden=2. Return -ERANGE in such case. bpf_jit_blind_constants() fails the same way when blinding of other insns moves a jump out of range. Fixes: 4f3446bb809f ("bpf: add generic constant blinding for use in jits") Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20260924182353.277516-1-alexei.starovoitov@gmail.com Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions