lkml.org 
[lkml]   [2015]   [Mar]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm: fix lockdep build in rcu-protected get_mm_exe_file()
On 23.03.2015 22:10, Oleg Nesterov wrote:
> On 03/23, Davidlohr Bueso wrote:
>>
>> void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file)
>> {
>> struct file *old_exe_file = rcu_dereference_protected(mm->exe_file,
>> - !atomic_read(&mm->mm_users) || current->in_execve ||
>> - lock_is_held(&mm->mmap_sem));
>> + !atomic_read(&mm->mm_users) || current->in_execve);
>
> Thanks, looks correct at first glance...
>
> But can't we remove the ->in_execve check above? and check
>
> atomic_read(&mm->mm_users) <= 1
>
> instead. OK, this is subjective, I won't insist. Just current->in_execve
> looks a bit confusing, it means "I swear, the caller is flush_old_exec()
> and this mm is actualy bprm->mm".
>
> "atomic_read(&mm->mm_users) <= 1" looks a bit more "safe". But again,
> I won't insist.

Not so safe: this will race with get_task_mm().
A lot of proc files grab temporary reference to task mm.
But this just a debug -- we can place here "true".

>
> Oleg.
>

--
Konstantin


\
 
 \ /
  Last update: 2015-03-24 18:21    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog