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-next>] [day] [month] [year] [list]
Date:   Sat, 31 Jul 2021 00:42:34 +0800
From:   Boqun Feng <boqun.feng@...il.com>
To:     linux-arch@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
        Wedson Almeida Filho <wedsonaf@...gle.com>,
        Gary Guo <gary@...yguo.net>, Hector Martin <marcan@...can.st>,
        Arnd Bergmann <arnd@...db.de>,
        Linus Walleij <linus.walleij@...aro.org>
Subject: [Question] Alignment requirement for readX() and writeX()

Hi,

The background is that I'm reviewing Wedson's PR on IoMem for
Rust-for-Linux project:
	
	https://github.com/Rust-for-Linux/linux/pull/462

readX() and writeX() are used to provide Rust code to read/write IO
memory. And I want to find whether we need to check the alignment of the
pointer. I wonder whether the addresses passed to readX() and writeX()
need to be aligned to the size of the accesses (e.g. the parameter of
readl() has to be a 4-byte aligned pointer).

The only related information I get so far is the following quote in
Documentation/driver-io/device-io.rst:

	On many platforms, I/O accesses must be aligned with respect to
	the access size; failure to do so will result in an exception or
	unpredictable results.

Does it mean all readX() and writeX() need to use aligned addresses?
Or the alignment requirement is arch-dependent, i.e. if the architecture
supports and has enabled misalignment load and store, no alignment
requirement on readX() and writeX(), otherwise still need to use aligned
addresses.

I know different archs have their own alignment requirement on memory
accesses, just want to make sure the requirement of the readX() and
writeX() APIs.

Thanks a lot!

Regards,
Boqun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ