尝试用 C 构建调试器以进行模糊测试。
基本上在linux中,我只是想通过fork启动一个进程,然后execve(),然后监控这个进程,看它是否在1秒后崩溃。
在 Linux 上,这是通过创建进程然后监视它为任何看起来像崩溃的东西生成的信号来完成的吗?或者是关于监控应用程序和?我不知道。
最佳答案
使用 ptrace(2)
系统调用:
While being traced, the child will stop each time a signal is delivered, even if the signal is being ignored. (The exception is SIGKILL, which has its usual effect.) The parent will be notified at its next wait(2) and may inspect and modify the child process while it is stopped. The parent then causes the child to continue, optionally ignoring the delivered signal (or even delivering a different signal instead).
关于进程崩溃,您应该感兴趣的信号是 SIGSEGV
(受限内存访问)、SIGBUS
(未对齐数据访问)、SIGILL
(非法指令)、SIGFPE
(非法浮点运算)等
关于c - 构建 Linux 调试器 C,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7702492/