On Mon, Sep 19, 2022 at 04:24:19PM +0200, Enrico Scholz wrote: > Sascha Hauer <sha@xxxxxxxxxxxxxx> writes: > > >> | zstd_decomp_init:536 workspace=8ff1a004+161320 > >> | ERROR: initcall ubifs_init+0x1/0xc4 failed: Invalid argument > >> > > If you had asked me which alignment we have then I would have said it's > > bigger. OTOH I never received any reports about insufficient alignment > > on ARM or any other 32bit architecture. > > The code which failed for me was added 3 months ago > > | commit b4a9782d4f56333e897dccc35c2c27e2605f6b93 > | Author: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> > | Date: Wed Jul 13 12:09:18 2022 +0200 > | > | lib: zstd: sync with Linux > > and the Kconfig options (FS_UBIFS_COMPRESSION_ZSTD) are set to "off"... When I said I received no reports about insufficient malloc alignment I meant reports about erroneous accesses, like wrong data read/writes or data aborts. > > > > I suspect we could just drop the check without any harm, but that's just > > a gut feeling because we never had any alignment issues. > > > > BTW are you sure ldrd/strd need 8 byte alignment? > > Their EX variants (LDREXD + STREXD; see [1]). Unaligned access on > plain LDRD/STRD is allowed on ARMv7-A. But not on ARMv7-M or ARMv6 and > earlier. Ok, I found this for the LDRD instruction: | Prior to ARMv6, if the memory address is not 64-bit aligned, the data read from memory is | UNPREDICTABLE. Alignment checking (taking a data abort), and support for a big-endian | (BE-32) data format are implementation options. So it seems it's really a good idea to increase malloc alignment accordingly. Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |