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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aPJAbHz33FPpYGG5@google.com>
Date: Fri, 17 Oct 2025 13:11:08 +0000
From: Alice Ryhl <aliceryhl@...gle.com>
To: Lyude Paul <lyude@...hat.com>
Cc: dri-devel@...ts.freedesktop.org, rust-for-linux@...r.kernel.org, 
	Daniel Almeida <daniel.almeida@...labora.com>, Danilo Krummrich <dakr@...nel.org>, 
	David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>, Miguel Ojeda <ojeda@...nel.org>, 
	Alex Gaynor <alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...il.com>, 
	Gary Guo <gary@...yguo.net>, 
	"Björn Roy Baron" <bjorn3_gh@...tonmail.com>, Benno Lossin <lossin@...nel.org>, 
	Andreas Hindborg <a.hindborg@...nel.org>, Trevor Gross <tmgross@...ch.edu>, 
	Asahi Lina <lina+kernel@...hilina.net>, Shankari Anand <shankari.ak0208@...il.com>, 
	open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 1/9] Partially revert "rust: drm: gem: Implement
 AlwaysRefCounted for all gem objects automatically"

On Thu, Oct 16, 2025 at 05:08:14PM -0400, Lyude Paul wrote:
> Currently in order to implement AlwaysRefCounted for gem objects, we use a
> blanket implementation:
> 
>   unsafe impl<T: IntoGEMObject> AlwaysRefCounted for T { … }
> 
> While this technically works, it comes with the rather unfortunate downside
> that attempting to create a similar blanket implementation in any other
> kernel crate will now fail in a rather confusing way.
> 
> Using an example from the (not yet upstream) rust DRM KMS bindings, if we
> were to add:
> 
>   unsafe impl<T: RcModeObject> AlwaysRefCounted for T { … }
> 
> Then the moment that both blanket implementations are present in the same
> kernel tree, compilation fails with the following:
> 
>    error[E0119]: conflicting implementations of trait `types::AlwaysRefCounted`
>       --> rust/kernel/drm/kms.rs:504:1
>        |
>    504 | unsafe impl<T: RcModeObject> AlwaysRefCounted for T {
>        | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
>        |
>       ::: rust/kernel/drm/gem/mod.rs:97:1
>        |
>    97  | unsafe impl<T: IntoGEMObject> AlwaysRefCounted for T {
>        | ---------------------------------------------------- first implementation here
> 
> So, revert these changes for now. The proper fix for this is to introduce a
> macro for copy/pasting the same implementation of AlwaysRefCounted around.
> 
> This reverts commit 38cb08c3fcd3f3b1d0225dcec8ae50fab5751549.
> 
> Signed-off-by: Lyude Paul <lyude@...hat.com>
> 
> ---
> V2:
> * Rewrite the commit message to explain a bit more why we don't want a
>   blanket implementation for this.
> 
> Signed-off-by: Lyude Paul <lyude@...hat.com>

Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ