x86: clear %db registers in new process

Reported by:	 Michał Górny <mgorny@gentoo.org>
PR:	254661
Reviewed by:	emaste, jhb
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D29496
This commit is contained in:
Konstantin Belousov 2021-03-30 18:40:02 +03:00
parent 2b98ea2e51
commit 8223717ce6
2 changed files with 16 additions and 0 deletions

View File

@ -229,6 +229,14 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags)
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));

View File

@ -241,6 +241,14 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags)
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));