summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2005-09-27 18:10:26 +0000
committerpeter <peter@FreeBSD.org>2005-09-27 18:10:26 +0000
commitef35b51d9d50287690c02c0c566d37a0a97161db (patch)
tree6cccaad7d1620ad5fe1791733869510c83045c68 /sys
parent0d152100b2df7e3e76fc69497ff1287595a74ee4 (diff)
downloadFreeBSD-src-ef35b51d9d50287690c02c0c566d37a0a97161db.zip
FreeBSD-src-ef35b51d9d50287690c02c0c566d37a0a97161db.tar.gz
Don't let the upper bits of %dr6/%dr7 get set.
Submitted by: Nate Eldredge <neldredge@math.ucsd.edu>
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/machdep.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 3e07952..5345dc1 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -1726,11 +1726,15 @@ set_dbregs(struct thread *td, struct dbreg *dbregs)
* check for undefined settings. Setting these bit patterns
* result in undefined behaviour and can lead to an unexpected
* TRCTRAP or a general protection fault right here.
+ * Upper bits of dr6 and dr7 must not be set
*/
for (i = 0, mask1 = 0x3<<16, mask2 = 0x2<<16; i < 8;
i++, mask1 <<= 2, mask2 <<= 2)
if ((dbregs->dr[7] & mask1) == mask2)
return (EINVAL);
+ if ((dbregs->dr[6] & 0xffffffff00000000ul) != 0 ||
+ (dbregs->dr[7] & 0xffffffff00000000ul) != 0)
+ return (EINVAL);
pcb = td->td_pcb;
OpenPOWER on IntegriCloud