** Also affects: linux (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1799237
Title:
mprotect fails on ext4 with dax
Status in Ubuntu:
New
Status in linux package in Ubuntu:
New
Bug description:
I have a file located on ext4 mounted with "dax". When I call mmap on that
file with protection flag different than PROT_NONE and pass the returned
address to mprotect(..., PROT_NONE) it fails with:
mprotect: Permission denied
This bug affects PMDK (https://github.com/pmem/pmdk) and seems to be Ubuntu
kernel-specific.
Problem was observer on kernel 4.15.0-36-generic and 4.15.0-34-generic
Below is a code which can be used to reproduce the issue.
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
int main(int argc, char *argv[])
{
if (argc < 3) {
fprintf(stderr, "usage %s file size\n",
argv[0]);
return 1;
}
int size = atoi(argv[2]);
int fd = open(argv[1], O_RDWR);
if (fd < 0) {
perror("open");
return 1;
}
void *addr = mmap(NULL, size, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, 0);
if (addr == MAP_FAILED) {
perror("mmap");
return 1;
}
if(mprotect(addr, size, PROT_NONE)) {
perror("mprotect");
return 1;
}
return 0;
}
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+bug/1799237/+subscriptions
--
Mailing list: https://launchpad.net/~kernel-packages
Post to : [email protected]
Unsubscribe : https://launchpad.net/~kernel-packages
More help : https://help.launchpad.net/ListHelp