[llvm-dev] [ASAN] [Regression] Stack pointer corruption on ARMv7

Vit “vit9696” U via llvm-dev llvm-dev at lists.llvm.org
Sun Nov 28 09:09:06 PST 2021


I discovered a stack pointer corruption regression in LLVM 13 causing stack leak with ASAN enabled when targeting cortex-a9.

The issue is reproducible with the file in the attachment. Also published online[1]. The arguments to compile are as follows:

clang -o error.o -c -target arm-gnu-linux-eabi -mcpu=cortex-a9 -fsanitize=address error.c

The problematic part is the loop in the `test` function. When `func` is called, LLVM does not adjust the stack back, causing fast stack overflow:

.LBB2_5:                                @ %for.cond
        sub     sp, sp, #8
        str     r12, [sp]
        bl      func
.LBB2_7:                                @ %if.end
        b       .LBB2_5

LLVM 12.0.1 does not have this issue. I will post the issue to the bugtracker when GitHub Issues land or bugzilla returns. Can anyone confirm that the issue is still present in main?

Best regards,

[1] https://godbolt.org/z/GjxqPfMW6

-------------- next part --------------
A non-text attachment was scrubbed...
Name: error.c
Type: application/octet-stream
Size: 360 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211128/30616bda/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211128/30616bda/attachment.sig>

More information about the llvm-dev mailing list