[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87zflu2ai4.fsf@kernel.org>
Date: Wed, 20 Nov 2024 16:25:07 +0100
From: Andreas Hindborg <a.hindborg@...nel.org>
To: "Lyude Paul" <lyude@...hat.com>
Cc: "Miguel Ojeda" <ojeda@...nel.org>, "Anna-Maria Behnsen"
<anna-maria@...utronix.de>, "Frederic Weisbecker" <frederic@...nel.org>,
"Thomas Gleixner" <tglx@...utronix.de>, "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" <benno.lossin@...ton.me>, "Alice Ryhl" <aliceryhl@...gle.com>,
"Trevor Gross" <tmgross@...ch.edu>, <rust-for-linux@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 06/13] rust: hrtimer: add `UnsafeTimerPointer`
"Lyude Paul" <lyude@...hat.com> writes:
> On Thu, 2024-10-17 at 15:04 +0200, Andreas Hindborg wrote:
>> Add a trait to allow unsafely queuing stack allocated timers.
>>
>> Signed-off-by: Andreas Hindborg <a.hindborg@...nel.org>
>> ---
>> rust/kernel/hrtimer.rs | 33 +++++++++++++++++++++++++++++++++
>> 1 file changed, 33 insertions(+)
>>
>> diff --git a/rust/kernel/hrtimer.rs b/rust/kernel/hrtimer.rs
>> index eeed2afd501b64b94d57cc658616659e28785078..e97d7b8ec63ce6c9ac3fe9522192a28fba78b8ba 100644
>> --- a/rust/kernel/hrtimer.rs
>> +++ b/rust/kernel/hrtimer.rs
>> @@ -151,6 +151,39 @@ pub trait TimerPointer: Sync + Sized {
>> fn start(self, expires: Ktime) -> Self::TimerHandle;
>> }
>>
>> +/// Unsafe version of [`TimerPointer`] for situations where leaking the
>> +/// `TimerHandle` returned by `start` would be unsound. This is the case for
>> +/// stack allocated timers.
>> +///
>> +/// Typical implementers are pinned references such as [`Pin<&T>].
>
> Missing a `
Thanks! I wonder why this is not caught when building the docs.
Best regards,
Andreas Hindborg
Powered by blists - more mailing lists