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: <CAH5fLgi+Qf=o91XEPamjycdrGeso1yDEDOGNQRmmy-miakDaOg@mail.gmail.com>
Date: Thu, 6 Feb 2025 16:43:17 +0100
From: Alice Ryhl <aliceryhl@...gle.com>
To: Guangbo Cui <2407018371@...com>
Cc: daniel.almeida@...labora.com, a.hindborg@...nel.org, alex.gaynor@...il.com, 
	benno.lossin@...ton.me, bjorn3_gh@...tonmail.mco, boqun.feng@...il.com, 
	boris.brezillon@...labora.com, dakr@...nel.org, gary@...yguo.net, 
	gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org, ojeda@...nel.org, 
	rafael@...nel.org, robh@...nel.org, rust-for-linux@...r.kernel.org, 
	tmgross@...ch.edu
Subject: Re: [PATCH v6 2/3] rust: io: mem: add a generic iomem abstraction

On Wed, Feb 5, 2025 at 3:56 PM Guangbo Cui <2407018371@...com> wrote:
>
> > +/// A generic memory-mapped IO region.
> > +///
> > +/// Accesses to the underlying region is checked either at compile time, if the
> > +/// region's size is known at that point, or at runtime otherwise.
> > +///
> > +/// # Invariants
> > +///
> > +/// `IoMem` always holds an `IoRaw` inststance that holds a valid pointer to the
> > +/// start of the I/O memory mapped region.
> > +pub struct IoMem<const SIZE: usize = 0> {
> > +    io: IoRaw<SIZE>,
> > +}
>
> Compile-time checks are only possible when CONFIG_RUST_BUILD_ASSERT_ALLOW=y.
> Otherwise, using compile-time check APIs of Io will cause a modpost error
> because the rust_build_error symbol is not exported. Details at the issue[1].
>
> Maybe Io should expose compile-time check APIs only when CONFIG_RUST_BUILD_ASSERT_ALLOW=y?
> The expectation is that a build error should occur when calling `Io::readX` and
> `Io::writeX` due to a boundary check failure, rather than because the
> `rust_build_error` symbol is not exported.
>
> Link: https://github.com/Rust-for-Linux/linux/issues/1141 [1]

This compilation failure is correct. You're trying to use writeb even
though the size is not known at compile time. You should use
try_writeb instead.

Alice

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ