Hi everybody,
I was trying to count instructions of a 'target-executable' (with PT_STEP using ptrace(2), fork(2) and execve(2)) - quite similar to what's shown at http://www.uibk.ac.at/linuxdoc/LDP/LDP/LG/issue81/sandeep.html (which is of course a linux-sample). I first tried this on a gentoo-box (running 2.4.35) and succeeded - but I totally failed on OpenBSD. (My counter-app allways tells me that there are only 2 steps and finishes with WIFSTOPPED == true wait()-status: 2943 (WEXITSTATUS: 11, WTERMSIG: 127, WCOREDUMP: 0, WSTOPSIG: 11) (see wait(2) for details). I didn't want to spam the whole list with source-details, but I can send them by pm if somebody wants to. The machine I've tested this on runs a GENERIC (but errata-patched) kernel based on 4.5/stable (arch is amd64) and my 'target_executable' has no fancy suid,sgid bits set ('-rwxr-xr-x'). I even tried my tests in securelevel=-1 or as user root but with no success. I really wouldn't wont to learn (at least not today ;-) how to debug the kernel (even tough I've allready read two or three google'ed sites on that topic - to be prepared). ...so I would really appreciate if somebody could give me a hint - maybe an URL to a paper or sample-code - on how OpenBSD uses ptrace() or what additional requirements (I've so far failed to met) OpenBSD has on using ptrace(). Of course I've allready read the manpages for ptrace, fork, execve - but I guess I must have overseen the obvious... shame on me. :-/ Many thanks in advance! Regards, Manfred