From: ebiederm@xmission.com (Eric W. Biederman)
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Pavel Emelyanov <xemul@openvz.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] do_task_stat: don't use task_pid_nr_ns() lockless
Date: Sat, 17 Nov 2007 13:11:00 -0700 [thread overview]
Message-ID: <m1fxz4ws2z.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <20071117183109.GA2605@tv-sign.ru> (Oleg Nesterov's message of "Sat, 17 Nov 2007 21:31:09 +0300")
Oleg Nesterov <oleg@tv-sign.ru> writes:
> Without rcu/tasklist/siglock lock task_pid_nr_ns() may read the freed memory,
> move the callsite under ->siglock.
>
> Sadly, we can report pid == 0 if the task was detached.
We only get detached in release_task so it is a pretty small window
where we can return pid == 0. Usually get_task_pid will fail first
and we will return -ESRCH. Still the distance from open to
There is another bug in here as well. current->nsproxy->pid_ns is wrong.
What we want is: ns = dentry->d_sb->s_fs_info;
Otherwise we will have file descriptor passing races and the like.
We could also do: proc_pid(inode) to get the pid, which is a little
more race free, and will prevent us from returning pid == 0.
In either event it looks like we need to implement some proper
file operations for these proc files, maybe even going to seq file
status.
Eric
next prev parent reply other threads:[~2007-11-17 20:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-17 18:31 Oleg Nesterov
2007-11-17 20:11 ` Eric W. Biederman [this message]
2007-11-19 9:30 ` Pavel Emelyanov
2007-11-19 18:04 ` Eric W. Biederman
2007-11-19 9:31 ` Pavel Emelyanov
2007-11-19 21:59 ` [PATCH 0/4] proc: Cleanup status files Eric W. Biederman
2007-11-19 22:04 ` [PATCH 1/4] proc: Implement proc_single_file_operations Eric W. Biederman
2007-11-19 22:06 ` [PATCH 2/4] proc: Rewrite do_task_stat to correctly handle pid namespaces Eric W. Biederman
2007-11-19 22:10 ` [PATCH 3/4] proc: seqfile convert proc_pid_status to properly " Eric W. Biederman
2007-11-19 22:13 ` [PATCH] proc: seqfile convert proc_pid_statm Eric W. Biederman
2007-11-20 10:34 ` [PATCH 0/4] proc: Cleanup status files Pavel Emelyanov
2007-11-19 22:30 ` [PATCH] proc: Proper pidns handling for /proc/self Eric W. Biederman
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=m1fxz4ws2z.fsf@ebiederm.dsl.xmission.com \
--to=ebiederm@xmission.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@tv-sign.ru \
--cc=xemul@openvz.org \
/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®