[LEDE-DEV] [PATCH] kmodloader: don't store aliases info in struct module

Yousong Zhou yszhou4tech at gmail.com
Thu Feb 23 16:26:15 PST 2017


On 23 February 2017 at 21:58, Felix Fietkau <nbd at nbd.name> wrote:
>> I actually thought about patching calloc_a to make sizeof_long-aligned
>> allocation as the comment in libubox/utils.h says the func should "allocate a
>> block of memory big enough to hold multiple aligned objects."
>>
>> But that's too corase a solution for a fundamental lib and can waste runtime
>> memory.  Maybe we should reword that comment and provide a few helper macros
>> like SHORT_ALIGN, INT_ALIGN, LONG_ALIGN?
> I think aligning to 4 bytes by default in calloc_a might be a good idea.
> For cases where it's important to not waste any bytes, we could have an
> unaligned variant of it.

Fixing it to 4 bytes is not enough.

The AArch64 ref manual says  in C2.2 Loads and stores that "Apart from
Load-Exclusive, Store-Exclusive, Load-Acquire, and Store-Release,
addresses can have any alignment unless strict alignment checking is
enabled, that is if SCTLR_ELx.A == 1." and otherwise Alignment fault
can happen on misaligned access.

               yousong



More information about the Lede-dev mailing list