Comment 7 for bug 2023424

Revision history for this message
Dimitry Andric (dimitry.unified-streaming.com) wrote :

Ok, I found https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110027 : "[11/12 regression] Stack objects with extended alignments (vectors etc) misaligned on detect_stack_use_after_return".

As described in that bug, turning _off_ the ASAN_OPTION detect_stack_use_after_return makes the misalignment go away:

$ ~/ins/gcc-13-103-gf732bf6a603/bin/gcc -fsanitize=address -fstack-protector asan-align.c -o asan-align

$ LD_LIBRARY_PATH=/home/ubuntu/ins/gcc-13-103-gf732bf6a603/lib64 ./asan-align
explicitly aligned variable: 0x7f6c6f100020
asan-align: asan-align.c:11: main: Assertion `addr % 64 == 0' failed.
Aborted

$ LD_LIBRARY_PATH=/home/ubuntu/ins/gcc-13-103-gf732bf6a603/lib64 ASAN_OPTIONS="detect_stack_use_after_return=false" ./asan-align
explicitly aligned variable: 0x7ffe189ec4c0

The fix for master (14.x) is in https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=467898d513e602f5b5fc4183052217d7e6d6e8ab, while it was merged to 13.x in https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=a16d90ec302e588dab5d7d31ccdd7b3fd5c6214e .

I think it should be relatively safe to apply this patch to Ubuntu's gcc packages?