Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 154313 - Kernel: proc: Use sane permission checks on the /proc/<pid>/fd/ symlinks (GENERIC-MAP-NOMATCH)
Summary: Kernel: proc: Use sane permission checks on the /proc/<pid>/fd/ symlinks (GEN...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Kernel (show other bugs)
Hardware: All Linux
: High normal
Assignee: Gentoo Security
URL: http://www.kernel.org/git/?p=linux/ke...
Whiteboard: [linux <2.6.19]
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-06 22:56 UTC by Sune Kloppenborg Jeppesen (RETIRED)
Modified: 2009-07-12 21:10 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch in Git (back.c.patch,6.97 KB, patch)
2006-12-21 18:25 UTC, Harlan Lieberman-Berg (RETIRED)
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-11-06 22:56:50 UTC
Not sure wether we're affected by this one:

Since 2.2 we have been doing a chroot check to see if it is appropriate to
 return a read or follow one of these magic symlinks.  The chroot check was
 asking a question about the visibility of files to the calling process and
 it was actually checking the destination process, and not the files
 themselves.  That test was clearly bogus.
 
 In my first pass through I simply fixed the test to check the visibility of
 the files themselves.  That naive approach to fixing the permissions was
 too strict and resulted in cases where a task could not even see all of
 it's file descriptors.
 
 What has disturbed me about relaxing this check is that file descriptors
 are per-process private things, and they are occasionaly used a user space
 capability tokens.  Looking a little farther into the symlink path on /proc
 I did find userid checks and a check for capability (CAP_DAC_OVERRIDE) so
 there were permissions checking this.
 
 But I was still concerned about privacy.  Besides /proc there is only one
 other way to find out this kind of information, and that is ptrace.  ptrace
 has been around for a long time and it has a well established security
 model.
 
 So after thinking about it I finally realized that the permission checks
 that make sense are the permission checks applied to ptrace_attach.  The
 checks are simple per process, and won't cause nasty surprises for people
 coming from less capable unices.
 
 Unfortunately there is one case that the current ptrace_attach test does
 not cover: Zombies and kernel threads.  Single stepping those kinds of
 processes is impossible.  Being able to see which file descriptors are open
 on these tasks is important to lsof, fuser and friends.  So for these
 special processes I made the rule you can't find out unless you have
 CAP_SYS_PTRACE.
 
 These proc permission checks should now conform to the principle of least
 surprise.  As well as using much less code to implement :)
 
 Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
 Signed-off-by: Andrew Morton <akpm@osdl.org>
 Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Comment 1 Harlan Lieberman-Berg (RETIRED) gentoo-dev 2006-12-21 18:25:56 UTC
Created attachment 104552 [details, diff]
Patch in Git
Comment 2 Harlan Lieberman-Berg (RETIRED) gentoo-dev 2006-12-21 18:28:01 UTC
hppa-sources: Bump to 2.6.19 or patch.
mips-sources: Bump to 2.6.19 or patch.
rsbac-sources: Bump to 2.6.19 or patch.
systrace-sources: Bump to 2.6.19 or patch.
usermode-sources: Bump to 2.6.19 or patch.
xen-sources: Bump to 2.6.19 or patch.
Comment 3 Guy Martin (RETIRED) gentoo-dev 2006-12-23 03:51:27 UTC
hppa-sources-2.6.19.1 commited.
Comment 4 Daniel Gryniewicz (RETIRED) gentoo-dev 2007-01-02 20:00:57 UTC
usermode-sources-2.6.18-r1 added.
Comment 5 Guillaume Destuynder (RETIRED) gentoo-dev 2007-01-12 13:40:28 UTC
rsbac-sources-2.6.19 is in cvs (~arch)
Comment 6 Harlan Lieberman-Berg (RETIRED) gentoo-dev 2007-05-21 23:18:43 UTC
Waiting on Xen.
Comment 7 Micheal Marineau (RETIRED) gentoo-dev 2007-08-26 23:28:30 UTC
The patch listed here was actually included in 2.6.18, not 2.6.19. So >=xen-sources-2.6.18 is unaffected. I masked xen-sources-2.6.16 a couple days ago and will be removed soon.