Re: [PATCH 1/1] mm_for_maps: simplify, use ptrace_may_access()

From: Oleg Nesterov
Date: Wed Jun 24 2009 - 13:52:36 EST


On 06/24, Roland McGrath wrote:
>
> > 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.
>
> Agreed. It has only one caller (though two forks of it) in
> fs/proc/task_{no,}mmu.c and it looks easy to change.
>
> > With or without this patch, without ->cred_guard_mutex held we can race
> > with exec() and get the new ->mm but check old creds.
>
> It looks safe and proper for mm_for_maps() to take that mutex around its
> check. Your patch looks good to me as it is, and taking cred_guard_mutex
> can be another security fix patch on top.

Agreed, will do.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/