Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2834774lqo; Tue, 14 May 2024 10:28:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX0kJbSU6LDg6kbQyo1aDlWnZDbBmNlI7VZIQ2jkHTB5XjvakFBxkhjxGw5Y88pgE97eeBCNxvEkIa2qH78v0WkLWdb2gyd9wOx98HiRA== X-Google-Smtp-Source: AGHT+IGSKRwIgx7KKz6XdwrhsF0HeR6V8Q2dKWBoXgEOeHGQ5G+6ufAmaN7pp95BF+lsrD23V7RL X-Received: by 2002:a05:622a:14b:b0:43a:b15a:f8c3 with SMTP id d75a77b69052e-43dfdaf28e2mr182902651cf.29.1715707693511; Tue, 14 May 2024 10:28:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715707693; cv=pass; d=google.com; s=arc-20160816; b=a8M1MaySGv6Cy1klP4gSm8VwxE0nBmRmLTsJXFl7waedoRt1a8QUW2za4d7RHDrcGT 8iJ0uJLeKPeUFvWDnPvADuS4Z2+DZz1RhIHSH6GTZCZ/LFzOtTn0Irxo554bbvv57oMx Me5toFtgD3lkQEXgIyZ/wGPynrdGwe4BqGN1j3AqswM8ee4EBtjICSGt57+SRlK2Zcss CJ3GU1KNt+cCgFTEMEkny5X1tvqnKCiEMpiFCIysA+iEHLhOkm0ad86FhrN67P8BTwEA nCv/ZU3yNUpdMlCHaa8UCzC4ZCXaSClE5woN+vVqthrFyLSUgP3mb3mwG0RGDuYpMK+r ZGvA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=nnX0R/TI2GhzGB/I6J3h0hAMTwZ7xbcibP7Acu3/QWA=; fh=VqMrzLr4ipT9Mpi7wNX5OVrCe56tSZKg2FtcCqhCksg=; b=XELxkueO0f6bsgggXB+yOFJY022/8+bl6sirFLGMgQH7jBRNctvbZWsjXyN+bBRkqy OX1lFpN2lify7bpNhrfiVH2rtgU9UOH+Rxm6Ldtt9/WkQIl/kqCLJJnJtggvPciL1lTN Hbn6SrdhCuSpbftd0ClkkabbejgqP1bEkUjjZmByLwYttYDmrCLVcJDTxGZ0xdBvjcM9 OiD23UkZGRyk1kLHRIyCt/ExK3scBX4O+EIaAgOj0G/0Y/XgtqBIE7OCePhBb5z5+eAT cshgzS8+EuIy1T1h1dgqXtNe+TwsIIFAiVPdP9zHrQwAlpncdfhRGN+pEBJ+9NxJGrgK sEQQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b="1/qr7dii"; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-179007-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179007-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43e061fb48fsi92417991cf.459.2024.05.14.10.28.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 10:28:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179007-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b="1/qr7dii"; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-179007-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179007-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3E6421C218CE for ; Tue, 14 May 2024 17:28:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB7251802AA; Tue, 14 May 2024 17:28:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="1/qr7dii" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA68117F378; Tue, 14 May 2024 17:28:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715707685; cv=none; b=NZEVaq4UsELjf4YyLf7Ph0kg1vONKmE1zRLfvQX8srgBu7mMJOwc7lMFq83D7p/Pba8LDAIKTTO7RAiXHFpabmoIHjkHirs1uXAQD1wKlzSpGelft0JUuhOccMu3ApUa0jTZD9TgbcEOGLq1/zSBG4PaMhmfrmQaVlU52JBNiRQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715707685; c=relaxed/simple; bh=Ex1jECYg9YCi18DK+c5M5YI2kVJQ/OqqOZjhQriYWAA=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=NI1WQN/+UjKaVBNGP79AUYxh4m6ECo80aBu9TFoTlDaVAGt7i8XPk4qR/DlWkK3pqayg7GrvrOqulG/fYHqZ15TQ69LWKK6I6x5Esws+acuBIgPiOoNQZ9BuwlzVoFGk+olFvylcXSn3eSnmW+wEE/CdTG4D0C6ZZca4WC1eELI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=1/qr7dii; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 646BCC2BD10; Tue, 14 May 2024 17:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1715707684; bh=Ex1jECYg9YCi18DK+c5M5YI2kVJQ/OqqOZjhQriYWAA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=1/qr7diiZFoMOkRRQAHecS9twVK6/XddQVf6LcYQfZ8frrVMFvQPtesA7vPTTbTlS b6lXYLnfiexNKGDEEeSSHJNv82F9Xc9xqceX5XyBR/td70xNUY8HsYwTZHF9+ceK3T eeiBtwEtzFdoNRXSrh9s41596Job3PtivO6KBaXw= Date: Tue, 14 May 2024 10:27:57 -0700 From: Andrew Morton To: Alice Ryhl Cc: Miguel Ojeda , Matthew Wilcox , Al Viro , Kees Cook , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?ISO-8859-1?Q?"Bj=F6rn_Roy_Baron"?= , Benno Lossin , Andreas Hindborg , Greg Kroah-Hartman , =?ISO-8859-1?Q?"Arve_Hj?= =?ISO-8859-1?Q?=F8nnev=E5g"?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Carlos Llamas , Suren Baghdasaryan , Arnd Bergmann , Trevor Gross , linux-mm@kvack.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, Christian Brauner Subject: Re: [PATCH v6 2/4] uaccess: always export _copy_[from|to]_user with CONFIG_RUST Message-Id: <20240514102757.b7034966a58e6cf44d75dc7d@linux-foundation.org> In-Reply-To: <20240418-alice-mm-v6-2-cb8f3e5d688f@google.com> References: <20240418-alice-mm-v6-0-cb8f3e5d688f@google.com> <20240418-alice-mm-v6-2-cb8f3e5d688f@google.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 18 Apr 2024 08:59:18 +0000 Alice Ryhl wrote: > From: Arnd Bergmann > > Rust code needs to be able to access _copy_from_user and _copy_to_user > so that it can skip the check_copy_size check in cases where the length > is known at compile-time, mirroring the logic for when C code will skip > check_copy_size. To do this, we ensure that exported versions of these > methods are available when CONFIG_RUST is enabled. > > Alice has verified that this patch passes the CONFIG_TEST_USER_COPY test > on x86 using the Android cuttlefish emulator. > > ... > > -#ifdef INLINE_COPY_TO_USER > static inline __must_check unsigned long > -_copy_to_user(void __user *to, const void *from, unsigned long n) > +_inline_copy_to_user(void __user *to, const void *from, unsigned long n) > { I think it would be helpful to have some comments in here describing why we're doing this _inline_* thing. What problem is it avoiding?