From: Andrea Arcangeli <[EMAIL PROTECTED]> there's a small glitch in the preempt notifier external module emulation. The overloaded debug handler will not detect when a debug exception has been generated by ptrace and it'll crash the host by calling the preempt emulator like if this was a KVM preempt emulated exception, instead of notifying userland.
To detect when the preempt emulation is needed and when the exception should be bypassed to the original handler, I decided to use bit 10 of db7 that can't be set to 1 by ptrace, the mask against the userland passed db7 value is 0xfc00, so bit 10 is forbidden to be on unless it was KVM setting it manually with 0x701 (kvm really only needs 0x301 to get exact exception, dunno what 0x400 means, it's defined reserved, but it doesn't matter what it means as long as ptrace can't set it ;). Signed-off-by: Andrea Arcangeli <[EMAIL PROTECTED]> Signed-off-by: Avi Kivity <[EMAIL PROTECTED]> diff --git a/kernel/preempt.c b/kernel/preempt.c index ed5d1c1..0ae69d7 100644 --- a/kernel/preempt.c +++ b/kernel/preempt.c @@ -143,10 +143,10 @@ unsigned long orig_int1_handler; asm ("pn_int1_handler: \n\t" "push " TMP " \n\t" - "mov %db6, " TMP " \n\t" - "test $1, " TMP " \n\t" + "mov %db7, " TMP " \n\t" + "cmp $0x701, " TMP " \n\t" "pop " TMP " \n\t" - "jz .Lnotme \n\t" + "jnz .Lnotme \n\t" SAVE_REGS "\n\t" #ifdef CONFIG_X86_64 "leaq 120(%rsp),%rdi\n\t" ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ kvm-commits mailing list kvm-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-commits