[PATCH v4] shell: exchange Dijkstra $(( )) evaluator..

Harald van Dijk harald at gigawatt.nl
Wed Sep 7 14:46:12 UTC 2022


On 07/09/2022 13:43, Steffen Nurpmeso wrote:
> Harald van Dijk wrote in
>   <92eff87d-3bfe-b1bb-03e1-5f280184434d at gigawatt.nl>:
>    ...
>   |The supplied patch appears to fix both #1 and #2, but it has alignment
>   |issues: when UBSAN is enabled, I see a lot of "runtime error: store to
>   |misaligned address <...> for type 'char *', which requires 4 byte
>   |alignment" warnings when using shell arithmetic.
> 
> ASAN works, UBSAN i have not tried.  How can char* require 4 byte
> alignment?

This message means the char * object itself needs to be aligned on a 4 
byte boundary, and isn't. It doesn't say anything about what the char * 
points to. It's the same alignment requirement that results (on typical 
platforms) in padding in struct S { char a; char *b; } s; between the 
s.a and s.b members, despite the fact that as you rightly hint, s.b can 
hold values pointing anywhere without alignment issues.

Cheers,
Harald van Dijk


More information about the busybox mailing list