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]
Date:   Tue, 30 Mar 2021 16:40:57 +0200
From:   Eric Dumazet <edumazet@...gle.com>
To:     Paolo Abeni <pabeni@...hat.com>
Cc:     netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH net] net: let skb_orphan_partial wake-up waiters.

On Tue, Mar 30, 2021 at 4:39 PM Eric Dumazet <edumazet@...gle.com> wrote:
>
> On Tue, Mar 30, 2021 at 4:25 PM Paolo Abeni <pabeni@...hat.com> wrote:
> >
> > Currently the mentioned helper can end-up freeing the socket wmem
> > without waking-up any processes waiting for more write memory.
> >
> > If the partially orphaned skb is attached to an UDP (or raw) socket,
> > the lack of wake-up can hang the user-space.
> >
> > Address the issue invoking the write_space callback after
> > releasing the memory, if the old skb destructor requires that.
> >
> > Fixes: f6ba8d33cfbb ("netem: fix skb_orphan_partial()")
> > Signed-off-by: Paolo Abeni <pabeni@...hat.com>
> > ---
> >  net/core/sock.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/net/core/sock.c b/net/core/sock.c
> > index 0ed98f20448a2..7a38332d748e7 100644
> > --- a/net/core/sock.c
> > +++ b/net/core/sock.c
> > @@ -2137,6 +2137,8 @@ void skb_orphan_partial(struct sk_buff *skb)
> >
> >                 if (refcount_inc_not_zero(&sk->sk_refcnt)) {
> >                         WARN_ON(refcount_sub_and_test(skb->truesize, &sk->sk_wmem_alloc));
> > +                       if (skb->destructor == sock_wfree)
> > +                               sk->sk_write_space(sk);
>
> Interesting.
>
> Why TCP is not a problem here ?
>
> I would rather replace WARN_ON(refcount_sub_and_test(skb->truesize,
> &sk->sk_wmem_alloc)) by :
>                         skb_orphan(skb);

And of course re-add
                        skb->sk = sk;

>
> This will get rid of this suspect WARN_ON() at the same time ?
>
> >                         skb->destructor = sock_efree;
> >                 }
> >         } else {
> > --
> > 2.26.2
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ