[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20120125153028.17d69f6e.akpm@linux-foundation.org>
Date: Wed, 25 Jan 2012 15:30:28 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Kees Cook <keescook@...omium.org>
Cc: linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Randy Dunlap <rdunlap@...otime.net>,
Borislav Petkov <bp@...en8.de>,
Vasiliy Kulikov <segoon@...nwall.com>,
Dan Ballard <dan@...dstab.net>, Jiri Kosina <jkosina@...e.cz>,
Al Viro <viro@...iv.linux.org.uk>,
Stephen Wilson <wilsons@...rt.ca>,
David Rientjes <rientjes@...gle.com>,
Ingo Molnar <mingo@...e.hu>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Eric Paris <eparis@...hat.com>,
"Serge E. Hallyn" <serge.hallyn@...onical.com>,
linux-doc@...r.kernel.org,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Colin Walters <walters@...bum.org>
Subject: Re: [PATCH v3] sysctl: control functionality of /proc/pid/mem
On Mon, 23 Jan 2012 13:21:15 -0800
Kees Cook <keescook@...omium.org> wrote:
>
> Add the "proc_pid_mem" sysctl to control whether or not /proc/pid/mem is
> allowed to work: 0: disabled, 1: read only, 2: read/write (default).
>
> Signed-off-by: Kees Cook <keescook@...omium.org>
> ---
> v3:
> - document the default, thanks to Randy Dunlap.
> - remove needless CONFIG_PROC_FS checks, thanks to Eric W. Biederman.
I was wondering about that. Is CONFIG_PROC_FS=n, CONFIG_SYSCTL=y an
impossible combination? If so, why?
> --- a/Documentation/sysctl/kernel.txt
> +++ b/Documentation/sysctl/kernel.txt
> @@ -56,6 +56,7 @@ show up in /proc/sys/kernel:
> - printk_delay
> - printk_ratelimit
> - printk_ratelimit_burst
> +- proc_pid_mem
> - randomize_va_space
> - real-root-dev ==> Documentation/initrd.txt
> - reboot-cmd [ SPARC only ]
> @@ -477,6 +478,20 @@ send before ratelimiting kicks in.
>
> ==============================================================
>
> +proc_pid_mem:
> +
> +This option can be used to select the level of access given to potential
> +ptracers when using the per-process "mem" file in /proc/pid/mem.
> +
> +0 - Disable entirely.
> +
> +1 - Allow potential ptracers read access to process memory, but not writes.
> +
> +2 - Allow potential ptracers read and write access to process memory. This
> + is the default.
> +
> +==============================================================
I agree with Colin on this (he stole my line!).
Overall, the patch looks really hacky and random. I felt the same way
as Vasily: it's easy to see how a significant number of similar (and
hacky and random) patches could be added, resulting in a regrettable
mess.
Is there some better designed, more organized way of approaching all of
this? Random ideas:
- A parallel /procfs-perms filesystem. You write a number into
/procfs-perms/stat to affect access to /proc/stat (although why the
heck not just run `chmod /proc/stat'?) It's unclear how to handle
/proc/pid/. Perhaps literally have a /procfs-perms/pid/ directory.
- Make tasks inherit their /proc/pid/* permissions across fork, do a
chmod /proc/1/whatever in initscripts.
- Other and better things ;) This particular approach makes my toes
curl.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists