NetBSD Problem Report #42053
From www@NetBSD.org Sat Sep 12 19:27:07 2009
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id 9D0C463C221
for <gnats-bugs@gnats.netbsd.org>; Sat, 12 Sep 2009 19:27:07 +0000 (UTC)
Message-Id: <20090912192707.70E3963C126@www.NetBSD.org>
Date: Sat, 12 Sep 2009 19:27:07 +0000 (UTC)
From: ryo@nerv.org
Reply-To: ryo@nerv.org
To: gnats-bugs@NetBSD.org
Subject: access of procfs occurs anonpage data leak
X-Send-Pr-Version: www-1.0
>Number: 42053
>Category: kern
>Synopsis: access of procfs occurs anonpage data leak
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: dholland
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Sep 12 19:30:00 +0000 2009
>Closed-Date: Wed Oct 28 14:27:48 +0000 2009
>Last-Modified: Wed Oct 28 14:27:48 +0000 2009
>Originator: SHIMIZU Ryo
>Release: NetBSD 5.0.1
>Organization:
>Environment:
NetBSD test 5.0.1 NetBSD 5.0.1 (GENERIC) #0: Thu Jul 30 01:39:11 UTC 2009 builds@b8.netbsd.org:/home/builds/ab/netbsd-5-0-1-RELEASE/i386\
/200907292356Z-obj/home/builds/ab/netbsd-5-0-1-RELEASE/src/sys/arch/i386/compile/GENERIC i386
>Description:
access /proc/#/stat many times, anonpage data leaks.
then, occur "out of swap" and crash kernel.
>How-To-Repeat:
$ while true; do find /proc -name stat -exec cat {} \;; done > /dev/null
in other terminal, for confirmation
$ systat 1 buf
"pages for anon (non-file) data" increase and never release.
>Fix:
not known
>Release-Note:
>Audit-Trail:
From: David Holland <dholland-bugs@netbsd.org>
To: ryo@nerv.org, gnats-bugs@netbsd.org
Cc:
Subject: Re: kern/42053: access of procfs occurs anonpage data leak
Date: Sun, 13 Sep 2009 18:09:13 +0000
On Sat, Sep 12, 2009 at 07:30:01PM +0000, ryo@nerv.org wrote:
> access /proc/#/stat many times, anonpage data leaks.
> then, occur "out of swap" and crash kernel.
This should fix it:
Index: procfs_linux.c
===================================================================
RCS file: /cvsroot/src/sys/miscfs/procfs/procfs_linux.c,v
retrieving revision 1.57
diff -u -p -r1.57 procfs_linux.c
--- procfs_linux.c 11 Jan 2009 03:16:33 -0000 1.57
+++ procfs_linux.c 13 Sep 2009 18:07:39 -0000
@@ -379,6 +379,8 @@ procfs_do_pid_statm(struct lwp *curl, st
(unsigned long)(vm->vm_ssize), /* stack size in pages */
(unsigned long) 0);
+ uvmspace_free(vm);
+
if (len == 0)
goto out;
@@ -483,6 +485,8 @@ procfs_do_pid_stat(struct lwp *curl, str
mutex_exit(p->p_lock);
mutex_exit(proc_lock);
+ uvmspace_free(vm);
+
if (len == 0)
goto out;
--
David A. Holland
dholland@netbsd.org
Responsible-Changed-From-To: kern-bug-people->dholland
Responsible-Changed-By: dholland@NetBSD.org
Responsible-Changed-When: Sun, 13 Sep 2009 18:11:05 +0000
Responsible-Changed-Why:
proposed a patch
State-Changed-From-To: open->feedback
State-Changed-By: snj@NetBSD.org
State-Changed-When: Thu, 08 Oct 2009 06:08:59 +0000
State-Changed-Why:
Does the proposed patch fix the problem?
From: SHIMIZU Ryo <ryo@nerv.org>
To: gnats-bugs@NetBSD.org
Cc: dholland@NetBSD.org, netbsd-bugs@netbsd.org, gnats-admin@netbsd.org,
snj@NetBSD.org, ryo@nerv.org
Subject: Re: kern/42053 (access of procfs occurs anonpage data leak)
Date: Thu, 08 Oct 2009 15:17:51 +0900
>Synopsis: access of procfs occurs anonpage data leak
>
>State-Changed-From-To: open->feedback
>State-Changed-By: snj@NetBSD.org
>State-Changed-When: Thu, 08 Oct 2009 06:08:59 +0000
>State-Changed-Why:
>Does the proposed patch fix the problem?
it was fixed in my environment by the patch.
thanks!
--
ryo shimizu
From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/42053 CVS commit: src/sys/miscfs/procfs
Date: Mon, 19 Oct 2009 01:25:29 +0000
Module Name: src
Committed By: dholland
Date: Mon Oct 19 01:25:29 UTC 2009
Modified Files:
src/sys/miscfs/procfs: procfs_linux.c
Log Message:
Avoid leaking pages. Fixes PR 42053 from SHIMIZU Ryo.
To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/miscfs/procfs/procfs_linux.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: feedback->pending-pullups
State-Changed-By: markd@NetBSD.org
State-Changed-When: Thu, 22 Oct 2009 22:34:51 +0000
State-Changed-Why:
feedback was provided, David committed the patch, I've requested a pullup.
From: Manuel Bouyer <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/42053 CVS commit: [netbsd-5] src/sys/miscfs/procfs
Date: Tue, 27 Oct 2009 21:42:34 +0000
Module Name: src
Committed By: bouyer
Date: Tue Oct 27 21:42:33 UTC 2009
Modified Files:
src/sys/miscfs/procfs [netbsd-5]: procfs_linux.c
Log Message:
Pull up following revision(s) (requested by markd in ticket #1113):
sys/miscfs/procfs/procfs_linux.c: revision 1.58
Avoid leaking pages. Fixes PR 42053 from SHIMIZU Ryo.
To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.54.8.1 src/sys/miscfs/procfs/procfs_linux.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: pending-pullups->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Wed, 28 Oct 2009 14:27:48 +0000
State-Changed-Why:
Fixed, thanks.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.