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] [thread-next>] [day] [month] [year] [list]
Message-Id: <4A89EA6C-7683-42CB-BA0E-0ED538480991@collabora.com>
Date: Fri, 25 Jul 2025 11:16:11 -0300
From: Daniel Almeida <daniel.almeida@...labora.com>
To: Lyude Paul <lyude@...hat.com>
Cc: rust-for-linux@...r.kernel.org,
 Thomas Gleixner <tglx@...utronix.de>,
 Boqun Feng <boqun.feng@...il.com>,
 linux-kernel@...r.kernel.org,
 Andreas Hindborg <a.hindborg@...nel.org>,
 FUJITA Tomonori <fujita.tomonori@...il.com>,
 Frederic Weisbecker <frederic@...nel.org>,
 Anna-Maria Behnsen <anna-maria@...utronix.de>,
 John Stultz <jstultz@...gle.com>,
 Stephen Boyd <sboyd@...nel.org>,
 Miguel Ojeda <ojeda@...nel.org>,
 Alex Gaynor <alex.gaynor@...il.com>,
 Gary Guo <gary@...yguo.net>,
 Björn Roy Baron <bjorn3_gh@...tonmail.com>,
 Benno Lossin <lossin@...nel.org>,
 Alice Ryhl <aliceryhl@...gle.com>,
 Trevor Gross <tmgross@...ch.edu>,
 Danilo Krummrich <dakr@...nel.org>
Subject: Re: [PATCH v6 3/7] rust: hrtimer: Add HrTimer::raw_forward() and
 forward()

[…]


> +
> +    /// Conditionally forward the timer.
> +    ///
> +    /// If the timer expires after `now`, this function does nothing and returns 0. If the timer
> +    /// expired at or before `now`, this function forwards the timer by `interval` until the timer
> +    /// expires after `now` and then returns the number of times the timer was forwarded by
> +    /// `interval`.
> +    ///
> +    /// Returns the number of overruns that occurred as a result of the timer expiry change.
> +    pub fn forward(self: Pin<&mut Self>, now: HrTimerInstant<T>, interval: Delta) -> u64
> +    where
> +        T: HasHrTimer<T>,
> +    {
> +        // SAFETY:
> +        // - `raw_forward` does not move `self`.
> +        // - Self is a mutable reference and thus always points to a valid `HrTimer`

I get what you're trying to say, but IMHO using the word "mutable" here is
confusing. Mutability has nothing to do on whether something is valid. This
should be rephrased, IMHO.

> +        // - The only way that we could hold a mutable reference to `HrTimer<T>` is if we have
> +        //   exclusive access to it - fulfilling the requirements of the C API.
> +        unsafe { Self::raw_forward(self.get_unchecked_mut(), now, interval) }
> +    }
> }
> 
> /// Implemented by pointer types that point to structs that contain a [`HrTimer`].
> -- 
> 2.50.0
> 
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ