Skip to content

Unblock SIGCHLD when spawning subprocesses

Simon McVittie requested to merge wip/t17980 into master
  • utils: Always call _srt_check_not_setuid from constructor

    Previously, we only called this if we were already going to call g_type_init().

  • SrtSystemInfo: Document that we need SIGCHLD

  • Unblock signals when spawning subprocesses, and in s-r-s-i

    This avoids a coreutils limitation in versions [8.27, 8.29), which unfortunately includes Ubuntu 18.04: timeout(1) relied on SIGCHLD not being blocked, but did not unblock it themselves.

    The Steam client runs s-r-s-i from a thread that has SIGCHLD blocked, and SIGALRM, SIGPIPE and SIGTRAP ignored. This is contrary to frequent expectations of general-purpose libraries and command-line utilities: in particular, SIGPIPE is used by processes writing to a pipe to detect that the read end has died, SIGTRAP is frequently used to terminate processes on an assertion failure, and SIGCHLD is often necessary for subprocess management.

    Games (whether Steam or non-Steam) appear to be run with only SIGPIPE and SIGTRAP ignored, so strictly speaking, unignoring those two makes the behaviour of s-r-s-i unlike the behaviour of actual games. However, the effect of unblocking SIGPIPE and SIGTRAP is to make s-r-s-i more likely to crash (the default disposition of both those signals is process termination), which is probably what we want: if there is any difference, we want s-r-s-i's helpers to be more strict than games (crash more often), so that they can act as an early-warning system for issues that could manifest in games.

  • tests: Add an "adverb" command that can be used to debug signal handling

    This can be wrapped around a command in the same way as env(1) to see what happens: in particular, it can undo some of Steam's execution environment.

    This is a developer tool rather than something for use in production, so it's only installed alongside the installed-tests at the moment.


Possible solution for https://phabricator.collabora.com/T17980

Test-build (together with pressure-vessel!18 and steamlinuxruntime!6 (merged)): https://jenkins.internal.steamos.cloud/job/playground/job/scout/job/build/140/

/cc @jpwhiting @denittis

Edited by Simon McVittie

Merge request reports

Loading