Module Name: src
Committed By: pooka
Date: Wed Jun 16 18:49:22 UTC 2010
Modified Files:
src/sys/kern: init_sysctl.c
Log Message:
Set kinfo_lwp to 0 before filling it so that if someone removes
variable assignments from here, kernel memory does not leak to
userspace.
Bug found, a little bit suprisingly, by the atf ps test which failed
due to the column width between the -o holdcnt column being too
wide due to the contents displayed being garbage.
To generate a diff of this commit:
cvs rdiff -u -r1.173 -r1.174 src/sys/kern/init_sysctl.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/init_sysctl.c
diff -u src/sys/kern/init_sysctl.c:1.173 src/sys/kern/init_sysctl.c:1.174
--- src/sys/kern/init_sysctl.c:1.173 Sat Feb 13 11:22:21 2010
+++ src/sys/kern/init_sysctl.c Wed Jun 16 18:49:22 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: init_sysctl.c,v 1.173 2010/02/13 11:22:21 yamt Exp $ */
+/* $NetBSD: init_sysctl.c,v 1.174 2010/06/16 18:49:22 pooka Exp $ */
/*-
* Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.173 2010/02/13 11:22:21 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.174 2010/06/16 18:49:22 pooka Exp $");
#include "opt_sysv.h"
#include "opt_compat_netbsd32.h"
@@ -3105,6 +3105,8 @@
KASSERT(lwp_locked(l, NULL));
+ memset(kl, 0, sizeof(*kl));
+
kl->l_forw = 0;
kl->l_back = 0;
kl->l_laddr = PTRTOUINT64(l);