开发者

Building a Linux Debugger C

开发者 https://www.devze.com 2023-04-11 22:48 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号