mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [PATCH 05/23] proc: Simplify the ownership rules for /proc
@ 2006-03-20  3:41 Albert Cahalan
  2006-03-20 17:51 ` Eric W. Biederman
  0 siblings, 1 reply; 6+ messages in thread
From: Albert Cahalan @ 2006-03-20  3:41 UTC (permalink / raw)
  To: ebiederm, linux-kernel, Andrew Morton

Eric W. Biederman writes:

> Currently in /proc if the task is dumpable all of files are owned by
> the tasks effective users.  Otherwise the files are owned by root.
> Unless it is the /proc/tgid>/ or /proc/tgid>/task/pid> directory
> in that case we always make the directory owned by the effective user.
>
> However the special case for directories is pointless except as a way
> to read the effective user, because the permissions on both of those
> directories are world readable, and executable.

Well, that's exactly how "top" gets the EUID. The code:

p->euid = sb.st_uid;       /* need a way to get real uid */
p->egid = sb.st_gid;       /* need a way to get real gid */

I sure hope this patch didn't slip by me somehow. Big proc changes
ought to get review by the maintainers of procps, gtop, gdb, and
probably a good number of packages that don't come to mind right now.
I'm lucky I spotted this while reading over old lwn.net stories.

> /proc/tgid>/status provides a much better way to read a processes
> effecitve userid, so it is silly to try to provide that on the directory.

The stat() call is cheap.

The status file is kind of nasty:

open()
read()
close()
parse vague ill-defined ASCII text using evil speed hacks

The procps code uses stat() for selection by EUID in some
cases, and for everything whenever the status file is not
needed for some other reason. The "top" program is quite
good about not opening the status file. Lots of profiling
showed that there would be a noticable performance difference.

^ permalink raw reply	[flat|nested] 6+ messages in thread
* [PATCH 00/23] proc cleanup.
@ 2006-02-23 15:52 Eric W. Biederman
  2006-02-23 15:54 ` [PATCH 01/23] tref: Implement task references Eric W. Biederman
  0 siblings, 1 reply; 6+ messages in thread
From: Eric W. Biederman @ 2006-02-23 15:52 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel


When working on pid namespaces I keep tripping over /proc.
It's hard coded inode numbers and the amount of cruft
accumulated over the years makes it hard to deal with.

So to put /proc out of my misery here is a series of patches that
removes the worst of the warts.

The first patch which introduces task_refs is used later to address
one of the worst faults how much low kernel memory it allows
an unprivileged process to pin.  There are other patches to cleanup
the permission checking, to cleanup how /proc interacts with the rest
of the kernel, and to patches to simply clean /proc up.

At least some of the cleans up go back to cruft that was introduced
in 2.2.  That was a challenge to track down and understand the
thinking at the time because even the historic git archive I have
doesn't go back that far :(

Ultimately the biggest cleanup is that this patchset removes 
the hard coded inode numbers from /proc.  There are still a few
theoretical issues about non-unique inode numbers but the /proc code
doesn't care, and it is no worse than the current situation with the
file descriptor inode numbers.  I would have loved to have made the
inode number the address of the inode data structure in the kernel but
I can't because on alpha __kernel_ino_t is an unsigned int!  Oh well,
the current situation keeps the inode numbers small and readable, and
32bit.

Eric

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-03-21 13:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-20  3:41 [PATCH 05/23] proc: Simplify the ownership rules for /proc Albert Cahalan
2006-03-20 17:51 ` Eric W. Biederman
2006-03-21  1:22   ` Albert Cahalan
2006-03-21 13:49     ` Eric W. Biederman
  -- strict thread matches above, loose matches on Subject: below --
2006-02-23 15:52 [PATCH 00/23] proc cleanup Eric W. Biederman
2006-02-23 15:54 ` [PATCH 01/23] tref: Implement task references Eric W. Biederman
2006-02-23 15:56   ` [PATCH 02/23] proc: Fix the .. inode number on /proc/<pid>/fd Eric W. Biederman
2006-02-23 15:57     ` [PATCH 03/23] proc: Remove useless BKL in proc_pid_readlink Eric W. Biederman
2006-02-23 15:58       ` [PATCH 04/23] proc: Remove unnecessary and misleading assignments from proc_pid_make_inode Eric W. Biederman
2006-02-23 16:00         ` [PATCH 05/23] proc: Simplify the ownership rules for /proc Eric W. Biederman
2006-02-23 16:02           ` Eric W. Biederman

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®