[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DAPV905HEGUN.5CLGEF6MLNWN@kernel.org>
Date: Wed, 18 Jun 2025 20:21:33 +0200
From: "Benno Lossin" <lossin@...nel.org>
To: "Alice Ryhl" <aliceryhl@...gle.com>
Cc: "Miguel Ojeda" <ojeda@...nel.org>, "Andrew Morton"
<akpm@...ux-foundation.org>, "Alexander Viro" <viro@...iv.linux.org.uk>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>, "Boqun Feng"
<boqun.feng@...il.com>, "Gary Guo" <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>, "Andreas
Hindborg" <a.hindborg@...nel.org>, "Trevor Gross" <tmgross@...ch.edu>,
"Danilo Krummrich" <dakr@...nel.org>, <rust-for-linux@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 2/2] uaccess: rust: add
UserSliceReader::strcpy_into_buf
On Tue Jun 17, 2025 at 10:55 AM CEST, Alice Ryhl wrote:
> On Tue, Jun 17, 2025 at 9:38 AM Benno Lossin <lossin@...nel.org> wrote:
>> What about the case `self.length == 0`? Will `raw_strncpy_from_user`
>> return early with a page fault, or will it return with `len == 0`?
>> Because if it is the latter, then this will result in UB.
>
> If `self.length == 0`, then you will either:
> 1. If buf.is_empty() then you return EINVAL at the top.
> 2. Otherwise, you return EFAULT from the `len < buf.len()` case.
Ah that makes sense. Thanks for explaining.
---
Cheers,
Benno
Powered by blists - more mailing lists