[llvm-dev] Guarantees on stack overflow

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Mon Nov 12 09:39:34 PST 2018


Hi Peter,

On Mon, 12 Nov 2018 at 16:27, Peter Lammich via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> 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?

Generally the latter. Some targets (well, Windows) have stack probing,
which will make sure the function doesn't just jump a huge gap with
its stack allocation. Porting that to x86_64 Linux would probably be
very simple[*] (especially if you were willing to implement the probe
function yourself in your application), but I can't see any tests that
indicate someone already has.

Cheers.

Tim.

[*] It might even be as simple as defining the name of the function to
be called judging from tests on the existing stack-probes.ll testcase.


More information about the llvm-dev mailing list