[Lguest] lguest: mapping switcher would thwack fixmap

Paul Bolle pebolle at tiscali.nl
Wed May 8 03:19:50 EST 2013


On Tue, 2013-05-07 at 14:33 +0930, Rusty Russell wrote:
> lguest: clear cached last cpu when guest_set_pgd() called.
> 
> commit v3.9-rc1-53-g6d0cda9 "lguest: cache last cpu we ran on." missed
> one case, which causes a triple fault.  The guest calls guest_set_pgd()
> on the top page, and we carefully remap the Switcher text page.  But
> we didn't reset last_host_cpu, so map_switcher_in_guest() thinks
> the guest's regs and IDT/GDT etc are already mapped.
> 
> Reported-by: Paul Bolle <pebolle at tiscali.nl>
> Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
> 
> diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c
> index 699187a..5b9ac32 100644
> --- a/drivers/lguest/page_tables.c
> +++ b/drivers/lguest/page_tables.c
> @@ -1002,6 +1002,7 @@ void guest_set_pgd(struct lguest *lg, unsigned long gpgdir, u32 idx)
>  			kill_guest(&lg->cpus[0],
>  				   "Cannot populate switcher mapping");
>  		}
> +		lg->pgdirs[pgdir].last_host_cpu = -1;
>  	}
>  }
>  

Thanks!

For the record: v3.9.1-rc1, with both the large diff you sent somewhere
halfway this thread and this one-liner fix applied, doesn't triple fault
the host anymore (neither on a virtual machine nor on a real laptop).


Paul Bolle



More information about the Lguest mailing list