---

KernelTrap: Who Owns The Stack?

“In a short thread on the lkml, Linux creator Linus Torvalds
discussed recently added hacks to prevent gcc from overwriting the
argument stack in asmlinkage functions on the x86 platform. The
existing fix involves using prevent_tail_call() to prevent the gcc
tail call optimization, though Linus notes, ‘the problem isn’t even
really fundamentally tailcalls, that just is the detail that
happens to trigger the problem (but I could imagine other
situations triggering it _too_.’ Tail calls are when the last line
of one function returns a call to another function, something
commonly optimized by compilers…”

Complete Story