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] [day] [month] [year] [list]
Date:   Fri, 22 Oct 2021 12:54:45 +0200
From:   Toke Høiland-Jørgensen <toke@...hat.com>
To:     Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Network Development <netdev@...r.kernel.org>,
        bpf <bpf@...r.kernel.org>,
        Lorenzo Bianconi <lorenzo.bianconi@...hat.com>
Subject: Re: [PATCH bpf] bpf: fix potential race in tail call compatibility
 check

Alexei Starovoitov <alexei.starovoitov@...il.com> writes:

> On Thu, Oct 21, 2021 at 11:40 AM Toke Høiland-Jørgensen <toke@...hat.com> wrote:
>> +       map_type = READ_ONCE(array->aux->type);
>> +       if (!map_type) {
>> +               /* There's no owner yet where we could check for compatibility.
>> +                * Do an atomic swap to prevent racing with another invocation
>> +                * of this branch (via simultaneous map_update syscalls).
>>                  */
>> -               array->aux->type  = fp->type;
>> -               array->aux->jited = fp->jited;
>> +               if (cmpxchg(&array->aux->type, 0, prog_type))
>> +                       return false;
>
> Other fields might be used in the compatibility check in the future.
> This hack is too fragile.
> Just use a spin_lock.

Well, yeah, we're adding another field for xdp_mb. I was just going to
eat more bits of the 'type' field, but OK, can switch to a spinlock
instead :)

-Toke

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ