Bug#891674: Patch to fix the problem

2018-02-28 Thread Peter.Chubb
> "Michel" == Michel Dänzer  writes:

Michel> On 2018-02-28 02:41 AM, peter.ch...@data61.csiro.au wrote:

Michel> Doing it like this breaks ABI. This is fixed in libpciaccess
Michel> 0.14 by
Michel> 
https://cgit.freedesktop.org/xorg/lib/libpciaccess/commit/?id=a167bd6474522a709ff3cbb00476c0e4309cb66f
Michel> , though Xorg needs to be rebuilt against that for it to take
Michel> effect.

Any idea when this'll hit Debian's archives?  Because this bug will
prevent X11 working on any machine that has VMD storage.

Peter C
--
Dr Peter Chubb Tel: +61 2 9490 5852  http://ts.data61.csiro.au/
Trustworthy Systems Group   Data61 (formerly NICTA)


Bug#891674: Patch to fix the problem

2018-02-27 Thread Peter.Chubb
The linux kernel treats PCI domains as 32 bit ints.

diff -ru libpciaccess-0.13.4/include/pciaccess.h 
libpciaccess-0.13.4-fixed/include/pciaccess.h
--- libpciaccess-0.13.4/include/pciaccess.h 2015-05-01 14:44:47.0 
+1000
+++ libpciaccess-0.13.4-fixed/include/pciaccess.h   2018-02-28 
12:21:12.280963252 +1100
@@ -321,7 +321,7 @@
  * the domain will always be zero.
  */
 /*@{*/
-uint16_tdomain;
+uint32_tdomain;
 uint8_t bus;
 uint8_t dev;
 uint8_t func;
diff -ru libpciaccess-0.13.4/src/linux_sysfs.c 
libpciaccess-0.13.4-fixed/src/linux_sysfs.c
--- libpciaccess-0.13.4/src/linux_sysfs.c   2015-05-01 14:44:47.0 
+1000
+++ libpciaccess-0.13.4-fixed/src/linux_sysfs.c 2018-02-28 12:21:32.676941130 
+1100
@@ -157,7 +157,7 @@
(struct pci_device_private *) &p->devices[i];
 
 
-   sscanf(devices[i]->d_name, "%04x:%02x:%02x.%1u",
+   sscanf(devices[i]->d_name, "%x:%02x:%02x.%1u",
   & dom, & bus, & dev, & func);
 
device->base.domain = dom;

-- 
Dr Peter Chubb Tel: +61 2 9490 5852  http://ts.data61.csiro.au/
Trustworthy Systems Group   Data61 (formerly NICTA)


Bug#891674: More info

2018-02-27 Thread Peter.Chubb

I built Xorg from source so I could get debugging symbols.

The crash is in  xf86VGAarbiterInit(), when it calls
pci_device_vgaarb_init().  This function can read /dev/vga_arbiter
which ordinary users cannot.

# head -1 < /dev/vga_arbiter 
count:1,PCI::65:00.0,decodes=io+mem,owns=none,locks=none(0:0)

pci_sys->devices is null.

The problem appears to be a bad scan format in
line 160 of linux_sysfs.c
   sscanf(devices[i]->d_name, "%04x:%02x:%02x.%1u",

ls /sys/bus/pci/devices shows devices with a BUS > 0x taking 5
digits.


ls /sys/bus/pci/devices
:00:00.0  :00:1f.2  :16:0e.4  :64:09.0  :64:0d.1
:00:04.0  :00:1f.3  :16:0e.5  :64:0a.0  :64:0d.2
:00:04.1  :00:1f.4  :16:0e.6  :64:0a.1  :64:0d.3
:00:04.2  :00:1f.6  :16:0e.7  :64:0a.2  :65:00.0
:00:04.3  :02:00.0  :16:0f.0  :64:0a.3  :65:00.1
:00:04.4  :16:05.0  :16:0f.1  :64:0a.4  :b2:05.0
:00:04.5  :16:05.2  :16:1d.0  :64:0a.5  :b2:05.2
:00:04.6  :16:05.4  :16:1d.1  :64:0a.6  :b2:05.4
:00:04.7  :16:08.0  :16:1d.2  :64:0a.7  :b2:05.5
:00:05.0  :16:08.1  :16:1d.3  :64:0b.0  :b2:12.0
:00:05.2  :16:08.2  :16:1e.0  :64:0b.1  :b2:12.1
:00:05.4  :16:08.3  :16:1e.1  :64:0b.2  :b2:12.2
:00:08.0  :16:08.4  :16:1e.2  :64:0b.3  :b2:15.0
:00:08.1  :16:08.5  :16:1e.3  :64:0c.0  :b2:16.0
:00:08.2  :16:08.6  :16:1e.4  :64:0c.1  :b2:16.4
:00:14.0  :16:08.7  :16:1e.5  :64:0c.2  :b2:17.0
:00:14.2  :16:09.0  :16:1e.6  :64:0c.3  1:00:02.0
:00:16.0  :16:09.1  :64:00.0  :64:0c.4  1:00:03.0
:00:17.0  :16:0e.0  :64:05.0  :64:0c.5  1:01:00.0
:00:1c.0  :16:0e.1  :64:05.2  :64:0c.6
:00:1c.6  :16:0e.2  :64:05.4  :64:0c.7
:00:1f.0  :16:0e.3  :64:08.0  :64:0d.0



-- 
Dr Peter Chubb Tel: +61 2 9490 5852  http://ts.data61.csiro.au/
Trustworthy Systems Group   Data61 (formerly NICTA)


Bug#891674: xserver-xorg-core: crashes if started as root

2018-02-27 Thread Peter.Chubb
Package: xserver-xorg-core
Version: 2:1.19.6-1
Severity: important

Dear Maintainer,

I can start Xorg using startx as an ordinary user (it uses 
the modesetting driver).
But when the display manager starts it (as root) it crashes.

The only `interesting' thing about this machine I'm aware of (apart
from it being a very recent Skylake architecture machine) is that all
the storage is under a VMD domain.  I've appended the output of lspci,
as the crash occurs when scanning the PCI bus as root.

GDB shows
(gdb) bt
#0  0x77019cc8 in pci_device_next ()
   from /usr/lib/x86_64-linux-gnu/libpciaccess.so.0
#1  0x77019d4b in pci_device_find_by_slot ()
   from /usr/lib/x86_64-linux-gnu/libpciaccess.so.0
#2  0x7701b9ca in pci_device_vgaarb_init ()
   from /usr/lib/x86_64-linux-gnu/libpciaccess.so.0
#3  0x55604d99 in ?? ()
#4  0x555de8e2 in xf86BusConfig ()
#5  0x555ecb68 in InitOutput ()
#6  0x555aab83 in ?? ()
#7  0x75362f2a in __libc_start_main (main=0x55594a00, argc=2, 
argv=0x7fffec38, init=, fini=, 
rtld_fini=, stack_end=0x7fffec28)
at ../csu/libc-start.c:310
#8  0x55594a3a in _start ()




-- Package-specific info:
/etc/X11/X does not exist.
/etc/X11/X is not a symlink.
/etc/X11/X is not executable.

VGA-compatible devices on PCI bus:
--
:65:00.0 VGA compatible controller [0300]: NVIDIA Corporation GF119 [NVS 
315] [10de:107c] (rev a1)

/etc/X11/xorg.conf does not exist.

Contents of /etc/X11/xorg.conf.d:
-
total 0

/etc/modprobe.d contains no KMS configuration files.

Kernel version (/proc/version):
---
Linux version 4.15.0-1-amd64 (debian-ker...@lists.debian.org) (gcc version 
7.3.0 (Debian 7.3.0-3)) #1 SMP Debian 4.15.4-1 (2018-02-18)

Xorg X server log files on system:
--
-rw-r--r-- 1 peterc peterc 56283 Feb 28 07:58 
/home/peterc/.local/share/xorg/Xorg.0.log
-rw-r--r-- 1 root   root5054 Feb 28 08:05 /var/log/Xorg.0.log

Contents of most recent Xorg X server log file (/var/log/Xorg.0.log):
-
[ 60011.801] 
X.Org X Server 1.19.6
Release Date: 2017-12-20
[ 60011.801] X Protocol Version 11, Revision 0
[ 60011.801] Build Operating System: Linux 4.9.0-5-amd64 x86_64 Debian
[ 60011.801] Current Operating System: Linux wolf-un 4.15.0-1-amd64 #1 SMP 
Debian 4.15.4-1 (2018-02-18) x86_64
[ 60011.801] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.15.0-1-amd64 
root=UUID=2cc1510e-8bb0-4e82-b22b-6bb508493d1f ro quiet
[ 60011.801] Build Date: 26 January 2018  04:30:21PM
[ 60011.801] xorg-server 2:1.19.6-1 (https://www.debian.org/support) 
[ 60011.801] Current version of pixman: 0.34.0
[ 60011.801]Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
[ 60011.801] Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[ 60011.801] (==) Log file: "/var/log/Xorg.0.log", Time: Wed Feb 28 08:05:36 
2018
[ 60011.801] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[ 60011.801] (==) No Layout section.  Using the first Screen section.
[ 60011.801] (==) No screen section available. Using defaults.
[ 60011.801] (**) |-->Screen "Default Screen Section" (0)
[ 60011.801] (**) |   |-->Monitor ""
[ 60011.802] (==) No monitor specified for screen "Default Screen Section".
Using a default monitor configuration.
[ 60011.802] (==) Automatically adding devices
[ 60011.802] (==) Automatically enabling devices
[ 60011.802] (==) Automatically adding GPU devices
[ 60011.802] (==) Max clients allowed: 256, resource mask: 0x1f
[ 60011.802] (WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
[ 60011.802]Entry deleted from font path.
[ 60011.802] (==) FontPath set to:
/usr/share/fonts/X11/misc,
/usr/share/fonts/X11/100dpi/:unscaled,
/usr/share/fonts/X11/75dpi/:unscaled,
/usr/share/fonts/X11/Type1,
/usr/share/fonts/X11/100dpi,
/usr/share/fonts/X11/75dpi,
built-ins
[ 60011.802] (==) ModulePath set to "/usr/lib/xorg/modules"
[ 60011.802] (II) The server relies on udev to provide the list of input 
devices.
If no devices become available, reconfigure udev or disable 
AutoAddDevices.
[ 60011.802] (II) Loader magic: 0x55996de0
[ 60011.802] (II) Module ABI versions:
[ 60011.802]X.Org ANSI C Emulation: 0.4
[ 60011.802]X.Org Video Driver: 23.0
[ 60011.802]X.Org XInput driver : 24.1
[ 60011.802]X.Org Server Extension : 10.0
[ 60011.802] (--) using VT number 2

[ 60011.802] (II) systemd-logind: logind integration requires -keeptty and 
-keeptty was not provided, disabling logind integration
[ 60011.803] (II) xfree86: Adding drm device (/dev/