Hi all, Lguest is a simple hypervisor which runs Linux under Linux, without needing VT hardware. Two people asked if I had a version of lguest which worked on other-than-bleeding-edge-mm kernels, so I did a backport of the latest version to 2.6.21. http://lguest.ozlabs.org/lguest-2.6.21-254.patch.gz See Documentation/lguest/lguest.txt for how to run, drivers/lguest/README for the draft code documentation journey. Bug or even success reports always welcome! Rusty. Quickstart: $ cd linux-2.6.21 $ zcat /tmp/lguest-2.6.21-254.patch.gz | patch -p1 $ make - Say "y" to CONFIG_EXPERIMENTAL, "m" to CONFIG_LGUEST. $ make modules_install $ make -C Documentation/lguest $ sudo Documentation/lguest/lguest --block=<some-convenient-raw-image> \ 128 vmlinux root=/dev/lgba Three ^C's within one second will kill the guest.
Hi Rusty! I found you forgot to check the return value of copy_from_user, and here is the fix for drivers/lguest/interrupts_and_traps.c. Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com> --- --- linux-2.6.21-rc7-mm2/drivers/lguest/interrupts_and_traps.c.orig 2007-05-03 03:10:44.000000000 +0800 +++ linux-2.6.21-rc7-mm2/drivers/lguest/interrupts_and_traps.c 2007-05-03 03:11:42.000000000 +0800 @@ -75,7 +75,8 @@ void maybe_do_interrupt(struct lguest *l set_bit(0, lg->irqs_pending); /* Mask out any interrupts they have blocked. */ - copy_from_user(&blk, lg->lguest_data->blocked_interrupts, sizeof(blk)); + if (copy_from_user(&blk, lg->lguest_data->blocked_interrupts, sizeof(blk))) + return; bitmap_andnot(blk, lg->irqs_pending, blk, LGUEST_IRQS); irq = find_first_bit(blk, LGUEST_IRQS);
On Thu, May 03, 2007 at 03:33:03AM +0800, WANG Cong wrote:>Hi Rusty! > >I found you forgot to check the return value of copy_from_user, and here is the fix for drivers/lguest/interrupts_and_traps.c. >Also this one, in drivers/lguest/hypercalls.c. Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com> --- --- linux-2.6.21-rc7-mm2/drivers/lguest/hypercalls.c.orig 2007-05-03 03:45:53.000000000 +0800 +++ linux-2.6.21-rc7-mm2/drivers/lguest/hypercalls.c 2007-05-03 03:46:20.000000000 +0800 @@ -102,7 +102,8 @@ static void do_async_hcalls(struct lgues unsigned int i; u8 st[LHCALL_RING_SIZE]; - copy_from_user(&st, &lg->lguest_data->hcall_status, sizeof(st)); + if (copy_from_user(&st, &lg->lguest_data->hcall_status, sizeof(st))) + return; for (i = 0; i < ARRAY_SIZE(st); i++) { struct lguest_regs regs; unsigned int n = lg->next_hcall;
On Thu, May 03, 2007 at 12:43:48AM +1000, Rusty Russell wrote:> Hi all, > > Lguest is a simple hypervisor which runs Linux under Linux, without > needing VT hardware. > > Two people asked if I had a version of lguest which worked on > other-than-bleeding-edge-mm kernels, so I did a backport of the latest > version to 2.6.21. > > http://lguest.ozlabs.org/lguest-2.6.21-254.patch.gz > > See Documentation/lguest/lguest.txt for how to run, > drivers/lguest/README for the draft code documentation journey.Your lguest readme is quite lacking in the area of how to configure a guest kernel as opposed to the host kernel. More hand-holding, please. Maybe it's obvious once I've actually applied the patch and run menuconfig, but I'm loathe to attempt anything that isn't a cake walk at my current loadavg, especially given the fits of blind rage trying to do anything nontrivial with Xen tends to provoke in me. -- Mathematics is the supreme nostalgia of our time.