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]
Message-ID: <871q5nwlck.fsf@cloudflare.com>
Date: Mon, 27 May 2024 13:22:19 +0200
From: Jakub Sitnicki <jakub@...udflare.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: John Fastabend <john.fastabend@...il.com>,  Daniel Borkmann
 <daniel@...earbox.net>,  Hillf Danton <hdanton@...a.com>,  Tetsuo Handa
 <penguin-kernel@...ove.sakura.ne.jp>,  Eric Dumazet <edumazet@...gle.com>,
  Linus Torvalds <torvalds@...ux-foundation.org>,  bpf
 <bpf@...r.kernel.org>,  LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] bpf, sockmap: defer sk_psock_free_link() using RCU

On Fri, May 24, 2024 at 03:06 PM +02, Jakub Sitnicki wrote:
> On Wed, May 22, 2024 at 07:57 AM -07, Alexei Starovoitov wrote:
>> On Wed, May 22, 2024 at 5:12 AM Jakub Sitnicki <jakub@...udflarecom> wrote:
>>>
>>> On Wed, May 22, 2024 at 07:33 PM +08, Hillf Danton wrote:
>>> > On Wed, 22 May 2024 11:50:49 +0200 Jakub Sitnicki <jakub@...udflare.com>
>>> > On Wed, May 22, 2024 at 06:59 AM +08, Hillf Danton wrote:
>>> >> > On Tue, 21 May 2024 08:38:52 -0700 Alexei Starovoitov <alexei.starovoitov@...il.com>
>>> >> >> On Sun, May 12, 2024 at 12:22=E2=80=AFAM Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp> wrote:
>>> >> >> > --- a/net/core/sock_map.c
>>> >> >> > +++ b/net/core/sock_map.c
>>> >> >> > @@ -142,6 +142,7 @@ static void sock_map_del_link(struct sock *sk,
>>> >> >> >         bool strp_stop =3D false, verdict_stop =3D false;
>>> >> >> >         struct sk_psock_link *link, *tmp;
>>> >> >> >
>>> >> >> > +       rcu_read_lock();
>>> >> >> >         spin_lock_bh(&psock->link_lock);
>>> >> >>
>>> >> >> I think this is incorrect.
>>> >> >> spin_lock_bh may sleep in RT and it won't be safe to do in rcu cs.
>>> >> >
>>> >> > Could you specify why it won't be safe in rcu cs if you are right?
>>> >> > What does rcu look like in RT if not nothing?
>>> >>
>>> >> RCU readers can't block, while spinlock RT doesn't disable preemption.
>>> >>
>>> >> https://docs.kernel.org/RCU/rcu.html
>>> >> https://docs.kernel.org/locking/locktypes.html#spinlock-t-and-preempt-rt
>>> >>
>>> >> I've finally gotten around to testing proposed fix that just disallows
>>> >> map_delete_elem on sockmap/sockhash from BPF tracing progs
>>> >> completely. This should put an end to this saga of syzkaller reports.
>>> >>
>>> >> https://lore.kernel.org/all/87jzjnxaqf.fsf@cloudflare.com/
>>
>> Agree. Let's do that. According to John the delete path is not something
>> that is used in production. It's only a source of trouble with syzbot.
>
> Cool. The proposed API rule would be that if a BPF program type is
> allowed to update a sockmap/sockhash, then it is also allowed to delete
> from it.
>
> So I need to tweak my patch to allow deletes from sock_ops progs.
> We have a dedicated bpf_sock_map_update() helper there.
>
> [...]

Posted:

https://lore.kernel.org/r/20240527-sockmap-verify-deletes-v1-0-944b372f2101@cloudflare.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ