Bug 110328

Summary: meson-built drivers are installed with non-empty rpath
Product: Mesa Reporter: Adam Jackson <ajax>
Component: OtherAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 109323    

Description Adam Jackson 2019-04-04 19:08:10 UTC
This is terrible:

datura:~% readelf -d /usr/lib64/dri/radeonsi_dri.so | grep RPATH
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/../../../mesa:$ORIGIN/../../../compiler/glsl:$ORIGIN/../../../compiler/glsl/glcpp:$ORIGIN/../../../util:$ORIGIN/../../../compiler/nir:$ORIGIN/../../../compiler:$ORIGIN/../../../mesa/drivers/dri/common:$ORIGIN/../../state_trackers/dri:$ORIGIN/../../auxiliary:$ORIGIN/../../../mapi/shared-glapi:$ORIGIN/../../auxiliary/pipe-loader:$ORIGIN/../../../loader:$ORIGIN/../../winsys/sw/null:$ORIGIN/../../winsys/sw/wrapper:$ORIGIN/../../winsys/sw/dri:$ORIGIN/../../winsys/sw/kms-dri:$ORIGIN/../../drivers/llvmpipe:$ORIGIN/../../drivers/softpipe:$ORIGIN/../../drivers/r300:$ORIGIN/../../winsys/radeon/drm:$ORIGIN/../../drivers/r600:$ORIGIN/../../drivers/radeonsi:$ORIGIN/../../winsys/amdgpu/drm:$ORIGIN/../../../amd/addrlib:$ORIGIN/../../../amd/common:$ORIGIN/../../winsys/nouveau/drm:$ORIGIN/../../drivers/nouveau:$ORIGIN/../../drivers/svga:$ORIGIN/../../winsys/svga/drm:$ORIGIN/../../drivers/virgl:$ORIGIN/../../winsys/virgl/drm:$ORIGIN/../../winsys/virgl/vtest]

This is _probably_ not a security problem, since in most cases $ORIGIN is going to be /usr/lib/dri, and /usr and / aren't generally world-writable. But it is a performance problem, because when the 3D driver loads any libraries it depends on that aren't already loaded (llvm, probably) will be uselessly searched for in a bunch of nonexistent directories. Not theoretical either, see:

https://gitlab.freedesktop.org/wayland/weston/issues/213

In Fedora I'm going to work around this for now by doing 'chrpath -d' on the drivers after they're installed, but this should be addressed upstream too.
Comment 1 Adam Jackson 2019-04-04 19:12:17 UTC
Pardon me, I had missed this commit:

datura:~/git/mesa% git show aa7afe324c2092fb31f9498cb3eda47dda96e6f2               
commit aa7afe324c2092fb31f9498cb3eda47dda96e6f2
Author: Eric Engestrom <eric.engestrom@intel.com>
Date:   Tue Mar 26 11:21:09 2019 +0000

    meson: strip rpath from megadrivers

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.