X sometimes crashes after using tablet mode (backtrace available)

Hi guys,

I am running Manjaro Xfce on my Thinkpad L13 Yoga Gen2:

$ inxi -F
  Host: ThinkpadL13Yoga Kernel: 6.0.6-1-MANJARO arch: x86_64 bits: 64
    Desktop: Xfce v: 4.16.1 Distro: Manjaro Linux
  Type: Convertible System: LENOVO product: 20VLS01500
    v: ThinkPad L13 Yoga Gen 2 serial: <superuser required>
  Mobo: LENOVO model: 20VLS01500 serial: <superuser required> UEFI: LENOVO
    v: R1FET46W (1.20 ) date: 08/05/2022
  ID-1: BAT0 charge: 13.6 Wh (34.5%) condition: 39.4/46.0 Wh (85.7%)
    volts: 14.8 min: 15.4
  Info: quad core model: 11th Gen Intel Core i5-1135G7 bits: 64 type: MT MCP
    cache: L2: 5 MiB
  Speed (MHz): avg: 1373 min/max: 400/4200 cores: 1: 1212 2: 2400 3: 1054
    4: 1261 5: 1250 6: 2400 7: 853 8: 554
  Device-1: Intel TigerLake-LP GT2 [Iris Xe Graphics] driver: i915 v: kernel
  Device-2: Chicony ThinkPad T490 Webcam type: USB driver: uvcvideo
  Device-3: Acer Integrated 5M Camera type: USB driver: uvcvideo
  Display: x11 server: X.Org v: 21.1.4 driver: X: loaded: modesetting
    dri: iris gpu: i915 resolution: 1920x1080~60Hz
  API: OpenGL v: 4.6 Mesa 22.2.3 renderer: Mesa Intel Xe Graphics (TGL GT2)
  Device-1: Intel Tiger Lake-LP Smart Sound Audio driver: snd_hda_intel
  Sound API: ALSA v: k6.0.6-1-MANJARO running: yes
  Sound Server-1: PulseAudio v: 16.1 running: yes
  Sound Server-2: PipeWire v: 0.3.59 running: yes
  Device-1: Intel Wi-Fi 6 AX201 driver: iwlwifi
  IF: wlp0s20f3 state: up mac: 2c:db:07:e7:59:78
  Device-2: Intel Ethernet I219-V driver: e1000e
  IF: enp0s31f6 state: down mac: 48:2a:e3:a8:52:ff
  Device-1: Intel AX201 Bluetooth type: USB driver: btusb
  Report: rfkill ID: hci0 rfk-id: 1 state: down bt-service: enabled,running
    rfk-block: hardware: no software: yes address: see --recommends
  Local Storage: total: 476.94 GiB used: 158.27 GiB (33.2%)
  ID-1: /dev/nvme0n1 vendor: Samsung model: MZVLB512HBJQ-000L7
    size: 476.94 GiB
  ID-1: / size: 383.47 GiB used: 158.07 GiB (41.2%) fs: ext4
    dev: /dev/nvme0n1p2
  ID-2: /boot/efi size: 299.4 MiB used: 25.6 MiB (8.6%) fs: vfat
    dev: /dev/nvme0n1p1
  ID-1: swap-1 type: partition size: 8.8 GiB used: 178.2 MiB (2.0%)
    dev: /dev/nvme0n1p3
  System Temperatures: cpu: 1.0 C mobo: 1.0 C
  Fan Speeds (RPM): N/A
  Processes: 321 Uptime: 10d 17h 52m Memory: 15.3 GiB used: 6.16 GiB (40.3%)
  Shell: Bash inxi: 3.3.23

The Thinkpad has this feature that you can fold the display all the way back (360°) and write on it using the stylus (let’s call it “tablet mode”): https://www.notebookcheck.com/uploads/tx_nbc2/LenovoThinkPadL13YogaG3__1_.jpg

This works without problems. But when I put the display back up to use the Thinkpad in “laptop mode” again, sometimes X crashes with the following backtrace:

[454028.520] (EE) Backtrace:
[454028.528] (EE) 0: /usr/lib/Xorg (dri3_send_open_reply+0xdd) [0x562bd9b80bed]
[454028.530] (EE) 1: /usr/lib/libc.so.6 (__sigaction+0x50) [0x7fe90bbc7a00]
[454028.532] (EE) 2: /usr/lib/libc.so.6 (pthread_key_delete+0x14c) [0x7fe90bc1764c]
[454028.533] (EE) 3: /usr/lib/libc.so.6 (gsignal+0x18) [0x7fe90bbc7958]
[454028.535] (EE) 4: /usr/lib/libc.so.6 (abort+0xd7) [0x7fe90bbb153d]
[454028.536] (EE) unw_get_proc_name failed: no unwind info found [-10]
[454028.536] (EE) 5: /usr/lib/libc.so.6 (?+0x0) [0x7fe90bbb145c]
[454028.537] (EE) 6: /usr/lib/libc.so.6 (__assert_fail+0x46) [0x7fe90bbc0486]
[454028.538] (EE) 7: /usr/lib/libinput.so.10 (libinput_device_config_rotation_get_default_angle+0x17e7) [0x7fe8e4048617]
[454028.539] (EE) 8: /usr/lib/libinput.so.10 (libinput_device_config_rotation_get_default_angle+0x1816) [0x7fe8e4048646]
[454028.540] (EE) 9: /usr/lib/libinput.so.10 (libinput_device_config_rotation_get_default_angle+0xa8f2) [0x7fe8e4051722]
[454028.541] (EE) 10: /usr/lib/libinput.so.10 (libinput_device_config_rotation_get_default_angle+0x108e1) [0x7fe8e4057711]
[454028.541] (EE) 11: /usr/lib/libinput.so.10 (libinput_device_config_rotation_get_default_angle+0xe3b) [0x7fe8e4047c6b]
[454028.542] (EE) 12: /usr/lib/libinput.so.10 (libinput_dispatch+0x98) [0x7fe8e4043b98]
[454028.543] (EE) unw_get_proc_name failed: no unwind info found [-10]
[454028.543] (EE) 13: /usr/lib/xorg/modules/input/libinput_drv.so (?+0x0) [0x7fe9017e64ed]
[454028.543] (EE) 14: /usr/lib/Xorg (SrvXkbKeyTypesForCoreSymbols+0x1c26) [0x562bd9b6ed76]
[454028.543] (EE) 15: /usr/lib/Xorg (UnlockServer+0x282) [0x562bd9b79552]
[454028.543] (EE) 16: /usr/lib/Xorg (ListenOnOpenFD+0x3a9) [0x562bd9b754a9]
[454028.545] (EE) 17: /usr/lib/libc.so.6 (pthread_condattr_setpshared+0x4ed) [0x7fe90bc158fd]
[454028.546] (EE) 18: /usr/lib/libc.so.6 (__xmknodat+0x250) [0x7fe90bc97a60]
[454028.546] (EE) 
[454028.546] (EE) 
Fatal server error:
[454028.546] (EE) Caught signal 6 (Aborted). Server aborting
[454028.546] (EE) 
[454028.546] (EE)

It’s very frustrating, especially if I am working on something which hasn’t been saved for some time, then all my work is gone…

I found some reports of similar crashes, in one case the origin was a “Rotate” option in xorg.conf (https://www.linuxquestions.org/questions/slackware-14/rotate-option-in-custom-xorg-conf-d-monitor-section-config-crashing-x11-on-startup-4175668937/ not the case for me) or plugging in a USB keyboard (Xorg seg faults when a USB keyboard is connected with '%' character in the product name (#759) · Issues · libinput / libinput · GitLab also not the case for me). So I’m a bit stuck here, any hints are appreciated!