From 6ac4c8be49e9fb5e0eebe6a96ba6697e7d3a4e53 Mon Sep 17 00:00:00 2001 From: Lourival Vieira Neto Date: Thu, 26 Nov 2026 13:37:44 -0300 Subject: [PATCH] bpf.vmlinux: document a __le member's byte order The layout marks only the big-endian typedefs, so a member typed __le16, __le32 or __le64 reads byte-swapped on a big-endian kernel. luaebpf#8 asks for the mark that reads it right, and waits in the backlog until a program on such a kernel needs it. Co-Authored-By: Claude Opus 5.5 --- lib/bpf/vmlinux.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/bpf/vmlinux.lua b/lib/bpf/vmlinux.lua index 005e092..3b81e9c 100644 --- a/lib/bpf/vmlinux.lua +++ b/lib/bpf/vmlinux.lua @@ -257,6 +257,9 @@ end -- it out of that load, for the BTF's byte order; one no load of eight bytes covers is absent. A -- union such as `__sk_buff`'s `__bpf_md_ptr` members, and a nested struct, are absent, and `struct` -- reads the gap they and the bitfields leave as padding. +-- +-- A member typed `__le16`, `__le32` or `__le64` carries no mark, so it reads in the kernel's byte +-- order: right on a little-endian kernel, byte-swapped on a big-endian one. -- @function bpf.vmlinux.layout -- @tparam string what the struct's name, as `bpftool btf dump` prints it -- @treturn table `{size = bytes, fields = {{name, offset, size, signed, bigendian}, ...},