How to intercept int 0x40 in UML
Hi,
I am trying to implement some ideas of Glendix [1], but without patching the underlying Linux kernel, staying completely within UML.
I am experimenting with kernel 2.6.31.6 sources (the same version for which Glendix patch is available)
I got stuck trying to intercept the "int 0x40" instruction which is used for syscalls in Plan 9. Example code below (NASM syntax, example borrowed from Glendix):
======================
section .data
hello: db 'Hello world!',10 ; 'Hello world!' plus a
linefeed character
helloLen: equ $-hello ; Length of the 'Hello world!' string
section .text
global _start
_start:
mov eax,8
mov ebx,hello
int 40h======================
I am trying to find a place within arch/um/os-Linux/skas/process.c where to my understanding the code responsible for intercepting syscalls is located - the place where I could insert my own code to intercept 0x40 interrupt and translate it to some kernel action.
When I run this program compiled I get "Segmentation fault" message.
I tried to insert printk call in the "userspace" function in arch/um/os-Linux/skas/process.c in various places to see if the "int 0x40" instruction is trapped by the UML kernel, unsuccessfully so far.
In particular, I tried:
* right after the if(WIFSTOPPED(status)) statement
(arch/um/os-Linux/skas/process.c, line 406)
* right before the same check (like this: if (!WIFSTOPPED(status)) printk ...)
* inside the "fatal_sigsegv" function in arch/um/kernel/trap.c
None caused any output when running the test program
Any suggestions where can I intercept it? Or does this signal completely bypass UML?
Thanks for any ideas.
----------------
[1] http://www.glendix.org - Linux kernel patch to run Plan9 binaries on Linux kernel
Signature · 14 lines
Dimitry Golubovsky Anywhere on the Web ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel