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: <CAEXW_YQLYnufG2wx9R1xkQYwkugeN=VFf9Dgkfu8WGeYVFLcgw@mail.gmail.com>
Date:   Sat, 3 Dec 2022 00:12:08 +0000
From:   Joel Fernandes <joel@...lfernandes.org>
To:     paulmck@...nel.org
Cc:     Eric Dumazet <edumazet@...gle.com>,
        "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
        eric.dumazet@...il.com, Dmitry Safonov <dima@...sta.com>
Subject: Re: [PATCH net-next] tcp: use 2-arg optimal variant of kfree_rcu()

On Sat, Dec 3, 2022 at 12:03 AM Paul E. McKenney <paulmck@...nel.org> wrote:
>
> On Fri, Dec 02, 2022 at 11:49:59PM +0000, Joel Fernandes wrote:
> > On Fri, Dec 02, 2022 at 05:28:47AM +0000, Eric Dumazet wrote:
> > > kfree_rcu(1-arg) should be avoided as much as possible,
> > > since this is only possible from sleepable contexts,
> > > and incurr extra rcu barriers.
> > >
> > > I wish the 1-arg variant of kfree_rcu() would
> > > get a distinct name, like kfree_rcu_slow()
> > > to avoid it being abused.
> >
> > Hi Eric,
> > Nice to see your patch.
> >
> > Paul, all, regarding Eric's concern, would the following work to warn of
> > users? Credit to Paul/others for discussing the idea on another thread. One
> > thing to note here is, this debugging will only be in effect on preemptible
> > kernels, but should still help catch issues hopefully.
>
> Mightn't there be some places where someone needs to invoke
> single-argument kfree_rcu() in a preemptible context, for example,
> due to the RCU-protected structure being very small and very numerous?

This could be possible but I am not able to find examples of such
cases, at the moment. Another approach could be to introduce a
dedicated API for such cases, where the warning will not fire. And
keep the warning otherwise.

Example: kfree_rcu_headless()
With a big comment saying, use only if you are calling from a
preemptible context and cannot absolutely embed an rcu_head. :-)

Thoughts?

Cheers,

 - Joel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ