[cfe-dev] stack overflow detection?

Kostya Serebryany kcc at google.com
Fri Oct 4 11:57:34 PDT 2013


Are you sure your test is correct?
It looks too simplistic and the compiler may turn it into something else.
On my x86 box:

% clang z.c ; ./a.out
Segmentation fault (core dumped)
% clang z.c -O; ./a.out
# <passed>



On Fri, Oct 4, 2013 at 9:13 PM, Greg Fitzgerald <garious at gmail.com> wrote:

> On Thu, Oct 3, 2013 at 9:58 PM, Kostya Serebryany <kcc at google.com> wrote:
> > Meanwhile, could you try to reverse the order of these two call in
> > asan/asan_rtl.cc and see if it helps?
> >   InstallSignalHandlers();
> >   AsanTSDInit(AsanThread::TSDDtor);
>
> That change fixes the assertion problem, but the stack overflow is
>

Good. I'll submit the change late next week.

--kcc


> still not detected.  Here's the code:
>
> static void loop() {
>   loop();  // BOOM
> }
>
> int main() {
>   loop();
>   return 0;
> }
>
>
> And here's how I execute it:
>
> $ adb  shell
> # cd /data/data
> # ASAN_OPTIONS=use_sigaltstack=1
> LD_PRELOAD=/data/data/libclang_rt.asan-arm-android.so
> ./example_StackExhaustion
>
>
> -Greg
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131004/efa9e87f/attachment.html>


More information about the cfe-dev mailing list