[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: stack bounds
From: |
Paul Eggert |
Subject: |
Re: stack bounds |
Date: |
Sun, 11 Oct 2020 11:49:55 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
On 10/10/20 2:49 PM, Bruno Haible wrote:
gcc -fstack-clash-protection -m32 -O2 stackish.c fixes this issue.
Yes. However, the GCC manual says this about -fstack-clash-protection:
Most targets do not fully support stack clash protection. However,
on those targets '-fstack-clash-protection' will protect dynamic
stack allocations. '-fstack-clash-protection' may also provide
limited protection for static stack allocations if the target
supports '-fstack-check=specific'.
which is not as close to "it should just work" as I'd like, especially when I go
read the section on -fstack-check. I suppose I need to look at the output of gcc
-S -fstack-clash-protection on my platform (and understand what the OS does) to
know whether stack overflow is detected reliably.
That being said, it does look like a reliability win if we start using
-fstack-clash-protection on platforms like Fedora x86-64 that support it and do
not enable it by default. Perhaps we should have a Gnulib or Autoconf macro that
does that.