[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d2bb7f4a8b214e1f8d50176e6d94b118@AcuMS.aculab.com>
Date: Mon, 21 Aug 2023 10:18:13 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Kees Cook' <keescook@...omium.org>,
Jeff Layton <jlayton@...nel.org>
CC: Andrew Morton <akpm@...ux-foundation.org>,
Jann Horn <jannh@...gle.com>,
"linux-hardening@...r.kernel.org" <linux-hardening@...r.kernel.org>,
"Elena Reshetova" <elena.reshetova@...el.com>,
David Windsor <dwindsor@...il.com>,
Hans Liljestrand <ishkamiel@...il.com>,
Trond Myklebust <trond.myklebust@...merspace.com>,
Anna Schumaker <anna@...nel.org>,
"Chuck Lever" <chuck.lever@...cle.com>, Neil Brown <neilb@...e.de>,
Olga Kornievskaia <kolga@...app.com>,
Dai Ngo <Dai.Ngo@...cle.com>, Tom Talpey <tom@...pey.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
"Alexey Gladkov" <legion@...nel.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
"Yu Zhao" <yuzhao@...gle.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-nfs@...r.kernel.org" <linux-nfs@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH v2] creds: Convert cred.usage to refcount_t
From: Kees Cook
> Sent: Friday, August 18, 2023 9:25 PM
>
> On Fri, Aug 18, 2023 at 04:10:49PM -0400, Jeff Layton wrote:
> > [...]
> > extra checks (supposedly) compile down to nothing. It should be possible
> > to build alternate refcount_t handling functions that are just wrappers
> > around atomic_t with no extra checks, for folks who want to really run
> > "fast and loose".
>
> No -- there's no benefit for this. We already did all this work years
> ago with the fast vs full break-down. All that got tossed out since it
> didn't matter. We did all the performance benchmarking and there was no
> meaningful difference -- refcount _is_ atomic with an added check that
> is branch-predicted away.
Hmmm IIRC recent Intel x86 cpu never do static branch prediction.
So you can't avoid mis-predicted branches in cold code.
David
> Peter Zijlstra and Will Deacon spent a lot of
> time making it run smoothly. :)
>
> -Kees
>
> --
> Kees Cook
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists