[llvm-dev] Guarantees on stack overflow

Peter Lammich via llvm-dev llvm-dev at lists.llvm.org
Mon Nov 12 08:26:49 PST 2018


Hi list,

I'm wondering what guarantees I get if my program runs into a stack
overflow. 

Background: I'm compiling security critical software via LLVM-IR. I can
guarantee (by program analysis, theorem proving, etc) that I have no
buffer overflows, and that the program is terminated in a controlled
way if it runs out of heap memory (calloc from libc has a clearly
defined semantics of returning NULL, or, in practice, the process may
be killed by the OS's OOM killer).

But what's about the stack? I cannot even estimate how much stack I
need, as this depends on LLVM optimization and backend passes. 
>From testing on a Linux x86-64 system, my experience is that I get a
SIGSEGV in these cases. But is this guaranteed? Or might it happen that
a stack overflow silently overwrites some memory and causes chaos and
security issues? 

Thanks in advance for any help or links to documentation on this issue,
  Peter







More information about the llvm-dev mailing list