Pages

Userspace PCIe access broken in 16.04

mercredi 10 août 2016

Alright, so they're ALL the wrong forum for this, but I'm hoping y'all can give me some help.

I wrote some programs to do some semi-hacky things against some proprietary hardware under 14.04 by running as root and mmap'ing the resource0 file under /sys/devices/... . Ugly, but it worked, and it saved having to actually write a kernel driver when all I wanted to do was read a couple sporadic registers.

strace verifies that under 14.04 I call

Code:

open("resource0", O_RDONLY)             = 3
fstat(3, {st_mode=S_IFREG|0600, st_size=16384, ...}) = 0
mmap(NULL, 16384, PROT_READ, MAP_SHARED, 3, 0) = 0x7fa78bce5000
On 16.04, though

Code:

open("resource0", O_RDONLY)             = 3
fstat(3, {st_mode=S_IFREG|0600, st_size=16384, ...}) = 0
mmap(NULL, 16384, PROT_READ, MAP_SHARED, 3, 0) = -1 EPERM (Operation not permitted)
I don't know if this was a kernel change or what, but even under sudo I'm locked out of the sysfs resource files. I tried diffing kernel versions 3.13 and 4.4, and looked at drivers/pci/pci-sysfs.c and arch/x86/pci/i386.c, but nothing jumped out as the issue. Anyone have any ideas? Alternatively, I'll post the program I'm testing against, mmcat, as the next message. Would anyone be willing to try to replicate on their end? Any resource file will do.

Let's block ads! (Why?)



Userspace PCIe access broken in 16.04

Aucun commentaire:

Enregistrer un commentaire