From: Johan Veenhuizen <veenhuizen@users.sf.net>
To: Johan Veenhuizen <veenhuizen@users.sourceforge.net>,
Jan Engelhardt <jengelh@linux01.gwdg.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2.6.12.3] Deny chmod in /proc/<pid>/
Date: Wed, 03 Aug 2005 12:05:27 +0200 [thread overview]
Message-ID: <42f096e7.9SOTOrosbBYB6uCh%veenhuizen@users.sf.net> (raw)
In-Reply-To: <Pine.LNX.4.61.0508030816150.2263@yvahk01.tjqt.qr>
Jan Engelhardt <jengelh@linux01.gwdg.de> wrote:
>
> >This patch tries to fix the strange behaviour in /proc/<pid>/,
> >where it is currently possible for the owner of a process to
> >temporarily chmod the entries.
>
> I am on 2.6.13-rc3-git5 and I do not see such behavior:
>
> 08:16 spectre:/proc/21345 # chown 1337 smaps
> 08:16 spectre:/proc/21345 # l -n smaps
> -r--r--r-- 1 25121 0 0 Aug 3 08:16 smaps
> 08:16 spectre:/proc/21345 #
Did you mean "chmod"? And I don't even have "smaps".
I tried this on 2.6.13-rc5 to make sure it hasn't been fixed since
2.6.12.3. Here is a sample session to illustrate the problem:
$ uname -sr
Linux 2.6.13-rc5
$ ./a.out &
[2] 181
$ cd /proc/181
$ ls -l
total 0
-r-------- 1 jpv user 0 Aug 3 11:37 auxv
-r--r--r-- 1 jpv user 0 Aug 3 11:37 cmdline
lrwxrwxrwx 1 jpv user 0 Aug 3 11:37 cwd -> ...
-r-------- 1 jpv user 0 Aug 3 11:37 environ
lrwxrwxrwx 1 jpv user 0 Aug 3 11:37 exe -> ...
dr-x------ 2 jpv user 0 Aug 3 11:37 fd
-r--r--r-- 1 jpv user 0 Aug 3 11:37 maps
-rw------- 1 jpv user 0 Aug 3 11:37 mem
-r--r--r-- 1 jpv user 0 Aug 3 11:37 mounts
-rw-r--r-- 1 jpv user 0 Aug 3 11:37 oom_adj
-r--r--r-- 1 jpv user 0 Aug 3 11:37 oom_score
lrwxrwxrwx 1 jpv user 0 Aug 3 11:37 root -> /
-rw------- 1 jpv user 0 Aug 3 11:37 seccomp
-r--r--r-- 1 jpv user 0 Aug 3 11:37 stat
-r--r--r-- 1 jpv user 0 Aug 3 11:37 statm
-r--r--r-- 1 jpv user 0 Aug 3 11:37 status
dr-xr-xr-x 3 jpv user 0 Aug 3 11:37 task
-r--r--r-- 1 jpv user 0 Aug 3 11:37 wchan
$ chmod 7777 auxv cmdline environ fd m* o* s* task wchan
$ ls -l
total 0
-rwsrwsrwt 1 jpv user 0 Aug 3 11:37 auxv
-rwsrwsrwt 1 jpv user 0 Aug 3 11:37 cmdline
lrwxrwxrwx 1 jpv user 0 Aug 3 11:37 cwd -> ...
-rwsrwsrwt 1 jpv user 0 Aug 3 11:37 environ
lrwxrwxrwx 1 jpv user 0 Aug 3 11:37 exe -> ...
drwsrwsrwt 2 jpv user 0 Aug 3 11:37 fd
-rwsrwsrwt 1 jpv user 0 Aug 3 11:37 maps
-rwsrwsrwt 1 jpv user 0 Aug 3 11:37 mem
-rwsrwsrwt 1 jpv user 0 Aug 3 11:37 mounts
-rwsrwsrwt 1 jpv user 0 Aug 3 11:37 oom_adj
-rwsrwsrwt 1 jpv user 0 Aug 3 11:37 oom_score
lrwxrwxrwx 1 jpv user 0 Aug 3 11:37 root -> /
-rwsrwsrwt 1 jpv user 0 Aug 3 11:37 seccomp
-rwsrwsrwt 1 jpv user 0 Aug 3 11:37 stat
-rwsrwsrwt 1 jpv user 0 Aug 3 11:37 statm
-rwsrwsrwt 1 jpv user 0 Aug 3 11:37 status
drwsrwsrwt 3 jpv user 0 Aug 3 11:37 task
-rwsrwsrwt 1 jpv user 0 Aug 3 11:37 wchan
$ eatmem
malloc: Cannot allocate memory
$ ls -l
total 0
-r-------- 1 jpv user 0 Aug 3 11:44 auxv
-r--r--r-- 1 jpv user 0 Aug 3 11:44 cmdline
lrwxrwxrwx 1 jpv user 0 Aug 3 11:44 cwd -> ...
-r-------- 1 jpv user 0 Aug 3 11:44 environ
lrwxrwxrwx 1 jpv user 0 Aug 3 11:44 exe -> ...
dr-x------ 2 jpv user 0 Aug 3 11:44 fd
-r--r--r-- 1 jpv user 0 Aug 3 11:44 maps
-rw------- 1 jpv user 0 Aug 3 11:44 mem
-r--r--r-- 1 jpv user 0 Aug 3 11:44 mounts
-rw-r--r-- 1 jpv user 0 Aug 3 11:44 oom_adj
-r--r--r-- 1 jpv user 0 Aug 3 11:44 oom_score
lrwxrwxrwx 1 jpv user 0 Aug 3 11:44 root -> /
-rw------- 1 jpv user 0 Aug 3 11:44 seccomp
-r--r--r-- 1 jpv user 0 Aug 3 11:44 stat
-r--r--r-- 1 jpv user 0 Aug 3 11:44 statm
-r--r--r-- 1 jpv user 0 Aug 3 11:44 status
dr-xr-xr-x 3 jpv user 0 Aug 3 11:44 task
-r--r--r-- 1 jpv user 0 Aug 3 11:44 wchan
> Though, chmod /proc/21345 correctly yielded EPERM.
That's because the /proc/<pid> directories are S_IMMUTABLE, so the
problem doesn't arise there.
Johan Veenhuizen
next prev parent reply other threads:[~2005-08-03 10:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-02 20:14 Johan Veenhuizen
2005-08-03 6:18 ` Jan Engelhardt
2005-08-03 10:05 ` Johan Veenhuizen [this message]
2005-08-04 6:06 ` Jan Engelhardt
2005-08-04 10:59 ` Johan Veenhuizen
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=42f096e7.9SOTOrosbBYB6uCh%veenhuizen@users.sf.net \
--to=veenhuizen@users.sf.net \
--cc=jengelh@linux01.gwdg.de \
--cc=linux-kernel@vger.kernel.org \
--cc=veenhuizen@users.sourceforge.net \
/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®