lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87jz4tnf2y.fsf@cloudflare.com>
Date: Mon, 30 Jun 2025 22:34:45 +0200
From: Jakub Sitnicki <jakub@...udflare.com>
To: Stanislav Fomichev <stfomichev@...il.com>
Cc: bpf@...r.kernel.org,  Alexei Starovoitov <ast@...nel.org>,  Arthur Fabre
 <arthur@...hurfabre.com>,  Eric Dumazet <edumazet@...gle.com>,  Jakub
 Kicinski <kuba@...nel.org>,  Jesper Dangaard Brouer <hawk@...nel.org>,
  Jesse Brandeburg <jbrandeburg@...udflare.com>,  Joanne Koong
 <joannelkoong@...il.com>,  Lorenzo Bianconi <lorenzo@...nel.org>,  Toke
 Høiland-Jørgensen <thoiland@...hat.com>,  Yan Zhai
 <yan@...udflare.com>,
  netdev@...r.kernel.org,  kernel-team@...udflare.com,  Stanislav Fomichev
 <sdf@...ichev.me>
Subject: Re: [PATCH bpf-next 03/13] bpf: Add new variant of skb dynptr for
 the metadata area

On Mon, Jun 30, 2025 at 09:27 AM -07, Stanislav Fomichev wrote:
> On 06/30, Jakub Sitnicki wrote:
>> Add a new flag for the bpf_dynptr_from_skb helper to let users to create
>> dynptrs to skb metadata area. Access paths are stubbed out. Implemented by
>> the following changes.
>> 
>> Signed-off-by: Jakub Sitnicki <jakub@...udflare.com>
>> ---
>>  include/uapi/linux/bpf.h |  9 ++++++++
>>  net/core/filter.c        | 60 +++++++++++++++++++++++++++++++++++++++++-------
>>  2 files changed, 61 insertions(+), 8 deletions(-)
>> 
>> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
>> index 719ba230032f..ab5730d2fb29 100644
>> --- a/include/uapi/linux/bpf.h
>> +++ b/include/uapi/linux/bpf.h
>> @@ -7591,4 +7591,13 @@ enum bpf_kfunc_flags {
>>  	BPF_F_PAD_ZEROS = (1ULL << 0),
>>  };
>>  
>> +/**
>> + * enum bpf_dynptr_from_skb_flags - Flags for bpf_dynptr_from_skb()
>> + *
>> + * @BPF_DYNPTR_F_SKB_METADATA: Create dynptr to the SKB metadata area
>> + */
>> +enum bpf_dynptr_from_skb_flags {
>> +	BPF_DYNPTR_F_SKB_METADATA = (1ULL << 0),
>> +};
>> +
>>  #endif /* _UAPI__LINUX_BPF_H__ */
>> diff --git a/net/core/filter.c b/net/core/filter.c
>> index 1fee51b72220..3c2948517838 100644
>> --- a/net/core/filter.c
>> +++ b/net/core/filter.c
>> @@ -11967,12 +11967,27 @@ bpf_sk_base_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
>>  	return func;
>>  }
>>  
>> +enum skb_dynptr_offset {
>> +	SKB_DYNPTR_METADATA	= -1,
>
> nit: any reason not do make it 1? The offset is u32, so that -1 reads a bit
> intentional and I don't get the intention :-)

Since we're abusing the "offset" field to serve as an enum tag, I
figured seeing 0xffffffff in a memory dump will be an clear indication
that this is not an offset.

Also, metadata comes before payload, like -1 does before 0...

JK of course. No preference here. Went with my gut.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ