Merge 5.7-rc3 into android-mainline
Linux 5.7-rc3 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I7ac2896e866a898b1f42fc8fd6d60b40a75ae1f0
This commit is contained in:
18
mm/madvise.c
18
mm/madvise.c
@@ -27,6 +27,7 @@
|
||||
#include <linux/swapops.h>
|
||||
#include <linux/shmem_fs.h>
|
||||
#include <linux/mmu_notifier.h>
|
||||
#include <linux/sched/mm.h>
|
||||
|
||||
#include <asm/tlb.h>
|
||||
|
||||
@@ -1090,6 +1091,23 @@ int do_madvise(unsigned long start, size_t len_in, int behavior)
|
||||
if (write) {
|
||||
if (down_write_killable(¤t->mm->mmap_sem))
|
||||
return -EINTR;
|
||||
|
||||
/*
|
||||
* We may have stolen the mm from another process
|
||||
* that is undergoing core dumping.
|
||||
*
|
||||
* Right now that's io_ring, in the future it may
|
||||
* be remote process management and not "current"
|
||||
* at all.
|
||||
*
|
||||
* We need to fix core dumping to not do this,
|
||||
* but for now we have the mmget_still_valid()
|
||||
* model.
|
||||
*/
|
||||
if (!mmget_still_valid(current->mm)) {
|
||||
up_write(¤t->mm->mmap_sem);
|
||||
return -EINTR;
|
||||
}
|
||||
} else {
|
||||
down_read(¤t->mm->mmap_sem);
|
||||
}
|
||||
|
Reference in New Issue
Block a user