From: Sripathi Kodi <sripathik@in.ibm.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org, patrics@interia.pl,
Ingo Molnar <mingo@elte.hu>, Roland McGrath <roland@redhat.com>
Subject: Re: [PATCH 2.6.13.1] Patch for invisible threads
Date: Tue, 13 Sep 2005 16:30:43 -0500 [thread overview]
Message-ID: <43274503.7090303@in.ibm.com> (raw)
In-Reply-To: <20050913171215.GS25261@ZenIV.linux.org.uk>
Al Viro wrote:
>
> Well... If exposing the list of tasks in a group is OK, we can just leave
> ->permission NULL for that sucker. If it's not (and arguably it can be
> sensitive information), we have a bigger problem - right now chroot boundary
> is the only control we have there; normally anyone can ls /proc/<whatever>/task
> and see other threads.
>
Al, I understand that we can't set ->permission to NULL as it removes the
chroot boundary check. If I understood you correctly, we need to put
additional checks in proc_permission to ensure anyone doing ls
/proc/<pid>/task won't be able to see other threads.
Coming back to the problem of being able to see the threads of a process
whose main thread has done pthread_exit, it appears to me that the only
hurdle is getting the ->fs pointer from task struct. Since all threads of
the process point to the same fs structure, would it be okay if we try to
get it from some other thread? Below is the patch I tried for this:
Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com>
--- linux-2.6.13.1-orig/fs/proc/base.c 2005-09-13 23:53:06.000000000 -0500
+++ linux-2.6.13.1/fs/proc/base.c 2005-09-13 23:51:36.000000000 -0500
@@ -273,13 +273,25 @@ static int proc_cwd_link(struct inode *i
static int proc_root_link(struct inode *inode, struct dentry **dentry,
struct vfsmount **mnt)
{
- struct fs_struct *fs;
+ struct fs_struct *fs = NULL;
int result = -ENOENT;
- task_lock(proc_task(inode));
- fs = proc_task(inode)->fs;
- if(fs)
- atomic_inc(&fs->count);
- task_unlock(proc_task(inode));
+ struct task_struct *task = proc_task(inode);
+ struct task_struct *leader_task = task;
+
+ read_lock(&tasklist_lock);
+ if (pid_alive(task)) {
+ do {
+ task_lock(task);
+ if ((fs = task->fs)) {
+ atomic_inc(&fs->count);
+ task_unlock(task);
+ break;
+ }
+ task_unlock(task);
+ } while ((task = next_thread(task)) != leader_task);
+ }
+ read_unlock(&tasklist_lock);
+
if (fs) {
read_lock(&fs->lock);
*mnt = mntget(fs->rootmnt);
next prev parent reply other threads:[~2005-09-13 21:37 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-12 17:46 [PATCH 2.6.13.1] Patch for invisible threads Sripathi Kodi
2005-09-12 20:49 ` Andrew Morton
2005-09-13 13:10 ` Sripathi Kodi
2005-09-13 14:53 ` Linus Torvalds
2005-09-13 16:51 ` Al Viro
2005-09-13 17:01 ` Linus Torvalds
2005-09-13 17:12 ` Al Viro
2005-09-13 21:30 ` Sripathi Kodi [this message]
2005-09-13 21:56 ` Roland McGrath
2005-09-13 21:57 ` Al Viro
2005-09-13 23:10 ` Linus Torvalds
2005-09-14 1:47 ` Sripathi Kodi
2005-09-14 1:52 ` Al Viro
2005-09-14 14:37 ` Bill Davidsen
2005-09-15 0:30 ` Sripathi Kodi
2005-09-14 1:50 ` Al Viro
2005-09-15 0:31 ` Sripathi Kodi
2005-09-15 0:55 ` Roland McGrath
2005-09-15 1:38 ` Sripathi Kodi
2005-09-15 2:12 ` Al Viro
2005-09-15 7:29 ` Roland McGrath
2005-09-15 1:18 ` Al Viro
2005-09-16 0:54 ` Sripathi Kodi
2005-09-16 7:46 ` Al Viro
2005-09-16 15:06 ` Sripathi Kodi
2005-09-16 18:05 ` Daniel Jacobowitz
2005-09-16 18:14 ` Al Viro
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=43274503.7090303@in.ibm.com \
--to=sripathik@in.ibm.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=patrics@interia.pl \
--cc=roland@redhat.com \
--cc=torvalds@osdl.org \
--cc=viro@ZenIV.linux.org.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