public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] UML on UML fixed: it did not start
@ 2009-03-06 19:49 Renzo Davoli
  2009-03-08  6:49 ` Américo Wang
  2009-03-10 14:27 ` Américo Wang
  0 siblings, 2 replies; 3+ messages in thread
From: Renzo Davoli @ 2009-03-06 19:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jeff Dike

It is currently impossible to run a user-mode linux machine inside another user-mode 
linux (UML on UML). It breaks after a few instructions. When it tries to check
whether SYSEMU is installed (the inner) UML receives an inconsistent result 
(from the outer UML).

This is the output of a broken attempt:
$ ./linux mem=256m ubd0=cow
Locating the bottom of the address space ... 0x0
Locating the top of the address space ... 0xc0000000
Core dump limits :
        soft - 0
        hard - NONE
Checking that ptrace can change system call numbers...OK
Checking ptrace new tags for syscall emulation...unsupported
Checking syscall emulation patch for ptrace...check_sysemu : expected SIGTRAP, got status = 256
$

The problem is the following:
PTRACE_SYSCALL/SINGLESTEP is currently managed inside arch_ptrace for ARCH=um.

PTRACE_SYSEMU/SUSEMU_SINGLESTEP is not captured in arch_ptrace's switch, therefore
it is erroneously passed back to ptrace_request (in kernel/ptrace).

This simple patch simply forces ptrace to return an error on PTRACE_SYSEMU/SUSEMU_SINGLESTEP
as it is unsupported on ARCH=um, and fixes the problem.

I posted the same patch one month ago. I just tested it again against the latest kernel.

	renzo

Signed-off-by: Renzo Davoli <renzo@cs.unibo.it>
---
diff -Naur linux-2.6.29-rc7/arch/um/kernel/ptrace.c linux-2.6.29-rc7-umluml/arch/um/kernel/ptrace.c
--- linux-2.6.29-rc7/arch/um/kernel/ptrace.c	2008-12-25 00:26:37.000000000 +0100
+++ linux-2.6.29-rc7-umluml/arch/um/kernel/ptrace.c	2009-03-06 20:27:51.000000000 +0100
@@ -64,6 +64,11 @@
 		ret = poke_user(child, addr, data);
 		break;
 
+	case PTRACE_SYSEMU:
+	case PTRACE_SYSEMU_SINGLESTEP:
+		ret=-EIO;
+		break;
+
 	/* continue and stop at next (return from) syscall */
 	case PTRACE_SYSCALL:
 	/* restart after signal. */

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] UML on UML fixed: it did not start
  2009-03-06 19:49 [PATCH] UML on UML fixed: it did not start Renzo Davoli
@ 2009-03-08  6:49 ` Américo Wang
  2009-03-10 14:27 ` Américo Wang
  1 sibling, 0 replies; 3+ messages in thread
From: Américo Wang @ 2009-03-08  6:49 UTC (permalink / raw)
  To: Renzo Davoli; +Cc: linux-kernel, Jeff Dike

On Fri, Mar 06, 2009 at 08:49:22PM +0100, Renzo Davoli wrote:
>It is currently impossible to run a user-mode linux machine inside another user-mode 
>linux (UML on UML). It breaks after a few instructions. When it tries to check
>whether SYSEMU is installed (the inner) UML receives an inconsistent result 
>(from the outer UML).
>
>This is the output of a broken attempt:
>$ ./linux mem=256m ubd0=cow
>Locating the bottom of the address space ... 0x0
>Locating the top of the address space ... 0xc0000000
>Core dump limits :
>        soft - 0
>        hard - NONE
>Checking that ptrace can change system call numbers...OK
>Checking ptrace new tags for syscall emulation...unsupported
>Checking syscall emulation patch for ptrace...check_sysemu : expected SIGTRAP, got status = 256
>$
>
>The problem is the following:
>PTRACE_SYSCALL/SINGLESTEP is currently managed inside arch_ptrace for ARCH=um.
>
>PTRACE_SYSEMU/SUSEMU_SINGLESTEP is not captured in arch_ptrace's switch, therefore
>it is erroneously passed back to ptrace_request (in kernel/ptrace).
>
>This simple patch simply forces ptrace to return an error on PTRACE_SYSEMU/SUSEMU_SINGLESTEP
>as it is unsupported on ARCH=um, and fixes the problem.
>
>I posted the same patch one month ago. I just tested it again against the latest kernel.
>
>	renzo

Thanks, renzo! Good work!

>
>Signed-off-by: Renzo Davoli <renzo@cs.unibo.it>
>---
>diff -Naur linux-2.6.29-rc7/arch/um/kernel/ptrace.c linux-2.6.29-rc7-umluml/arch/um/kernel/ptrace.c
>--- linux-2.6.29-rc7/arch/um/kernel/ptrace.c	2008-12-25 00:26:37.000000000 +0100
>+++ linux-2.6.29-rc7-umluml/arch/um/kernel/ptrace.c	2009-03-06 20:27:51.000000000 +0100
>@@ -64,6 +64,11 @@
> 		ret = poke_user(child, addr, data);
> 		break;
> 
>+	case PTRACE_SYSEMU:
>+	case PTRACE_SYSEMU_SINGLESTEP:
>+		ret=-EIO;
>+		break;
>+

I think this is OK. Please feel free to add my reviewed-by:

Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>

Jeff, what do you think?

-- 
Do what you love, f**k the rest! F**k the regulations!
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] UML on UML fixed: it did not start
  2009-03-06 19:49 [PATCH] UML on UML fixed: it did not start Renzo Davoli
  2009-03-08  6:49 ` Américo Wang
@ 2009-03-10 14:27 ` Américo Wang
  1 sibling, 0 replies; 3+ messages in thread
From: Américo Wang @ 2009-03-10 14:27 UTC (permalink / raw)
  To: Renzo Davoli
  Cc: linux-kernel, Jeff Dike, Andrew Morton, user-mode-linux-devel

On Fri, Mar 06, 2009 at 08:49:22PM +0100, Renzo Davoli wrote:
>It is currently impossible to run a user-mode linux machine inside another user-mode 
>linux (UML on UML). It breaks after a few instructions. When it tries to check
>whether SYSEMU is installed (the inner) UML receives an inconsistent result 
>(from the outer UML).
>
>This is the output of a broken attempt:
>$ ./linux mem=256m ubd0=cow
>Locating the bottom of the address space ... 0x0
>Locating the top of the address space ... 0xc0000000
>Core dump limits :
>        soft - 0
>        hard - NONE
>Checking that ptrace can change system call numbers...OK
>Checking ptrace new tags for syscall emulation...unsupported
>Checking syscall emulation patch for ptrace...check_sysemu : expected SIGTRAP, got status = 256
>$
>
>The problem is the following:
>PTRACE_SYSCALL/SINGLESTEP is currently managed inside arch_ptrace for ARCH=um.
>
>PTRACE_SYSEMU/SUSEMU_SINGLESTEP is not captured in arch_ptrace's switch, therefore
>it is erroneously passed back to ptrace_request (in kernel/ptrace).
>
>This simple patch simply forces ptrace to return an error on PTRACE_SYSEMU/SUSEMU_SINGLESTEP
>as it is unsupported on ARCH=um, and fixes the problem.
>
>I posted the same patch one month ago. I just tested it again against the latest kernel.
>
>	renzo
>
>Signed-off-by: Renzo Davoli <renzo@cs.unibo.it>

Cc: Andrew Morton <akpm@osdl.org>

Andrew, would you like to put this patch into -mm? It looks fine for me.

Renzo, I remember you sent some patches about PTRACE_SYSEMU support
for UML some days ago, could you please rebase them against the latest
-git tree and resend?

Thank you very much! Have a nice day!


Yours,
Cong
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-03-10 14:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-06 19:49 [PATCH] UML on UML fixed: it did not start Renzo Davoli
2009-03-08  6:49 ` Américo Wang
2009-03-10 14:27 ` Américo Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox