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: <6b8c65cc-d0cd-4022-8d8c-3a4aaf8d36e5@kernel.org>
Date: Wed, 2 Jul 2025 12:21:04 +0200
From: Danilo Krummrich <dakr@...nel.org>
To: Daniel Almeida <daniel.almeida@...labora.com>
Cc: 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>,
 Andreas Hindborg <a.hindborg@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>,
 Trevor Gross <tmgross@...ch.edu>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
 "Rafael J. Wysocki" <rafael@...nel.org>,
 Andrew Morton <akpm@...ux-foundation.org>,
 Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
 Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
 Bjorn Helgaas <bhelgaas@...gle.com>,
 Mika Westerberg <mika.westerberg@...ux.intel.com>,
 Ying Huang <huang.ying.caritas@...il.com>, Benno Lossin <lossin@...nel.org>,
 linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org,
 Fiona Behrens <me@...enk.dev>
Subject: Re: [PATCH v11 1/4] rust: io: add resource abstraction

> +#[cfg(CONFIG_HAS_IOPORT)]
> +/// Returns a reference to the global `ioport_resource` variable.
> +pub fn ioport_resource() -> &'static Resource {
> +    // SAFETY: `bindings::ioport_resoure` has global lifetime and is of type Resource.
> +    unsafe { Resource::as_ref(&raw mut bindings::ioport_resource) }
> +}
> +
> +#[cfg(CONFIG_HAS_IOMEM)]
> +/// Returns a reference to the global `iomem_resource` variable.
> +pub fn iomem_resource() -> &'static Resource {
> +    // SAFETY: `bindings::iomem_resoure` has global lifetime and is of type Resource.
> +    unsafe { Resource::as_ref(&raw mut bindings::iomem_resource) }
> +}

This caught my attention, and I have a few questions:

   1) What do you need them for? I don't see any methods that would usually
      consume those.

   2) Why are they behind CONFIG_HAS_IOPORT and CONFIG_HAS_IOMEM, even though the
      C instances are not?

   3) What happens if we pass them to IoMem::new()? Is this really safe, or do we
      need them to be a special Resource type?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ