[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Mem_event API and MEM_EVENT_REASON_SINGLESTEP



On Fri, Nov 30, 2012 at 12:45 PM, Razvan Cojocaru <rzvncj@xxxxxxxxx> wrote:
>>> I do see single step mem_events after. I've tried it on a SMP HVM
>>> Slackware guest. What behaviour am I observing? The gla and gfn values
>>> are being printed out - but I don't know how to detect a write operation
>>> based on them. Tim Deegan has kindly suggested that I pass those values
>>
>> You will not be able to detect a write event based on them as you have
>> marked the page rwx. One option is to mark the page rx and continue
>> single stepping the page. The on the next write to that page should
>> give you a write violation and there you can stop single stepping the
>> page.
>
> I'm not trying to detect a write event - the write event has already
> been detected: before the "case MEM_EVENT_REASON_VIOLATION" part of the
> code, I've put "xc_hvm_set_mem_access(xch, domain_id, default_access, 0,
> xenaccess->domain_info->max_pages);". Default_access, in the
> xen-access.c file, is rx, and after_first_access is rwx.
>
> What I am trying to do is catch the first write operation (that's why
> I'm single stepping), not the first write mem_event.

Not sure what the difference is between first write operation and
first write mem_event.

> My scenario is this: I'd like to mark _all_ of the domain's pages rw,
> then when I get a write mem_event, mark only one page rwx, allow that
> write (single stepping), then mark that one page rw again. This would

Do you mean rx? If you mark a page rw you will not get a write mem_event for it.

> allow me to catch more than one write per unique domain page, as
> xen-access.c does. Xen-access.c does not catch subsequent writes to a
> page once it received a write mem_event about it.

You could track the EIP and GFN and if you single step more than one
instruction you can mark the page RX and stop single stepping. You
will get control again on the next write. Though if there are jmp,
things could get tricky.

Thanks,
AP

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.