Building a Linux Debugger C
Trying to build a debugger in C for fuzzing.
Basically in linux, I just want to start a process via fork and then execve(), then monitor this process to 开发者_JS百科see if it crashes after 1 second.
On linux, is this done via creating the process then monitoring the SIGNALs it generates for anything that looks like a crash? Or is it about monitoring the application and? I'm not sure.
Use the ptrace(2)
system call:
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).
The signals you should be interested in, regarding to the process having crashed are SIGSEGV
(restricted memory access), SIGBUS
(unaligned data access), SIGILL
(illegal instruction), SIGFPE
(illegal floating-point operation), etc.
精彩评论