Skip to content

Commit 433956e

Browse files
Alexei Starovoitovborkmann
authored andcommitted
bpf: Fix extable fixup offset.
The prog - start_of_ldx is the offset before the faulting ldx to the location after it, so this will be used to adjust pt_regs->ip for jumping over it and continuing, and with old temp it would have been fixed up to the wrong offset, causing crash. Fixes: 4c5de12 ("bpf: Emit explicit NULL pointer checks for PROBE_LDX instructions.") Signed-off-by: Alexei Starovoitov <[email protected]> Reviewed-by: Daniel Borkmann <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
1 parent b1a7288 commit 433956e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/net/bpf_jit_comp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,7 @@ st: if (is_imm8(insn->off))
13051305
* End result: x86 insn "mov rbx, qword ptr [rax+0x14]"
13061306
* of 4 bytes will be ignored and rbx will be zero inited.
13071307
*/
1308-
ex->fixup = (prog - temp) | (reg2pt_regs[dst_reg] << 8);
1308+
ex->fixup = (prog - start_of_ldx) | (reg2pt_regs[dst_reg] << 8);
13091309
}
13101310
break;
13111311

0 commit comments

Comments
 (0)