Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp3146853lqo; Wed, 15 May 2024 00:35:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUE51EE2yAnU95BlLIDB2ROLo3JlnC4KHFBq3bk/FIh7Kh9ujN2PvwmfXNRoS98P4fN/N7dW1Iezu5hmjZXRoOYMsxwFq4tnI4BrSlTLA== X-Google-Smtp-Source: AGHT+IECPnambIBJVU+FzMMxB1lU+dfwp6xYJJAxTfkjad6ryBTqm6vYd1b8lK7sZiweLiv0agCm X-Received: by 2002:a05:6871:1d3:b0:23b:360d:4549 with SMTP id 586e51a60fabf-24172f5e5d5mr17354775fac.38.1715758506518; Wed, 15 May 2024 00:35:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715758506; cv=pass; d=google.com; s=arc-20160816; b=IesruD/+vfyStNPFflNjK4PnkXG4oMxCUQEdSrp4vofjBI9PTS6DUh3O5oeiDR2paU R3zMiuSkta2fkowBnXavpUvhl/5mbbl36sRQifb28JVVj7QdIStw5KZlWZgd17RB4rUS MbL6SYZ9JhzOQ85FFUhX/PFv29e0V36SuGH1iMq/ddCgZQwkejibJukShmMqf6IEMg8f G4i8gW+hQx/L/J/CPNBTDteknDNZwwCepGpjLwLHXPomyKOdrs6eAoooY3Kh8yQnOd4P pqrOlgcJJ8SHJ1Dhj9iapNwNMVChWb28G7reme0nOaBSkyjLhEtxRwoGCwlyFj9YpmEk tX2Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:cc:to:from:date:references:in-reply-to:message-id :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:feedback-id:dkim-signature:dkim-signature; bh=vYBANP9AhE/d4SYDAtFqOYHR51zF89WgGBJY4yYfEbU=; fh=zfW8l5WQ/2BAwPhGI+djlOqozdeIzYCT16efkyftj9E=; b=PsLUHgU8uQpDRkRiRkjwfRbI+LwyAbL04zx4jA+t1iAnXlwiYloiG3/0rY6uaXWhph Zi/w7GJ860+COE8HvwHVMwTP3w0qbZevApj/nvyMOumrZJo0Tg0uYLJsDaeC83UZXDvV Y+6yoBMA6jb3Gt3Ka6i2NSl53gd0/6h9JZ2FGA5XRt888LyJ6c1Wkh0nYJ79WPWRL2Tx KMOzwpGMGXVBVwNDHLEXntK93JGpbjVgkbEwin75Vh52IPsJ+mVWHkEqk1uR1jSeYDyf +kBz7ghKGzLNs/svC4qM0+4kwG6bw2uhaKhBN0UbXRsXggabg2lnP+JoYZmMhVzRHaXf 0KdA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm3 header.b=fBh8nkRi; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=AsX96VWV; arc=pass (i=1 spf=pass spfdomain=arndb.de dkim=pass dkdomain=arndb.de dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=arndb.de); spf=pass (google.com: domain of linux-kernel+bounces-179586-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179586-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-634103f6a8bsi12994360a12.278.2024.05.15.00.35.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:35:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179586-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm3 header.b=fBh8nkRi; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=AsX96VWV; arc=pass (i=1 spf=pass spfdomain=arndb.de dkim=pass dkdomain=arndb.de dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=arndb.de); spf=pass (google.com: domain of linux-kernel+bounces-179586-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179586-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B8C6428197C for ; Wed, 15 May 2024 07:35:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A177446D9; Wed, 15 May 2024 07:34:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b="fBh8nkRi"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="AsX96VWV" Received: from wfout7-smtp.messagingengine.com (wfout7-smtp.messagingengine.com [64.147.123.150]) (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 153D342061; Wed, 15 May 2024 07:34:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.150 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715758498; cv=none; b=l5l02ae6uBLiiGSuqedtNsds/njp/KhNDoK49XI9t54JT72p7+gQmRYEBmf78Qr4ji8XCzqX7ShtUar2qJ8nkZIL9Nq+2q/bpz4eEaj0GKh7TWKCuySFsiX5LxhN06CQxN1cAruer833rXuIIYkylLy4LrteNBUoH7sHd5BX7mw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715758498; c=relaxed/simple; bh=o0K8SOZhFFx3AbDud2mrFyHDdGrcVFTLMD9MdfObI+0=; h=MIME-Version:Message-Id:In-Reply-To:References:Date:From:To:Cc: Subject:Content-Type; b=T1gtPYyMWuNmwoPeuEV2b98s2GeOonp/ShQIUc2u7FNP49cB5wh8RzlzXo3eXHIob5nMBDUPqG9dzjwI7dhLw2Tb963e6bHUhn9zlVGvCdmZrYD6cjejcwqeqI5RLvqEYG/Xnsz1IDgt7jQB4FGRAfqYfhlYfy6J1yDmlL+Ndqo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de; spf=pass smtp.mailfrom=arndb.de; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b=fBh8nkRi; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=AsX96VWV; arc=none smtp.client-ip=64.147.123.150 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arndb.de Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfout.west.internal (Postfix) with ESMTP id 664B51C000EC; Wed, 15 May 2024 03:34:53 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Wed, 15 May 2024 03:34:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1715758493; x=1715844893; bh=vYBANP9AhE /d4SYDAtFqOYHR51zF89WgGBJY4yYfEbU=; b=fBh8nkRioN2mg4e68WVi/3USgv +hXgKI9+wvlzhnDN/BsJAkWcdpd4vm8XxJ1ytSeV9eA5dJPGsYAHiwAWKBkiqI0o Z/nnMXdhVsQeu31HeBjkvfsw4y90IS20zEd1XXS6LklsF5IhWirTXBibO9GGpTgO OosXcJG1YXO9uhW/OiIwAwyLnwrbLzE+TxQA/ilRj2/eS/eK/TQ0iElSpEJfQx5Y 1kprX8MUZlkdQcPwZoG5tK67SyZ11d0Y+W+D3vzDK86aTsXACzwjRQBt6v2o8OKh r0lyugNyjYdec86oSIv5CyPIKMxBXWEstiyFwNtQAKa/87HigMWHWSmotCrQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1715758493; x=1715844893; bh=vYBANP9AhE/d4SYDAtFqOYHR51zF 89WgGBJY4yYfEbU=; b=AsX96VWVBUDft5ySkos/jCnMBF+Jq5h6nP2QvMhrDCL/ J27ZPMy9V8syoXKAfZN3bHQuKnpvYsBH7BfF81NGWq6bzD2/y+tM+zLjaZk8qh1K 78uckXnN7U6hMCOAMlC+rL3VxX2ikeqlmpUZx3hw1zRAu8toxyTAjgCZsfvc3SY/ BnfGNNpX17ggOEbdYUm5gmpyq703jVGoQPvs6QVDKKZFzr/NLZkUWWnC0k7lW4g7 9idkhMwYDmCMjSuLxKXqlkx8UaEsCUmC72B2YKc0wsUAnmYwGrq/G8Du5vrHHLuF f4fV/bfY4HWal34oyDp92MK43avjyJTOfqfo3GId1w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdegjedguddujecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvvefutgesthdtredtreertdenucfhrhhomhepfdet rhhnugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusgdruggvqeenucggtffrrg htthgvrhhnpeffheeugeetiefhgeethfejgfdtuefggeejleehjeeutefhfeeggefhkedt keetffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe grrhhnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id E9B46B6008D; Wed, 15 May 2024 03:34:51 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-455-g0aad06e44-fm-20240509.001-g0aad06e4 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: In-Reply-To: <20240514102757.b7034966a58e6cf44d75dc7d@linux-foundation.org> References: <20240418-alice-mm-v6-0-cb8f3e5d688f@google.com> <20240418-alice-mm-v6-2-cb8f3e5d688f@google.com> <20240514102757.b7034966a58e6cf44d75dc7d@linux-foundation.org> Date: Wed, 15 May 2024 07:34:31 +0000 From: "Arnd Bergmann" To: "Andrew Morton" , "Alice Ryhl" Cc: "Miguel Ojeda" , "Matthew Wilcox" , "Alexander Viro" , "Kees Cook" , "Alex Gaynor" , "Wedson Almeida Filho" , "Boqun Feng" , "Gary Guo" , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , "Benno Lossin" , "Andreas Hindborg" , "Greg Kroah-Hartman" , =?UTF-8?Q?Arve_Hj=C3=B8nnev=C3=A5g?= , "Todd Kjos" , "Martijn Coenen" , "Joel Fernandes" , "Carlos Llamas" , "Suren Baghdasaryan" , "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 Content-Type: text/plain On Tue, May 14, 2024, at 17:27, Andrew Morton wrote: > 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? How about /* * Architectures that #define INLINE_COPY_TO_USER use this function * directly in the normal copy_to_user(), the other ones go through * an extern _copy_to_user(), which expands the same code here. * Rust code always uses the extern definition. */ Arnd