Re: x86: Hardware breakpoints are not always triggered
From: Oleg Nesterov
Date: Thu Jan 28 2016 - 15:53:38 EST
On 01/28, Andrey Wagin wrote:
>
> We use hardware breakpoints in CRIU and we found that sometimes we set
> a break-point, but a process doesn't stop on it.
reproduced, and this certainly looks like kvm bug to me.
> The reproducer uses a different break-point address if it is executed
> with arguments than when it executed without arguments.
IOW, multiple processes running in parallel use the same debug register db0
but different address. And it seems that set_debugreg(address, 0) sometime
doesn't work in the guest kernel.
I think I verified the following:
- debug registers look always correct as it seen by the guest.
I used get_debugreg() to dump them after the task misses bp.
- do_debug() was not called in this case.
- finally, it seems that the host has the wrong value in db0
set by another process.
I modified your test-case so that child2() calls child() when
it detects the missed bp, and this does trigger do_debug/etc
while it should not.
Oleg.