Re: [PATCH v4 1/2] rust: hrtimer: Restrict expires() to safe contexts
Andreas Hindborg <[email protected]>
| Newsgroups | org.kernel.vger.rust-for-linux |
|---|---|
| Message-ID | <[email protected]> |
"FUJITA Tomonori" <[email protected]> writes: > From: FUJITA Tomonori <[email protected]> > > HrTimer::expires() previously read node.expires via a volatile load, which > can race with C-side updates. Rework the API so it is only callable with > exclusive access or from the callback context. > > Introduce expires_unchecked() with an explicit safety contract, switch > HrTimer::expires() to Pin<&mut Self>, add > HrTimerCallbackContext::expires(), and route the read through > hrtimer_get_expires() via a Rust helper. > > Fixes: 4b0147494275 ("rust: hrtimer: Add HrTimer::expires()") > Closes: https://lore.kernel.org/rust-for-linux/[email protected]/ > Signed-off-by: FUJITA Tomonori <[email protected]> This looks good to me now. @Miguel, can you take this through rust or rust-fixes? Please add the missing bullet in the invariant on patch 2. Acked-by: Andreas Hindborg <[email protected]> Best regards, Andreas Hindborg