summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2020-03-30 23:33:39 +0200
committerEric W. Biederman <ebiederm@xmission.com>2020-05-11 19:08:48 +0200
commita28bf136e651e17d7e2c753aa140ce3cc1df36a0 (patch)
tree59d5b9fac27883ec10a233dad05a0dd64857d053
parentexec: Fix spelling of search_binary_handler in a comment (diff)
downloadlinux-a28bf136e651e17d7e2c753aa140ce3cc1df36a0.tar.xz
linux-a28bf136e651e17d7e2c753aa140ce3cc1df36a0.zip
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 <keescook@chromium.org> Link: https://lkml.kernel.org/r/875zd66za3.fsf_-_@x220.int.ebiederm.org Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
-rw-r--r--fs/exec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 82106241ed53..ecee0ebebf85 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1051,13 +1051,14 @@ static int exec_mmap(struct mm_struct *mm)
tsk = current;
old_mm = current->mm;
exec_mm_release(tsk, old_mm);
+ if (old_mm)
+ sync_mm_rss(old_mm);
ret = mutex_lock_killable(&tsk->signal->exec_update_mutex);
if (ret)
return ret;
if (old_mm) {
- sync_mm_rss(old_mm);
/*
* Make sure that if there is a core dump in progress
* for the old mm, we get out and die instead of going