This bug is missing log files that will aid in diagnosing the problem.
While running an Ubuntu kernel (not a mainline or third-party kernel)
please enter the following command in a terminal window:

apport-collect 1799237

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable
to run this command, please add a comment stating that fact and change
the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the
Ubuntu Kernel Team.

** Changed in: linux (Ubuntu)
       Status: New => Incomplete

** Tags added: bionic

-- 
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:
  Incomplete

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     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to