All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kingsley Cheung <kingsley@aurema.com>
To: Andrew Morton <akpm@osdl.org>
Cc: davidm@hpl.hp.com, davidm@napali.hpl.hp.com,
	peter@chubb.wattle.id.au, linux-kernel@vger.kernel.org,
	Daniel Jacobowitz <dan@debian.org>
Subject: Re: /proc visibility patch breaks GDB, etc.
Date: Fri, 27 Feb 2004 08:59:41 +1100	[thread overview]
Message-ID: <20040227085941.A21764@aurema.com> (raw)
In-Reply-To: <20040226120959.35b284ff.akpm@osdl.org>; from akpm@osdl.org on Thu, Feb 26, 2004 at 12:09:59PM -0800

On Thu, Feb 26, 2004 at 12:09:59PM -0800, Andrew Morton wrote:
> David Mosberger <davidm@napali.hpl.hp.com> wrote:
> >
> > >>>>> On Wed, 25 Feb 2004 22:44:10 -0800, Andrew Morton <akpm@osdl.org> said:
> > 
> >   Andrew> Peter Chubb <peter@chubb.wattle.id.au> wrote:
> >   >> 
> >   >> 
> >   >> In fs/proc/base.c:proc_pid_lookup(), the patch
> >   >> 
> >   >> 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);
> >   >> 
> >   >> means that threads other than the thread group leader don't
> >   >> appear in the /proc top-level directory.  Programs that are
> >   >> informed via pid of events can no longer find the appropriate
> >   >> process -- for example, using gdb on a multi-threaded process, or
> >   >> profiling using perfmon.
> >   >> 
> >   >> The immediate symptom is GDB saying: Could not open
> >   >> /proc/757/status when 757 is a TID not a PID.
> > 
> >   Andrew> What does `ls /proc/757' say?  Presumably no such file or
> >   Andrew> directory?  It's fairly bizare behaviour to be able to open
> >   Andrew> files which don't exist according to readdir, which is why
> >   Andrew> we made that change.
> > 
> > Excuse, but this seems seriously FOOBAR.  I understand that it's
> > interesting to see the thread-leader/thread relationship, but surely
> > that's no reason to break backwards compatibility and the ability to
> > look up _any_ task's info via /proc/PID/.
> 
> Well you can't look them up - you can only open them.  But I take your
> point.  In another life, these things would appear under a special
> /proc/magical_directory_which_has_dopey_semantics.
> 
> > A program that only wants
> > to show "processes" (thread-group leaders) can simply read
> > /proc/PID/status and ignore the entries for which Tgid != PPid.
> > 
> > Perhaps you could put relative symlinks in task/?  Something like
> > this:
> > 
> >  $ ls -l /proc/self/task
> >  dr-xr-xr-x    3 davidm   users           0 Feb 26 11:37 13494 -> ..
> >  dr-xr-xr-x    3 davidm   users           0 Feb 26 11:37 13495 -> ../../13495
> > 
> > perhaps?
> 
> Well the contents of /proc/pid/task are OK at present.
> 
> I guess we should revert that change.

Ah, so there was some fundamental reason behind that behaviour!
Perhaps then a comment or two in the code to explain that such
behaviour (prior to change) is intended in proc_pid_lookup()?  That
way it will be clear that is intended behaviour.

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.  

The patch that broke backwards compatibility for GDB likewise changed
that.  It enforces that tid must be a part of the pid thread group.

--
		Kingsley

  reply	other threads:[~2004-02-26 22:07 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 [this message]
2004-02-26 22:14         ` Peter Chubb
2004-02-26 23:19         ` Andrew Morton
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=20040227085941.A21764@aurema.com \
    --to=kingsley@aurema.com \
    --cc=akpm@osdl.org \
    --cc=dan@debian.org \
    --cc=davidm@hpl.hp.com \
    --cc=davidm@napali.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.