diff --git a/drivers/lguest/interrupts_and_traps.c b/drivers/lguest/interrupts_and_traps.c index 49aa55577d0dec0e2543c2a8801b91ebc98b1359..39731232d82770ecc3a4bb0d76cb27d4b9578621 100644 --- a/drivers/lguest/interrupts_and_traps.c +++ b/drivers/lguest/interrupts_and_traps.c @@ -270,8 +270,11 @@ void pin_stack_pages(struct lguest *lg) /* Depending on the CONFIG_4KSTACKS option, the Guest can have one or * two pages of stack space. */ for (i = 0; i < lg->stack_pages; i++) - /* The stack grows *upwards*, hence the subtraction */ - pin_page(lg, lg->esp1 - i * PAGE_SIZE); + /* The stack grows *upwards*, so the address we're given is the + * start of the page after the kernel stack. Subtract one to + * get back onto the first stack page, and keep subtracting to + * get to the rest of the stack pages. */ + pin_page(lg, lg->esp1 - 1 - i * PAGE_SIZE); } /* Direct traps also mean that we need to know whenever the Guest wants to use