public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kingsley Cheung <kingsley@aurema.com>
To: Andrew Morton <akpm@osdl.org>
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: Fri, 27 Feb 2004 10:29:55 +1100	[thread overview]
Message-ID: <20040227102955.B21764@aurema.com> (raw)
In-Reply-To: <20040226151917.404af252.akpm@osdl.org>; from akpm@osdl.org on Thu, Feb 26, 2004 at 03:19:17PM -0800

On Thu, Feb 26, 2004 at 03:19:17PM -0800, Andrew Morton wrote:
> 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?)

Completely an accident on my part.  While writing code to traverse
threads in a group and obtain their data usage, I was comparing what I
could see from the output with the shell and I just happened to do a
typo on the tid value... To my suprise it worked.

> 
> How's this?

Looks like proc_pid_lookup() was never changed at all :)

> 
> 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);
>  }
> 
> _

-- 
		Kingsley

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

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-26  6:27 /proc visibility patch breaks GDB, etc 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
2004-02-26 23:29           ` Kingsley Cheung [this message]
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=20040227102955.B21764@aurema.com \
    --to=kingsley@aurema.com \
    --cc=akpm@osdl.org \
    --cc=dan@debian.org \
    --cc=davidm@hpl.hp.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