]> git.karo-electronics.de Git - karo-tx-linux.git/commit
mm_for_maps: simplify, use ptrace_may_access()
authorOleg Nesterov <oleg@redhat.com>
Tue, 23 Jun 2009 19:25:32 +0000 (21:25 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sun, 16 Aug 2009 21:19:08 +0000 (14:19 -0700)
commit95d7e670e3158b6a52a8279290a0d6f7047250b4
treef7d1fba412ffc289a051e485d10eeab3a1d4eb68
parent11ebe4a3a51c597583df02572f6ddca844b6ecc8
mm_for_maps: simplify, use ptrace_may_access()

commit 13f0feafa6b8aead57a2a328e2fca6a5828bf286 upstream.

It would be nice to kill __ptrace_may_access(). It requires task_lock(),
but this lock is only needed to read mm->flags in the middle.

Convert mm_for_maps() to use ptrace_may_access(), this also simplifies
the code a little bit.

Also, we do not need to take ->mmap_sem in advance. In fact I think
mm_for_maps() should not play with ->mmap_sem at all, the caller should
take this lock.

With or without this patch, without ->cred_guard_mutex held we can race
with exec() and get the new ->mm but check old creds.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/proc/base.c