Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+10
+10
drivers/lguest/interrupts_and_traps.c
··· 140 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 153 * There are two kinds of interrupt handlers: 0xE is an "interrupt 144 154 * gate" which expects interrupts to be disabled on entry. 145 155 */