Bad handling of some ROMs when using sysfs
Submitted by Pierre Willenbrock
Assigned to Xorg Project Team
Description
Created attachment 21104 Make libpciaccess rom handling behave better
On my system, the "resource"-file for the graphics adapter reports a rom of 0 size, but the "rom"-file is 128k. This leads to rom_size == 0. Intel driver allocates a 64k buffer for read_rom in this case(normally, it allocates rom_size) and read_rom happily overwrites the data after those 64k with the rest of the rom.
This does not happen if rom_size is set to 128k and read_rom prevents reading more than advertised(which could still be samller than the size of the rom-file, if the rom-resource line says so).
->cat /sys/bus/pci/devices/0000\:00\:02.0/resource
0x00000000f8100000 0x00000000f81fffff 0x0000000000020204
0x0000000000000000 0x0000000000000000 0x0000000000000000
0x00000000e0000000 0x00000000efffffff 0x000000000002120c
0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000001800 0x0000000000001807 0x0000000000020101
0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 0x0000000000000002
->ls -l /sys/bus/pci/devices/0000\:00\:02.0/rom
-r-------- 1 root root 131072 12. Dez 19:03 /sys/bus/pci/devices/0000:00:02.0/rom
Patch 21104, "Make libpciaccess rom handling behave better":
libpciaccess.patch
Version: git