Rust for Linux List
 help / color / mirror / Atom feed
From: "Gary Guo" <gary@garyguo.net>
To: "Deborah Brouwer" <deborah.brouwer@collabora.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"Onur Özkan" <work@onurozkan.dev>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>
Cc: <rust-for-linux@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH v4 1/3] rust: uaccess: add UserSliceWriter::clear()
Date: Sat, 21 Nov 2026 16:21:26 +0000	[thread overview]
Message-ID: <DN10YV2PJNQ1.2ZQRU6MQ9BS@garyguo.net> (raw)
In-Reply-To: <20261020-b4-dev_query_fixes-v4-1-df66b4c98bc6@collabora.com>

On Wed Oct 21, 2026 at 1:06 AM BST, Deborah Brouwer wrote:
> Add a method to zero the remaining bytes in a UserSliceWriter.
> 
> If userspace provides a buffer that is larger than necessary, provide
> a method to zero out the remaining UserSliceWriter buffer. This avoids
> userspace consuming potentially uninitialized memory and/or mistaking it
> for data intentionally provided by the kernel.
> 
> Use the #[inline] annotation to make this clear() method available for
> inlining outside of the kernel crate.
> 
> Since clear_user() is architecturally defined and may be a macro or inline
> function, add a rust helper to make clear_user() callable from rust.
> 
> Reviewed-by: Alice Ryhl <aliceryhl@google.com>
> Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>

Reviewed-by: Gary Guo <gary@garyguo.net>

> ---
>  rust/helpers/uaccess.c |  6 ++++++
>  rust/kernel/uaccess.rs | 24 ++++++++++++++++++++++++
>  2 files changed, 30 insertions(+)


  reply	other threads:[~2026-11-21 16:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-21  0:06 [PATCH v4 0/3] drm/tyr: allow mismatched buffers for dev_query Deborah Brouwer
2026-10-21  0:06 ` [PATCH v4 1/3] rust: uaccess: add UserSliceWriter::clear() Deborah Brouwer
2026-11-21 16:21   ` Gary Guo [this message]
2026-10-21  0:06 ` [PATCH v4 2/3] rust: uaccess: add method to get UserPtr from u64 Deborah Brouwer
2026-10-21  8:52   ` Alice Ryhl
2026-11-21 16:21   ` Gary Guo
2026-10-21  0:06 ` [PATCH v4 3/3] drm/tyr: allow userspace buffers to be mismatched Deborah Brouwer
2026-10-21  8:52   ` Alice Ryhl
2026-11-21 14:18 ` [PATCH v4 0/3] drm/tyr: allow mismatched buffers for dev_query Alice Ryhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DN10YV2PJNQ1.2ZQRU6MQ9BS@garyguo.net \
    --to=gary@garyguo.net \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=deborah.brouwer@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=work@onurozkan.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox