summaryrefslogtreecommitdiff
path: root/fs/proc/task_mmu.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2019-05-13 21:30:15 +0300
committerIngo Molnar <mingo@kernel.org>2019-05-13 21:30:15 +0300
commit82045dd85566d87128dcc66277cf1177d9930a4a (patch)
tree22fea6311a4866293005a1a44f34310e4007a3c9 /fs/proc/task_mmu.c
parente0478542cfd4d993e38d5f92a3f3ecd238805e96 (diff)
parentffa6f55eb6188ee73339cab710fabf30d13110a7 (diff)
downloadlinux-82045dd85566d87128dcc66277cf1177d9930a4a.tar.xz
Merge branch 'linus' into core/urgent, to merge in dependent changes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'fs/proc/task_mmu.c')
-rw-r--r--fs/proc/task_mmu.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 92a91e7816d8..95ca1fe7283c 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -1143,6 +1143,24 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf,
count = -EINTR;
goto out_mm;
}
+ /*
+ * Avoid to modify vma->vm_flags
+ * without locked ops while the
+ * coredump reads the vm_flags.
+ */
+ if (!mmget_still_valid(mm)) {
+ /*
+ * Silently return "count"
+ * like if get_task_mm()
+ * failed. FIXME: should this
+ * function have returned
+ * -ESRCH if get_task_mm()
+ * failed like if
+ * get_proc_task() fails?
+ */
+ up_write(&mm->mmap_sem);
+ goto out_mm;
+ }
for (vma = mm->mmap; vma; vma = vma->vm_next) {
vma->vm_flags &= ~VM_SOFTDIRTY;
vma_set_page_prot(vma);