On Thu, Sep 16, 2021 at 12:53:53PM +1200, Michael Schmitz wrote:
IOW, what would be the benefit of trying to avoid unconditional gap there?
Avoiding a kernel stack overflow - there are comments in the code that warn
against that, but those may be largely historic...
This is syscall entry; moreover, it critically relies upon the fixed stack
layout - type 0 exception frame + pt_regs + switch_stack + (now) gap.
Followed by fairly shallow C call chain. I suspect that the deepest you
can get there is when you get an unmapped page when reading the sigframe
and go into page fault handling, with call chain going into some filesystem's
->readpage(). If it was that close to stack overflow, we'd see them all
the time in e.g. random net ioctl doing copy_from_user() - that's going
to be deeper. Or in stat(2), for that matter.