Did this issue start happening after an update/upgrade?  Was there a
prior kernel version where you were not having this particular problem?

If it is a regression, we can perform a kernel bisect to narrow down
which commit introduced it.

Also, it might be good to test the latest mainline kernel to see if this
bug was already fixed upstream.  If it was, can investigate to find the
commit that fixes the bug.

** Changed in: linux (Ubuntu)
   Importance: Undecided => High

** Also affects: linux (Ubuntu Bionic)
   Importance: Undecided
       Status: New

** Also affects: pmdk (Ubuntu Bionic)
   Importance: Undecided
       Status: New

** Also affects: Ubuntu Bionic
   Importance: Undecided
       Status: New

** No longer affects: pmdk (Ubuntu Bionic)

** No longer affects: Ubuntu Bionic

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

** Changed in: linux (Ubuntu Bionic)
   Importance: Undecided => High

** Changed in: linux (Ubuntu)
     Assignee: (unassigned) => Joseph Salisbury (jsalisbury)

** Changed in: linux (Ubuntu Bionic)
     Assignee: (unassigned) => Joseph Salisbury (jsalisbury)

-- 
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:
  Invalid
Status in linux package in Ubuntu:
  Confirmed
Status in pmdk package in Ubuntu:
  Invalid
Status in linux source package in Bionic:
  Confirmed

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;
  }
  ---
  ProblemType: Bug
  ApportVersion: 2.20.9-0ubuntu7.4
  Architecture: amd64
  AudioDevicesInUse: Error: command ['fuser', '-v', '/dev/snd/seq', 
'/dev/snd/timer'] failed with exit code 1:
  CRDA: Error: command ['iw', 'reg', 'get'] failed with exit code 1: nl80211 
not found.
  CurrentDesktop: ubuntu:GNOME
  DistroRelease: Ubuntu 18.04
  InstallationDate: Installed on 2018-10-23 (0 days ago)
  InstallationMedia: Ubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 
(20180725)
  IwConfig:
   lo        no wireless extensions.

   enp0s3    no wireless extensions.
  Lsusb:
   Bus 001 Device 002: ID 80ee:0021 VirtualBox USB Tablet
   Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
  MachineType: innotek GmbH VirtualBox
  Package: linux (not installed)
  ProcFB:

  ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-4.15.0-36-generic 
root=UUID=48e87c4c-3028-4252-b7bb-e1e6091ff7f6 ro quiet splash
  ProcVersionSignature: Ubuntu 4.15.0-36.39-generic 4.15.18
  RelatedPackageVersions:
   linux-restricted-modules-4.15.0-36-generic N/A
   linux-backports-modules-4.15.0-36-generic  N/A
   linux-firmware                             1.173.1
  RfKill:

  Tags:  bionic
  Uname: Linux 4.15.0-36-generic x86_64
  UpgradeStatus: No upgrade log present (probably fresh install)
  UserGroups: adm cdrom dip lpadmin plugdev sambashare sudo
  _MarkForUpload: True
  dmi.bios.date: 12/01/2006
  dmi.bios.vendor: innotek GmbH
  dmi.bios.version: VirtualBox
  dmi.board.name: VirtualBox
  dmi.board.vendor: Oracle Corporation
  dmi.board.version: 1.2
  dmi.chassis.type: 1
  dmi.chassis.vendor: Oracle Corporation
  dmi.modalias: 
dmi:bvninnotekGmbH:bvrVirtualBox:bd12/01/2006:svninnotekGmbH:pnVirtualBox:pvr1.2:rvnOracleCorporation:rnVirtualBox:rvr1.2:cvnOracleCorporation:ct1:cvr:
  dmi.product.family: Virtual Machine
  dmi.product.name: VirtualBox
  dmi.product.version: 1.2
  dmi.sys.vendor: innotek GmbH

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