进程处理堆栈溢出
我有一个疑问,情况是这样的 -
假设进程通过使用写保护页保护其堆栈区域边界来检测和处理堆栈溢出。因此,由于堆栈溢出而对此页的任何写入都将导致生成 SIGSEGV 信号。
但是由于进程堆栈已经溢出,如何执行 SIGSEGV 的信号处理程序???
问题。希望我能找到一些答案。提前致谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常,您切换到单独的堆栈来运行信号/异常处理程序。无论如何,大多数都在内核模式下运行,并且(至少通常)内核模式中的任何内容在任何情况下都不会脱离用户模式堆栈。
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.