diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2013-09-05 04:15:53 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2013-09-05 18:39:27 -0400 |
commit | 98fb4e5e6b100a247ce2dbf2d1699726fdcdef20 (patch) | |
tree | caed1f9e084f2e8f7d1a38b8705d2c7831da2ee8 /drivers/lguest | |
parent | 4623c28e222d82f87537ef66db61ebcfbd8306db (diff) |
lguest: fix guest kernel stack overflow when TF bit set.
The symptoms are that running gdb on a binary causes the guest to
overflow the kernels stack (after some period of time), resulting in
it finally being killed with a "Bad address" message.
Reported-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest')
-rw-r--r-- | drivers/lguest/interrupts_and_traps.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/lguest/interrupts_and_traps.c b/drivers/lguest/interrupts_and_traps.c index 28433a155d67..70dfcdc29f1f 100644 --- a/drivers/lguest/interrupts_and_traps.c +++ b/drivers/lguest/interrupts_and_traps.c | |||
@@ -140,6 +140,16 @@ static void set_guest_interrupt(struct lg_cpu *cpu, u32 lo, u32 hi, | |||
140 | cpu->regs->eip = idt_address(lo, hi); | 140 | cpu->regs->eip = idt_address(lo, hi); |
141 | 141 | ||
142 | /* | 142 | /* |
143 | * Trapping always clears these flags: | ||
144 | * TF: Trap flag | ||
145 | * VM: Virtual 8086 mode | ||
146 | * RF: Resume | ||
147 | * NT: Nested task. | ||
148 | */ | ||
149 | cpu->regs->eflags &= | ||
150 | ~(X86_EFLAGS_TF|X86_EFLAGS_VM|X86_EFLAGS_RF|X86_EFLAGS_NT); | ||
151 | |||
152 | /* | ||
143 | * There are two kinds of interrupt handlers: 0xE is an "interrupt | 153 | * There are two kinds of interrupt handlers: 0xE is an "interrupt |
144 | * gate" which expects interrupts to be disabled on entry. | 154 | * gate" which expects interrupts to be disabled on entry. |
145 | */ | 155 | */ |