Re: [PATCH] mm: fix lockdep build in rcu-protected get_mm_exe_file()

2015-03-24 Thread Oleg Nesterov
On 03/24, Konstantin Khlebnikov wrote: > > On Tue, Mar 24, 2015 at 9:10 PM, Oleg Nesterov wrote: > >>> > >>> "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(). > > > > How? > > I mean rcu/lockdep deb

Re: [PATCH] mm: fix lockdep build in rcu-protected get_mm_exe_file()

2015-03-24 Thread Konstantin Khlebnikov
On Tue, Mar 24, 2015 at 9:10 PM, Oleg Nesterov wrote: > On 03/24, Konstantin Khlebnikov wrote: >> >> 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_e

Re: [PATCH] mm: fix lockdep build in rcu-protected get_mm_exe_file()

2015-03-24 Thread Oleg Nesterov
On 03/24, Konstantin Khlebnikov wrote: > > 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, >>> -

Re: [PATCH] mm: fix lockdep build in rcu-protected get_mm_exe_file()

2015-03-24 Thread Konstantin Khlebnikov
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_e

Re: [PATCH] mm: fix lockdep build in rcu-protected get_mm_exe_file()

2015-03-24 Thread Davidlohr Bueso
On Mon, 2015-03-23 at 20:10 +0100, Oleg Nesterov wrote: > "atomic_read(&mm->mm_users) <= 1" looks a bit more "safe". But again, > I won't insist. Agreed, it is nicer to do that check, but I have no strong preference either, perhaps Konstantin or akpm do. Anyway, here's the change that can be folde

Re: [PATCH] mm: fix lockdep build in rcu-protected get_mm_exe_file()

2015-03-23 Thread Oleg Nesterov
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_h

Re: [PATCH] mm: fix lockdep build in rcu-protected get_mm_exe_file()

2015-03-23 Thread Davidlohr Bueso
Actually, here's a patch that gets rid of that condition, per Oleg. What do you think? 8< Subject: [PATCH -next] prctl: avoid using mmap_sem for exe_file serialization Oleg cleverly suggested using xchg() to set the new mm->exe_file instead of call

[PATCH] mm: fix lockdep build in rcu-protected get_mm_exe_file()

2015-03-20 Thread Konstantin Khlebnikov
Signed-off-by: Konstantin Khlebnikov --- kernel/fork.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/fork.c b/kernel/fork.c index a7c596517bd6..aa2ba1a34ce8 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -696,7 +696,7 @@ void set_mm_exe_file(struct mm_struct *mm