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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250115072050.72oeibi735k3pjdq@vireshk-i7>
Date: Wed, 15 Jan 2025 12:50:50 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>,
	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 <benno.lossin@...ton.me>,
	Andreas Hindborg <a.hindborg@...nel.org>,
	Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
	linux-pm@...r.kernel.org,
	Vincent Guittot <vincent.guittot@...aro.org>,
	linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org
Subject: Re: [PATCH V7 03/16] rust: cpu: Add from_cpu()

On 14-01-25, 19:44, Greg KH wrote:
> > +pub fn from_cpu(cpu: u32) -> Result<&'static Device> {
> > +    // SAFETY: The pointer returned by `get_cpu_device()`, if not `NULL`, is a valid pointer to
> > +    // a `struct device` and is never freed by the C code.
> 
> I thought it was pointed out that it could be freed when a cpu was
> hot-unplugged?  Or is that a different device in the cpu code?  We seem
> to have 2 of them and it's not obvious which is which :(

I did reply [1] to that earlier. The CPU can get unregistered but the
memory for the device is never freed (it is part of struct cpu). Some
calls on the CPU device may fail later on (if called for an unregisted
dev), but should never crash the kernel.

-- 
viresh

[1] https://lore.kernel.org/all/20250109063605.gmykltd6bnjaspwm@vireshk-i7/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ