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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <24956178-c806-4bf1-8442-73ceda725b8c@linux.dev>
Date: Wed, 5 Nov 2025 18:17:44 -0800
From: Martin KaFai Lau <martin.lau@...ux.dev>
To: Amery Hung <ameryhung@...il.com>
Cc: netdev@...r.kernel.org, alexei.starovoitov@...il.com, andrii@...nel.org,
 daniel@...earbox.net, tj@...nel.org, martin.lau@...nel.org,
 kernel-team@...a.com, bpf@...r.kernel.org
Subject: Re: [PATCH bpf-next v5 2/7] bpf: Support associating BPF program with
 struct_ops



On 11/5/25 5:01 PM, Amery Hung wrote:
> On Wed, Nov 5, 2025 at 4:57 PM Martin KaFai Lau <martin.lau@...ux.dev> wrote:
>>
>>
>>
>> On 11/4/25 9:26 AM, Amery Hung wrote:
>>> +void *bpf_prog_get_assoc_struct_ops(const struct bpf_prog_aux *aux)
>>> +{
>>> +     struct bpf_map *st_ops_assoc = READ_ONCE(aux->st_ops_assoc);
>>> +     struct bpf_struct_ops_map *st_map;
>>> +
>>> +     if (!st_ops_assoc || st_ops_assoc == BPF_PTR_POISON)
>>> +             return NULL;
>>> +
>>> +     st_map = (struct bpf_struct_ops_map *)st_ops_assoc;
>>> +
>>> +     if (smp_load_acquire(&st_map->kvalue.common.state) == BPF_STRUCT_OPS_STATE_INIT) {
>>> +             bpf_map_put(st_ops_assoc);
>>
>> hmm... why bpf_map_put is needed?
>>
> 
> AI also caught this. This is not needed. I overlooked it when changing
> from v4, where bpf_prog_get_assoc_struct_ops() used to first bump the
> refcount.

ah. My bad for the noise. Fixed my mail client. Somehow only that one 
email got filtered.

> 
>> Should the state be checked only once during assoc time instead of
>> checking it every time bpf_prog_get_assoc_struct_ops is called?
>>
>>> +             return NULL;
>>> +     }
>>> +
>>> +     return &st_map->kvalue.data;
>>> +}
>>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ