mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Kingsley Cheung <kingsley@aurema.com>
Cc: davidm@hpl.hp.com, peter@chubb.wattle.id.au,
	linux-kernel@vger.kernel.org, dan@debian.org
Subject: Re: /proc visibility patch breaks GDB, etc.
Date: Thu, 26 Feb 2004 15:19:17 -0800	[thread overview]
Message-ID: <20040226151917.404af252.akpm@osdl.org> (raw)
In-Reply-To: <20040227085941.A21764@aurema.com>

Kingsley Cheung <kingsley@aurema.com> wrote:
>
> Am I correct to assume though that the corresponding change in
> proc_task_lookup() should stay?  The existing behaviour there was that
> one could do say,
> 
> cat /proc/<pid>/task/<tid>/stat, where tid could be any thread and not
> a part of the thread group pid.  

That sounds especially broken - let's hope that nobody has started using it
(but how did you even discover this?  Code audit?)

How's this?

diff -puN fs/proc/base.c~proc-thread-visibility-revert fs/proc/base.c
--- 25/fs/proc/base.c~proc-thread-visibility-revert	Thu Feb 26 15:17:48 2004
+++ 25-akpm/fs/proc/base.c	Thu Feb 26 15:17:48 2004
@@ -1582,13 +1582,14 @@ struct dentry *proc_pid_lookup(struct in
 	read_unlock(&tasklist_lock);
 	if (!task)
 		goto out;
-	if (!thread_group_leader(task))
-		goto out_drop_task;
 
 	inode = proc_pid_make_inode(dir->i_sb, task, PROC_TGID_INO);
 
-	if (!inode)
-		goto out_drop_task;
+
+	if (!inode) {
+		put_task_struct(task);
+		goto out;
+	}
 	inode->i_mode = S_IFDIR|S_IRUGO|S_IXUGO;
 	inode->i_op = &proc_tgid_base_inode_operations;
 	inode->i_fop = &proc_tgid_base_operations;
@@ -1613,8 +1614,6 @@ struct dentry *proc_pid_lookup(struct in
 		goto out;
 	}
 	return NULL;
-out_drop_task:
-	put_task_struct(task);
 out:
 	return ERR_PTR(-ENOENT);
 }

_


  parent reply	other threads:[~2004-02-26 23:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-26  6:27 Peter Chubb
2004-02-26  6:44 ` Andrew Morton
2004-02-26 16:02   ` Daniel Jacobowitz
2004-02-26 19:39   ` David Mosberger
2004-02-26 20:09     ` Andrew Morton
2004-02-26 21:59       ` Kingsley Cheung
2004-02-26 22:14         ` Peter Chubb
2004-02-26 23:19         ` Andrew Morton [this message]
2004-02-26 23:29           ` Kingsley Cheung
2004-02-26 23:48           ` Peter Chubb
2004-02-26 20:10     ` Peter Chubb

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=20040226151917.404af252.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=dan@debian.org \
    --cc=davidm@hpl.hp.com \
    --cc=kingsley@aurema.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter@chubb.wattle.id.au \
    /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®