Re: [PATCH 2/2] memcg: Close the race between migration and installing bprm->mm as mm

2018-05-09 Thread Eric W. Biederman
Oleg Nesterov writes: > On 05/04, Eric W. Biederman wrote: >> >> --- a/fs/exec.c >> +++ b/fs/exec.c >> @@ -1044,6 +1044,8 @@ static int exec_mmap(struct mm_struct *mm) >> return 0; >> } >> mmdrop(active_mm); >> +/* The tsk may have migrated before the new mm was attache

Re: [PATCH 2/2] memcg: Close the race between migration and installing bprm->mm as mm

2018-05-09 Thread Oleg Nesterov
On 05/04, Eric W. Biederman wrote: > > --- a/fs/exec.c > +++ b/fs/exec.c > @@ -1044,6 +1044,8 @@ static int exec_mmap(struct mm_struct *mm) > return 0; > } > mmdrop(active_mm); > + /* The tsk may have migrated before the new mm was attached */ > + mm_sync_memcg_fro

[PATCH 2/2] memcg: Close the race between migration and installing bprm->mm as mm

2018-05-04 Thread Eric W. Biederman
Oleg pointed out that there is a race at exec time between when bprm->mm is initialized and the exec'ing task being migrated to a different memory control group. Ractor the code in memcontrol so exec_mmap can use the same code as as fork to ensure that task->memcg == task->mm->memcg. Reported-by