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: <Z60Lb4OK3jLCAAra@pollux>
Date: Wed, 12 Feb 2025 21:58:23 +0100
From: Danilo Krummrich <dakr@...nel.org>
To: Tamir Duberstein <tamird@...il.com>
Cc: Gary Guo <gary@...yguo.net>, Miguel Ojeda <ojeda@...nel.org>,
	DJ Delorie <dj@...hat.com>, Eric Blake <eblake@...hat.com>,
	Paul Eggert <eggert@...ucla.edu>,
	Alex Gaynor <alex.gaynor@...il.com>,
	Boqun Feng <boqun.feng@...il.com>,
	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>,
	rust-for-linux@...r.kernel.org, linux-man@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5] rust: alloc: satisfy POSIX alignment requirement

On Wed, Feb 12, 2025 at 03:47:11PM -0500, Tamir Duberstein wrote:
> Looks like I wasn't the only one to fall into the trap (rust/kernel/io.rs):
> 
>     #[inline]
>     const fn io_addr_assert<U>(&self, offset: usize) -> usize {
>         build_assert!(Self::offset_valid::<U>(offset, SIZE));
> 
>         self.addr() + offset
>     }
> 
> since offset isn't known at compile time, this can easily be misused?

Well, that's intentional.

iomem.readb(0x0)     // succeeds if SIZE >=1
iomem.readb(foo)     // fails if foo is not known at compile time
iomem.try_readb(foo) // succeeds if self.maxsize() >= 1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ