From mboxrd@z Thu Jan 1 00:00:00 1970 From: Int0x82 Subject: Print ebx parameter VM syscalls Date: Fri, 19 Feb 2010 14:05:03 +0100 Message-ID: <5d8428621002190505o1522a1fbq13a31ac9265a1eff@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0300947925==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============0300947925== Content-Type: multipart/alternative; boundary=00032555b4ce51fcbc047ff3bb50 --00032555b4ce51fcbc047ff3bb50 Content-Type: text/plain; charset=ISO-8859-1 My mission is intercept VM syscall insmod (sys_init_module) from hypervisor. I've dirty xen code to try, specifically in do_guest_trap function in arch/x86/traps.c Xen file. In this function I've added this small part of code: unit32_t a; if (v->domain->domain_id != 0) { /* if domain is not Dom0 */ a=regs->eax; if (a == 128) { printk("I've intercepted sys_init_module"); } } In this way I'm able to intercept the syscall sys_init_module (number 128) from any DomU, but my problem now is to intercept the insmod parameter and print it with printk. I've tried to assign a char __user *myvar = (char __user *)regs->ebx but I can't print it with printk("%s",myvar) This is what happen: when I start my domU and happen an insmod in boot time, my dom0 reboots itself. Is it true that parameter of my syscall is in regs->ebx register?? What is the way to print it in human readable (for example if in DomU I print in shell "insmod mymodule" I'd like print "mymodule" from hypervisor, not the hex value like 0804b018, but the string). Can you help me? I'd like only print insmod parameter. I use 3.2.1 xen + linux-2.6.18-xen.hg. Thanks a lot. Elena --00032555b4ce51fcbc047ff3bb50 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable My mission is intercept VM syscall insmod (sys_init_module) from hypervisor= .
I've dirty xen code to try, specifically in do_guest_trap functio= n in arch/x86/traps.c Xen file. In this function I've added this small = part of code:

unit32_t a;
if (v->domain->domain_id !=3D 0) { /* if domain is= not Dom0 */
=A0=A0=A0 a=3Dregs->eax;
=A0=A0=A0 if (a =3D=3D 128) = {
=A0=A0=A0=A0=A0=A0=A0=A0=A0 printk("I've intercepted sys_init= _module");
=A0=A0=A0 }
}

In this way I'm able to intercept the syscall sys_init_module (number 1= 28) from any DomU, but my problem now is to intercept the insmod parameter = and print it with printk.
I've tried to assign a

char __use= r *myvar =3D (char __user *)regs->ebx

but I can't print it with

printk("%s",myvar)
<= br>This is what happen: when I start my domU and happen an insmod in boot t= ime, my dom0 reboots itself.

Is it true that parameter of my syscal= l is in regs->ebx register?? What is the way to print it in human readab= le (for example if in DomU I print in shell "insmod mymodule" I&#= 39;d like print "mymodule" from hypervisor, not the hex value lik= e 0804b018, but the string).

Can you help me? I'd like only print insmod parameter. I use 3.2.1 = xen + linux-2.6.18-xen.hg.

Thanks a lot.

Elena

=A0
--00032555b4ce51fcbc047ff3bb50-- --===============0300947925== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============0300947925==--