Date: Tue, 30 Mar 2021 23:27:49 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 8223717ce62c - main - x86: clear %db registers in new process Message-ID: <202103302327.12UNRnXu088523@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8223717ce62c1ad0becc34ce69fe2d1771f3ba05 commit 8223717ce62c1ad0becc34ce69fe2d1771f3ba05 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-03-30 15:40:02 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-03-30 23:07:35 +0000 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 --- sys/amd64/amd64/vm_machdep.c | 8 ++++++++ sys/i386/i386/vm_machdep.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index f64259decbff..98d212dc8771 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -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)); diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index c04fb57db4b1..ed40ebe5d1c8 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -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));help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103302327.12UNRnXu088523>
