From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB5E6C00A89 for ; Mon, 2 Nov 2020 10:25:57 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4C2BD2071E for ; Mon, 2 Nov 2020 10:25:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="1+GwBw9r" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C2BD2071E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=huXMauqeBgrzUPGhN+hYZzx5sKLAlAkIzZhJL4CnU2c=; b=1+GwBw9r3SdDDFs9Ir/oU5t4w H/9JfyQpxPjIrhhEXsbJAs5MFECd0m51xMB8E19ZYW18Nzh+DKNeD1Hn1xM38RbiMwUcqu4TZkliJ QYzD8pirZEAtASNSQnc0xjawE4f450lsm+ElPFB9/fSlJEe0yAgJQhGXQt1d87FN2s+Tnq2+J82zx u8vFRRAsp8/HuSuBL99rul86yVJipcluGb+ZcdNO4AAtZZjEcW/C+1mdoaYogMrKILBmXBmv6c/zQ /S6eyJa8HkA9KcE37c/ofxovF+Q+2gcD/VZhWlIlX3pQ1y8fqrGfWtu/edqqXwhdT596Pgc1ACoKb 7NhqfYSww==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZX1k-0003n5-1t; Mon, 02 Nov 2020 10:25:28 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZX1g-0003m3-3w for linux-arm-kernel@lists.infradead.org; Mon, 02 Nov 2020 10:25:25 +0000 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 A27C7101E; Mon, 2 Nov 2020 02:25:22 -0800 (PST) Received: from C02TD0UTHF1T.local (unknown [10.57.54.146]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6B71B3F719; Mon, 2 Nov 2020 02:25:21 -0800 (PST) Date: Mon, 2 Nov 2020 10:25:18 +0000 From: Mark Rutland To: Robin Murphy Subject: Re: [PATCHv3 11/17] arm64: uaccess: refactor __{get,put}_user Message-ID: <20201102102518.GB71783@C02TD0UTHF1T.local> References: <20201026133156.44186-1-mark.rutland@arm.com> <20201026133156.44186-12-mark.rutland@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201102_052524_288420_67686786 X-CRM114-Status: GOOD ( 27.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: catalin.marinas@arm.com, will@kernel.org, james.morse@arm.com, hch@lst.de, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Oct 27, 2020 at 06:03:19PM +0000, Robin Murphy wrote: > On 2020-10-26 13:31, Mark Rutland wrote: > > As a step towards implementing __{get,put}_kernel_nofault(), this patch > > splits most user-memory specific logic out of __{get,put}_user(), with > > the memory access and fault handling in new __{raw_get,put}_mem() > > helpers. > > > > For now the LDR/LDTR patching is left within the *get_mem() helpers, and > > will be removed in a subsequent patch. > > > > There should be no functional change as a result of this patch. > > > > Signed-off-by: Mark Rutland > > Cc: Catalin Marinas > > Cc: Christoph Hellwig > > Cc: James Morse > > Cc: Will Deacon > > --- > > arch/arm64/include/asm/uaccess.h | 40 +++++++++++++++++++++++++--------------- > > 1 file changed, 25 insertions(+), 15 deletions(-) > > > > diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h > > index d6a4e496ebc64..4ad2990241d78 100644 > > --- a/arch/arm64/include/asm/uaccess.h > > +++ b/arch/arm64/include/asm/uaccess.h > > @@ -253,7 +253,7 @@ static inline void __user *__uaccess_mask_ptr(const void __user *ptr) > > * The "__xxx_error" versions set the third argument to -EFAULT if an error > > * occurs, and leave it unchanged on success. > > */ > > -#define __get_user_asm(instr, alt_instr, reg, x, addr, err, feature) \ > > +#define __get_mem_asm(instr, alt_instr, reg, x, addr, err, feature) \ > > asm volatile( \ > > "1:"ALTERNATIVE(instr " " reg "1, [%2]\n", \ > > alt_instr " " reg "1, [%2]\n", feature) \ > > @@ -268,35 +268,40 @@ static inline void __user *__uaccess_mask_ptr(const void __user *ptr) > > : "+r" (err), "=&r" (x) \ > > : "r" (addr), "i" (-EFAULT)) > > -#define __raw_get_user(x, ptr, err) \ > > +#define __raw_get_mem(x, ptr, err) \ > > do { \ > > unsigned long __gu_val; \ > > __chk_user_ptr(ptr); \ > > Should this move out as well? Yes, it looks like it should! > It seems logical that wherever we figure out whether a pointer is > "kernel" or "user" in order to call the appropriate low-level routine, > the __user annotation could be dropped from the "kernel" path at that > point - or have I misunderstood? Agreed; I can't see any reason to keep this here, and it does look like it's liable to cause sparse warnings when we add the kernel accsessors. I'll shuffle this into the user wrappers. Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel