Skip to content

Commit 5dad4f4

Browse files
aspskKernel Patches Daemon
authored andcommitted
bpf: disasm: add support for BPF_JMP|BPF_JA|BPF_X
Add support for indirect jump instruction. Example output from bpftool: 0: (79) r3 = *(u64 *)(r1 +0) 1: (25) if r3 > 0x4 goto pc+666 2: (67) r3 <<= 3 3: (18) r1 = 0xffffbeefspameggs 5: (0f) r1 += r3 6: (79) r1 = *(u64 *)(r1 +0) 7: (0d) gotox r1 Signed-off-by: Anton Protopopov <[email protected]> Acked-by: Eduard Zingerman <[email protected]>
1 parent fc76c1b commit 5dad4f4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

kernel/bpf/disasm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,9 @@ void print_bpf_insn(const struct bpf_insn_cbs *cbs,
358358
} else if (insn->code == (BPF_JMP | BPF_JA)) {
359359
verbose(cbs->private_data, "(%02x) goto pc%+d\n",
360360
insn->code, insn->off);
361+
} else if (insn->code == (BPF_JMP | BPF_JA | BPF_X)) {
362+
verbose(cbs->private_data, "(%02x) gotox r%d\n",
363+
insn->code, insn->dst_reg);
361364
} else if (insn->code == (BPF_JMP | BPF_JCOND) &&
362365
insn->src_reg == BPF_MAY_GOTO) {
363366
verbose(cbs->private_data, "(%02x) may_goto pc%+d\n",

0 commit comments

Comments
 (0)