Reputation: 14578
I have a doubt which goes like this -
Assume that a process detects and handles stack overflow by protecting its stack region boundary with a write protected page. Thus any write to this page due to stack overflow will result in a SIGSEGV signal being generated.
But since the process stack has already overflowed how can the signal handler for the SIGSEGV be executed????
It's a conceptual question. Hope I'll find some answers. Thanks in advance.
Upvotes: 1
Views: 94
Reputation: 490538
Typically, you switch to a separate stack to run the signal/exception handler. Most run in kernel mode anyway, and (at least normally) nothing in kernel mode runs off a user-mode stack in any case.
Upvotes: 1