Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1906568rbb; Tue, 27 Feb 2024 05:13:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXsKjhpn1mI4iEZXMh46rsdaMN5AChmClcugS5MOaDymVRwRx57X0f+B9hpC/o3zT2SoYw17T6gZxn0kGwDzbyNCxO2U6+o+5unMEKD7g== X-Google-Smtp-Source: AGHT+IEwNDPFVu2Ci8Q1Q87/2cdMSTtMoX7QuGaadbSYtqAu0+nj5KZ3YcPEaAQ4O/iNp15Ucav/ X-Received: by 2002:a05:6402:c8f:b0:566:51ea:2d9a with SMTP id cm15-20020a0564020c8f00b0056651ea2d9amr93739edb.35.1709039580413; Tue, 27 Feb 2024 05:13:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709039580; cv=pass; d=google.com; s=arc-20160816; b=tW6jMl08uy2WIWQv8LeKqUFpThxWZ1sBxUyZm6WmpwAfa1sW+y6U6QZauiV+bFtqCB 5Mw80R1XTLShVfe2vFMqih32MvEtuJsOqPWIMjRlGk4l8D0GJgWdduULt8aKGy+ABD1X tz7eNyWSY2dU4t5XUwoezBOZKBeXDcFr5yIfNmZl8VKyXCxm1C3Jf8wazBcC6cbs9YYC JVudSSyIxUbC24cSaJyxfB+brm5o4kCpDlHVWhwPzwijN3VfYVR9/a8WwSUwebOOGx4I VY4wp2gerZYA0Rs1Xm/Xhqq/t9U+krtIoc8Mb3qK+w9wLDDeAeYfmWtYsNoFMhdPbBVu E+gg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=d3oWv3i2/XO5b533cdNomwEvxjqpP18WAK9tbqODocY=; fh=+pmZ2UEpzWOcaCzvkJB18C3rrdnM/YpicbSu87s1FK8=; b=g+T0edFWfz6GEHuYSucCO17xIqJGJ5vAUFyzWXhXaZwE0Yd22otGPAhXHQuxGiQHHy NttjRPXlLIoQ/YnCHwVNx2xu+mA7sgO5t7XgwqY3DialDGx84c2hnROL9rpTx7mLgIjL EEPbvWxgBGS5bb4CZeUzlECptLaswGOan3XlU+S+Qo74i2vFtNNV3aU3wC3QRYuHH4Zs PiRYM7VD3DpQFszbd3c2V2W0hB15SloTVPaMlBzU3pZSF2rhkE2Ep8qQqH46cnBwfGp7 Nx41pxh/Faz0oGgClXZLvVK3wycbGwtFx02w5UsfrY6dOj40W1aj1R4FE/3ze+R1FUxW YZ7Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=f7yw8rlX; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-83293-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83293-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id cm20-20020a0564020c9400b005664c403c45si169241edb.317.2024.02.27.05.13.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:13:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83293-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=f7yw8rlX; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-83293-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83293-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 9D7511F21727 for ; Tue, 27 Feb 2024 13:12:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 16B161EB25; Tue, 27 Feb 2024 13:12:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="f7yw8rlX" Received: from mail-ua1-f53.google.com (mail-ua1-f53.google.com [209.85.222.53]) (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 BC85413AA46 for ; Tue, 27 Feb 2024 13:12:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709039566; cv=none; b=tRNmFYR2nC3S24Qb2tYH9EQSIrWLpQWNDJCKGHEwHgooIklIsfiOghuilpCnnbbOSuSmIpkiXuDIqZKojkXoNq8a5XxF8dcqx87WL0yRnML7gD4e2ngq4VDz7w2ryroXeLm+uuKG5DxN2AYCwKaOIi+vJ5mE4f0fiAucmUMVdIw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709039566; c=relaxed/simple; bh=y6dpxMerbedpocP5qX8Fk424TWfiwib+4y7gPQ6TzzM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=D4vmh3z8j09QVPtdv+sAz3e5jreJoHMRvshS77IZ7lcjS43U3ABtZ79MbWXV6h+M8/n9vGtEr6Gpf6YkyghMPCaPb+a8Wxd8eVBQYQ3Ze/70+IzZFsa/H2U/65/Ns/T/dOa6EzFMx+4SVDD4HYwgQSTM+feg76vqCDXgk54Gw1k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=f7yw8rlX; arc=none smtp.client-ip=209.85.222.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-ua1-f53.google.com with SMTP id a1e0cc1a2514c-7d5bbbe592dso2226320241.0 for ; Tue, 27 Feb 2024 05:12:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709039563; x=1709644363; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=d3oWv3i2/XO5b533cdNomwEvxjqpP18WAK9tbqODocY=; b=f7yw8rlXRFO8RCB5v/Wh9ZIpMBjLKECCg/hhQ9SYuAh4yC+sGfh43eLbKYdaJTaMK7 lSZeqTOBl9YKInmXxtqAauIL3q7CIqtX7HN8UN21fUJyQOUSoRRoGDz0HPXdrhNYzh2Y ijdAVYjjfzqVsDCqB8lP9uNWhn0AHI48GB94aFPKRmx6kuIn0jhI10t/CXBNHD4zR1UW I5+ylCrYZk8qP9UgAysQOTorU3T5bgGPtZ0zmrueJtPB5f+x+WQMjyTozatTIOKW5qo/ 1DYpML4uLlpHy5GTbj3bxUkaxdfBvSpUElHiq/ig2cgI8k+Gz7yfce7nFIoeK0aanOvr o3Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709039563; x=1709644363; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d3oWv3i2/XO5b533cdNomwEvxjqpP18WAK9tbqODocY=; b=cKDcbEjnwAUwQX9xtqYbCL4ZU8dEsBC+t6vQL+uDk0Iy3igbU+hIr/hDvhv6k6GE8W oytwY/JwdqIopQyvAqgX3Lq5jxEJiCa48TM2SV1rNhwnLDJVkjWM5FC5S4P1q/NB8N+N A+YbRIGoTNapGC3BkN5xdMM18SuP87F9CjwBFEPRT7eRHJ92QFBH4RsWOE+KNPDihxY6 XVC/1bEcR7dCfxYKpVrMmiodWfO0YccrFfKM/pv9K4EavmX9AcRfsLFdvhPdqXYCvRtP l/fzyghTk7/PKJF1WhHQNsRTmRnssmHmFEsAm/od7fCnpRoNjShLX7Ea0Mos3+1WVvMX w5dQ== X-Forwarded-Encrypted: i=1; AJvYcCUAt1bkkExwPkXVPDlgLH6R4NW3cLLplD2YzNXJ8pPAVyUdsOabtExSsRT6JOEwIUQD9LrxngTopa3CTYngfN9/sk8hLYXBd6Dwv30F X-Gm-Message-State: AOJu0Yyh5Pg6cDzlaBAu4FdFpmE71qarqJkrgKZ2jkntBhAAbj2wzKWx wbB3zFM0B5oUfP7D2G1U96fzJX8R578yPNIHEsVreyi9Oy08VJAjbixuzb2m8NWTpebjX1hR1VE l4s8Mvfas4s3OAbDTrIh9ry/eIDmD8HiiI98j X-Received: by 2002:a1f:da81:0:b0:4c0:3116:e909 with SMTP id r123-20020a1fda81000000b004c03116e909mr6754352vkg.7.1709039563535; Tue, 27 Feb 2024 05:12:43 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240208-alice-mm-v2-0-d821250204a6@google.com> <20240208-alice-mm-v2-1-d821250204a6@google.com> In-Reply-To: From: Alice Ryhl Date: Tue, 27 Feb 2024 14:12:32 +0100 Message-ID: Subject: Re: [PATCH v2 1/4] rust: uaccess: add userspace pointers To: =?UTF-8?Q?Carlos_L=C3=B3pez?= Cc: Greg Kroah-Hartman , =?UTF-8?B?QXJ2ZSBIasO4bm5ldsOlZw==?= , 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 , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Kees Cook , Al Viro , Andrew Morton Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Feb 27, 2024 at 11:05=E2=80=AFAM Carlos L=C3=B3pez = wrote: > > > On 8/2/24 16:47, Alice Ryhl wrote: > > + /// Create a reader that can access the same range of data. > > + /// > > + /// Reading from the clone does not advance the current reader. > > + /// > > + /// The caller should take care to not introduce TOCTOU issues, as= described > > + /// in the documentation for [`UserSlice`]. > > + pub fn clone_reader(&self) -> UserSliceReader { > > + UserSliceReader { > > + ptr: self.ptr, > > + length: self.length, > > + } > > + } > > Just out of curiosity, is there any reason why this is not implemented > in terms of the Clone trait? I think people find a non-Clone-trait method higher friction than just calling .clone(), so this nudges people towards not using it if they don't really need it. But really, it could go either way. It would be okay to use the Clone trait= . Alice