linux-um archives
 help / color / mirror / Atom feed
* [uml-devel] How to intercept int 0x40 in UML
@ 2010-01-07  4:36 Dimitry Golubovsky
  0 siblings, 0 replies; only message in thread
From: Dimitry Golubovsky @ 2010-01-07  4:36 UTC (permalink / raw)
  To: user-mode-linux-devel

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

-- 
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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-01-07  4:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-07  4:36 [uml-devel] How to intercept int 0x40 in UML Dimitry Golubovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox