Module Name:    src
Committed By:   martin
Date:           Sun Aug 11 10:04:03 UTC 2019

Modified Files:
        src/sys/kern [netbsd-8]: sys_lwp.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1333):

        sys/kern/sys_lwp.c: revision 1.69 (patch)

Fix info leak: instead of using SS_INIT as a literal compound, use a global
variable from rodata. The compound gets pushed on the stack, the padding
of the structure was therefore not initialized, and was getting leaked to
userland in sys___sigaltstack14().


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.61.2.1 src/sys/kern/sys_lwp.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/kern/sys_lwp.c
diff -u src/sys/kern/sys_lwp.c:1.61 src/sys/kern/sys_lwp.c:1.61.2.1
--- src/sys/kern/sys_lwp.c:1.61	Thu Jun  1 02:45:13 2017
+++ src/sys/kern/sys_lwp.c	Sun Aug 11 10:04:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_lwp.c,v 1.61 2017/06/01 02:45:13 chs Exp $	*/
+/*	$NetBSD: sys_lwp.c,v 1.61.2.1 2019/08/11 10:04:03 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_lwp.c,v 1.61 2017/06/01 02:45:13 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_lwp.c,v 1.61.2.1 2019/08/11 10:04:03 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -53,6 +53,8 @@ __KERNEL_RCSID(0, "$NetBSD: sys_lwp.c,v 
 
 #define	LWP_UNPARK_MAX		1024
 
+static const stack_t lwp_ss_init = SS_INIT;
+
 static syncobj_t lwp_park_sobj = {
 	SOBJ_SLEEPQ_LIFO,
 	sleepq_unsleep,
@@ -86,7 +88,7 @@ do_lwp_create(lwp_t *l, void *arg, u_lon
 		return ENOMEM;
 
 	error = lwp_create(l, p, uaddr, flags & LWP_DETACHED, NULL, 0,
-	    p->p_emul->e_startlwp, arg, &l2, l->l_class, sigmask, &SS_INIT);
+	    p->p_emul->e_startlwp, arg, &l2, l->l_class, sigmask, &lwp_ss_init);
 	if (__predict_false(error)) {
 		uvm_uarea_free(uaddr);
 		return error;

Reply via email to