From: Manfred Spraul <manfred@colorfullife.com>
To: Andrew Morton <akpm@osdl.org>
Cc: viro@parcelfarce.linux.theplanet.co.uk, arekm@pld-linux.org,
linux-kernel@vger.kernel.org, jmorris@redhat.com,
sds@epoch.ncsc.mil, "Albert D. Cahalan" <acahalan@cs.uml.edu>
Subject: Re: 2.6.0-test9 and sleeping function called from invalid context
Date: Sun, 26 Oct 2003 18:26:35 +0100 [thread overview]
Message-ID: <3F9C03CB.8030200@colorfullife.com> (raw)
In-Reply-To: <3F9BAA1B.6080203@colorfullife.com>
[-- Attachment #1: Type: text/plain, Size: 166 bytes --]
What about the attached patch?
The lifetime of dentries is quite long, thus I'd prefer if the race
between proc_pid_lookup and sys_exit is closed.
--
Manfred
[-- Attachment #2: patch-proc_dentry --]
[-- Type: text/plain, Size: 1004 bytes --]
--- 2.6/fs/proc/base.c 2003-10-09 21:23:15.000000000 +0200
+++ build-2.6/fs/proc/base.c 2003-10-26 16:25:24.000000000 +0100
@@ -1524,6 +1524,7 @@
struct inode *inode;
struct proc_inode *ei;
unsigned tgid;
+ int died;
if (dentry->d_name.len == 4 && !memcmp(dentry->d_name.name,"self",4)) {
inode = new_inode(dir->i_sb);
@@ -1567,12 +1568,21 @@
dentry->d_op = &pid_base_dentry_operations;
+ died = 0;
+ d_add(dentry, inode);
spin_lock(&task->proc_lock);
task->proc_dentry = dentry;
- d_add(dentry, inode);
+ if (!pid_alive(task)) {
+ dentry = proc_pid_unhash(task);
+ died = 1;
+ }
spin_unlock(&task->proc_lock);
put_task_struct(task);
+ if (died) {
+ proc_pid_flush(dentry);
+ goto out;
+ }
return NULL;
out:
return ERR_PTR(-ENOENT);
@@ -1612,10 +1622,7 @@
dentry->d_op = &pid_base_dentry_operations;
- spin_lock(&task->proc_lock);
- task->proc_dentry = dentry;
d_add(dentry, inode);
- spin_unlock(&task->proc_lock);
put_task_struct(task);
return NULL;
next prev parent reply other threads:[~2003-10-26 17:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-25 22:45 Arkadiusz Miskiewicz
2003-10-26 1:50 ` Andrew Morton
2003-10-26 5:49 ` Andrew Morton
2003-10-26 8:26 ` viro
2003-10-26 8:41 ` Andrew Morton
2003-10-26 9:41 ` viro
2003-10-26 11:03 ` Manfred Spraul
2003-10-26 17:26 ` Manfred Spraul [this message]
2003-10-27 13:52 ` Stephen Smalley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3F9C03CB.8030200@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=acahalan@cs.uml.edu \
--cc=akpm@osdl.org \
--cc=arekm@pld-linux.org \
--cc=jmorris@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sds@epoch.ncsc.mil \
--cc=viro@parcelfarce.linux.theplanet.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®