LTP regressions due to 6dc296e7df4c ("mm: make sure all file VMAs have ->vm_ops set")

From: Will Deacon
Date: Mon Sep 14 2015 - 06:54:15 EST


Hi Kirill,

Your patch 6dc296e7df4c ("mm: make sure all file VMAs have ->vm_ops set")
causes some mmap regressions in LTP, which appears to use a MAP_PRIVATE
mmap of /dev/zero as a way to get anonymous pages in some of its tests
(specifically mmap10 [1]).

Dead simple reproducer below. Is this change in behaviour intentional?

Will

[1]
http://sourceforge.net/p/ltp/git/ci/1eb440c2b5fe43a3e5023015a16aa5d7d3385b1e/tree/testcases/kernel/syscalls/mmap/mmap10.c

--->8

#include <sys/mman.h>
#include <sys/stat.h>

#include <fcntl.h>
#include <stdio.h>

#define MAP_SZ 5*1024*1024

int main(void)
{
char *foo;
int fd;

fd = open("/dev/zero", O_RDWR, 0666);
if (fd < 0) {
perror(NULL);
return fd;
}

foo = mmap(NULL, MAP_SZ, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
if (foo == MAP_FAILED) {
perror(NULL);
return -1;
}

foo[MAP_SZ >> 1] = 0; // Generates SIGBUS with 4.3-rc1
return 0;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/