All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Abhinav Srivastava <abhinavs_iitkgp@yahoo.co.in>
Cc: xen-devel <xen-devel@lists.xensource.com>
Subject: Re: How to intercept memory operation in Xen
Date: Mon, 13 Nov 2006 12:34:20 -0600	[thread overview]
Message-ID: <4558BAAC.7000006@us.ibm.com> (raw)
In-Reply-To: <20061113172557.34567.qmail@web7910.mail.in.yahoo.com>

Abhinav Srivastava wrote:
> 
> Hi all,
> 
> I am new to the Xen and currently using Xen 3.0.3. My goal is to provide 
> memory logging facility in Dom0. If any guest domain (DomU) application 
> tries to access any memory area, I would like to know in dom0 what area 
> they are accessing. So that if any user space applications try to access 
> kernel memory then i can see in dom0 and using my detection system, i 
> can say that it is illegal memory request as user space applications are 
> not allowed to use kernel memory. I have three Qs related to this:

You would have a much easier time just modifying the Linux kernel.  Xen 
isn't going to help you much here.

> 1) Is this doable?

Exceptions do go through the hypervisor however page faults are not 
usually a sign of something bad happening.  Linux, for instance, uses 
copy-on-write and on-demand paging which means in many circumstances, 
page faults are not a sign of misuse of memory.

I don't think there's any generic way of identifying whether a page 
fault is a "good" page fault or a "bad" page fault at the hypervisor 
level.  The hypervisor merely forwards the fault to the guest and the 
guest then decides what action to take (update a page table, kill a 
process, etc.).  To complicate matters further, some apps catch SEGV and 
handle it themselves.  That makes the potential recovery behavior 
totally non-deterministic.  You could potentially try to track 
heuristically whether a PTE update occurs after a page fault at the 
hypervisor level but that would be easily defeatable (which means it 
isn't useful for an IDS system).  At the end of the day, you really have 
to modify the domU kernel.

You should look at some of the bug reporting tools in Linux.  They seem 
to be doing something to hook all process crashes.  Ubuntu has a new bug 
crash tool that you could probably start with.  This would put you in 
domU userspace though...

Regards,

Anthony Liguori

> 2) If yes, how should I start with? Do i need to intercept hypercalls? 
> If yes, how to do this?
> 
> 3) To intercept memory operation, do i need to change in the Xen code? 
> If yes, it would be great if you could point me exact file where changes 
> are to be made.
> 
> 4) Can it be done using some application or IDS in dom0 with some hooks 
> without changing the Xen code?
> 
> I would really appreciate your help.
> 
> Thanks,
> Abhi
> 
> ------------------------------------------------------------------------
> Find out what India is talking about on - Yahoo! Answers India 
> <http://us.rd.yahoo.com/mail/in/yanswers/*http://in.answers.yahoo.com/>
> Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. 
> Get it NOW 
> <http://us.rd.yahoo.com/mail/in/messengertagline/*http://in.messenger.yahoo.com> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

  parent reply	other threads:[~2006-11-13 18:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-13 17:25 How to intercept memory operation in Xen Abhinav Srivastava
2006-11-13 18:08 ` Petersson, Mats
2006-11-13 18:34 ` Anthony Liguori [this message]
2006-11-13 20:18   ` Abhinav Srivastava
2006-11-14 11:42     ` Petersson, Mats

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=4558BAAC.7000006@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=abhinavs_iitkgp@yahoo.co.in \
    --cc=xen-devel@lists.xensource.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.