We have been waiting for a very long time. I am giving up on upstream
merging the commits. Let's vendor the patch. New debdiffs inbound. SRU
template ready.

** Also affects: xorg-server (Ubuntu Plucky)
   Importance: High
       Status: Confirmed

** Changed in: xorg-server (Ubuntu Noble)
   Importance: Undecided => High

** Changed in: xorg-server (Ubuntu Jammy)
   Importance: Undecided => High

** Changed in: xorg-server (Ubuntu Focal)
   Importance: Undecided => High

** Changed in: xorg-server (Ubuntu Plucky)
       Status: Confirmed => In Progress

** Changed in: xorg-server (Ubuntu Oracular)
       Status: Confirmed => In Progress

** Changed in: xorg-server (Ubuntu Noble)
       Status: Confirmed => In Progress

** Changed in: xorg-server (Ubuntu Jammy)
       Status: Confirmed => In Progress

** Changed in: xorg-server (Ubuntu Focal)
       Status: Confirmed => In Progress

** Changed in: xorg-server (Ubuntu Plucky)
     Assignee: (unassigned) => Matthew Ruffell (mruffell)

** Changed in: xorg-server (Ubuntu Oracular)
     Assignee: (unassigned) => Matthew Ruffell (mruffell)

** Changed in: xorg-server (Ubuntu Noble)
     Assignee: (unassigned) => Matthew Ruffell (mruffell)

** Changed in: xorg-server (Ubuntu Focal)
     Assignee: (unassigned) => Matthew Ruffell (mruffell)

** Changed in: xorg-server (Ubuntu Jammy)
     Assignee: (unassigned) => Matthew Ruffell (mruffell)

** Summary changed:

- Xorg crashed with assertion failure (usually in a VM) at [privates.h:121/122: 
dixGetPrivateAddr: Assertion `key->initialized' failed]
+ Xorg crashes with assertion failure at dixGetPrivateAddr: Assertion 
`key->initialized' failed

** Description changed:

- Xorg crashed with assertion failure (usually in a VM):
+ [Impact]
  
- privates.h:121: dixGetPrivateAddr: Assertion `key->initialized' failed.
+ A very common crash in Xorg occurs when an application you are trying to 
launch
+ does not call DRI2ScreenInit() before calling DRI2Authenticate() or 
+ DRI2CreateDrawable2(). 
  
- WORKAROUND
+ This brings down the entire Xserver, and you lose all work.
  
- Select 'Ubuntu on Wayland' on the login screen.
+ This isn't just a single application, common ones are gstreamer1.0-vaapi
+ either invoked as gst-inspect-1.0 or through file manager thumbnailers,
+ Intel libva, and more.
+ 
+ The solution is to make DRI2Authenticate() and DRI2CreateDrawable2() more
+ robust to not having had DRI2ScreenInit() called, and to pass the error up
+ instead of just crashing on the assert.
+ 
+ Stack traces from logs:
+ 
+ Xorg: ../../../../../../include/privates.h:122: dixGetPrivateAddr: Assertion 
`key->initialized' failed.
+ (EE)
+ (EE) Backtrace:
+ (EE) 0: /usr/lib/xorg/Xorg (OsLookupColor+0x14c) [0x587abb9686dc]
+ (EE) 1: /lib/x86_64-linux-gnu/libc.so.6 (__sigaction+0x50) [0x747466445650]
+ (EE) 2: /lib/x86_64-linux-gnu/libc.so.6 (pthread_kill+0x11c) [0x7474664a3f5c]
+ (EE) 3: /lib/x86_64-linux-gnu/libc.so.6 (gsignal+0x1e) [0x74746644559e]
+ (EE) 4: /lib/x86_64-linux-gnu/libc.so.6 (abort+0xdf) [0x747466428902]
+ (EE) unw_get_proc_name failed: no unwind info found [-10]
+ (EE) 5: /lib/x86_64-linux-gnu/libc.so.6 (?+0x0) [0x74746642881e]
+ (EE) 6: /lib/x86_64-linux-gnu/libc.so.6 (__assert_fail+0x47) [0x74746643bb87]
+ (EE) 7: /usr/lib/xorg/Xorg (DRIMoveBuffersHelper+0xb13) [0x587abb90de23]
+ (EE) 8: /usr/lib/xorg/Xorg (DRI2Authenticate+0xce) [0x587abb9108de]
+ (EE) 9: /usr/lib/xorg/Xorg (DRI2GetParam+0x6d9) [0x587abb9116f9]
+ (EE) 10: /usr/lib/xorg/Xorg (SendErrorToClient+0x3fc) [0x587abb7a004c]
+ (EE) 11: /usr/lib/xorg/Xorg (InitFonts+0x3b3) [0x587abb7a5623]
+ (EE) 12: /lib/x86_64-linux-gnu/libc.so.6 (__libc_init_first+0x88) 
[0x74746642a3b8]
+ (EE) 13: /lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+0x8b) 
[0x74746642a47b]
+ (EE) 14: /usr/lib/xorg/Xorg (_start+0x25) [0x587abb789685]
+ (EE)
+ (EE)
+ Fatal server error:
+ (EE) Caught signal 6 (Aborted). Server aborting
+ 
+ #0 _XReply (dpy=dpy@entry=0x55555558dce0, rep=rep@entry=0x7fffffffd6f0, 
extra=extra@entry=0, discard=discard@entry=0)
+     at ../../src/xcb_io.c:680
+ #1 0x00007ffff752a3d0 in VA_DRI2Authenticate (dpy=dpy@entry=0x55555558dce0, 
window=1046, magic=magic@entry=1)
+     at ../va/x11/va_dri2.c:225
+ #2 0x00007ffff7c138ed in va_drm_authenticate_x11 (fd=fd@entry=6, 
magic=magic@entry=1) at ../va/drm/va_drm_auth_x11.c:140
+ #3 0x00007ffff7c135d5 in va_drm_authenticate (fd=6, magic=1) at 
../va/drm/va_drm_auth.c:37
+ #4 0x00007ffff7c134bd in va_DisplayContextConnect (pDisplayContext=<optimized 
out>) at ../va/drm/va_drm.c:62
+ #5 va_DisplayContextGetDriverNames (pDisplayContext=<optimized out>, 
drivers=0x7fffffffd890, num_drivers=0x7fffffffd884)
+     at ../va/drm/va_drm.c:79
+ #6 0x00007ffff781729e in va_new_opendriver (dpy=0x55555558d310) at 
../va/va.c:681
+ #7 vaInitialize
+     (dpy=dpy@entry=0x55555558d310, 
major_version=major_version@entry=0x7fffffffdb34, 
minor_version=minor_version@entry=0x7fffffffdb30) at ../va/va.c:743
+ #8 0x00007ffff7f496d0 in vaapi_initialize (dpy=0x55555558d310) at 
../gst-libs/gst/vaapi/gstvaapiutils.c:113
+ #9 0x00007ffff7f6db73 in supports_vaapi (fd=6) at 
../gst-libs/gst/vaapi/gstvaapidisplay_drm.c:77
+ #10 get_default_device_path (display=0x5555555892a0 
[GstVaapiDisplayDRM|vaapidisplaydrm1])
+     at ../gst-libs/gst/vaapi/gstvaapidisplay_drm.c:140
+ #11 set_device_path (device_path=<optimized out>, display=0x5555555892a0 
[GstVaapiDisplayDRM|vaapidisplaydrm1])
+     at ../gst-libs/gst/vaapi/gstvaapidisplay_drm.c:181
+ #12 gst_vaapi_display_drm_open_display (display=0x5555555892a0 
[GstVaapiDisplayDRM|vaapidisplaydrm1], name=<optimized out>)
+     at ../gst-libs/gst/vaapi/gstvaapidisplay_drm.c:247
+ #13 0x00007ffff7f4a68b in gst_vaapi_display_create
+     (data=0x0, init_type=GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, 
display=0x5555555892a0 [GstVaapiDisplayDRM|vaapidisplaydrm1])
+     at ../gst-libs/gst/vaapi/gstvaapidisplay.c:965
+ #14 gst_vaapi_display_config
+     (display=0x5555555892a0 [GstVaapiDisplayDRM|vaapidisplaydrm1], 
init_type=GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, init_value=0x0) at 
../gst-libs/gst/vaapi/gstvaapidisplay.c:1272
+ #15 0x00007ffff7f709a1 in gst_vaapi_display_drm_new (device_path=0x0) at 
../gst-libs/gst/vaapi/gstvaapidisplay_drm.c:367
+ #16 0x00007ffff7f0c295 in gst_vaapi_create_test_display () at 
../gst/vaapi/gstvaapipluginutil.c:929
+ #17 plugin_init (plugin=0x555555585b10 [GstPlugin|plugin1]) at 
../gst/vaapi/gstvaapi.c:191
+ #18 0x00007ffff7e22452 in gst_plugin_register_func
+     (plugin=plugin@entry=0x555555585b10 [GstPlugin|plugin1], 
desc=desc@entry=0x7ffff7fb71a0 <gst_plugin_desc>, 
user_data=user_data@entry=0x0) at ../gst/gstplugin.c:540
+ #19 0x00007ffff7e279c0 in _priv_gst_plugin_load_file_for_registry
+     (filename=0x55555558122c 
"/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvaapi.so", registry=<optimized 
out>, error=<optimized out>) at ../gst/gstplugin.c:979
+ #20 0x00007ffff7e6ed41 in do_plugin_load
+     (tag=0, filename=0x55555558122c 
"/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvaapi.so", l=<optimized out>)
+     at ../gst/gstpluginloader.c:741
+ #21 handle_rx_packet
+     (payload_len=<optimized out>, payload=0x55555558122c 
"/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvaapi.so", tag=0, 
pack_type=<optimized out>, l=<optimized out>) at ../gst/gstpluginloader.c:849
+ #22 read_one (l=0x555555584a30) at ../gst/gstpluginloader.c:1025
+ #23 exchange_packets (l=l@entry=0x555555584a30) at 
../gst/gstpluginloader.c:1053
+ #24 0x00007ffff7e703a8 in _gst_plugin_loader_client_run 
(pipe_name=pipe_name@entry=0x0) at ../gst/gstpluginloader.c:596
+ #25 0x00005555555551db in main (argc=<optimized out>, argv=<optimized out>) 
at ../libs/gst/helpers/gst-plugin-scanner.c:81
+ 
+ [Testcase]
+ 
+ Start a fresh VM. Make sure the session is using X Server.
+ 
+ $ sudo apt install gstreamer1.0-vaapi gstreamer1.0-tools
+ $ gst-inspect-1.0
+ 
+ On plucky, you don't even need to run gst-inspect-1.0, just try log in, you 
will
+ quickly find that xserver is broken and you aren't getting a X session today.
+ 
+ Review the backtrace in /var/log/syslog.
+ 
+ If you install a test package from the following ppa, the issue does not
+ occur:
+ 
+ https://launchpad.net/~mruffell/+archive/ubuntu/sf392117-test
+ 
+ [Where problems could occur]
+ 
+ We are adding some protection on the xserver side against user-space 
applications
+ that incorrectly do not call DRI2ScreenInit() before attempting to construct
+ a window.
+ 
+ It would be best if all applications would call DRI2ScreenInit(), but if an
+ applications don't, then we need to not crash the entire xserver.
+ 
+ Regressions could occur in unintended behaviour for applications that can get
+ away without calling DRI2ScreenInit(), but those applications will likely just
+ continue working as usual. 
+ 
+ If a regression were to occur, it would occur when launching applications in
+ Xorg desktop environments.
+ 
+ [Other Info]
+ 
+ Duplicate Bugs
+ --------------
+ 
+ At the time of writing the primary Launchpad bug has 19 duplicate bugs, which
+ is the most I have ever seen, so this bug impacts a large amount of people.
+ 
+ Upstream Bugs
+ -------------
+ 
+ https://gitlab.freedesktop.org/xorg/xserver/-/issues/1053
+ https://gitlab.freedesktop.org/xorg/xserver/-/issues/1340
+ https://gitlab.freedesktop.org/xorg/xserver/-/issues/1534
+ https://lists.x.org/archives/xorg-devel/2024-September/059318.html
+ 
+ Downstream Bugs
+ ---------------
+ 
+ https://bugs.gentoo.org/841662
+ 
+ Merge Request and Fix
+ ---------------------
+ 
+ https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1608
+ 
+ commit 07931601759be31b86892fd1485bc127edadf65e
+ From: Doug Brown <d...@schmorgal.com>
+ Date: Mon, 15 Jul 2024 19:44:23 -0700
+ Subject: dri2: Protect against dri2ClientPrivate assertion failures
+ Link: 
https://gitlab.freedesktop.org/xorg/xserver/-/commit/07931601759be31b86892fd1485bc127edadf65e?merge_request_iid=1608
+ 
+ NOTE THIS IS NOT MERGED UPSTREAM, AND WILL BE VENDORED TO UBUNTU. See reasons
+ below.
+ 
+ The State of Upstream xserver
+ -----------------------------
+ 
+ Upstream xserver is on essential life-support maintenance at the moment.
+ No one is interested in reviewing or merging the merge request, after repeated
+ messages to the issue, merge quest, and development mailing list.
+ 
+ If you review:
+ 
+ https://gitlab.freedesktop.org/xorg/xserver/-/issues/1757
+ 
+ Then it becomes clear there are many other open merge requests waiting for
+ attention, and the only person who seems interested in these, Enrico Weigelt,
+ comments and gives attention, but he cannot merge due to not being a 
maintainer,
+ and the maintainers are being a little rude to him in that particular issue.
+ 
+ In short, this patch would have a big impact on the stability of xserver users
+ on Ubuntu, and we should just vendor this patch.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1861609

Title:
  Xorg crashes with assertion failure at dixGetPrivateAddr: Assertion
  `key->initialized' failed

To manage notifications about this bug go to:
https://bugs.launchpad.net/xorg-server/+bug/1861609/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to