Module Name:    src
Committed By:   maxv
Date:           Mon Feb 13 14:54:11 UTC 2017

Modified Files:
        src/sys/compat/linux/arch/amd64: linux_machdep.c

Log Message:
Don't let userland choose %rip. This is the Intel Sysret vulnerability
again.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/compat/linux/arch/amd64/linux_machdep.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/compat/linux/arch/amd64/linux_machdep.c
diff -u src/sys/compat/linux/arch/amd64/linux_machdep.c:1.49 src/sys/compat/linux/arch/amd64/linux_machdep.c:1.50
--- src/sys/compat/linux/arch/amd64/linux_machdep.c:1.49	Sun Feb  5 08:42:49 2017
+++ src/sys/compat/linux/arch/amd64/linux_machdep.c	Mon Feb 13 14:54:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_machdep.c,v 1.49 2017/02/05 08:42:49 maxv Exp $ */
+/*	$NetBSD: linux_machdep.c,v 1.50 2017/02/13 14:54:11 maxv Exp $ */
 
 /*-
  * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.49 2017/02/05 08:42:49 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.50 2017/02/13 14:54:11 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -234,7 +234,12 @@ linux_sendsig(const ksiginfo_t *ksi, con
 	if (error != 0) {
 		sigexit(l, SIGILL);
 		return;
-	}	
+	}
+
+	if ((vaddr_t)catcher >= VM_MAXUSER_ADDRESS) {
+		sigexit(l, SIGILL);
+		return;
+	}
 
 	linux_buildcontext(l, catcher, sp);
 	tf->tf_rdi = sigframe.info.lsi_signo;

Reply via email to