From: "Gary Guo" <gary@garyguo.net>
To: "Gary Guo" <gary@garyguo.net>,
"Alistair Popple" <apopple@nvidia.com>,
<rust-for-linux@vger.kernel.org>,
"nova-gpu" <nova-gpu@lists.linux.dev>
Cc: "M Henning" <mhenning@darkrefraction.com>,
"Danilo Krummrich" <dakr@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"David Airlie" <airlied@gmail.com>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Benno Lossin" <lossin@kernel.org>,
"Eliot Courtney" <ecourtney@nvidia.com>,
"John Hubbard" <jhubbard@nvidia.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
<linux-kernel@vger.kernel.org>, <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH v6 01/13] rust: auxiliary: let registration_data_with() closures return covariant sub-fields
Date: Mon, 19 Oct 2026 17:16:40 +0100 [thread overview]
Message-ID: <DM8Y78VGDXM5.36K23TMPY8ZVZ@garyguo.net> (raw)
In-Reply-To: <DM8Y4G5JMZ64.9PYKH079V51H@garyguo.net>
On Mon Oct 19, 2026 at 5:13 PM BST, Gary Guo wrote:
> On Wed Sep 9, 2026 at 7:44 AM BST, Alistair Popple wrote:
>> The closure passed to registration_data_with() currently receives
>> `Pin<&'a F::Of<'a>>` with `'a` universally quantified. This prevents the
>> closure from returning references derived from the registration data,
>> even for sub-fields that are covariant in their lifetime, because the
>> compiler cannot relate `'a` to any lifetime the caller knows about.
>>
>> Tie the outer reference to the `&self` lifetime instead, i.e. pass
>> `Pin<&'this F::Of<'a>>`. This gives the closure the implied bound
>> `'a: 'this`, so covariant sub-fields such as `&'a T` can be coerced to
>> `'this` and returned directly, while invariant fields still cannot be
>> coerced and therefore cannot escape with an incorrect lifetime.
>>
>> This allows auxiliary child drivers to project covariant data out of
>> invariant registration data without having to wrap every use in a
>> closure.
>
> Looking at this again I think the current API might be unsound where this patch
> becomes fix rather than just a feature update.
>
> For an invariant `&'b F::Of<'a>`, it's actually a requirement that `'a` strictly
> outlive `'b`. With the current API surface, we can obtain a `&'a F::Of<'a>`,
> then we can store it inside `F::Of<'a>` (because, well, F::Of<'a> being
> invariant, it can internally have a `Mutex<Option<F::Of<'a>>`), and then we're
> able to UAF within the destruction code of `F::Of<'a>`.
>
> The fix, is, well, this patch.
>
> Would you might pulling this patch out, rework the commit message a bit and send
> as a standalone fix?
>
> Best,
> Gary
Ah, I am looking at an old thread, this has been merged now.
Ignore the message please.
Best,
Gary
next prev parent reply other threads:[~2026-10-19 16:16 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 6:44 [PATCH v6 00/13] gpu: nova: Export parameters from nova-core to nova-drm Alistair Popple
2026-09-09 6:44 ` [PATCH v6 01/13] rust: auxiliary: let registration_data_with() closures return covariant sub-fields Alistair Popple
2026-10-19 16:13 ` Gary Guo
2026-10-19 16:16 ` Gary Guo [this message]
2026-09-09 6:44 ` [PATCH v6 02/13] gpu: nova-core: Add public driver API to nova-core Alistair Popple
2026-09-09 6:44 ` [PATCH v6 03/13] drm: nova: Add DRM registration data Alistair Popple
2026-09-09 6:44 ` [PATCH v6 04/13] drm: nova: Add GPU architecture enum to nova-drm UAPI Alistair Popple
2026-09-09 6:44 ` [PATCH v6 05/13] drm: nova: Add chipid " Alistair Popple
2026-09-09 6:44 ` [PATCH v6 06/13] rust: uaccess: add UserSliceWriter::write_truncated() Alistair Popple
2026-09-27 10:32 ` Miguel Ojeda
2026-09-09 6:45 ` [PATCH v6 07/13] drm: nova: Add an info ioctl Alistair Popple
2026-09-09 6:45 ` [PATCH v6 08/13] drm: nova: Add usable VRAM size to GPU info Alistair Popple
2026-10-19 15:43 ` Faith Ekstrand
2026-09-09 6:45 ` [PATCH v6 09/13] drm: nova: Use nova-core to read VRAM_BAR_SIZE parameter Alistair Popple
2026-09-09 6:45 ` [PATCH v6 10/13] drm: nova: Expose a render node Alistair Popple
2026-09-09 6:45 ` [PATCH v6 11/13] drm: nova: Report GPU name in GPU info Alistair Popple
2026-09-09 6:45 ` [PATCH v6 12/13] drm: nova: Report GPU short " Alistair Popple
2026-09-09 6:45 ` [PATCH v6 13/13] drm: nova: Report GPU GID " Alistair Popple
2026-09-27 12:17 ` [PATCH v6 00/13] gpu: nova: Export parameters from nova-core to nova-drm Danilo Krummrich
2026-09-27 12:25 ` Danilo Krummrich
2026-09-30 23:08 ` Alistair Popple
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=DM8Y78VGDXM5.36K23TMPY8ZVZ@garyguo.net \
--to=gary@garyguo.net \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=apopple@nvidia.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=ecourtney@nvidia.com \
--cc=gregkh@linuxfoundation.org \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=mhenning@darkrefraction.com \
--cc=nova-gpu@lists.linux.dev \
--cc=rafael@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
/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