Module Name:    src
Committed By:   maxv
Date:           Thu Apr  5 14:14:27 UTC 2018

Modified Files:
        src/sys/arch/x86/x86: dbregs.c

Log Message:
Hum, don't let userland set bit 13, because this can crash the kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x86/x86/dbregs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/dbregs.c
diff -u src/sys/arch/x86/x86/dbregs.c:1.7 src/sys/arch/x86/x86/dbregs.c:1.8
--- src/sys/arch/x86/x86/dbregs.c:1.7	Thu Apr  5 14:11:20 2018
+++ src/sys/arch/x86/x86/dbregs.c	Thu Apr  5 14:14:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: dbregs.c,v 1.7 2018/04/05 14:11:20 maxv Exp $	*/
+/*	$NetBSD: dbregs.c,v 1.8 2018/04/05 14:14:27 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -191,6 +191,9 @@ x86_dbregs_validate(const struct dbreg *
 		if (regs->dr[i] >= (vaddr_t)VM_MAXUSER_ADDRESS)
 			return EINVAL;
 
+	if (regs->dr[7] & X86_DR7_GENERAL_DETECT_ENABLE)
+		return EINVAL;
+
 	/*
 	 * Skip checks for reserved registers (DR4-DR5, DR8-DR15).
 	 *

Reply via email to