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. 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]
.LBB2_7: @ %if.end
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?
error.c (360 Bytes)