Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp86539pxb; Tue, 15 Feb 2022 06:08:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHkap//FiD6Au36jAchefyT2mkzsOwToU0ePLynIQe6OCKqjL46HhnObSwmn+WRaRd61K5 X-Received: by 2002:a63:6a46:: with SMTP id f67mr3587476pgc.541.1644934102761; Tue, 15 Feb 2022 06:08:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644934102; cv=none; d=google.com; s=arc-20160816; b=rSlszO0HPx+Srkd7hyTTY46M/8Iiopt3Fnq2Y6M5kL+0I3O7++myZVpeQFhWFnGdXr rNSF05/utgIlc6sQmonXISluvFFfNd4jDsv4qbJ7yv926oJ2J7V09peeIQyIyluDPSls wWg8kT8XFSf3IQOKAaiH8dj/ed204ntoiOfTI/XoJ6+zmkQgT73GgNxlX7iCjjy6g9ZD VG2VOK7ZkounzESOTZQgtdsE3EitPvMm0Q/mC+A02oQ4bmYh7dQw0AnhXya8FiIPGGSN xOyZbxWEmAkO4Ab5UBBD8HUDwEDSE5NRrmWwIAxVTliL+hEKbti3nn5EJZ/HJmJdIkh/ DLYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=QGD6u7ipw1XVlUuJPdqPlmRc3UdQses8qtI4458fjxI=; b=XM2QnLErxmSA+6a8PFeh/y3QVOupx1+Ofkle0vvkjsgAwWooZdtIrM0RCYmLrF0Btb 5A6L7dOyLAeO/QjkZBvH35bqygaLiQaSUZ10VRwmf9ZPiIB1I7GJ3pQa7chg3LJF+Ak0 8TDaxbU2NdcEGj6+1p1Pa8P4d2RcePMbT8PqQCUa2Yli5gXfnOPeUusKvZ8GE1pD3Lhn UTXYb5fuLb8bltlTb907frcZt2lmx32ELPoRm+qrqTeba59HsqTOBBWAfcCXBSc+4iAm JABewJ0z/c6uGRwEpVFZnI+GijuXWS/AesGIi+1QCvnSRTQ2Eep321Fsw41f3nq4gAAj m3ag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j191si2763760pgd.776.2022.02.15.06.08.06; Tue, 15 Feb 2022 06:08:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236604AbiBOKj3 (ORCPT + 99 others); Tue, 15 Feb 2022 05:39:29 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234419AbiBOKj1 (ORCPT ); Tue, 15 Feb 2022 05:39:27 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 85EBC8AE4A; Tue, 15 Feb 2022 02:39:17 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 31E1E13D5; Tue, 15 Feb 2022 02:39:17 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.89.144]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4B7AE3F66F; Tue, 15 Feb 2022 02:39:10 -0800 (PST) Date: Tue, 15 Feb 2022 10:39:06 +0000 From: Mark Rutland To: Arnd Bergmann Cc: Ard Biesheuvel , Linus Torvalds , Christoph Hellwig , linux-arch , Linux Memory Management List , Linux API , Arnd Bergmann , Linux Kernel Mailing List , Russell King , Will Deacon , Guo Ren , Brian Cain , Geert Uytterhoeven , Michal Simek , Thomas Bogendoerfer , Nick Hu , Greentime Hu , Dinh Nguyen , Stafford Horne , Helge Deller , Michael Ellerman , Peter Zijlstra , Ingo Molnar , Heiko Carstens , Rich Felker , "David S. Miller" , Richard Weinberger , X86 ML , Max Filippov , "Eric W. Biederman" , Andrew Morton , alpha , "open list:SYNOPSYS ARC ARCHITECTURE" , Linux ARM , linux-csky@vger.kernel.org, "open list:QUALCOMM HEXAGON..." , linux-ia64@vger.kernel.org, linux-m68k , "open list:MIPS" , Openrisc , "open list:PARISC ARCHITECTURE" , "open list:LINUX FOR POWERPC (32-BIT AND 64-BIT)" , linux-riscv , "open list:S390" , Linux-sh list , "open list:SPARC + UltraSPARC (sparc/sparc64)" , linux-um , "open list:TENSILICA XTENSA PORT (xtensa)" , Robin Murphy Subject: Re: [PATCH 08/14] arm64: simplify access_ok() Message-ID: References: <20220214163452.1568807-1-arnd@kernel.org> <20220214163452.1568807-9-arnd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-kernel@vger.kernel.org On Tue, Feb 15, 2022 at 10:39:46AM +0100, Arnd Bergmann wrote: > On Tue, Feb 15, 2022 at 10:21 AM Ard Biesheuvel wrote: > > On Tue, 15 Feb 2022 at 10:13, Arnd Bergmann wrote: > > > > arm64 also has this leading up to the range check, and I think we'd no > > longer need it: > > > > if (IS_ENABLED(CONFIG_ARM64_TAGGED_ADDR_ABI) && > > (current->flags & PF_KTHREAD || test_thread_flag(TIF_TAGGED_ADDR))) > > addr = untagged_addr(addr); > > I suspect the expensive part here is checking the two flags, as untagged_addr() > seems to always just add a sbfx instruction. Would this work? > > #ifdef CONFIG_ARM64_TAGGED_ADDR_ABI > #define access_ok(ptr, size) __access_ok(untagged_addr(ptr), (size)) > #else // the else path is the default, this can be left out. > #define access_ok(ptr, size) __access_ok((ptr), (size)) > #endif This would be an ABI change, e.g. for tasks without TIF_TAGGED_ADDR. I don't think we should change this as part of this series. Thanks, Mark.