Eric W. Biederman df26c40e56 [PATCH] proc: Cleanup proc_fd_access_allowed
In process of getting proc_fd_access_allowed to work it has developed a few
warts.  In particular the special case that always allows introspection and
the special case to allow inspection of kernel threads.

The special case for introspection is needed for /proc/self/mem.

The special case for kernel threads really should be overridable
by security modules.

So consolidate these checks into ptrace.c:may_attach().

The check to always allow introspection is trivial.

The check to allow access to kernel threads, and zombies is a little
trickier.  mem_read and mem_write already verify an mm exists so it isn't
needed twice.  proc_fd_access_allowed only doesn't want a check to verify
task->mm exits, s it prevents all access to kernel threads.  So just move
the task->mm check into ptrace_attach where it is needed for practical
reasons.

I did a quick audit and none of the security modules in the kernel seem to
care if they are passed a task without an mm into security_ptrace.  So the
above move should be safe and it allows security modules to come up with
more restrictive policy.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Stephen Smalley <sds@tycho.nsa.gov>
Cc: Chris Wright <chrisw@sous-sol.org>
Cc: James Morris <jmorris@namei.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-26 09:58:26 -07:00
..
2006-06-25 10:01:22 -07:00
2006-06-26 09:58:18 -07:00
2006-06-26 09:58:18 -07:00
2006-06-26 09:58:18 -07:00
2006-06-26 09:58:20 -07:00
2006-06-26 09:58:18 -07:00
2006-06-09 09:40:27 -04:00
2006-06-25 12:30:33 -07:00
2006-06-26 09:58:18 -07:00
2006-03-24 07:33:19 -08:00
2006-06-26 09:58:18 -07:00
2006-06-26 09:58:18 -07:00
2006-06-26 09:58:17 -07:00
2006-01-11 18:42:13 -08:00
2006-01-10 08:01:25 -08:00
2006-06-23 17:10:39 +02:00
2006-06-26 09:58:17 -07:00
2006-06-23 17:10:39 +02:00
2006-01-08 20:12:40 -08:00
2006-04-02 13:37:19 +02:00
2006-04-11 13:53:33 +02:00
2005-10-30 17:37:32 -08:00
2006-06-23 17:10:39 +02:00
2006-04-02 13:38:18 +02:00
2006-01-11 18:42:13 -08:00
2006-06-23 07:42:53 -07:00
2006-06-26 09:58:17 -07:00
2006-03-28 09:16:08 -08:00
2006-06-23 07:42:49 -07:00
2006-06-26 09:58:17 -07:00
2006-03-24 07:33:19 -08:00
2006-06-26 09:58:17 -07:00
2005-11-07 18:18:11 -08:00
2006-03-23 07:38:11 -08:00
2006-03-23 07:38:11 -08:00
2006-03-23 07:38:12 -08:00
2006-04-28 21:04:59 +10:00
2006-06-23 07:42:49 -07:00