modify syscall nr on-the-fly

看板FB_hackers作者時間18年前 (2007/08/18 19:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/9 (看更多)
I'm trying to get user-mode Linux to run under FreeBSD Linux emulation (on i386). User-mode Linux in it's start-up tests tries to modify syscall number (to be called by kernel) on-the-fly (http://fxr.watson.org/fxr/source/arch/um/os-Linux/start_up.c?v=linux-2.6). It forks a child thread that stops (using SIGSTOP), calls getpid() (that will be intercepted by parent thread using PTRACE_SYSCALL) and return some value based on getpid() results. Main thread waits for SIGSTOP in child process and enables PTRACE_SYSCALL (I have some code that implements it. It makes some incompatible changes to PT_SYSCALL that will break FreeBSD applications, but works for Linux apps). When main thread catches SIGTRAP (generated by ptrace) it tries to modify EAX of child thread (with PTRACE_PEEKUSR and PTRACE_POKEUSR) to replace getpid syscall with getppid. is it possible to get updated EAX (and other registers as well) in syscall(...) after ptracestop(...) in PTRACESTOP_SC(...) returns? Hope for your help, Yuriy. _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
文章代碼(AID): #16njYu00 (FB_hackers)
討論串 (同標題文章)
文章代碼(AID): #16njYu00 (FB_hackers)