Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/x86 Hum, don't let userland set bit 13, because...



details:   https://anonhg.NetBSD.org/src/rev/86ee282819fa
branches:  trunk
changeset: 360892:86ee282819fa
user:      maxv <maxv%NetBSD.org@localhost>
date:      Thu Apr 05 14:14:27 2018 +0000

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

diffstat:

 sys/arch/x86/x86/dbregs.c |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (19 lines):

diff -r 22442d3cdb25 -r 86ee282819fa sys/arch/x86/x86/dbregs.c
--- a/sys/arch/x86/x86/dbregs.c Thu Apr 05 14:11:20 2018 +0000
+++ b/sys/arch/x86/x86/dbregs.c Thu Apr 05 14:14:27 2018 +0000
@@ -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 @@
                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).
         *



Home | Main Index | Thread Index | Old Index