[Kernel-packages] [Bug 1799237] Re: mprotect fails on ext4 with dax

2018-11-30 Thread Marcin Ślusarz
To summarize: 4.15.0-20 is the last kernel where mprotect works, all kernels 
between 4.15.0-20 and 4.15.0-34 are not testable, 4.15.0-34 is the first kernel 
that boots correctly and mprotect fails.
You have a test program, instructions how to run it and here's a guide how to 
set up pmem emulation: http://pmem.io/2016/02/22/pm-emulation.html (just adding 
memmap=1G!4G to kernel command line should be enough).

We (me and Igor) are not kernel developers. The ball is on your side :).

-- 
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 
  #include 
  #include 
  #include 
  #include 
  #include 

  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:
   lono wireless extensions.

   enp0s3no 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


[Kernel-packages] [Bug 1799237] Re: mprotect fails on ext4 with dax

2018-10-24 Thread Marcin Ślusarz
This is purely kernel issue. It can be worked around in PMDK by code
change, as those mprotects are only safety precautions, but I really
wouldn't want to do this upstream.

-- 
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:
  Confirmed
Status in linux package in Ubuntu:
  Confirmed
Status in pmdk package in Ubuntu:
  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 
  #include 
  #include 
  #include 
  #include 
  #include 

  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:
   lono wireless extensions.

   enp0s3no 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


[Kernel-packages] [Bug 1799237] Re: mprotect fails on ext4 with dax

2018-10-24 Thread Marcin Ślusarz
** Also affects: pmdk (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:
  Confirmed
Status in linux package in Ubuntu:
  Confirmed
Status in pmdk 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 
  #include 
  #include 
  #include 
  #include 
  #include 

  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:
   lono wireless extensions.
   
   enp0s3no 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