Vit “vit9696” U via llvm-dev
2021-Nov-28 17:09 UTC
[llvm-dev] [ASAN] [Regression] Stack pointer corruption on ARMv7
Hello,
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,
Vitaly
[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>
Vit “vit9696” U via llvm-dev
2021-Nov-28 21:33 UTC
[llvm-dev] [ASAN] [Regression] Stack pointer corruption on ARMv7
The issue is present in main and is caused by d88f96dff3f192fc0c1bf57f7810b95a709b3591. Added Tim and Jessica to CC. Differential: https://reviews.llvm.org/D102613 Best regards, Vitaly> On 28 Nov 2021, at 20:09, Vit “vit9696” U <vit9696 at avp.su> wrote: > > Hello, > > 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, > Vitaly > > [1] https://godbolt.org/z/GjxqPfMW6 > > <error.c>-------------- 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/20211129/98917d30/attachment.sig>