Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp354633ybg; Fri, 12 Jun 2020 03:23:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdd7NtS7SuMN9H8CxH2V7DspTtTlKZIacq2GYTRtLThv+nD5Qf7RJA7oH11ee2TbMVPx4X X-Received: by 2002:a05:6402:144c:: with SMTP id d12mr11203559edx.386.1591957395809; Fri, 12 Jun 2020 03:23:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591957395; cv=none; d=google.com; s=arc-20160816; b=BVfB0M+UyuG+aE1CE7PRzF8JibAgfl55EsT9MrqB33cvpaxIJfUq5KGdOMpXocbLd/ Jf5uY1xbNAGuph4rg/GvdJ76FHDFCzX+7UF7wIVO4uQEFk4O3/CqvDgQ5hrA7M224Kuh t5NQfv0RO19febSD3CEPLGTL4qg7t5U90GJ42LH6lCx70kDREm+2Cz1tEd81LTZd4oHP +habrpPKgKnBwQPTh85Dol3qdWao5z3HGZyrzwhaemaqZf5UgDQP4adD8Y9PKWG6KSGL F2gMf8gAmk+PPEr/ncvhX759eeSjyv4RGGAAjIEI8/47XoIWNfskiE60L8mvgXI0bZ/L 96lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=iOkJqi7aCMYM9LukTx1mTmPwI0a9w/kRf9osBcBZvIc=; b=rIJPwQfokD1vHxJkBr9dRI0G22MMu3NrXqXuinbRj7T1exBRs6ojM8jGWz/UK6g8Sk QMJl5yX0yBMaOcXGnqlL2o0TJt7gZVVJ18ISeWMEJ6PsHY7RvnZSwBTQ407Da8V3xF56 R8R4jYcvU5qL27srSfJmlSTqXXjgLo60nYUJnMAhVwfnxxMfmsITfECdSJ9rc4oc6gzN avhYGXz/KQhZpPV7YNOPXt4qHXcwtwGJREpZV8NoZPQgpwaIOEWCiv3YT7MnqaQu1+6H hf5nCny1cKYvAaQ4upTQU+mIyffWj8C/cvXsd9BssUh6E/OAPatieKaaKa/62gt1uIQC mJdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="JCLTilb/"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c13si3136065edk.57.2020.06.12.03.22.52; Fri, 12 Jun 2020 03:23:15 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="JCLTilb/"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726416AbgFLKSR (ORCPT + 99 others); Fri, 12 Jun 2020 06:18:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725872AbgFLKSO (ORCPT ); Fri, 12 Jun 2020 06:18:14 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EED00C03E96F for ; Fri, 12 Jun 2020 03:18:12 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id s10so3939768pgm.0 for ; Fri, 12 Jun 2020 03:18:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=iOkJqi7aCMYM9LukTx1mTmPwI0a9w/kRf9osBcBZvIc=; b=JCLTilb/KzC4qQpnHpewmcVqa2dz/z1DYUIZGzZAi6BQhulMANqhXWRNn0a7S6LwX2 MPpC5wjLCA4pAPGXgrEan8v5RmP3taIXMHDvtwyFhlEuZbDqyR/gDZ1+igFuYar460vB oxY1VN3r62rPv4gK3xsX/Nt+/C+M6vGDsmWS+N3FPUpqO6gnYSDuXQQGVoIOaqzXKMt/ TvWXrFaBvXPbxe0MznrYQVzyG3sxrIG9+A61ljbAzY9A4GMRi/VulHlzNNSor+/t/mn/ OX68fkXy2atEzWIzfn0+3fYoF+Gz2t4HG87HVJJHAubbwYUnM5MqIGAw3WiAoRL4QKD1 Hyxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=iOkJqi7aCMYM9LukTx1mTmPwI0a9w/kRf9osBcBZvIc=; b=EdK9eC1mZAyPES3D54RuugFRXCdH3gSuC2e+Enrds5mtVA2Xi/dLAvVEIf7kn5AdNl YJq74ldyop+ewg82yMjyXAZMqHW7i83CL8POi3F3wCKECIqBDScTT+sn/ovM/BetNtXk CoHTvGn16kc6bGQGr7zxT1kihXGtsxJbJR+8jt/3mG1tuGH5xLNU2Qj+5geFFvaCjKeD L4HiHf9SbblphlbkHwte6g31+xIxHNJegyOT791a4Tt+TmEgAX9cmObtwD0yZrFsufow yJmR2TCnMQvaul6cKSzbK5n7QzYLyVbNznASI7VjDywvRSf1OkJU4hRjrdb2WWml7Yvv lO0g== X-Gm-Message-State: AOAM531ihq/pyIo5BihitpH8uYGmBRpeDG7IYgzBf0TRAcO7uzKwpy6Y sZqBcCwWotH2NuWFLIds70Y= X-Received: by 2002:a63:f804:: with SMTP id n4mr9157746pgh.302.1591957092495; Fri, 12 Jun 2020 03:18:12 -0700 (PDT) Received: from localhost ([49.205.222.116]) by smtp.gmail.com with ESMTPSA id d3sm5482512pfh.157.2020.06.12.03.18.11 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Jun 2020 03:18:12 -0700 (PDT) Date: Fri, 12 Jun 2020 15:48:10 +0530 From: afzal mohammed To: Russell King - ARM Linux admin , Arnd Bergmann , Linus Walleij Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, Nicolas Pitre , Catalin Marinas , Will Deacon Subject: [RFC 2/3] ARM: uaccess: let UACCESS_GUP_KMAP_MEMCPY enabling Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Turn off existing raw_copy_{from,to}_user() using arm_copy_{from,to}_user() when CONFIG_UACCESS_GUP_KMAP_MEMCPY is enabled. Signed-off-by: afzal mohammed --- arch/arm/include/asm/uaccess.h | 20 ++++++++++++++++++++ arch/arm/kernel/armksyms.c | 2 ++ arch/arm/lib/Makefile | 7 +++++-- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h index 98c6b91be4a8a..4a16ae52d4978 100644 --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h @@ -512,6 +512,15 @@ do { \ extern unsigned long __must_check arm_copy_from_user(void *to, const void __user *from, unsigned long n); +#ifdef CONFIG_UACCESS_GUP_KMAP_MEMCPY +extern unsigned long __must_check +gup_kmap_copy_from_user(void *to, const void __user *from, unsigned long n); +static inline __must_check unsigned long +raw_copy_from_user(void *to, const void __user *from, unsigned long n) +{ + return gup_kmap_copy_from_user(to, from, n); +} +#else static inline unsigned long __must_check raw_copy_from_user(void *to, const void __user *from, unsigned long n) { @@ -522,12 +531,22 @@ raw_copy_from_user(void *to, const void __user *from, unsigned long n) uaccess_restore(__ua_flags); return n; } +#endif extern unsigned long __must_check arm_copy_to_user(void __user *to, const void *from, unsigned long n); extern unsigned long __must_check __copy_to_user_std(void __user *to, const void *from, unsigned long n); +#ifdef CONFIG_UACCESS_GUP_KMAP_MEMCPY +extern unsigned long __must_check +gup_kmap_copy_to_user(void __user *to, const void *from, unsigned long n); +static inline __must_check unsigned long +raw_copy_to_user(void __user *to, const void *from, unsigned long n) +{ + return gup_kmap_copy_to_user(to, from, n); +} +#else static inline unsigned long __must_check raw_copy_to_user(void __user *to, const void *from, unsigned long n) { @@ -541,6 +560,7 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n) return arm_copy_to_user(to, from, n); #endif } +#endif extern unsigned long __must_check arm_clear_user(void __user *addr, unsigned long n); diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c index 98bdea51089d5..8c92fe30d1559 100644 --- a/arch/arm/kernel/armksyms.c +++ b/arch/arm/kernel/armksyms.c @@ -96,8 +96,10 @@ EXPORT_SYMBOL(mmiocpy); #ifdef CONFIG_MMU EXPORT_SYMBOL(copy_page); +#ifndef CONFIG_UACCESS_GUP_KMAP_MEMCPY EXPORT_SYMBOL(arm_copy_from_user); EXPORT_SYMBOL(arm_copy_to_user); +#endif EXPORT_SYMBOL(arm_clear_user); EXPORT_SYMBOL(__get_user_1); diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index 6d2ba454f25b6..1aeff2cd7b4b3 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -16,8 +16,11 @@ lib-y := changebit.o csumipv6.o csumpartial.o \ io-readsb.o io-writesb.o io-readsl.o io-writesl.o \ call_with_stack.o bswapsdi2.o -mmu-y := clear_user.o copy_page.o getuser.o putuser.o \ - copy_from_user.o copy_to_user.o +mmu-y := clear_user.o copy_page.o getuser.o putuser.o + +ifndef CONFIG_UACCESS_GUP_KMAP_MEMCPY + mmu-y += copy_from_user.o copy_to_user.o +endif ifdef CONFIG_CC_IS_CLANG lib-y += backtrace-clang.o -- 2.26.2