Re: [Qemu-devel] [PATCH] mount syscall

2007-02-22 Thread Paul Brook
On Wednesday 14 February 2007 08:26, Kirill A. Shutemov wrote:
 In the attachment fixed Debian patch(with lock_user_string).

This is still wrong. You need to figure out what arg5 really is.

I've attached an old, bitrotten and untested patch you might want to use as a 
base. It predates all the lock_user stuff, so you'll need to retrofit that.

Paul
? p
Index: main.c
===
RCS file: /cvsroot/qemu/qemu/linux-user/main.c,v
retrieving revision 1.59
diff -u -p -r1.59 main.c
--- main.c	7 Feb 2005 23:12:27 -	1.59
+++ main.c	11 Feb 2005 00:25:05 -
@@ -62,40 +62,51 @@ void gemu_log(const char *fmt, ...)
 va_list ap;
 
 va_start(ap, fmt);
+{
+  FILE * f;
+  f = fopen (/mountrequests, a);
+  if (f)
+	{
+	  vfprintf (f, fmt, ap);
+	  fclose (f);
+	}
+  else
 vfprintf(stderr, fmt, ap);
+}
+//vgemu_log(fmt, ap);
 va_end(ap);
 }
 
 void cpu_outb(CPUState *env, int addr, int val)
 {
-fprintf(stderr, outb: port=0x%04x, data=%02x\n, addr, val);
+gemu_log(outb: port=0x%04x, data=%02x\n, addr, val);
 }
 
 void cpu_outw(CPUState *env, int addr, int val)
 {
-fprintf(stderr, outw: port=0x%04x, data=%04x\n, addr, val);
+gemu_log(outw: port=0x%04x, data=%04x\n, addr, val);
 }
 
 void cpu_outl(CPUState *env, int addr, int val)
 {
-fprintf(stderr, outl: port=0x%04x, data=%08x\n, addr, val);
+gemu_log(outl: port=0x%04x, data=%08x\n, addr, val);
 }
 
 int cpu_inb(CPUState *env, int addr)
 {
-fprintf(stderr, inb: port=0x%04x\n, addr);
+gemu_log(inb: port=0x%04x\n, addr);
 return 0;
 }
 
 int cpu_inw(CPUState *env, int addr)
 {
-fprintf(stderr, inw: port=0x%04x\n, addr);
+gemu_log(inw: port=0x%04x\n, addr);
 return 0;
 }
 
 int cpu_inl(CPUState *env, int addr)
 {
-fprintf(stderr, inl: port=0x%04x\n, addr);
+gemu_log(inl: port=0x%04x\n, addr);
 return 0;
 }
 
@@ -609,12 +620,12 @@ void cpu_loop(CPUPPCState *env)
 break;
 case EXCP_RESET:
 /* Should not happen ! */
-fprintf(stderr, RESET asked... Stop emulation\n);
+gemu_log(RESET asked... Stop emulation\n);
 if (loglevel)
 fprintf(logfile, RESET asked... Stop emulation\n);
 abort();
 case EXCP_MACHINE_CHECK:
-fprintf(stderr, Machine check exeption...  Stop emulation\n);
+gemu_log(Machine check exeption...  Stop emulation\n);
 if (loglevel)
 fprintf(logfile, RESET asked... Stop emulation\n);
 info.si_signo = TARGET_SIGBUS;
@@ -623,7 +634,7 @@ void cpu_loop(CPUPPCState *env)
 info._sifields._sigfault._addr = env-nip - 4;
 queue_signal(info.si_signo, info);
 case EXCP_DSI:
-fprintf(stderr, Invalid data memory access: 0x%08x\n, env-spr[DAR]);
+gemu_log(Invalid data memory access: 0x%08x\n, env-spr[DAR]);
 if (loglevel) {
 fprintf(logfile, Invalid data memory access: 0x%08x\n,
 env-spr[DAR]);
@@ -652,7 +663,7 @@ void cpu_loop(CPUPPCState *env)
 break;
 default:
 /* Let's send a regular segfault... */
-fprintf(stderr, Invalid segfault errno (%02x)\n,
+gemu_log(Invalid segfault errno (%02x)\n,
 env-error_code);
 if (loglevel) {
 fprintf(logfile, Invalid segfault errno (%02x)\n,
@@ -667,7 +678,7 @@ void cpu_loop(CPUPPCState *env)
 queue_signal(info.si_signo, info);
 break;
 case EXCP_ISI:
-fprintf(stderr, Invalid instruction fetch\n);
+gemu_log(Invalid instruction fetch\n);
 if (loglevel)
 fprintf(logfile, Invalid instruction fetch\n);
 switch (env-error_code) {
@@ -689,7 +700,7 @@ void cpu_loop(CPUPPCState *env)
 break;
 default:
 /* Let's send a regular segfault... */
-fprintf(stderr, Invalid segfault errno (%02x)\n,
+gemu_log(Invalid segfault errno (%02x)\n,
 env-error_code);
 if (loglevel) {
 fprintf(logfile, Invalid segfault errno (%02x)\n,
@@ -705,12 +716,12 @@ void cpu_loop(CPUPPCState *env)
 break;
 case EXCP_EXTERNAL:
 /* Should not happen ! */
-fprintf(stderr, External interruption... Stop emulation\n);
+gemu_log(External interruption... Stop emulation\n);
 if (loglevel)
 fprintf(logfile, External interruption... Stop emulation\n);
 abort();
 case EXCP_ALIGN:
-fprintf(stderr, Invalid unaligned memory access\n);
+gemu_log(Invalid unaligned memory access\n);
 if (loglevel)
 fprintf(logfile, Invalid unaligned memory access\n);

[Qemu-devel] [PATCH] mount syscall

2007-02-14 Thread Kirill A. Shutemov
In the attachment fixed Debian patch(with lock_user_string).
Index: linux-user/syscall.c
===
RCS file: /sources/qemu/qemu/linux-user/syscall.c,v
retrieving revision 1.86
diff -u -r1.86 syscall.c
--- linux-user/syscall.c11 Feb 2007 20:03:13 -  1.86
+++ linux-user/syscall.c12 Feb 2007 10:49:07 -
@@ -2163,8 +2163,18 @@
 ret = get_errno(getpid());
 break;
 case TARGET_NR_mount:
-/* need to look at the data field */
-goto unimplemented;
+   {
+   /* need to look at the data field */
+   void *p2, *p3;
+   p = lock_user_string(arg1);
+   p2 = lock_user_string(arg2);
+   p3 = lock_user_string(arg3);
+   ret = get_errno(mount(p, p2, p3, (unsigned long)arg4, 
(const void *)arg5));
+   unlock_user(p, arg1, 0);
+   unlock_user(p2, arg2, 0);
+   unlock_user(p3, arg3, 0);
+   break;
+   }
 case TARGET_NR_umount:
 p = lock_user_string(arg1);
 ret = get_errno(umount(p));


signature.asc
Description: Digital signature
___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


[Qemu-devel] [PATCH] mount syscall

2007-02-14 Thread Kirill A. Shutemov
Fixed Debian patch in the attachment(lock_user_string used).
Index: linux-user/syscall.c
===
RCS file: /sources/qemu/qemu/linux-user/syscall.c,v
retrieving revision 1.86
diff -u -r1.86 syscall.c
--- linux-user/syscall.c11 Feb 2007 20:03:13 -  1.86
+++ linux-user/syscall.c12 Feb 2007 10:49:07 -
@@ -2163,8 +2163,18 @@
 ret = get_errno(getpid());
 break;
 case TARGET_NR_mount:
-/* need to look at the data field */
-goto unimplemented;
+   {
+   /* need to look at the data field */
+   void *p2, *p3;
+   p = lock_user_string(arg1);
+   p2 = lock_user_string(arg2);
+   p3 = lock_user_string(arg3);
+   ret = get_errno(mount(p, p2, p3, (unsigned long)arg4, 
(const void *)arg5));
+   unlock_user(p, arg1, 0);
+   unlock_user(p2, arg2, 0);
+   unlock_user(p3, arg3, 0);
+   break;
+   }
 case TARGET_NR_umount:
 p = lock_user_string(arg1);
 ret = get_errno(umount(p));


signature.asc
Description: Digital signature
___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


[Qemu-devel] [PATCH] mount syscall

2007-02-14 Thread Kirill A. Shutemov
Fixed(with lock_user_string) patch in the attachment.
Index: linux-user/syscall.c
===
RCS file: /sources/qemu/qemu/linux-user/syscall.c,v
retrieving revision 1.86
diff -u -r1.86 syscall.c
--- linux-user/syscall.c11 Feb 2007 20:03:13 -  1.86
+++ linux-user/syscall.c12 Feb 2007 10:49:07 -
@@ -2163,8 +2163,18 @@
 ret = get_errno(getpid());
 break;
 case TARGET_NR_mount:
-/* need to look at the data field */
-goto unimplemented;
+   {
+   /* need to look at the data field */
+   void *p2, *p3;
+   p = lock_user_string(arg1);
+   p2 = lock_user_string(arg2);
+   p3 = lock_user_string(arg3);
+   ret = get_errno(mount(p, p2, p3, (unsigned long)arg4, 
(const void *)arg5));
+   unlock_user(p, arg1, 0);
+   unlock_user(p2, arg2, 0);
+   unlock_user(p3, arg3, 0);
+   break;
+   }
 case TARGET_NR_umount:
 p = lock_user_string(arg1);
 ret = get_errno(umount(p));


signature.asc
Description: Digital signature
___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel