Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1736125lqp; Mon, 15 Apr 2024 16:05:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVBXl8dZLUEVFphASa0cDUfzjEnGeX2FQQ/GhOEVZTKnb3jwvGkDS50GQ/nJR9r6XeZ91HnxF2hbINmrKmJrEf3RfCMb3viZadQ9LdGVQ== X-Google-Smtp-Source: AGHT+IFtyxORfspagA3a9/sRWATKGgjG2zL4FyjLt+5JLHtEm4bV+w5O5gx2kun8nzRifnEaSslr X-Received: by 2002:a17:902:f60b:b0:1e7:b6f4:2d77 with SMTP id n11-20020a170902f60b00b001e7b6f42d77mr554202plg.22.1713222329465; Mon, 15 Apr 2024 16:05:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713222329; cv=pass; d=google.com; s=arc-20160816; b=f71f1hMQ+0zQAf5A1MjEGyFSOYHPz37f4DtC7QF/hIBD5lWmQR3LjBscMMSo6WXhy7 X1DTfkXP/CYi521YQF8Xhhsam/19rwfiZPN0aoKA6e6iLhBfuOustNfXCGHjLBuAKwVn ZwSyR2jCUDgPB4XrgjeCjUurZg8eRo1THaWDsV4Eh50KMP6uW3+ab1cRlRiyWCqp0Le2 n6BZOiuYerarLtnNzDmLrukPFveCvAN5ZqTEXdGpDTcKGENajPyskldzQ77VfCV3pwko 00HeoouYKJ/4DEfEaDGSCXIwD+k+nbkq2BHk6ybWqNBvC4XeSGZFPtOlGefNUVVQ78hX uGjg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Yo3EV3bfEx0E8U36ciba2hXn2Sc3b8SZ2s8fl04bgqI=; fh=WrfYZUvGtDnJ3PmzGF7Ceg/ATw8ixpmp6PmL4CvTaoE=; b=XoVzjsddWXjF3C2X8dOMBng6PWEyViZF1WD+zIz7c1SdFYT6X1X1xYjew2RU1B1+zt yTyEyIJzQIODU1clw7nLWzS9HxzepY34R9xCJNHt/XVBVsLKOg0z65aB/SOGH/L4F4R5 sgdooD1Ag/kuc4xkNSV362ShP9ETE6BEcFEQWYmexjJv7D9ZHgqXachZP5VJzCu8O3c8 rCT1uW/6I22vkz9jX3szps7phyje26hqPY23HJ5STgM1ng2HhdqoljQ4KK654SrxK5QW wBKQkF66vO40MW+RhbhIS7pLAzAXQHnfYDF1cDD5oTYqUQyyAC3F8A1Ntcm1YmFdfAWw zICA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=OO3BEPOA; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-145993-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145993-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n6-20020a170902d2c600b001dee4bd73f3si8672381plc.599.2024.04.15.16.05.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 16:05:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145993-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=@chromium.org header.s=google header.b=OO3BEPOA; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-145993-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145993-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 0F94B282A29 for ; Mon, 15 Apr 2024 23:05:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7748C158D61; Mon, 15 Apr 2024 23:05:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="OO3BEPOA" Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D935A156977 for ; Mon, 15 Apr 2024 23:05:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713222321; cv=none; b=fXIJVgTLp+8Z3u6Q54bxEWFTA6eXEzcP/ognkopEKPqczf9XOLfJyqWm0hEeS1EdiFpJA+ynTN9JX/COSibK55aNc4ffNWszVJXrthHdqlrFADzXyxEZODXGVfc4k8ai08rVn03p7+h6Yey1/RsPxMgtiBYTK8NysDnTEf8tLso= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713222321; c=relaxed/simple; bh=0W2WWM+WXMki7GHsigtUNVnOpWEGnshZxotBdbsJZ+E=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Zq2yhQlJVo83gqy+C9AsyN/mSYzSMt4YDkfXul6E0DSHzB7+UHV1pDRqBQLS1b9LNBSaymODNteEAJLte4LiIs/PuBjTWjnlh0JN6Nofbwa/A0skR+8wsszGoq4S9keazKHwwqG1zFd+AtY+td3wgkB3J43notPPW1/iJJwAJXc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=OO3BEPOA; arc=none smtp.client-ip=209.85.210.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-6ee12766586so2474163b3a.0 for ; Mon, 15 Apr 2024 16:05:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713222319; x=1713827119; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Yo3EV3bfEx0E8U36ciba2hXn2Sc3b8SZ2s8fl04bgqI=; b=OO3BEPOAYipo0Xa+PU68F2I+F6RFB2ginNYj5MUILjvMpwS0oc2w9MQVhxzQAfL7z3 NMSecf1vTZImbiPvN4crZIBZlLg8QH9j/Tag7FpDnRiGmZyE9cLb2ItEU6tKy3HvJTUd xSRdE/w+OrCiQN3YXuKAT169JHf019DlzQVy8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713222319; x=1713827119; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Yo3EV3bfEx0E8U36ciba2hXn2Sc3b8SZ2s8fl04bgqI=; b=WRhuC+pKBsmLMxvJy3aFLKc/U0+PyZy0jmVon+gIcksoA+4dyIrJGFPD8ydOYvBcQK CfvMRoe5zRy9iKY2OuE3NCe6kaNoaokMNLOsasiyBeOg0faBUbRGwFW90E41XhC8GMw/ 8+O3LjrJRUKza3GDgP6jstYn5jKSBL3m6Gkefmudd/fqw4LreuQM/VvyDd09yhLnITh2 VrIJ0VEitS7dMo4xvez0RAPW1bUzAoaUFrP3WC4CO5iMHtFBUtBJg+2j/2C5THtT6Pfx XxsOlSpLC2UWXKEaQmEzapnraKGMKdq8hGbi+mNRXgAVTEkqjCg9VVzNJ4Tz1kmpeSWi Ik5A== X-Forwarded-Encrypted: i=1; AJvYcCXsipcBXjy662MFKjhksScw0aQS4Dehi03iGOtMKxuSLXc64lBp70Nd628OrNzGkoddclfwfec+v9iwbBV8WI2f4jyqzt+PWwywbW/g X-Gm-Message-State: AOJu0YxSGHdf7TJ97rMzBGdoHFL6HwtYDRD28WEL6tgaFWAVf/Ct/f5w cChPT70q8NaGX8CKT2aesyaiPDWsAE/l2bnXMmtZ2skhM1Vrcv3ba1ZayVfFGA== X-Received: by 2002:a05:6a00:1787:b0:6ec:ef1c:4dcd with SMTP id s7-20020a056a00178700b006ecef1c4dcdmr541831pfg.6.1713222319125; Mon, 15 Apr 2024 16:05:19 -0700 (PDT) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id go26-20020a056a003b1a00b006edceb4ea9dsm7679876pfb.166.2024.04.15.16.05.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 16:05:18 -0700 (PDT) Date: Mon, 15 Apr 2024 16:05:17 -0700 From: Kees Cook To: Alice Ryhl Cc: Miguel Ojeda , Matthew Wilcox , Al Viro , Andrew Morton , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Greg Kroah-Hartman , Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Carlos Llamas , Suren Baghdasaryan , Arnd Bergmann , linux-mm@kvack.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, Christian Brauner Subject: Re: [PATCH v5 2/4] uaccess: always export _copy_[from|to]_user with CONFIG_RUST Message-ID: <202404151605.6EFC791E@keescook> References: <20240415-alice-mm-v5-0-6f55e4d8ef51@google.com> <20240415-alice-mm-v5-2-6f55e4d8ef51@google.com> 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-Disposition: inline In-Reply-To: <20240415-alice-mm-v5-2-6f55e4d8ef51@google.com> On Mon, Apr 15, 2024 at 07:13:54AM +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. > > Signed-off-by: Arnd Bergmann Thanks for the updates and the comment on testing. :) Reviewed-by: Kees Cook -- Kees Cook