https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78654

            Bug ID: 78654
           Summary: ubsan can lead to excessive stack usage
           Product: gcc
           Version: 7.0
               URL: https://bugs.linaro.org/show_bug.cgi?id=2350
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: clyon at gcc dot gnu.org
  Target Milestone: ---

[Forwarding Arnd's bug report from
https://bugs.linaro.org/show_bug.cgi?id=2350]

When building the kernel with all sanitizers enabled, some functions have a
much larger stack frame than expected. In some cases we just barely cross the
1024 byte stack size limit for functions that were already using a lot, but one
file sticks out from using almost twice as much as before.

Using today's trunk
$ arm-none-linux-gnueabi-gcc -O2 -Wno-pointer-sign  -Wframe-larger-than=100 -
c serpent_generic.i 
frame size 528

$ arm-none-linux-gnueabi-gcc -O2 -Wno-pointer-sign  -Wframe-larger-than=1024 -c
 serpent_generic.i -fsanitize=shift -fsanitize=integer-divide-by-zero
-fsanitize=unreachable -fsanitize=vla-bound -fsanitize=null
-fsanitize=signed-integer-overflow -fsanitize=bounds -fsanitize=object-size
-fsanitize=returns-nonnull-attribute -fsanitize=bool -fsanitize=enum
-fsanitize=alignment
frame size 1072

$ arm-none-linux-gnueabi-gcc  -Wall -Wframe-larger-than=100 -Wno-pointer-sign
-Os -c  mb86a16.i
frame size 416

$ arm-none-linux-gnueabi-gcc  -Wall -Wframe-larger-than=100 -Wno-pointer-sign
-Os -c  mb86a16.i -fsanitize=signed-integer-overflow
frame size 448

Reply via email to