NetBSD Problem Report #39913
From www@NetBSD.org Thu Nov 13 15:47:52 2008
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by narn.NetBSD.org (Postfix) with ESMTP id 997BA63B8A9
for <gnats-bugs@gnats.netbsd.org>; Thu, 13 Nov 2008 15:47:52 +0000 (UTC)
Message-Id: <20081113154752.63DD863B898@narn.NetBSD.org>
Date: Thu, 13 Nov 2008 15:47:52 +0000 (UTC)
From: ad@netbsd.org
Reply-To: ad@netbsd.org
To: gnats-bugs@NetBSD.org
Subject: exec, fork, exit hooks need locking
X-Send-Pr-Version: www-1.0
>Number: 39913
>Category: kern
>Synopsis: exec, fork, exit hooks need locking
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Nov 13 15:50:00 +0000 2008
>Closed-Date:
>Last-Modified: Thu Apr 18 18:25:01 +0000 2024
>Originator: Andrew Doran
>Release: 5.99.1
>Organization:
The NetBSD Project
>Environment:
n/a
>Description:
As per summary.
>How-To-Repeat:
Code inspection.
>Fix:
The exechooks can be covered by exec_lock.
Another mechanism will be needed for fork and exit hooks.
>Release-Note:
>Audit-Trail:
From: Andrew Doran <ad@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/39913 CVS commit: src/sys/kern
Date: Fri, 14 Nov 2008 13:01:18 +0000 (UTC)
Module Name: src
Committed By: ad
Date: Fri Nov 14 13:01:18 UTC 2008
Modified Files:
src/sys/kern: kern_subr.c
Log Message:
PR kern/39913 exec, fork, exit hooks need locking
Acquire exec_lock where needed.
To generate a diff of this commit:
cvs rdiff -r1.194 -r1.195 src/sys/kern/kern_subr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Soren Jacobsen <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/39913 CVS commit: [netbsd-5] src/sys/kern
Date: Mon, 17 Nov 2008 18:56:05 +0000 (UTC)
Module Name: src
Committed By: snj
Date: Mon Nov 17 18:56:05 UTC 2008
Modified Files:
src/sys/kern [netbsd-5]: kern_subr.c
Log Message:
Pull up following revision(s) (requested by ad in ticket #75):
sys/kern/kern_subr.c: revision 1.195
PR kern/39913 exec, fork, exit hooks need locking
Acquire exec_lock where needed.
To generate a diff of this commit:
cvs rdiff -r1.192 -r1.192.4.1 src/sys/kern/kern_subr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->feedback
State-Changed-By: oster@NetBSD.org
State-Changed-When: Fri, 18 Nov 2011 21:12:18 +0000
State-Changed-Why:
It appears that this is fixed, and pulled up. Is there anything further to do here?
State-Changed-From-To: feedback->open
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 09 Apr 2012 06:02:07 +0000
State-Changed-Why:
ad resigned; someone needs to figure out if this is fully fixed or not
From: "Juergen Hannken-Illjes" <hannken@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/39913 CVS commit: src/sys/kern
Date: Wed, 17 Jan 2024 10:18:42 +0000
Module Name: src
Committed By: hannken
Date: Wed Jan 17 10:18:41 UTC 2024
Modified Files:
src/sys/kern: init_main.c kern_hook.c
Log Message:
Protect kernel hooks exechook, exithook and forkhook with rwlock.
Lock as writer on establish/disestablish and as reader on list traverse.
For exechook ride "exec_lock" as it is already take as reader when
traversing the list. Add local locks for exithook and forkhook.
Move exec_init before signal_init as signal_init calls exechook_establish()
that needs "exec_lock".
PR kern/39913 "exec, fork, exit hooks need locking"
To generate a diff of this commit:
cvs rdiff -u -r1.546 -r1.547 src/sys/kern/init_main.c
cvs rdiff -u -r1.14 -r1.15 src/sys/kern/kern_hook.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/39913 CVS commit: [netbsd-10] src/sys
Date: Thu, 18 Apr 2024 18:22:10 +0000
Module Name: src
Committed By: martin
Date: Thu Apr 18 18:22:10 UTC 2024
Modified Files:
src/sys/kern [netbsd-10]: init_main.c kern_hook.c vfs_mount.c
src/sys/miscfs/procfs [netbsd-10]: procfs.h procfs_subr.c
procfs_vfsops.c procfs_vnops.c
Log Message:
Pull up following revision(s) (requested by hannken in ticket #668):
sys/miscfs/procfs/procfs.h: revision 1.83
sys/miscfs/procfs/procfs.h: revision 1.84
sys/kern/vfs_mount.c: revision 1.104
sys/miscfs/procfs/procfs_vnops.c: revision 1.230
sys/kern/init_main.c: revision 1.547
sys/kern/kern_hook.c: revision 1.15
sys/miscfs/procfs/procfs_vfsops.c: revision 1.112
sys/miscfs/procfs/procfs_vfsops.c: revision 1.113
sys/miscfs/procfs/procfs_vfsops.c: revision 1.114
sys/miscfs/procfs/procfs_subr.c: revision 1.117
Print dangling vnode before panic() to help debug.
PR kern/57775 ""panic: unmount: dangling vnode" while umounting procfs"
Protect kernel hooks exechook, exithook and forkhook with rwlock.
Lock as writer on establish/disestablish and as reader on list traverse.
For exechook ride "exec_lock" as it is already take as reader when
traversing the list. Add local locks for exithook and forkhook.
Move exec_init before signal_init as signal_init calls exechook_establish()
that needs "exec_lock".
PR kern/39913 "exec, fork, exit hooks need locking"
Add a hashmap to access all procfs nodes by pid.
Using the exechook to revoke procfs nodes is racy and may deadlock:
one thread runs doexechooks() -> procfs_revoke_vnodes() and wants to suspend
the file system for vgone(), while another thread runs a forced unmount,
has the file system suspended, tries to disestablish the exechook and
waits for doexechooks() to complete.
Establish/disestablish the exechook on module load/unload instead
mount/unmount and use the hashmap to access all procfs nodes for this pid.
May fix PR kern/57775 ""panic: unmount: dangling vnode" while umounting procfs"
Remove all procfs nodes for this process on process exit.
To generate a diff of this commit:
cvs rdiff -u -r1.541 -r1.541.2.1 src/sys/kern/init_main.c
cvs rdiff -u -r1.14 -r1.14.2.1 src/sys/kern/kern_hook.c
cvs rdiff -u -r1.101 -r1.101.2.1 src/sys/kern/vfs_mount.c
cvs rdiff -u -r1.82 -r1.82.4.1 src/sys/miscfs/procfs/procfs.h
cvs rdiff -u -r1.116 -r1.116.20.1 src/sys/miscfs/procfs/procfs_subr.c
cvs rdiff -u -r1.111 -r1.111.4.1 src/sys/miscfs/procfs/procfs_vfsops.c
cvs rdiff -u -r1.229 -r1.229.4.1 src/sys/miscfs/procfs/procfs_vnops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.