Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Set kinfo_lwp to 0 before filling it so that if som...



details:   https://anonhg.NetBSD.org/src/rev/8e29fe67c03d
branches:  trunk
changeset: 755692:8e29fe67c03d
user:      pooka <pooka%NetBSD.org@localhost>
date:      Wed Jun 16 18:49:22 2010 +0000

description:
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.

diffstat:

 sys/kern/init_sysctl.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 26122e2fba02 -r 8e29fe67c03d sys/kern/init_sysctl.c
--- a/sys/kern/init_sysctl.c    Wed Jun 16 18:13:41 2010 +0000
+++ b/sys/kern/init_sysctl.c    Wed Jun 16 18:49:22 2010 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index