{"id":2229034,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2229034/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/9fe875d2f55af59c12708336c571a46038528678.1777306795.git.chleroy@kernel.org/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/1.1/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/"},"msgid":"<9fe875d2f55af59c12708336c571a46038528678.1777306795.git.chleroy@kernel.org>","date":"2026-04-27T17:13:43","name":"[RFC,v1,2/9] uaccess: Convert INLINE_COPY_{TO/FROM}_USER to kconfig and reduce ifdefery","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"34083bc2cd6496d13fb1e7a3d29ca6c667f90c8a","submitter":{"id":92089,"url":"http://patchwork.ozlabs.org/api/1.1/people/92089/?format=json","name":"Christophe Leroy (CS GROUP)","email":"chleroy@kernel.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/9fe875d2f55af59c12708336c571a46038528678.1777306795.git.chleroy@kernel.org/mbox/","series":[{"id":501691,"url":"http://patchwork.ozlabs.org/api/1.1/series/501691/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=501691","date":"2026-04-27T17:13:41","name":"uaccess: Convert small fixed size copy_{to/from}_user() to scoped user access","version":1,"mbox":"http://patchwork.ozlabs.org/series/501691/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2229034/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2229034/checks/","tags":{},"headers":{"Return-Path":"\n <linuxppc-dev+bounces-20177-incoming=patchwork.ozlabs.org@lists.ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=iZa57++f;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=112.213.38.117; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev+bounces-20177-incoming=patchwork.ozlabs.org@lists.ozlabs.org;\n receiver=patchwork.ozlabs.org)","lists.ozlabs.org;\n arc=none smtp.remote-ip=172.105.4.254","lists.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org","lists.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=iZa57++f;\n\tdkim-atps=neutral","lists.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org\n (client-ip=172.105.4.254; helo=tor.source.kernel.org;\n envelope-from=chleroy@kernel.org; receiver=lists.ozlabs.org)"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1 raw public key)\n server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g49HN6F5Hz1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 03:17:36 +1000 (AEST)","from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4g49HN5HvJz2yfK;\n\tTue, 28 Apr 2026 03:17:36 +1000 (AEST)","from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 4g49HM4Tj5z2xlM;\n\tTue, 28 Apr 2026 03:17:35 +1000 (AEST)","from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58])\n\tby tor.source.kernel.org (Postfix) with ESMTP id A0A196015B;\n\tMon, 27 Apr 2026 17:17:32 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 9AEAAC2BCB5;\n\tMon, 27 Apr 2026 17:17:13 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1777310256;\n\tcv=none;\n b=KrBeCCbFQsgs0y0U1e8lkq4AHulzSbUJtFZTWcMRzM5FjIGXZWXt27vZ8iVAgo5yB/pUVokc2k266CT2eumjEUeuddg0Ez3EMmnR/qOgkj/y8GaBEMgUR13YJiB4eDxRMR11H4o8T7BY1811PFuk7wk58QgMADtmnCgmduvTkfqBHknFleT9JcrBZpIeXTvHUuoVVNOc7b+78NsK92RX4TiUTFgYBaGNeNz8F9Mcae6HjoqWFDRxo3ZWFgNVbCoze5PZ6u4nKXk+2/SFIyT4Ohq8mEhM+xFqa0yFpznkf9ZVC+U9IT+5cfrBX3mgEtXO5JsKSKJ6fV7s9umTOTOvZw==","ARC-Message-Signature":"i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1777310256; c=relaxed/relaxed;\n\tbh=WBLQd2pnjKhdodnW2i8UCMLWkT3XEMzQeRPL3EsBmDE=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=l14iFNZDjQl4jumdKVEPuZWCiPW6edmEC8nwOk1TrBccLAfbek0ggpzxNr0l4qXZhA/Ng1TAAcjKtTAyYyf7pp0dUpsmAXCM8dX8bt7hGkqU4ovl/bpLk55MV103kvaKKyAXJmuDCDZSGrsoWo/wpoyggD5TdLE88GPDZrFy2zn9zs+EZnMnvb7jCVMAcBcn5FOYmh9ukfsIhdi9FecujwoR5rZ9DBm5DZM+ucRr387EJN370iwaUc4QsBsFIuDfMgKiRMLp+rq6RmFL0fCNXJ2szyTLjQrRdjfEvZyvsxUGmmC/fW85jicoeQSuTMUId7eTXffuBzUuHgkZccFLaQ==","ARC-Authentication-Results":"i=1; lists.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org;\n dkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=iZa57++f; dkim-atps=neutral;\n spf=pass (client-ip=172.105.4.254; helo=tor.source.kernel.org;\n envelope-from=chleroy@kernel.org;\n receiver=lists.ozlabs.org) smtp.mailfrom=kernel.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1777310252;\n\tbh=2A3pp34TaOBrBLCc7n3D/0VUADnJLMBU+ywYlmILDq0=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=iZa57++f4J+GqwvmN6cOlz8Y1H7GNDryi4ZRD+CJk+hBQU7Iobf+tE7/GXYinO2zm\n\t iEth1up0MDkLOAxzQiz5mqcfHR3P06TXmSl3XzIFaDPQuFHo3UkJmapo/kW88jy3aQ\n\t 3aznlfwGIxcYhdaW4V5tVjatVhcyAHWEKfRp+CGH8zAHmw+dzciaz6iCaNPprV57bn\n\t 8osxBss4ioepFyLm+2kR+UIAIIrgH8FbX9Dl39gcSvCHEwtnH4JUk+pOBX2jvh7BG3\n\t 7M8Bd9CW5MVAHSPSRYqg08B9eeC3kSJm80fJ6QSe91ed2+rsgDjp3uvvAKjOOY8v3a\n\t 6k1/LUiGGTPUw==","From":"\"Christophe Leroy (CS GROUP)\" <chleroy@kernel.org>","To":"Yury Norov <ynorov@nvidia.com>,\n\tAndrew Morton <akpm@linux-foundation.org>,\n\tLinus Torvalds <torvalds@linux-foundation.org>,\n\tDavid Laight <david.laight.linux@gmail.com>,\n\tThomas Gleixner <tglx@linutronix.de>","Cc":"\"Christophe Leroy (CS GROUP)\" <chleroy@kernel.org>,\n\tlinux-alpha@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\tlinux-snps-arc@lists.infradead.org,\n\tlinux-arm-kernel@lists.infradead.org,\n\tlinux-mips@vger.kernel.org,\n\tlinuxppc-dev@lists.ozlabs.org,\n\tkvm@vger.kernel.org,\n\tlinux-riscv@lists.infradead.org,\n\tlinux-s390@vger.kernel.org,\n\tsparclinux@vger.kernel.org,\n\tlinux-um@lists.infradead.org,\n\tdmaengine@vger.kernel.org,\n\tlinux-efi@vger.kernel.org,\n\tlinux-fsi@lists.ozlabs.org,\n\tamd-gfx@lists.freedesktop.org,\n\tdri-devel@lists.freedesktop.org,\n\tintel-gfx@lists.freedesktop.org,\n\tlinux-wpan@vger.kernel.org,\n\tnetdev@vger.kernel.org,\n\tlinux-wireless@vger.kernel.org,\n\tlinux-spi@vger.kernel.org,\n\tlinux-media@vger.kernel.org,\n\tlinux-staging@lists.linux.dev,\n\tlinux-serial@vger.kernel.org,\n\tlinux-usb@vger.kernel.org,\n\txen-devel@lists.xenproject.org,\n\tlinux-fsdevel@vger.kernel.org,\n\tocfs2-devel@lists.linux.dev,\n\tbpf@vger.kernel.org,\n\tkasan-dev@googlegroups.com,\n\tlinux-mm@kvack.org,\n\tlinux-x25@vger.kernel.org,\n\trust-for-linux@vger.kernel.org,\n\tlinux-sound@vger.kernel.org,\n\tsound-open-firmware@alsa-project.org,\n\tlinux-csky@vger.kernel.org,\n\tlinux-hexagon@vger.kernel.org,\n\tloongarch@lists.linux.dev,\n\tlinux-m68k@lists.linux-m68k.org,\n\tlinux-openrisc@vger.kernel.org,\n\tlinux-parisc@vger.kernel.org,\n\tlinux-sh@vger.kernel.org,\n\tlinux-arch@vger.kernel.org","Subject":"[RFC PATCH v1 2/9] uaccess: Convert INLINE_COPY_{TO/FROM}_USER to\n kconfig and reduce ifdefery","Date":"Mon, 27 Apr 2026 19:13:43 +0200","Message-ID":"\n <9fe875d2f55af59c12708336c571a46038528678.1777306795.git.chleroy@kernel.org>","X-Mailer":"git-send-email 2.49.0","In-Reply-To":"<cover.1777306795.git.chleroy@kernel.org>","References":"<cover.1777306795.git.chleroy@kernel.org>","X-Mailing-List":"linuxppc-dev@lists.ozlabs.org","List-Id":"<linuxppc-dev.lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev+help@lists.ozlabs.org>","List-Owner":"<mailto:linuxppc-dev+owner@lists.ozlabs.org>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Archive":"<https://lore.kernel.org/linuxppc-dev/>,\n  <https://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Subscribe":"<mailto:linuxppc-dev+subscribe@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-digest@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-nomail@lists.ozlabs.org>","List-Unsubscribe":"<mailto:linuxppc-dev+unsubscribe@lists.ozlabs.org>","Precedence":"list","MIME-Version":"1.0","X-Developer-Signature":"v=1; a=openpgp-sha256; l=18999; i=chleroy@kernel.org;\n h=from:subject:message-id; bh=2A3pp34TaOBrBLCc7n3D/0VUADnJLMBU+ywYlmILDq0=;\n b=owGbwMvMwCV2d0KB2p7V54MZT6slMWS+nxl942rk7qV/z0wpsopc/EjgrOKra6+/qq3zDzp1o\n 3Cx5MQvcR2lLAxiXAyyYoosx/9z75rR9SU1f+oufZg5rEwgQxi4OAVgIuKajAx/ndKvMf5+vP6+\n 0DUOzaI/8u977T8/tn8jYyzy8FHU4dqzDP9dp5oyP1vg/Kml4FbUFMnSvxpN1/NNNGPF159+JNd\n bVcIDAA==","X-Developer-Key":"i=chleroy@kernel.org; a=openpgp;\n fpr=10FFE6F8B390DE17ACC2632368A92FEB01B8DD78","Content-Transfer-Encoding":"8bit","X-Spam-Status":"No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,\n\tDKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS\n\tautolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on lists.ozlabs.org"},"content":"Among the 21 architectures supported by the kernel, 16 define both\nINLINE_COPY_TO_USER and INLINE_COPY_FROM_USER while the 5 other ones\ndon't define any of the two.\n\nTo simplify and reduce risk of mistakes, convert them to a single\nkconfig item named CONFIG_ARCH_WANTS_NOINLINE_COPY which will be\nselected by the 5 architectures that don't want inlined copy.\n\nTo minimise complication in a later patch, also remove\nifdefery and replace it with IS_ENABLED().\n\nSigned-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>\n---\n arch/alpha/Kconfig                    |  1 +\n arch/arc/include/asm/uaccess.h        |  3 ---\n arch/arm/include/asm/uaccess.h        |  2 --\n arch/arm64/include/asm/uaccess.h      |  3 ---\n arch/csky/Kconfig                     |  1 +\n arch/hexagon/include/asm/uaccess.h    |  3 ---\n arch/loongarch/include/asm/uaccess.h  |  3 ---\n arch/m68k/include/asm/uaccess.h       |  3 ---\n arch/microblaze/include/asm/uaccess.h |  2 --\n arch/mips/include/asm/uaccess.h       |  3 ---\n arch/nios2/include/asm/uaccess.h      |  2 --\n arch/openrisc/include/asm/uaccess.h   |  2 --\n arch/parisc/include/asm/uaccess.h     |  3 ---\n arch/powerpc/Kconfig                  |  1 +\n arch/riscv/Kconfig                    |  1 +\n arch/s390/include/asm/uaccess.h       |  3 ---\n arch/sh/include/asm/uaccess.h         |  2 --\n arch/sparc/include/asm/uaccess_32.h   |  3 ---\n arch/sparc/include/asm/uaccess_64.h   |  2 --\n arch/um/include/asm/uaccess.h         |  3 ---\n arch/x86/Kconfig                      |  1 +\n arch/xtensa/include/asm/uaccess.h     |  2 --\n include/asm-generic/uaccess.h         |  2 --\n include/linux/uaccess.h               | 32 ++++++++++++---------------\n lib/Kconfig                           |  3 +++\n lib/Makefile                          |  3 ++-\n lib/usercopy.c                        |  4 ----\n rust/helpers/uaccess.c                |  2 +-\n 28 files changed, 25 insertions(+), 70 deletions(-)","diff":"diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig\nindex 7b7dafe7d9df..65e533cead6b 100644\n--- a/arch/alpha/Kconfig\n+++ b/arch/alpha/Kconfig\n@@ -11,6 +11,7 @@ config ALPHA\n \tselect ARCH_NO_PREEMPT\n \tselect ARCH_NO_SG_CHAIN\n \tselect ARCH_USE_CMPXCHG_LOCKREF\n+\tselect ARCH_WANTS_NOINLINE_COPY_USER\n \tselect FORCE_PCI\n \tselect PCI_DOMAINS if PCI\n \tselect PCI_SYSCALL if PCI\ndiff --git a/arch/arc/include/asm/uaccess.h b/arch/arc/include/asm/uaccess.h\nindex 1e8809ea000a..e8b161b37a03 100644\n--- a/arch/arc/include/asm/uaccess.h\n+++ b/arch/arc/include/asm/uaccess.h\n@@ -628,9 +628,6 @@ static inline unsigned long __clear_user(void __user *to, unsigned long n)\n \treturn res;\n }\n \n-#define INLINE_COPY_TO_USER\n-#define INLINE_COPY_FROM_USER\n-\n #define __clear_user\t\t\t__clear_user\n \n #include <asm-generic/uaccess.h>\ndiff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h\nindex d6ae80b5df36..7280c162bb71 100644\n--- a/arch/arm/include/asm/uaccess.h\n+++ b/arch/arm/include/asm/uaccess.h\n@@ -616,8 +616,6 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)\n }\n #define __clear_user(addr, n)\t\t(memset((void __force *)addr, 0, n), 0)\n #endif\n-#define INLINE_COPY_TO_USER\n-#define INLINE_COPY_FROM_USER\n \n static inline unsigned long __must_check clear_user(void __user *to, unsigned long n)\n {\ndiff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h\nindex b0c83a08dda9..1e20ec91b56f 100644\n--- a/arch/arm64/include/asm/uaccess.h\n+++ b/arch/arm64/include/asm/uaccess.h\n@@ -456,9 +456,6 @@ do {\t\t\t\t\t\t\t\t\t\\\n \tunsafe_copy_loop(__ucu_dst, __ucu_src, __ucu_len, u8, label);\t\\\n } while (0)\n \n-#define INLINE_COPY_TO_USER\n-#define INLINE_COPY_FROM_USER\n-\n extern unsigned long __must_check __arch_clear_user(void __user *to, unsigned long n);\n static inline unsigned long __must_check __clear_user(void __user *to, unsigned long n)\n {\ndiff --git a/arch/csky/Kconfig b/arch/csky/Kconfig\nindex 4331313a42ff..d010d7eb47bf 100644\n--- a/arch/csky/Kconfig\n+++ b/arch/csky/Kconfig\n@@ -40,6 +40,7 @@ config CSKY\n \tselect ARCH_NEED_CMPXCHG_1_EMU\n \tselect ARCH_WANT_FRAME_POINTERS if !CPU_CK610 && $(cc-option,-mbacktrace)\n \tselect ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT\n+\tselect ARCH_WANTS_NOINLINE_COPY_USER\n \tselect COMMON_CLK\n \tselect CLKSRC_MMIO\n \tselect CSKY_MPINTC if CPU_CK860\ndiff --git a/arch/hexagon/include/asm/uaccess.h b/arch/hexagon/include/asm/uaccess.h\nindex bff77efc0d9a..4bf863217636 100644\n--- a/arch/hexagon/include/asm/uaccess.h\n+++ b/arch/hexagon/include/asm/uaccess.h\n@@ -26,9 +26,6 @@ unsigned long raw_copy_from_user(void *to, const void __user *from,\n \t\t\t\t     unsigned long n);\n unsigned long raw_copy_to_user(void __user *to, const void *from,\n \t\t\t\t   unsigned long n);\n-#define INLINE_COPY_FROM_USER\n-#define INLINE_COPY_TO_USER\n-\n __kernel_size_t __clear_user_hexagon(void __user *dest, unsigned long count);\n #define __clear_user(a, s) __clear_user_hexagon((a), (s))\n \ndiff --git a/arch/loongarch/include/asm/uaccess.h b/arch/loongarch/include/asm/uaccess.h\nindex 438269313e78..72a04ac88549 100644\n--- a/arch/loongarch/include/asm/uaccess.h\n+++ b/arch/loongarch/include/asm/uaccess.h\n@@ -292,9 +292,6 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)\n \treturn __copy_user((__force void *)to, from, n);\n }\n \n-#define INLINE_COPY_FROM_USER\n-#define INLINE_COPY_TO_USER\n-\n /*\n  * __clear_user: - Zero a block of memory in user space, with less checking.\n  * @addr: Destination address, in user space.\ndiff --git a/arch/m68k/include/asm/uaccess.h b/arch/m68k/include/asm/uaccess.h\nindex 64914872a5c9..20e249a6ad07 100644\n--- a/arch/m68k/include/asm/uaccess.h\n+++ b/arch/m68k/include/asm/uaccess.h\n@@ -377,9 +377,6 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)\n \t\treturn __constant_copy_to_user(to, from, n);\n \treturn __generic_copy_to_user(to, from, n);\n }\n-#define INLINE_COPY_FROM_USER\n-#define INLINE_COPY_TO_USER\n-\n #define __get_kernel_nofault(dst, src, type, err_label)\t\t\t\\\n do {\t\t\t\t\t\t\t\t\t\\\n \ttype *__gk_dst = (type *)(dst);\t\t\t\t\t\\\ndiff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h\nindex 3aab2f17e046..3355f541e12a 100644\n--- a/arch/microblaze/include/asm/uaccess.h\n+++ b/arch/microblaze/include/asm/uaccess.h\n@@ -250,8 +250,6 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)\n {\n \treturn __copy_tofrom_user(to, (__force const void __user *)from, n);\n }\n-#define INLINE_COPY_FROM_USER\n-#define INLINE_COPY_TO_USER\n \n /*\n  * Copy a null terminated string from userspace.\ndiff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h\nindex c0cede273c7c..8714caefbac8 100644\n--- a/arch/mips/include/asm/uaccess.h\n+++ b/arch/mips/include/asm/uaccess.h\n@@ -433,9 +433,6 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)\n \treturn __cu_len_r;\n }\n \n-#define INLINE_COPY_FROM_USER\n-#define INLINE_COPY_TO_USER\n-\n extern __kernel_size_t __bzero(void __user *addr, __kernel_size_t size);\n \n /*\ndiff --git a/arch/nios2/include/asm/uaccess.h b/arch/nios2/include/asm/uaccess.h\nindex 6ccc9a232c23..46d7312a1c96 100644\n--- a/arch/nios2/include/asm/uaccess.h\n+++ b/arch/nios2/include/asm/uaccess.h\n@@ -57,8 +57,6 @@ extern unsigned long\n raw_copy_from_user(void *to, const void __user *from, unsigned long n);\n extern unsigned long\n raw_copy_to_user(void __user *to, const void *from, unsigned long n);\n-#define INLINE_COPY_FROM_USER\n-#define INLINE_COPY_TO_USER\n \n extern long strncpy_from_user(char *__to, const char __user *__from,\n \t\t\t      long __len);\ndiff --git a/arch/openrisc/include/asm/uaccess.h b/arch/openrisc/include/asm/uaccess.h\nindex d6500a374e18..c84effde867a 100644\n--- a/arch/openrisc/include/asm/uaccess.h\n+++ b/arch/openrisc/include/asm/uaccess.h\n@@ -218,8 +218,6 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long size)\n {\n \treturn __copy_tofrom_user((__force void *)to, from, size);\n }\n-#define INLINE_COPY_FROM_USER\n-#define INLINE_COPY_TO_USER\n \n extern unsigned long __clear_user(void __user *addr, unsigned long size);\n \ndiff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h\nindex 6c531d2c847e..1dd6a1dd653f 100644\n--- a/arch/parisc/include/asm/uaccess.h\n+++ b/arch/parisc/include/asm/uaccess.h\n@@ -197,7 +197,4 @@ unsigned long __must_check raw_copy_to_user(void __user *dst, const void *src,\n \t\t\t\t\t    unsigned long len);\n unsigned long __must_check raw_copy_from_user(void *dst, const void __user *src,\n \t\t\t\t\t    unsigned long len);\n-#define INLINE_COPY_TO_USER\n-#define INLINE_COPY_FROM_USER\n-\n #endif /* __PARISC_UACCESS_H */\ndiff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig\nindex e93df95b79e7..6816f402fe3d 100644\n--- a/arch/powerpc/Kconfig\n+++ b/arch/powerpc/Kconfig\n@@ -187,6 +187,7 @@ config PPC\n \tselect ARCH_WANT_LD_ORPHAN_WARN\n \tselect ARCH_WANT_OPTIMIZE_DAX_VMEMMAP\tif PPC_RADIX_MMU\n \tselect ARCH_WANTS_MODULES_DATA_IN_VMALLOC\tif PPC_BOOK3S_32 || PPC_8xx\n+\tselect ARCH_WANTS_NOINLINE_COPY_USER\n \tselect ARCH_WEAK_RELEASE_ACQUIRE\n \tselect AUDIT_ARCH_COMPAT_GENERIC\n \tselect BINFMT_ELF\ndiff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig\nindex d235396c4514..492b920c1a51 100644\n--- a/arch/riscv/Kconfig\n+++ b/arch/riscv/Kconfig\n@@ -88,6 +88,7 @@ config RISCV\n \tselect ARCH_WANT_OPTIMIZE_DAX_VMEMMAP\n \tselect ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP\n \tselect ARCH_WANTS_NO_INSTR\n+\tselect ARCH_WANTS_NOINLINE_COPY_USER if MMU\n \tselect ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE\n \tselect ARCH_WEAK_RELEASE_ACQUIRE if ARCH_USE_QUEUED_SPINLOCKS\n \tselect BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU\ndiff --git a/arch/s390/include/asm/uaccess.h b/arch/s390/include/asm/uaccess.h\nindex dff035372601..2e0472c20da0 100644\n--- a/arch/s390/include/asm/uaccess.h\n+++ b/arch/s390/include/asm/uaccess.h\n@@ -30,9 +30,6 @@ void debug_user_asce(int exit);\n #define uaccess_kmsan_or_inline __always_inline\n #endif\n \n-#define INLINE_COPY_FROM_USER\n-#define INLINE_COPY_TO_USER\n-\n static uaccess_kmsan_or_inline __must_check unsigned long\n raw_copy_from_user(void *to, const void __user *from, unsigned long size)\n {\ndiff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h\nindex a79609eb14be..0cd75308e6d3 100644\n--- a/arch/sh/include/asm/uaccess.h\n+++ b/arch/sh/include/asm/uaccess.h\n@@ -95,8 +95,6 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)\n {\n \treturn __copy_user((__force void *)to, from, n);\n }\n-#define INLINE_COPY_FROM_USER\n-#define INLINE_COPY_TO_USER\n \n /*\n  * Clear the area and return remaining number of bytes\ndiff --git a/arch/sparc/include/asm/uaccess_32.h b/arch/sparc/include/asm/uaccess_32.h\nindex 43284b6ec46a..e01f43c6421c 100644\n--- a/arch/sparc/include/asm/uaccess_32.h\n+++ b/arch/sparc/include/asm/uaccess_32.h\n@@ -190,9 +190,6 @@ static inline unsigned long raw_copy_from_user(void *to, const void __user *from\n \treturn __copy_user((__force void __user *) to, from, n);\n }\n \n-#define INLINE_COPY_FROM_USER\n-#define INLINE_COPY_TO_USER\n-\n static inline unsigned long __clear_user(void __user *addr, unsigned long size)\n {\n \tunsigned long ret;\ndiff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h\nindex b825a5dd0210..62ee0b074fec 100644\n--- a/arch/sparc/include/asm/uaccess_64.h\n+++ b/arch/sparc/include/asm/uaccess_64.h\n@@ -231,8 +231,6 @@ unsigned long __must_check raw_copy_from_user(void *to,\n unsigned long __must_check raw_copy_to_user(void __user *to,\n \t\t\t\t\t   const void *from,\n \t\t\t\t\t   unsigned long size);\n-#define INLINE_COPY_FROM_USER\n-#define INLINE_COPY_TO_USER\n \n unsigned long __must_check raw_copy_in_user(void __user *to,\n \t\t\t\t\t   const void __user *from,\ndiff --git a/arch/um/include/asm/uaccess.h b/arch/um/include/asm/uaccess.h\nindex 0df9ea4abda8..1e14260c7f0f 100644\n--- a/arch/um/include/asm/uaccess.h\n+++ b/arch/um/include/asm/uaccess.h\n@@ -27,9 +27,6 @@ static inline int __access_ok(const void __user *ptr, unsigned long size);\n #define __access_ok __access_ok\n #define __clear_user __clear_user\n \n-#define INLINE_COPY_FROM_USER\n-#define INLINE_COPY_TO_USER\n-\n #include <asm-generic/uaccess.h>\n \n static inline int __access_ok(const void __user *ptr, unsigned long size)\ndiff --git a/arch/x86/Kconfig b/arch/x86/Kconfig\nindex f3f7cb01d69d..c1e58d8c6864 100644\n--- a/arch/x86/Kconfig\n+++ b/arch/x86/Kconfig\n@@ -143,6 +143,7 @@ config X86\n \tselect ARCH_WANTS_CLOCKSOURCE_READ_INLINE\tif X86_64\n \tselect ARCH_WANTS_DYNAMIC_TASK_STRUCT\n \tselect ARCH_WANTS_NO_INSTR\n+\tselect ARCH_WANTS_NOINLINE_COPY_USER\n \tselect ARCH_WANT_GENERAL_HUGETLB\n \tselect ARCH_WANT_HUGE_PMD_SHARE\t\tif X86_64\n \tselect ARCH_WANT_LD_ORPHAN_WARN\ndiff --git a/arch/xtensa/include/asm/uaccess.h b/arch/xtensa/include/asm/uaccess.h\nindex 56aec6d504fe..f9e1623a7be9 100644\n--- a/arch/xtensa/include/asm/uaccess.h\n+++ b/arch/xtensa/include/asm/uaccess.h\n@@ -237,8 +237,6 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)\n \tprefetch(from);\n \treturn __xtensa_copy_user((__force void *)to, from, n);\n }\n-#define INLINE_COPY_FROM_USER\n-#define INLINE_COPY_TO_USER\n \n /*\n  * We need to return the number of bytes not cleared.  Our memset()\ndiff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h\nindex b276f783494c..fb33a71fd24e 100644\n--- a/include/asm-generic/uaccess.h\n+++ b/include/asm-generic/uaccess.h\n@@ -91,8 +91,6 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)\n \tmemcpy((void __force *)to, from, n);\n \treturn 0;\n }\n-#define INLINE_COPY_FROM_USER\n-#define INLINE_COPY_TO_USER\n #endif /* CONFIG_UACCESS_MEMCPY */\n \n /*\ndiff --git a/include/linux/uaccess.h b/include/linux/uaccess.h\nindex 56328601218c..bd1201c81d94 100644\n--- a/include/linux/uaccess.h\n+++ b/include/linux/uaccess.h\n@@ -83,8 +83,8 @@\n  * with that.  They should not be used directly; they are used to implement\n  * the 6 functions (copy_{to,from}_user(), __copy_{to,from}_user_inatomic())\n  * that are used instead.  Out of those, __... ones are inlined.  Plain\n- * copy_{to,from}_user() might or might not be inlined.  If you want them\n- * inlined, have asm/uaccess.h define INLINE_COPY_{TO,FROM}_USER.\n+ * copy_{to,from}_user() might or might not be inlined.  If you don't want them\n+ * inlined, select CONFIG_ARCH_WANTS_NOINLINE_COPY_USER.\n  *\n  * NOTE: only copy_from_user() zero-pads the destination in case of short copy.\n  * Neither __copy_from_user() nor __copy_from_user_inatomic() zero anything\n@@ -157,8 +157,8 @@ __copy_to_user(void __user *to, const void *from, unsigned long n)\n }\n \n /*\n- * Architectures that #define INLINE_COPY_TO_USER use this function\n- * directly in the normal copy_to/from_user(), the other ones go\n+ * Architectures that don't select CONFIG_ARCH_WANTS_NOINLINE_COPY_USER use\n+ * this function directly in the normal copy_to/from_user(), the other ones go\n  * through an extern _copy_to/from_user(), which expands the same code\n  * here.\n  */\n@@ -190,10 +190,9 @@ _inline_copy_from_user(void *to, const void __user *from, unsigned long n)\n \tmemset(to + (n - res), 0, res);\n \treturn res;\n }\n-#ifndef INLINE_COPY_FROM_USER\n+\n extern __must_check unsigned long\n _copy_from_user(void *, const void __user *, unsigned long);\n-#endif\n \n static inline __must_check unsigned long\n _inline_copy_to_user(void __user *to, const void *from, unsigned long n)\n@@ -207,21 +206,19 @@ _inline_copy_to_user(void __user *to, const void *from, unsigned long n)\n \t}\n \treturn n;\n }\n-#ifndef INLINE_COPY_TO_USER\n+\n extern __must_check unsigned long\n _copy_to_user(void __user *, const void *, unsigned long);\n-#endif\n \n static __always_inline unsigned long __must_check\n copy_from_user(void *to, const void __user *from, unsigned long n)\n {\n \tif (!check_copy_size(to, n, false))\n \t\treturn n;\n-#ifdef INLINE_COPY_FROM_USER\n-\treturn _inline_copy_from_user(to, from, n);\n-#else\n-\treturn _copy_from_user(to, from, n);\n-#endif\n+\tif (IS_ENABLED(ARCH_WANTS_NOINLINE_COPY_USER))\n+\t\treturn _copy_from_user(to, from, n);\n+\telse\n+\t\treturn _inline_copy_from_user(to, from, n);\n }\n \n static __always_inline unsigned long __must_check\n@@ -230,11 +227,10 @@ copy_to_user(void __user *to, const void *from, unsigned long n)\n \tif (!check_copy_size(from, n, true))\n \t\treturn n;\n \n-#ifdef INLINE_COPY_TO_USER\n-\treturn _inline_copy_to_user(to, from, n);\n-#else\n-\treturn _copy_to_user(to, from, n);\n-#endif\n+\tif (IS_ENABLED(ARCH_WANTS_NOINLINE_COPY_USER))\n+\t\treturn _copy_to_user(to, from, n);\n+\telse\n+\t\treturn _inline_copy_to_user(to, from, n);\n }\n \n #ifndef copy_mc_to_kernel\ndiff --git a/lib/Kconfig b/lib/Kconfig\nindex 00a9509636c1..a2e07d4dd2bf 100644\n--- a/lib/Kconfig\n+++ b/lib/Kconfig\n@@ -68,6 +68,9 @@ config ARCH_HAS_STRNCPY_FROM_USER\n config ARCH_HAS_STRNLEN_USER\n \tbool\n \n+config ARCH_WANTS_NOINLINE_COPY_USER\n+\tbool\n+\n config GENERIC_STRNCPY_FROM_USER\n \tdef_bool !ARCH_HAS_STRNCPY_FROM_USER\n \ndiff --git a/lib/Makefile b/lib/Makefile\nindex 7c0334d7675b..f4d577910671 100644\n--- a/lib/Makefile\n+++ b/lib/Makefile\n@@ -57,9 +57,10 @@ obj-y += bcd.o sort.o parser.o debug_locks.o random32.o \\\n \t list_sort.o uuid.o iov_iter.o clz_ctz.o \\\n \t bsearch.o find_bit.o llist.o lwq.o memweight.o kfifo.o \\\n \t percpu-refcount.o rhashtable.o base64.o \\\n-\t once.o refcount.o rcuref.o usercopy.o errseq.o bucket_locks.o \\\n+\t once.o refcount.o rcuref.o errseq.o bucket_locks.o \\\n \t generic-radix-tree.o bitmap-str.o\n obj-y += usercheck.o\n+obj-$(CONFIG_ARCH_WANTS_NOINLINE_COPY_USER) += usercopy.o\n obj-y += string_helpers.o\n obj-y += hexdump.o\n obj-$(CONFIG_TEST_HEXDUMP) += test_hexdump.o\ndiff --git a/lib/usercopy.c b/lib/usercopy.c\nindex 7a93f56d81dd..d2deb4b0a3c5 100644\n--- a/lib/usercopy.c\n+++ b/lib/usercopy.c\n@@ -4,18 +4,14 @@\n \n /* out-of-line parts */\n \n-#if !defined(INLINE_COPY_FROM_USER)\n unsigned long _copy_from_user(void *to, const void __user *from, unsigned long n)\n {\n \treturn _inline_copy_from_user(to, from, n);\n }\n EXPORT_SYMBOL(_copy_from_user);\n-#endif\n \n-#if !defined(INLINE_COPY_TO_USER)\n unsigned long _copy_to_user(void __user *to, const void *from, unsigned long n)\n {\n \treturn _inline_copy_to_user(to, from, n);\n }\n EXPORT_SYMBOL(_copy_to_user);\n-#endif\ndiff --git a/rust/helpers/uaccess.c b/rust/helpers/uaccess.c\nindex d9625b9ee046..01de4fbbcc84 100644\n--- a/rust/helpers/uaccess.c\n+++ b/rust/helpers/uaccess.c\n@@ -14,7 +14,7 @@ rust_helper_copy_to_user(void __user *to, const void *from, unsigned long n)\n \treturn copy_to_user(to, from, n);\n }\n \n-#ifdef INLINE_COPY_FROM_USER\n+#ifndef CONFIG_ARCH_WANTS_NOINLINE_COPY_USER\n __rust_helper\n unsigned long rust_helper__copy_from_user(void *to, const void __user *from, unsigned long n)\n {\n","prefixes":["RFC","v1","2/9"]}