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: <CANn89i+eZ0OZCxP=s4BsY5qoPcwg-zZ1vYqGQvPaOs8OCG8Nzw@mail.gmail.com>
Date:   Tue, 8 Nov 2022 17:45:06 -0800
From:   Eric Dumazet <edumazet@...gle.com>
To:     Jakub Kicinski <kuba@...nel.org>
Cc:     "David S . Miller" <davem@...emloft.net>,
        Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
        eric.dumazet@...il.com, syzbot <syzkaller@...glegroups.com>,
        Wang Yufen <wangyufen@...wei.com>
Subject: Re: [PATCH net] net: tun: call napi_schedule_prep() to ensure we own
 a napi

On Tue, Nov 8, 2022 at 5:41 PM Jakub Kicinski <kuba@...nel.org> wrote:
>
> On Mon,  7 Nov 2022 18:00:11 +0000 Eric Dumazet wrote:
> >               if (unlikely(headlen > skb_headlen(skb))) {
> > +                     WARN_ON_ONCE(1);
> > +                     err = -ENOMEM;
> >                       dev_core_stats_rx_dropped_inc(tun->dev);
> > +napi_busy:
> >                       napi_free_frags(&tfile->napi);
> >                       rcu_read_unlock();
> >                       mutex_unlock(&tfile->napi_mutex);
> > -                     WARN_ON(1);
> > -                     return -ENOMEM;
> > +                     return err;
> >               }
> >
> > -             local_bh_disable();
> > -             napi_gro_frags(&tfile->napi);
> > -             napi_complete(&tfile->napi);
> > -             local_bh_enable();
> > +             if (likely(napi_schedule_prep(&tfile->napi))) {
> > +                     local_bh_disable();
> > +                     napi_gro_frags(&tfile->napi);
> > +                     napi_complete(&tfile->napi);
> > +                     local_bh_enable();
> > +             } else {
> > +                     err = -EBUSY;
> > +                     goto napi_busy;
>
> This can only hit if someone else is trying to detach / napi_disable()
> at the same time?

I think this can happen if /sys/class/net/${dev}/gro_flush_timeout is used.

napi_watchdog() might grab NAPI_STATE_SCHED

Since this is mostly used by validation tools, I think it is better to
let the tool retry,
rather than trying to spin to acquire NAPI_STATE_SCHED.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ