On Fri, 2025-05-09 at 22:10 +0200, Kumar Kartikeya Dwivedi wrote: [...] > > Arena access is translated as an instruction with three operands, e.g.: > > > > `movzx <dst>, byte ptr [<src> + r12 + <off>]` > > > > As far as I understand the code, currently `addr` takes into account > > `<src>` value, but not the `<off>` value. > > Ah, good point. We could certainly reconstruct it. > I'll look into it. > For prog authors I think giving them src + off in the output is the clearest? > IIUC that's what they'll see when they bpf_printk the pointer, too, right? Yes, the final address where access occurred. > LLVM wouldn't insert cast insns unless the pointer is being loaded from. I think so, have the following docstring in the BPFCheckAndAdjustIR.cpp: // Support for BPF address spaces: // - for each function in the module M, update pointer operand of // each memory access instruction (load/store/cmpxchg/atomicrmw) // by casting it from non-zero address space to zero address space, e.g: // // (load (ptr addrspace (N) %p) ...) // -> (load (addrspacecast ptr addrspace (N) %p to ptr))