Skip to content

Commit a28bf13

Browse files
committed
exec: Run sync_mm_rss before taking exec_update_mutex
Like exec_mm_release sync_mm_rss is about flushing out the state of the old_mm, which does not need to happen under exec_update_mutex. Make this explicit by moving sync_mm_rss outside of exec_update_mutex. Reviewed-by: Kees Cook <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: "Eric W. Biederman" <[email protected]>
1 parent 13c432b commit a28bf13

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/exec.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1051,13 +1051,14 @@ static int exec_mmap(struct mm_struct *mm)
10511051
tsk = current;
10521052
old_mm = current->mm;
10531053
exec_mm_release(tsk, old_mm);
1054+
if (old_mm)
1055+
sync_mm_rss(old_mm);
10541056

10551057
ret = mutex_lock_killable(&tsk->signal->exec_update_mutex);
10561058
if (ret)
10571059
return ret;
10581060

10591061
if (old_mm) {
1060-
sync_mm_rss(old_mm);
10611062
/*
10621063
* Make sure that if there is a core dump in progress
10631064
* for the old mm, we get out and die instead of going

0 commit comments

Comments
 (0)