x86/traps: Avoid the #GP slowpath for guest #DB exceptions
PATCH 1/1 x86/traps: Avoid the #GP slowpath for guest #DB exceptions
do_debug() is capable of correctly dealing with #DB exceptions in guest context, and indeed needs to be as the 'icebp' instruction skips the DPL check anyway.
--- xen/arch/x86/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/traps.c +1 -1
@@ -3518,7 +3518,7 @@ void __init init_idt_traps(void)* has been read and saved on the stack. */ set_intr_gate (TRAP_divide_error,÷_error); -set_intr_gate (TRAP_debug,&debug); +set_swint_gate (TRAP_debug,&debug);/* usable from all privileges */ set_intr_gate (TRAP_nmi,&nmi);set_swint_gate (TRAP_int3,&int3);/* usable from all privileges */ set_swint_gate (TRAP_overflow,&overflow);/* usable from all privileges */
Signature · 1 line
1.7.10.4
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 08.01.15 at 14:25, <[email protected]> wrote:
do_debug()is capable of correctly dealing with #DB exceptions in guest context, and indeed needs to be as the 'icebp' instruction skips the DPL check anyway.
I don't follow: ICEBP doesn't check DPL, right, but what does setting DPL to 3 buy us? Other than for INTO and INT3, we don't want to encourage use of INT $0x01 instructions, nor am I aware of anyone commonly using them. Yet afaict only they would be affected by your change. Actual #DB, just like any other hardware exceptions, don't consider DPL just like ICEBP doesn't.
Jan
Quoted 4 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 08.01.15 at 14:25, <[email protected]> wrote:
do_debug()is capable of correctly dealing with #DB exceptions in guest context, and indeed needs to be as the 'icebp' instruction skips the DPL check anyway.
Quoted 9 lines
I don't follow: ICEBP doesn't check DPL, right, but what does setting DPL to 3 buy us? Other than for INTO and INT3, we don't want to encourage use of INT $0x01 instructions, nor am I aware of anyone commonly using them. Yet afaict only they would be affected by your change. Actual #DB, just like any other hardware exceptions, don't consider DPL just like ICEBP doesn't.
Jan
I noticed it as I was attempting to get my debugtraps test case working for PV guests, which does indeed use 'int $0x1'. But as you point out, it is only 'int $0x1' we would gain a fastpath for, which doesn't really make it worthwhile.
~Andrew