Re: [PATCH v2] x86/debug: Fix DR6 handling

From: Tom de Vries
Date: Fri Jan 29 2021 - 12:02:56 EST


On 1/29/21 3:48 PM, Borislav Petkov wrote:
> On Thu, Jan 28, 2021 at 10:16:27PM +0100, Peter Zijlstra wrote:
>>
>> Tom reported that one of the GDB test-cases failed, and Boris bisected
>> it to commit:
>>
>> d53d9bc0cf78 ("x86/debug: Change thread.debugreg6 to thread.virtual_dr6")
>>
>> The debugging session led us to commit:
>>
>> 6c0aca288e72 ("x86: Ignore trap bits on single step exceptions")
>>
>> It turns out that TF and data breakpoints are both traps and will be
>> merged, while instruction breakpoints are faults and will not be
>> merged. This means 6c0aca288e72 is wrong, we only need to exclude TF
>> and instruction breakpoints while we can merge TF and data
>> breakpoints.
>>
>> Fixes: d53d9bc0cf78 ("x86/debug: Change thread.debugreg6 to thread.virtual_dr6")
>> Fixes: 6c0aca288e72 ("x86: Ignore trap bits on single step exceptions")
>> Reported-by: Tom de Vries <tdevries@xxxxxxx>
>> Bisected-by: Borislav Petkov <bp@xxxxxxxxx>
>> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
>
> I guess
>
> Cc: <stable@xxxxxxxxxxxxxxx>
>
> Also,
>
> Reviewed-by: Borislav Petkov <bp@xxxxxxx>
>
> And gdb testsuite is a bit happier:
>
> --- before
> +++ after
> === gdb Summary ===
>
> -# of expected passes 70822
> -# of unexpected failures 899
> +# of expected passes 70852
> +# of unexpected failures 869
> # of expected failures 74
> # of known failures 99
> # of untested testcases 114
>
> You just fixed 30(!) testcases.
>
> :-)
>

Hi Boris,

thanks for testing this, and just to confirm: the total number of
regressions I see in the gdb testsuite related to watchpoints is indeed 30.

Thanks,
- Tom