All of lore.kernel.org
 help / color / mirror / Atom feed
From: Razvan Cojocaru <rcojocaru@bitdefender.com>
To: Gareth Stockwell <Gareth.Stockwell@arm.com>,
	"xen-devel (xen-devel@lists.xen.org)" <xen-devel@lists.xen.org>
Cc: "stefano.stabellini@citrix.com" <stefano.stabellini@citrix.com>,
	"tklengyel@sec.in.tum.de" <tklengyel@sec.in.tum.de>,
	"Ian.Campbell@citrix.com" <Ian.Campbell@citrix.com>
Subject: Re: memaccess: skipping mem_access_send_req
Date: Fri, 10 Apr 2015 18:11:36 +0300	[thread overview]
Message-ID: <5527E828.8010406@bitdefender.com> (raw)
In-Reply-To: <DA845EDCE27355428C520DC5B8DC05CE763FB38550@GEORGE.Emea.Arm.com>

On 04/10/2015 06:04 PM, Gareth Stockwell wrote:
> My understanding of memaccess is that it provides the following
> functionality:
> 
>  
> 
> 1. Modify permission values in the page table of the target domain.
> 
> 2. When the domain generates an illegal access, the exception handler
> delegates to memaccess, which pauses the VCPU and records the event in a
> ring buffer.
> 
> 3. Some permission values are special in that they automatically mutate
> to a different value following the first access; others are persistently
> applied.
> 
>  
> 
> We would like to use memaccess to perform (1) - but rather than pausing
> the VCPU in (2), instead simply directly inject the exception into the
> VCPU.  I can see two ways of doing this:
> 
>  
> 
> a) Implement an observer of the ring buffer, which triggers injection of
> the exception and unpausing of the VCPU.
> 
> b) Define new xenmem_access_t values which cause the exception handler
> to reinject rather than adding a message to the ring buffer.
> 
>  
> 
> (a) seems cumbersome, and requires multiple context switches in order to
> handle the exception.
> 
> (b) therefore looks preferable, and I think should be fairly simple to
> implement on top of https://github.com/tklengyel/xen/tree/arm_memaccess15.
> 
>  
> 
> Does this sound reasonable?  Or is there a better way of modifying
> access permissions for a specific pfn range of a target domain?

It's not entirely clear to me what you're trying to do, but if I
understand it correctly, there's always the third option of simply using
the vm_event system as it is now, and when you get an EPT violation
event simply use xc_hvm_inject_trap() from userspace to inject the
exception.

If you don't want to remove the page restrictions after this (in order
to unpause the VCPU), you can simply emulate the instruction that caused
the event and continue that way. I've added support for that last year
(but I don't know right now if that part is still functional until
Tamas' final half of the series gets merged).


HTH,
Razvan

  reply	other threads:[~2015-04-10 15:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-10 15:04 memaccess: skipping mem_access_send_req Gareth Stockwell
2015-04-10 15:11 ` Razvan Cojocaru [this message]
2015-04-10 15:23   ` Julien Grall
2015-04-15  9:18     ` Ian Campbell
2015-04-10 15:28 ` Tamas K Lengyel
2015-04-10 16:03 ` Andrew Cooper
2015-04-17  9:35   ` Gareth Stockwell
2015-04-15  9:26 ` Ian Campbell
2015-04-17  9:35   ` Gareth Stockwell
2015-04-17 10:31     ` Ian Campbell

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=5527E828.8010406@bitdefender.com \
    --to=rcojocaru@bitdefender.com \
    --cc=Gareth.Stockwell@arm.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=tklengyel@sec.in.tum.de \
    --cc=xen-devel@lists.xen.org \
    /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.