On Mon, 20 Apr 2026 18:59:39 -0700, Alexei Starovoitov wrote: > On Mon, Apr 20, 2026 at 6:43 PM Leon Hwang wrote: >> >> On Mon, 20 Apr 2026 07:58:06 -0700, "Alexei Starovoitov" wrote: >>> On Sun Apr 19, 2026 at 10:24 PM PDT, Leon Hwang wrote: >>>> >>>> int xdp_prog(struct xdp_md * ctx): >>>> ; cnt++; >>>> 0: (18) r6 = map[id:28][0]+0 >>>> 2: (bf) r6 = &(void __percpu *)(r6) >>> >>> well. that insn was inserted by the verifier and it shows up in xlated. >>> That was expected. >>> The point about 'bogus xlated' was about offset translation. >>> map_direct_value_meta() should recover proper insns[i + 1].imm = off; >>> In your example it's zero, so not an interesting test. >>> >> >> The original insns[i + 1] wasn't broken. See the key change of this >> patch. > > You're missing the point insns[i + 1].imm = off is how > off returned from map_direct_value_meta() is used in updating _this_ > ldimm64 insn. After looking into bpf_insn_prepare_dump(), agreed with "not an interesting test". Then, updated the selftest with non-zero offset. And updated disasm_helpers.c::disasm_insn() to dump such ldimm64 insn as map info by the way of bpftool/xlated_dumper.c::print_imm(). +static volatile const char fmt2[] SEC(".percpu.fmt") = "data %d\n"; + +SEC("?kprobe") +__success +__xlated("r{{[0-9]+}} = map[id:{{[0-9]+}}][0]+9") +__xlated("r{{[0-9]+}} = &(void __percpu *)(r{{[0-9]+}})") +__xlated("r{{[0-9]+}} = *(u8 *)(r{{[0-9]+}} +4)") +int verifier_percpu_read(void *ctx) +{ + char c = fmt2[4]; + + return c == ' '; +} It would verify the following xlated insns. XLATED: ============= 0: r1 = map[id:7][0]+9 2: r1 = &(void __percpu *)(r1) 3: r1 = *(u8 *)(r1 +4) 4: w0 = 1 5: if w1 == 0x20 goto pc+1 6: w0 = 0 7: exit The selftest looks better now. Thanks, Leon