diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -229,6 +229,14 @@ copy_thread(td1, td2); + /* Reset debug registers in the new process */ + pcb2->pcb_dr0 = 0; + pcb2->pcb_dr1 = 0; + pcb2->pcb_dr2 = 0; + pcb2->pcb_dr3 = 0; + pcb2->pcb_dr6 = 0; + pcb2->pcb_dr7 = 0; + /* Point mdproc and then copy over p1's contents */ mdp2 = &p2->p_md; bcopy(&p1->p_md, mdp2, sizeof(*mdp2)); diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -241,6 +241,14 @@ copy_thread(td1, td2); + /* Reset debug registers in the new process */ + pcb2->pcb_dr0 = 0; + pcb2->pcb_dr1 = 0; + pcb2->pcb_dr2 = 0; + pcb2->pcb_dr3 = 0; + pcb2->pcb_dr6 = 0; + pcb2->pcb_dr7 = 0; + /* Point mdproc and then copy over td1's contents */ mdp2 = &p2->p_md; bcopy(&p1->p_md, mdp2, sizeof(*mdp2));