Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp1289245rdb; Mon, 21 Aug 2023 03:24:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFTSDIA4JFZr+D6e3WMZ1qsLFDYGSUNyx4HEivZjDzHB5kr8QJfpqc/GaiYYmLobtJyJtlk X-Received: by 2002:a17:902:d38c:b0:1b5:1787:d23f with SMTP id e12-20020a170902d38c00b001b51787d23fmr3838578pld.5.1692613462750; Mon, 21 Aug 2023 03:24:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692613462; cv=none; d=google.com; s=arc-20160816; b=vmtPA4qoT3Rch1B7dsPpAzPAx5w7CfHJHNcsJrBXllmOGxKpAt0goJNuuy4DqOWNLZ vhhLW2//zZPrKgYBSPTJrx62ZSvsIOOZS00/dkinrg7i9DrS1urzr9K0lsNxwrC6ub/a Fq+NXhs4EJNXYpKFUjsPFL5ZApneKwUIGaomh/77GW3IqwSkaJO6RdHSUOvQJBaAVwr5 oZVpPLsxvz58t3cvI5LkrXli0b6JKe/IRk/wVBCiXqpnw1IexqllSO38AHNoF1LIZfhy xHycloV3cMxzsYSzWMsD7sb9qSt4Vrhdg9AvKushHEUfLTS8PEwOTjuq2Aj0d4U7fUN9 kodQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=Q50u/JvbFoOd1i46Ddyur+KHtVOA8PVwptFH2jisNqo=; fh=TJVuNb2UkCYpLcGgmlU8+8uuusl2RkdBES4daGhXbFg=; b=PEx/1p8PdWnXllpEhn52kSnn0yoaWoV1uktBFi2o+Mx2XSfOfpVFkJKrLn/HNoxBHu N2mytZgL1h8+QRDAluVSglilA/s2/jFmQ8dULNKZ2/foem6slBZuUyAYGlt40580sh8l zIBvDNgm30kBzgu2wnx3dpwCvVRwgf3NEAOsEUhnC/z+aSCevhtNYCISoHesPBf1oqYf i0hadmTg0YXyc+jI0apDiC2O/952PN5ITVBr1yQjNe0TJARliEmZmoBKLy4JkhDPQUTw kCILovlT1LOLuHLmAcIQqpg/8CFux+dDuMdOvWetU65zRt1OoZN6hQWx4p6ws7bvQhPr 0T9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e12-20020a170902e0cc00b001bbbd9cd44bsi6712357pla.79.2023.08.21.03.23.58; Mon, 21 Aug 2023 03:24:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234598AbjHUKSe convert rfc822-to-8bit (ORCPT + 99 others); Mon, 21 Aug 2023 06:18:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231183AbjHUKSe (ORCPT ); Mon, 21 Aug 2023 06:18:34 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AF90C2 for ; Mon, 21 Aug 2023 03:18:32 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-309-wqiF68MgN6SF-J6xIfBlHw-1; Mon, 21 Aug 2023 11:18:26 +0100 X-MC-Unique: wqiF68MgN6SF-J6xIfBlHw-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Mon, 21 Aug 2023 11:18:14 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Mon, 21 Aug 2023 11:18:14 +0100 From: David Laight To: 'Kees Cook' , Jeff Layton CC: Andrew Morton , Jann Horn , "linux-hardening@vger.kernel.org" , "Elena Reshetova" , David Windsor , Hans Liljestrand , Trond Myklebust , Anna Schumaker , "Chuck Lever" , Neil Brown , Olga Kornievskaia , Dai Ngo , Tom Talpey , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Sergey Senozhatsky , "Alexey Gladkov" , "Eric W. Biederman" , "Yu Zhao" , "linux-kernel@vger.kernel.org" , "linux-nfs@vger.kernel.org" , "netdev@vger.kernel.org" Subject: RE: [PATCH v2] creds: Convert cred.usage to refcount_t Thread-Topic: [PATCH v2] creds: Convert cred.usage to refcount_t Thread-Index: AQHZ0hIjCu0dtWFxxUKez0i3A14O7q/0jIjg Date: Mon, 21 Aug 2023 10:18:13 +0000 Message-ID: References: <20230818041740.gonna.513-kees@kernel.org> <20230818105542.a6b7c41c47d4c6b9ff2e8839@linux-foundation.org> <202308181146.465B4F85@keescook> <20230818123148.801b446cfdbd932787d47612@linux-foundation.org> <202308181317.66E6C9A5@keescook> In-Reply-To: <202308181317.66E6C9A5@keescook> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,PDS_BAD_THREAD_QP_64, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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)