Skip to content

Commit

Permalink
setup.sh: Special-case libudev.so.0.0.9999 as newer than our libudev.…
Browse files Browse the repository at this point in the history
…so.0

Steam Runtime 1 'scout' is based on a library stack from 2012, so it
includes libudev.so.0 v175, from before libudev was merged into systemd
and bumped its SONAME to libudev.so.1. libudev.so.0 and libudev.so.1
mostly export the same symbols, and the symbols in libudev.so.0 don't
use ELF symbol versioning, so if we load both libudev.so.0 and
libudev.so.1 into the same process, libudev.so.0 will "win". This
can cause crashes if another module of the same process calls functions
that are unique to libudev.so.1, by sharing data structures between
libraries that were never intended to share them.

There is a libudev0-shim project, originating in Arch Linux and now
offered by several other distributions such as Debian, which provides a
drop-in replacement for the legacy libudev.so.0. Unfortunately, the
legacy libudev.so.0 is versioned as .so.0.13.0, while Arch's shim is
currently versioned as .so.0.0.9999 (archlinux/libudev0-shim#4), so we
would normally assume our legacy version is actually newer.

If we special-case Arch's shim to be considered to be newer than the
Steam Runtime's legacy version, then we'll load the shim version whenever
it's available at OS level, avoiding crashes.

Part-of: steamrt/tasks#313
Helps: ValveSoftware/steam-for-linux#9805
Signed-off-by: Simon McVittie <smcv@collabora.com>
  • Loading branch information
smcv authored and RyuzakiKK committed Jul 27, 2023
1 parent 13b2e08 commit 2677a6e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions templates/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,12 @@ pin_newer_runtime_libs ()
runtime_version_newer="yes"
fi

if [[ "$soname" == libudev.so.0 && "$h_lib_major.$h_lib_minor.$h_lib_third" == 0.0.9999 ]]; then
# Work around https://github.com/archlinux/libudev0-shim/issues/4
debug "Treating libudev0-shim as newer than runtime version"
runtime_version_newer="no"
fi

# Print to stderr because zenity is consuming stdout
if [[ $runtime_version_newer == "yes" ]]; then
log "Found newer runtime version for $bitness-bit $soname. Host: $h_lib_major.$h_lib_minor.$h_lib_third Runtime: $r_lib_major.$r_lib_minor.$r_lib_third"
Expand Down

0 comments on commit 2677a6e

Please sign in to comment.