News for hackers. Stuff that matters.
Re:Strace – My Favourite Secret Weapon (2011) by orivej on Sunday February 11, 2018 @08:08PM (#16355814)
Actually you can strace strace! Try

  strace -o 1.log strace -o 2.log ls
and observe in 1.log how the second strace uses ptrace call.

The limitation is that a process can not be ptraced by multiple processes at the same time. If you add -f to the first strace, it will start tracing the fork meant for ls before the second strace has a chance to setup its tracing. That setup will fail, and the second strace will kill the fork instead of running ls. You can read this from 1.log!

If I'm not mistaken, a ptrace tool may untrace its grandchild right when it intercepts a child attempt to trace that grandchild to make the attempt succeed, but I don't know if strace can.

There are no comments on this comment yet.