On Sat, Jul 04, 2020 at 12:22:41PM +0200, Landry Breuil wrote:
> On Sat, Jul 04, 2020 at 05:58:07PM +1000, Jonathan Gray wrote:
> > On Fri, Jul 03, 2020 at 11:14:02PM -0400, Joe Gidi wrote:
> > > Hello,
> > > 
> > 
> > firefox seems to be doing a dlopen after it has unveil'd and can't
> > open libLLVM.  unveil removes visibility of parts of the filesystem,
> > but it has to be done in the right place.
> 
> i dont think firefox itself is doing this dlopen, rather MESA ?
> https://searchfox.org/mozilla-central/search?q=libllvm

firefox would be dlopen'ing libGL.so
the Mesa loader opens the dri driver which I suspect happens when
the GL context is created.

/usr/X11R6/lib/modules/dri/radeonsi_dri.so for amdgpu

in the case of radeonsi and swrast these are linked against
libLLVM (and libelf for amdgpu)

dlopen: loading: libGL.so
dlopen: libGL.so: done (success).
dlopen: loading: /usr/X11R6/lib/modules/dri/radeonsi_dri.so
 flags /usr/X11R6/lib/modules/dri/radeonsi_dri.so = 0x0
head /usr/X11R6/lib/modules/dri/radeonsi_dri.so
obj /usr/X11R6/lib/modules/dri/radeonsi_dri.so has 
/usr/X11R6/lib/modules/dri/radeonsi_dri.so as head
linking /usr/X11R6/lib/modules/dri/radeonsi_dri.so as dlopen()ed
head [/usr/X11R6/lib/modules/dri/radeonsi_dri.so]
examining: '/usr/X11R6/lib/modules/dri/radeonsi_dri.so'
loading: libelf.so.3.0 required by /usr/X11R6/lib/modules/dri/radeonsi_dri.so
dlopen: failed to open libelf.so.3.0
unload_shlib called on /usr/X11R6/lib/modules/dri/radeonsi_dri.so
unload_shlib unloading on /usr/X11R6/lib/modules/dri/radeonsi_dri.so
dlopen: /usr/X11R6/lib/modules/dri/radeonsi_dri.so: done (failed).
libGL error: MESA-LOADER: failed to open radeonsi (search paths 
/usr/X11R6/lib/modules/dri)

It works if I disable unveil in the kernel and permit DRM_IOCTL_GET_CLIENT
in pledge_ioctl_drm(), which was discussed at some point but apparently
didn't go in.  This should only be required if trying to create a
context after pledge, occurs in libdrm amdgpu init.

> 
> >  37357 firefox  NAMI  "/usr/lib/libLLVM.so.2.0"
> >  37357 firefox  RET   open -1 errno 2 No such file or directory
> > 
> > this can be reproduced on other hardware by forcing swrast which also
> > uses libLLVM
> > 
> > LIBGL_ALWAYS_SOFTWARE=1 firefox
> > 
> > this a firefox specific problem which does not occur with chromium
> 
> Since unveil doesnt allow wildcards, i guess adding '/usr/lib r' to
> /etc/firefox/unveil.gpu is the way to go. I dont have a machine with
> amdgpu, and it doesnt seem to help LIBGL_ALWAYS_SOFTWARE=1 firefox
> httpss://get.webgl.org here but maybe that's unrelated.
> 
> Landry
> 
> 

Reply via email to