Rusty Russell
2007-Jul-20 05:12 UTC
[PATCH 1/3] lguest: fix sense if IF flag on interrupt injection
The sense of the IF bit is backwards in the host interrupt handling. This means we always save "IF=1" on the stack when injecting an interrupt. It turns out this is almost always correct (unless the guest is taking a page fault in an interrupt due to an unpopulated vmalloc mapping), so went unnoticed. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> --- drivers/lguest/interrupts_and_traps.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff -r 209f5cd5cda5 drivers/lguest/interrupts_and_traps.c --- a/drivers/lguest/interrupts_and_traps.c Fri Jul 20 14:53:40 2007 +1000 +++ b/drivers/lguest/interrupts_and_traps.c Fri Jul 20 21:34:06 2007 +1000 @@ -38,12 +38,12 @@ static void set_guest_interrupt(struct l ss = lg->regs->ss; } - /* We use IF bit in eflags to indicate whether irqs were disabled - (it's always 0, since irqs are enabled when guest is running). */ + /* We use IF bit in eflags to indicate whether irqs were enabled + (it's always 1, since irqs are enabled when guest is running). */ eflags = lg->regs->eflags; - if (get_user(irq_enable, &lg->lguest_data->irq_enabled)) - irq_enable = 0; - eflags |= (irq_enable & X86_EFLAGS_IF); + if (get_user(irq_enable, &lg->lguest_data->irq_enabled) == 0 + && !(irq_enable & X86_EFLAGS_IF)) + eflags &= ~X86_EFLAGS_IF; push_guest_stack(lg, &gstack, eflags); push_guest_stack(lg, &gstack, lg->regs->cs);
Rusty Russell
2007-Jul-20 05:13 UTC
[PATCH 2/3] lguest: trivial: We now have asm/processor-flags.h, so use it.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> diff -r f41cd1b8d7ef drivers/lguest/lguest_asm.S --- a/drivers/lguest/lguest_asm.S Fri Jul 20 13:46:40 2007 +1000 +++ b/drivers/lguest/lguest_asm.S Fri Jul 20 14:17:04 2007 +1000 @@ -2,9 +2,7 @@ #include <linux/lguest.h> #include <asm/asm-offsets.h> #include <asm/thread_info.h> - -/* FIXME: Once asm/processor-flags.h goes in, include that */ -#define X86_EFLAGS_IF 0x00000200 +#include <asm/processor-flags.h> /* * This is where we begin: we have a magic signature which the launcher looks