[RFA][PATCH] Stack clash protection 06/08 - V4

Jeff Law law@redhat.com
Mon Sep 25 15:29:00 GMT 2017


On 09/25/2017 06:41 AM, Segher Boessenkool wrote:
> On Mon, Sep 25, 2017 at 05:52:27AM -0500, Segher Boessenkool wrote:
>> Bootstrap+testsuite finished on BE, but I forgot to enable stack-clash
>> protection by default, whoops.  Will have results later today (also LE).
> 
> Some new failures show up:
> 
> +FAIL: c-c++-common/ubsan/vla-1.c   -O0  execution test
> 
> /home/segher/src/gcc/gcc/testsuite/c-c++-common/ubsan/vla-1.c:18:7: runtime error: variable length array bound evaluates to non-positive value -1
> /home/segher/src/gcc/gcc/testsuite/c-c++-common/ubsan/vla-1.c:24:7: runtime error: variable length array bound evaluates to non-positive value -1
> /home/segher/src/gcc/gcc/testsuite/c-c++-common/ubsan/vla-1.c:24:7: runtime error: variable length array bound evaluates to non-positive value -1
> /home/segher/src/gcc/gcc/testsuite/c-c++-common/ubsan/vla-1.c:30:7: runtime error: variable length array bound evaluates to non-positive value -1
> /home/segher/src/gcc/gcc/testsuite/c-c++-common/ubsan/vla-1.c:30:7: runtime error: variable length array bound evaluates to non-positive value -1
> /home/segher/src/gcc/gcc/testsuite/c-c++-common/ubsan/vla-1.c:30:7: runtime error: variable length array bound evaluates to non-positive value -1
> /home/segher/src/gcc/gcc/testsuite/c-c++-common/ubsan/vla-1.c:36:7: runtime error: variable length array bound evaluates to non-positive value -5
Yes.  I've known about this.

What happens is ubsan detects the error, but allows the code to continue
to run and try to allocate huge stacks.  The stack clash code comes
along and tries to probe the just allocated space which fails in the
expected manner.  It's really a testsuite issue and not an issue with
either UB or stack clash protection -- that's why I didn't call it out.

We could ask the sanitizers to abort on detecting UB, but then the test
itself needs to be split up (and that's the right thing to do IMHO).

There are other tests which are going to fail -- things like mixing
-fstack-check and -fstack-clash and an assortment of guality things.

Jeff



More information about the Gcc-patches mailing list