All of lore.kernel.org
 help / color / mirror / Atom feed
From: machi1271 <machi1271@gmail.com>
To: Razvan Cojocaru <rcojocaru@bitdefender.com>,
	xen-devel <xen-devel@lists.xen.org>
Subject: Re: Modify cr0 at dom0
Date: Fri, 17 Oct 2014 14:34:49 +0800	[thread overview]
Message-ID: <201410171434447719581@gmail.com> (raw)
In-Reply-To: 5440B647.2000502@bitdefender.com


[-- Attachment #1.1: Type: text/plain, Size: 1915 bytes --]

Thanks Razvan~

I'm new to Xen and Linux.
Could you please tell me is there any Xen-independent manner to modify CR0, or the memory area protected by CR0.WP bit?

Regards




machi1271

From: Razvan Cojocaru
Date: 2014-10-17 14:25
To: machi1271; xen-devel
Subject: Re: [Xen-devel] Modify cr0 at dom0
On 10/17/14 04:47, machi1271 wrote:
> hi,
> Background:
> I want to hook the syscalls for dom0. So, I get the syscall_enter
> address by calling HYPERVISOR_domctl, with xen_domctl.cmd =
> XEN_DOMCTL_getvcpucontext.
> The returned ctx.syscall_callback_eip is correct, and I find the
> syscall_table address from the syscall_callback_eip.
> Now, my target is to modify the original syscall_table, and I know I
> should clear the CR0.WP bit before modify.
>  
> However, when I try to set cr0 back to hypervisor after the cr0.WP being
> cleared through HYPERVISOR_domctl(with xen_domctl.cmd =
> XEN_DOMCTL_setvcpucontext),
> dom0 DEAD.
>  
> I traced into the hypercall, and I find the program dead in the
> following while loop:
> void vcpu_sleep_sync(struct vcpu *v)
> {
>     vcpu_sleep_nosync(v);
>  
>     while ( !vcpu_runnable(v) && v->is_running )
>         cpu_relax();
>  
>     sync_vcpu_execstate(v);
> }
> in domain_pause.
>  
> Why? Is Calling XEN_DOMCTL_setvcpucontext from dom0 not allowed? Or, is
> there another way to make the memory area protected by WP to be writable?
>  
> I am running my code on 2.6.18-194.el5xen., no domain is running except
> dom0.

Calling setvcpucontext() _from_ dom0 is indeed allowed (I'm doing it
with no apparent ill-effects), however I'm not sure about calling it
_from_ dom0 _to_ dom0 - I've only tried it with HVM guests _other_ than
dom0.

Calling that hypercall from dom0 to modify dom0's state does sound a bit
unnecessary - why can't you just modify dom0's state in a
Xen-independent manner?


Razvan

[-- Attachment #1.2: Type: text/html, Size: 5152 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

  reply	other threads:[~2014-10-17  6:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-17  1:47 Modify cr0 at dom0 machi1271
2014-10-17  6:25 ` Razvan Cojocaru
2014-10-17  6:34   ` machi1271 [this message]
2014-10-17  6:48     ` Razvan Cojocaru
2014-10-17  7:14       ` machi1271
2014-10-17  8:01         ` Razvan Cojocaru
2014-10-17  9:16           ` machi1271

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=201410171434447719581@gmail.com \
    --to=machi1271@gmail.com \
    --cc=rcojocaru@bitdefender.com \
    --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.