Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp4029508ybg; Sun, 7 Jun 2020 19:07:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNSq5DZvH9L+97sOK0wH5DSYz6sgsr1f1DgrQ2Ub59jrKA9bHd1DGzHBv8nIpx/3GtpLbB X-Received: by 2002:a17:906:51d1:: with SMTP id v17mr8134259ejk.383.1591582057057; Sun, 07 Jun 2020 19:07:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591582057; cv=none; d=google.com; s=arc-20160816; b=cFsQr+YbFS69Seai+sGRVKLHs3h3WXrQdzDKncVnVnj8bO+bUI51lSfJje7BLzvBqv /Zkk60oeo7H3FFEIExeT6fu1Aj+ztgr3at166r+4KKGEBIdplMKKWoRI6g5cIWQiCQLQ 9TRbaNXMm/Uxs19z89M4S4OGwasNFxU11vV4LoSbArjaNIMCeHy8NiV9NZbhTY6NEoUh TtKZ1xWZAe6exX46wtjV/RiH/647yjSxN+88DWYHPJUfN3vAZndc92RC5qcst37tJ9yf OYLOtMAF9F5xwXstvuR4PfBoBgvY8L23GgZMEQ6hmVOzGNvKjPrMH2Yn6S/Xo0Y2J1Vu 33sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=RjpeQKOPf9O1Pr81RP4fr1DP5kDr0epGt31p0OZMzT4=; b=i9lHh0rCgRn54Jc31bm64KWOR1M9lGSmpHF9FUkySKC+1pTUg10SsGs7OMDmutB5Zo UYXjbBck3qDJX/g8kjQr/AjAV5dztorIhsVhPfwybLAp95m5TDN2lGlLlWsrmyCzokcY JKby4JbCTFk1ux+gaAdqkikq25g9K24nTszTatR60JUuykdwi2q7kWW7sxrr/wC/9n15 fLehy57wzoFtcYnuR7CJDu3+kEap1WrBTKsBMg6/pArT8BuJ+ndbx20SU36FWIGW2rRM RHWiPECMrETi1eldiesAO50KJlxHggJ43pn/HgGrr1cTD7DhkcM5DexZ/VN5vFgNV5iC +FIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p13si7694829eji.495.2020.06.07.19.07.14; Sun, 07 Jun 2020 19:07:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728502AbgFHCF0 (ORCPT + 99 others); Sun, 7 Jun 2020 22:05:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726662AbgFHCF0 (ORCPT ); Sun, 7 Jun 2020 22:05:26 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A9C2C08C5C3; Sun, 7 Jun 2020 19:05:26 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.93 #3 (Red Hat Linux)) id 1ji7AA-004wgp-2Q; Mon, 08 Jun 2020 02:05:22 +0000 Date: Mon, 8 Jun 2020 03:05:22 +0100 From: Al Viro To: Linus Torvalds Cc: Rasmus Villemoes , linux-fsdevel , Linux Kernel Mailing List Subject: Re: [PATCH resend] fs/namei.c: micro-optimize acl_permission_check Message-ID: <20200608020522.GN23230@ZenIV.linux.org.uk> References: <20200605142300.14591-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 07, 2020 at 12:48:53PM -0700, Linus Torvalds wrote: > Rasmus, say the word and I'll mark you for authorship on the first one. > > Comments? Can you find something else wrong here, or some other fixup to do? > > Al, any reaction? It's correct, but this > + if (mask & (mode ^ (mode >> 3))) { > + if (in_group_p(inode->i_gid)) > + mode >>= 3; > + } > + > + /* Bits in 'mode' clear that we require? */ > + return (mask & ~mode) ? -EACCES : 0; might be easier to follow if we had, from the very beginning done unsigned int deny = ~inode->i_mode; and turned that into // for group the bits 3..5 apply, for others - 0..2 // we only care which to use when they do not // agree anyway. if (mask & (deny ^ (deny >> 3))) // mask & deny != mask & (deny >> 3) if (in_... deny >>= 3; return mask & deny ? -EACCES : 0; Hell knows...