Skip to content

Remove explicit BPF_CORE_READ#2

Merged
DispatchCode merged 2 commits intoDispatchCode:mainfrom
work-robot:main
Feb 13, 2026
Merged

Remove explicit BPF_CORE_READ#2
DispatchCode merged 2 commits intoDispatchCode:mainfrom
work-robot:main

Conversation

@work-robot
Copy link
Contributor

@work-robot work-robot commented Feb 11, 2026

With a new enough llvm-objdump, we can see the implicitly-generated CO-RE relocations, e.g.:

      74:       if r0 == 0x0 goto +0x28 <LBB0_4>
      75:       r1 = *(u64 *)(r0 + 0x80)
                0000000000000258:  CO-RE <byte_off> [311] struct pt_regs::ip (0:16)
      76:       *(u64 *)(r7 + 0x38) = r1
      77:       r1 = *(u64 *)(r0 + 0x98)
                0000000000000268:  CO-RE <byte_off> [311] struct pt_regs::sp (0:19)
      78:       *(u64 *)(r7 + 0x40) = r1
      79:       r1 = *(u64 *)(r0 + 0x50)
                0000000000000278:  CO-RE <byte_off> [311] struct pt_regs::ax (0:10)
      80:       *(u64 *)(r7 + 0x48) = r1
      81:       r1 = *(u64 *)(r0 + 0x28)
                0000000000000288:  CO-RE <byte_off> [311] struct pt_regs::bx (0:5)
      82:       *(u64 *)(r7 + 0x50) = r1
      83:       r1 = *(u64 *)(r0 + 0x58)
                0000000000000298:  CO-RE <byte_off> [311] struct pt_regs::cx (0:11)
      84:       *(u64 *)(r7 + 0x58) = r1
      85:       r1 = *(u64 *)(r0 + 0x60)
                00000000000002a8:  CO-RE <byte_off> [311] struct pt_regs::dx (0:12)
      86:       *(u64 *)(r7 + 0x60) = r1
      87:       r1 = *(u64 *)(r0 + 0x68)
                00000000000002b8:  CO-RE <byte_off> [311] struct pt_regs::si (0:13)
      88:       *(u64 *)(r7 + 0x68) = r1
      89:       r1 = *(u64 *)(r0 + 0x70)
                00000000000002c8:  CO-RE <byte_off> [311] struct pt_regs::di (0:14)
      90:       *(u64 *)(r7 + 0x70) = r1
      91:       r1 = *(u64 *)(r0 + 0x20)

(struct pt_regs comes from vmlinux.h which has all structs with an implicit preserve_index_access)

CO-RE should already be implicit via struct-level attribute from
vmlinux.h
@DispatchCode
Copy link
Owner

Sounds good thanks.

@DispatchCode DispatchCode merged commit 3394480 into DispatchCode:main Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants