Bug 104278

Summary: segfault (segmentation fault) on libinput when resuming from hibernation (s2disk)
Product: xorg Reporter: fredgib
Component: Input/libinputAssignee: Peter Hutterer <peter.hutterer>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: major    
Priority: medium CC: aplattner, bugzilla, dblack, fredgib, peter.hutterer
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Syslog showing libinput error messages when resuming from hibernate.
none
Xorg log none

Description fredgib 2017-12-15 09:21:11 UTC
Created attachment 136190 [details]
Syslog showing libinput error messages when resuming from hibernate.

Hi, 

I have a laptop with an up-to-date Debian and Gnome. I always hibernate it rather than shut it down. Since a few days, the X server has crashed when resuming from hibernation arrives to the lock screen, forcing X to drop my previous session and restart a new one.

What is strange to me is that it happens every other time I resume, meaning the sequence will be like:
1. Start a new session and work
2. Hibernate
3. Resume with no problem and work
4. Hibernate
5. Try to resume but it crashes and falls back on the login screen.

The attached syslog shows what happens from the first error message until the moment where X restarts the new session. In between, there are to groups of error messages mentioning libinput (I don't know if it is relevant here, but my only input devices are my Asus laptop's integrated keyboard and touchpad).
Comment 1 Peter Hutterer 2017-12-18 04:06:57 UTC
Interesting. This looks like it's a combination of failures:

Dec 13 23:59:23 MyComputer /usr/lib/gdm3/gdm-x-session[31060]: (II) Using input driver 'libinput' for 'USB2.0 0.3M UVC WebCam: USB2.0 '
Dec 13 23:59:23 MyComputer /usr/lib/gdm3/gdm-x-session[31060]: (EE) systemd-logind: failed to take device /dev/input/event26: Invalid argument

^^^ for some reason systemd-login doesn't take the device

Dec 13 23:59:23 MyComputer /usr/lib/gdm3/gdm-x-session[31060]: (**) USB2.0 0.3M UVC WebCam: USB2.0 : always reports core events
Dec 13 23:59:23 MyComputer /usr/lib/gdm3/gdm-x-session[31060]: (**) Option "Device" "/dev/input/event26"
Dec 13 23:59:23 MyComputer /usr/lib/gdm3/gdm-x-session[31060]: (**) Option "_source" "server/udev"

^^^ but we seem to continue anyway

Dec 13 23:59:25 MyComputer /usr/lib/gdm3/gdm-x-session[31060]: (EE) libinput bug: udev device never initialized (/dev/input/event26)

^^^ and now we complain

I suspect this triggers some error path that was untested previously.
Comment 2 Luca Weiss 2017-12-26 11:19:07 UTC
Created attachment 136389 [details]
Xorg log

I guess I have a similar / the same issue when suspending my laptop / waking up from suspend. Then apparently Xorg crashes and throws me back to SDDM (I use KDE Plasma 5). Surprisingly, this behavior is only when I have the proprietary NVIDIA driver installed and not when I use the Intel modesetting driver. I cannot say what upgrade caused this behavior but I can say the same setup worked before where Xorg didn't crash on suspend.

xorg-server 1.19.5-1
xf86-input-libinput 0.26.0-1
linux 4.14.8-1
nvidia 387.34-14 (when installed)
Comment 3 fredgib 2017-12-30 14:02:47 UTC
I am not sure about this but...

It seems to have been related to the fact that I had 2 X servers (2 gdm) running on two different tty, and I was unaware of this.

So apparently, when resuming, the displayed shield screen asking for the password is on the tty that is NOT the tty under which I hibernated, which immediately cause some inconsistency somewhere, breaks the resume process and restarts the X server.

I don't know how libinput is involved nor if anything I wrote makes any sense at all...
Comment 4 Peter Hutterer 2018-01-05 04:46:01 UTC
still not sure what the real issue is but https://lists.freedesktop.org/archives/wayland-devel/2018-January/036471.html may paper over it
Comment 5 Francois Cartegnie 2018-01-16 08:16:19 UTC
Same here, but more annoyingly, from regular suspend to memory with lightdm.


Build ID: xorg-x11-server 1.19.3-4.fc26 
Current version of pixman: 0.34.0
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Sat Jan 13 20:46:10 2018
(==) Using config directory: "/etc/X11/xorg.conf.d"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(II) [KMS] Kernel modesetting enabled.
(II) AIGLX: Suspending AIGLX clients for VT switch
(II) AIGLX: Suspending AIGLX clients for VT switch
(II) AIGLX: Suspending AIGLX clients for VT switch
(EE) libinput bug: udev device never initialized (/dev/input/event12)
(EE) 
(EE) Backtrace:
(EE) 0: /usr/libexec/Xorg (OsLookupColor+0x139) [0x59c629]
(EE) 1: /lib64/libpthread.so.0 (funlockfile+0x50) [0x7f2218c4a3ff]
(EE) 2: /usr/lib64/xorg/modules/input/libinput_drv.so (_init+0x12b7) [0x7f2214bae7e7]
(EE) 3: /lib64/libinput.so.10 (libinput_device_config_rotation_get_default_angle+0x2d12) [0x7f2214944152]
(EE) 4: /lib64/libinput.so.10 (libinput_device_config_rotation_get_default_angle+0x1774f) [0x7f221496d54f]
(EE) 5: /lib64/libinput.so.10 (libinput_device_config_rotation_get_default_angle+0x17963) [0x7f221496da23]
(EE) 6: /lib64/libinput.so.10 (libinput_path_add_device+0xdf) [0x7f22149562df]
(EE) 7: /usr/lib64/xorg/modules/input/libinput_drv.so (_init+0x5810) [0x7f2214bb6990]
(EE) 8: /usr/libexec/Xorg (EnableDevice+0xb4) [0x42d7b4]
(EE) 9: /usr/libexec/Xorg (xf86EnableInputDeviceForVTSwitch+0x2a) [0x47769a]
(EE) 10: /usr/libexec/Xorg (xf86VTEnter+0x156) [0x477d26]
(EE) 11: /usr/libexec/Xorg (WakeupHandler+0xbd) [0x43a3cd]
(EE) 12: /usr/libexec/Xorg (WaitForSomething+0x209) [0x596049]
(EE) 13: /usr/libexec/Xorg (SendErrorToClient+0x113) [0x435643]
(EE) 14: /usr/libexec/Xorg (InitFonts+0x420) [0x439890]
(EE) 15: /lib64/libc.so.6 (__libc_start_main+0xea) [0x7f221888388a]
(EE) 16: /usr/libexec/Xorg (_start+0x2a) [0x42357a]
(EE) 
(EE) Segmentation fault at address 0x0
Comment 6 Peter Hutterer 2018-02-07 23:17:35 UTC
This may be the same problem addressed by the patchset in https://github.com/whot/xf86-input-libinput/tree/wip/subdevice-config-filtering, please give that one a test, thanks.
Comment 7 Peter Hutterer 2018-02-07 23:20:01 UTC
Hmm, it could also be Bug 104939, there's a patch for that one out too.
Comment 8 Peter Hutterer 2018-02-13 03:54:29 UTC
Most likely fixed by bb4ec1e3e76b64ec53c25036976e0374aaf41de, see Bug 104939
Comment 9 Peter Hutterer 2018-02-13 04:04:10 UTC
sorry, wrong conclusion, this is a different rotation than the one from bug 104939
Comment 10 Peter Hutterer 2018-02-13 04:32:37 UTC
commit cb186abc17ad9e525609dc32385b0a7992e949a9 (HEAD -> master, origin/master)
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Feb 9 19:24:15 2018 +1000

    evdev: fail before open_restricted if the devnode doesn't exist

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.