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 15:14:34 +0800	[thread overview]
Message-ID: <201410171514301630964@gmail.com> (raw)
In-Reply-To: 5440BBBD.4040709@bitdefender.com


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

I'v tried the way to modify CR0 by writing to it directly. But I got the following error:
\x02(XEN) traps.c:1768:d0 Attempt to change unmodifiable CR0 flags.
general protection fault: 0000 [1] SMP 
last sysfs file: /devices/pci0000:00/0000:00:00.0/resource
CPU 0 
Modules linked in: fsp(U) autofs4 hidp rfcomm l2cap bluetooth lockd sunrpc ip_conntrack_netbios_ns ip_conntrack nfnetlink xt_tcpudp iptable_filter ip_tables x_tables acpiphp loop dm_multipath scsi_dh video backlight sbs power_meter hwmon i2c_ec dell_wmi wmi button battery asus_acpi ac ipv6 xfrm_nalgo crypto_api lp joydev floppy sg snd_ens1371 gameport i2c_piix4 snd_rawmidi snd_ac97_codec ac97_bus snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq i2c_core pcspkr snd_seq_device snd_pcm_oss snd_mixer_oss snd_pcm e1000 snd_timer snd soundcore snd_page_alloc shpchp serio_raw ide_cd parport_pc parport cdrom serial_core dm_raid45 dm_message dm_region_hash dm_mem_cache dm_snapshot dm_zero dm_mirror dm_log dm_mod ata_piix libata mptspi mptscsih mptbase scsi_transport_spi sd_mod scsi_mod ext3 jbd uhci_hcd ohci_hcd ehci_hcd
Pid: 4103, comm: insmod Tainted: G      2.6.18-194.el5xen #1
RIP: e030:[<ffffffff88218020>]  [<ffffffff88218020>] :fsp:init_fsp+0x20/0x2d
RSP: e02b:ffff880025145f50  EFLAGS: 00010202
RAX: 000000008004003b RBX: ffffffff88680600 RCX: 0000000000000000
RDX: 000000008005003b RSI: 0000000000000000 RDI: 0000000000000000
RBP: 000000001fc65060 R08: 000000001fc65060 R09: 0000000000000000
R10: ffff880024967360 R11: ffff880032c42100 R12: 0000000000094ee5
R13: 00002b3383dc6010 R14: 0000000000100000 R15: 0000000000100000
FS:  00002b3383dc5750(0000) GS:ffffffff805d2000(0000) knlGS:0000000000000000
CS:  e033 DS: 0000 ES: 0000
Process insmod (pid: 4103, threadinfo ffff880025144000, task ffff880032c42100)
Stack:  ffffffff802a28e8  0000000000100000  00002b3383dc6010  0000000000000003 
 00007fff5237dbdc  0000000000094ee5  ffffffff802602f9  0000000000000206 
 0000000000000000  0000000000001007 
Call Trace:
 [<ffffffff802a28e8>] sys_init_module+0xaf/0x1f2
 [<ffffffff802602f9>] tracesys+0xab/0xb6


Code: 0f 22 c0 31 c0 48 89 15 3c 09 47 00 c3 00 00 00 00 00 00 00 
RIP  [<ffffffff88218020>] :fsp:init_fsp+0x20/0x2d
 RSP <ffff880025145f50>
 <0>Kernel panic - not syncing: Fatal exception
 (XEN) Domain 0 crashed: rebooting machine in 5 seconds.

Directly modifying CR0 by assembly language seems to modify the real physical register on the  real CPU, 
but I just want to modify dom's virtual CR0 in the vcpu structure, since I want to modify some memory area 
in dom0's kernel which is protected by dom0's vcpu's CR0.WP bit.

Regards~




machi1271

From: Razvan Cojocaru
Date: 2014-10-17 14:48
To: machi1271; xen-devel
Subject: Re: [Xen-devel] Modify cr0 at dom0
On 10/17/14 09:34, machi1271 wrote:
> 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?

Sure, there's an example here:

https://stackoverflow.com/questions/3962950/how-to-set-control-register-0-cr0-bits-in-x86-64-using-gcc-assembly-on-linux


Razvan

[-- Attachment #1.2: Type: text/html, Size: 5535 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  7:14 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
2014-10-17  6:48     ` Razvan Cojocaru
2014-10-17  7:14       ` machi1271 [this message]
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=201410171514301630964@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.