Merge branch 'akpm' (patches from Andrew)
Merge updates from Andrew Morton: "Incoming: - a small number of updates to scripts/, ocfs2 and fs/buffer.c - most of MM I still have quite a lot of material (mostly not MM) staged after linux-next due to -next dependencies. I'll send those across next week as the preprequisites get merged up" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (135 commits) mm/page_io.c: annotate refault stalls from swap_readpage mm/Kconfig: fix trivial help text punctuation mm/Kconfig: fix indentation mm/memory_hotplug.c: remove __online_page_set_limits() mm: fix typos in comments when calling __SetPageUptodate() mm: fix struct member name in function comments mm/shmem.c: cast the type of unmap_start to u64 mm: shmem: use proper gfp flags for shmem_writepage() mm/shmem.c: make array 'values' static const, makes object smaller userfaultfd: require CAP_SYS_PTRACE for UFFD_FEATURE_EVENT_FORK fs/userfaultfd.c: wp: clear VM_UFFD_MISSING or VM_UFFD_WP during userfaultfd_register() userfaultfd: wrap the common dst_vma check into an inlined function userfaultfd: remove unnecessary WARN_ON() in __mcopy_atomic_hugetlb() userfaultfd: use vma_pagesize for all huge page size calculation mm/madvise.c: use PAGE_ALIGN[ED] for range checking mm/madvise.c: replace with page_size() in madvise_inject_error() mm/mmap.c: make vma_merge() comment more easy to understand mm/hwpoison-inject: use DEFINE_DEBUGFS_ATTRIBUTE to define debugfs fops autonuma: reduce cache footprint when scanning page tables autonuma: fix watermark checking in migrate_balanced_pgdat() ...
This commit is contained in:
@@ -290,6 +290,40 @@ static void mfd_assert_read_shared(int fd)
|
||||
munmap(p, mfd_def_size);
|
||||
}
|
||||
|
||||
static void mfd_assert_fork_private_write(int fd)
|
||||
{
|
||||
int *p;
|
||||
pid_t pid;
|
||||
|
||||
p = mmap(NULL,
|
||||
mfd_def_size,
|
||||
PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE,
|
||||
fd,
|
||||
0);
|
||||
if (p == MAP_FAILED) {
|
||||
printf("mmap() failed: %m\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
p[0] = 22;
|
||||
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
p[0] = 33;
|
||||
exit(0);
|
||||
} else {
|
||||
waitpid(pid, NULL, 0);
|
||||
|
||||
if (p[0] != 22) {
|
||||
printf("MAP_PRIVATE copy-on-write failed: %m\n");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
munmap(p, mfd_def_size);
|
||||
}
|
||||
|
||||
static void mfd_assert_write(int fd)
|
||||
{
|
||||
ssize_t l;
|
||||
@@ -760,6 +794,8 @@ static void test_seal_future_write(void)
|
||||
mfd_assert_read_shared(fd2);
|
||||
mfd_fail_write(fd2);
|
||||
|
||||
mfd_assert_fork_private_write(fd);
|
||||
|
||||
munmap(p, mfd_def_size);
|
||||
close(fd2);
|
||||
close(fd);
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
CONFIG_SYSVIPC=y
|
||||
CONFIG_USERFAULTFD=y
|
||||
CONFIG_TEST_VMALLOC=m
|
||||
|
||||
Reference in New Issue
Block a user