linux-um archives
 help / color / mirror / Atom feed
From: Dimitry Golubovsky <golubovsky@gmail.com>
To: user-mode-linux-devel@lists.sourceforge.net
Subject: [uml-devel] How to intercept int 0x40 in UML
Date: Wed, 6 Jan 2010 23:36:53 -0500	[thread overview]
Message-ID: <bcba51a1001062036i3343fdccxbca2cc2ec246410a@mail.gmail.com> (raw)

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


                 reply	other threads:[~2010-01-07  4:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bcba51a1001062036i3343fdccxbca2cc2ec246410a@mail.gmail.com \
    --to=golubovsky@gmail.com \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox