Re: [PATCH bpf-next v4 1/6] bpf: name the enum for BPF_FUNC_skb_adjust_room flags

"Hudson, Nick" <[email protected]>
Newsgroups dev.linux.lists.sashiko,org.kernel.vger.bpf
Message-ID <[email protected]>

> On Apr 16, 2026, at 3:18 PM, Alexei Starovoitov <[email protected]> wrote:
> 
> !-------------------------------------------------------------------|
>  This Message Is From an External Sender
>  This message came from outside your organization.
> |-------------------------------------------------------------------!
> 
> On Thu Apr 16, 2026 at 3:02 AM PDT, sashiko-bot wrote:
>> Sashiko AI review found 1 potential issue(s):
>> - [Medium] The newly named `enum bpf_adj_room_flags` will not be emitted into the kernel's BTF, rendering the intended CO-RE lookups non-functional.
>> --
>> 
>> commit d9be60117de7ebbae2642c8a29e31a5aa11ff502
>> Author: Nick Hudson <[email protected]>
>> 
>> bpf: name the enum for BPF_FUNC_skb_adjust_room flags
>> 
>> This commit names the previously anonymous enum for BPF_FUNC_skb_adjust_room
>> flags to bpf_adj_room_flags. The stated goal is to enable CO-RE lookups in
>> BPF programs.
>> 
>>> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
>>> index c8d400b7680a8..bc4b25eb72ce5 100644
>>> --- a/include/uapi/linux/bpf.h
>>> +++ b/include/uapi/linux/bpf.h
>>> @@ -6209,7 +6209,7 @@ enum {
>>> };
>>> 
>>> /* BPF_FUNC_skb_adjust_room flags. */
>>> -enum {
>>> +enum bpf_adj_room_flags {
>> 
>> Since this enum is only declared in the UAPI header and never actually used as
>> a variable, parameter, or struct field type in the kernel C code, will the
>> compiler generate DWARF debug information for it?
>> 
>> If it is omitted from the DWARF info, pahole will not emit it into the
>> vmlinux BTF. This causes libbpf CO-RE checks for these values to silently
>> evaluate to false regardless of the kernel version, which seems to defeat the
>> purpose of this patch.
>> 
>> Does the kernel need to explicitly force the emission of this type into the
>> target BTF, for example by using BTF_TYPE_EMIT(enum bpf_adj_room_flags) in a
>> compiled C file?
> 
> Nick,
> 
> take bots feedback with a grain of salt.
> I suspect the bot is wrong here, but do you homework.
> 
Thanks.

I guess it depends on tools?

$ ./tools/bpf/bpftool/bpftool  btf dump file vmlinux format c | grep -A 10 'enum bpf_adj_room_flags'
enum bpf_adj_room_flags {
	BPF_F_ADJ_ROOM_FIXED_GSO = 1,
	BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 2,
	BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 4,
	BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 8,
	BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 16,
	BPF_F_ADJ_ROOM_NO_CSUM_RESET = 32,
	BPF_F_ADJ_ROOM_ENCAP_L2_ETH = 64,
	BPF_F_ADJ_ROOM_DECAP_L3_IPV4 = 128,
	BPF_F_ADJ_ROOM_DECAP_L3_IPV6 = 256,
	BPF_F_ADJ_ROOM_DECAP_L4_GRE = 512,
$
smime.p7s (application/pkcs7-signature, 3 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.