Does anyone have any good explanations, tutorials, books, or guides on the use of PTRACE_SYSEMU?
相关问题
- Is shmid returned by shmget() unique across proces
- how to get running process information in java?
- Error building gcc 4.8.3 from source: libstdc++.so
- Why should we check WIFEXITED after wait in order
- Null-terminated string, opening file for reading
What I found interesting:
And programming library that makes using ptrace easier :
For pinktrace there are examples, sydbox sources are example of complex pinktrace usecase. In general, I've found author as good person to contact about using and testing pinktrace.
There is small test from linux kernel sources which uses PTRACE_SYSEMU:
http://code.metager.de/source/xref/linux/stable/tools/testing/selftests/x86/ptrace_syscall.c or http://lxr.free-electrons.com/source/tools/testing/selftests/x86/ptrace_syscall.c
So, it looks like just another
ptrace
call which will allow program to run until next system call is made by it; then stop child and signal the ptracer. It can read registers, optionally change some and restart the syscall.Implemented in http://lxr.free-electrons.com/source/kernel/ptrace.c?v=4.10#L1039 like other stepping
ptrace
calls:And man page has some info: http://man7.org/linux/man-pages/man2/ptrace.2.html
So, it is not portable and used only for Usermode linux (um) on x86 platform as variant of classic
PTRACE_SYSCALL
. And um test for sysemu with some comments is here: http://lxr.free-electrons.com/source/arch/um/os-Linux/start_up.c?v=4.10#L155Link in comment was redirecting to secret site http://sysemu.sourceforge.net/ from 2004: