On 2019/11/26 11:57, Chris Cappuccio wrote:
> I keep getting random crashes on firefox tabs related to DRI use of shm.
> The funny thing is, 'ipcs' never shows any allocated shm right before the
> crash, or at any time. The shmget is entirely superfluous, but it crashes
> my browser. If I restart firefox, this can go away for hours or a few days,
> and then it starts trying to do shmget again for a bit. It seems to be
> partiallyu related to the web page, and its use of the browser.
> 
> This is both on 6.6 and current. Is anyone else seeing this with an inteldrm
> based console, or any console and firefox ??
> 
> #0  shmget () at -:3
> #1  0x000013e24027df7c in dri_sw_displaytarget_create ()
>    from /usr/X11R6/lib/modules/dri/swrast_dri.so
> #2  0x000013e240434d51 in llvmpipe_resource_create ()
>    from /usr/X11R6/lib/modules/dri/swrast_dri.so
> #3  0x000013e2400eaaad in drisw_allocate_textures ()
>    from /usr/X11R6/lib/modules/dri/swrast_dri.so
> #4  0x000013e2400e7d9d in dri_st_framebuffer_validate ()
>    from /usr/X11R6/lib/modules/dri/swrast_dri.so
> #5  0x000013e23fef93ad in st_framebuffer_validate ()
>    from /usr/X11R6/lib/modules/dri/swrast_dri.so
> #6  0x000013e23fefa241 in st_api_make_current ()
>    from /usr/X11R6/lib/modules/dri/swrast_dri.so
> #7  0x000013e2400e77f9 in dri_make_current ()
>    from /usr/X11R6/lib/modules/dri/swrast_dri.so
> #8  0x000013e2400e627a in driBindContext ()
>    from /usr/X11R6/lib/modules/dri/swrast_dri.so
> #9  0x000013e1ec0497ba in drisw_bind_context ()
>    from /usr/X11R6/lib/libGL.so.17.1
> #10 0x000013e1ec04fb8c in glXMakeCurrentReadSGI ()
>    from /usr/X11R6/lib/libGL.so.17.1
> #11 0x000013e1f780fcda in std::__1::vector<unsigned short, 
> std::__1::allocator<unsigned short> >::__append () from 
> /usr/local/lib/firefox/libxul.so.84.0
> ...
> libxul trace + broken trace
> 

Two simpler ways likely to bypass it, one is the diff below which is
expected to slow things down for non-pledged programs, the other is to
disable pledge in firefox which you can do with lines like these in
prefs.js (replace if already present, add if not).

user_pref("security.sandbox.pledge.content", "moo");
user_pref("security.sandbox.pledge.main", "moo");

(this is the method for current Firefox, but future updates are
expected to move this config into a different file).

Index: src/gallium/winsys/sw/dri/dri_sw_winsys.c
===================================================================
RCS file: 
/cvs/OpenBSD/xenocara/lib/mesa/src/gallium/winsys/sw/dri/dri_sw_winsys.c,v
retrieving revision 1.7
diff -u -p -u -r1.7 dri_sw_winsys.c
--- src/gallium/winsys/sw/dri/dri_sw_winsys.c   19 Feb 2019 04:24:01 -0000      
1.7
+++ src/gallium/winsys/sw/dri/dri_sw_winsys.c   5 Oct 2019 09:15:29 -0000
@@ -138,7 +138,7 @@ dri_sw_displaytarget_create(struct sw_wi
 
    dri_sw_dt->shmid = -1;
 
-#ifdef HAVE_SHM
+#if defined(HAVE_SHM) && !defined(__OpenBSD__)
    if (ws->lf->put_image_shm)
       dri_sw_dt->data = alloc_shm(dri_sw_dt, size);
 #endif

There is another option (described by matthieu@ when we were looking at
Firefox on aarch64) of converting DRI to using mmap() based shared
memory, but it's a lot more complex (the relevant code is scattered in
multiple places).

Reply via email to