lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <DAKJPI52CL6O.5AHQSFJBEZPR@kernel.org>
Date: Thu, 12 Jun 2025 14:15:33 +0200
From: "Benno Lossin" <lossin@...nel.org>
To: "Alice Ryhl" <aliceryhl@...gle.com>, "Miguel Ojeda" <ojeda@...nel.org>
Cc: "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>, "Marcelo Moreira"
 <marcelomoreira1905@...il.com>, <rust-for-linux@...r.kernel.org>,
 <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] revocable: rust: document why &T is not used in
 RevocableGuard

On Thu Jun 12, 2025 at 1:17 PM CEST, Alice Ryhl wrote:
> When a reference appears in a function argument, the reference is
> assumed to be valid for the entire duration of that function call; this
> is called a stack protector [1]. Because of that, custom pointer types
> whose destructor may invalidate the pointee (i.e. they are more similar
> to Box<T> than &T) cannot internally use a reference, and must instead
> use a raw pointer.
>
> This issue is something that is often missed during unsafe review. For
> examples, see [2] and [3]. To ensure that people don't try to simplify
> RevocableGuard by changing the raw pointer to a reference, add a comment
> to that effect.
>
> Link: https://perso.crans.org/vanille/treebor/protectors.html [1]
> Link: https://users.rust-lang.org/t/unsafe-code-review-semi-owning-weak-rwlock-t-guard/95706 [2]
> Link: https://lore.kernel.org/all/aEqdur4JTFa1V20U@google.com/ [3]
> Signed-off-by: Alice Ryhl <aliceryhl@...gle.com>

Thanks!

Reviewed-by: Benno Lossin <lossin@...nel.org>

---
Cheers,
Benno

> ---
>  rust/kernel/revocable.rs | 4 ++++
>  1 file changed, 4 insertions(+)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ