Games that use the Steam Linux Runtime container environment do not inherit these excess fds - they only receive fds 0, 1 and 2 from Steam - so it seems that none of the inherited fds >= 3 are strictly necessary.
steam-launch-wrapper now closes the excess fds.
Nothing extracted yet.
Your system information
Please describe your issue in as much detail as possible:
When Steam launches a game, it does so with a lot of file descriptors open. The game could accidentally (or maliciously?) write to or read from these fds, disrupting intended Steam functionality.
I would expect that the vast majority of file descriptors that are open in Steam should have the close-on-execute (FD_CLOEXEC) flag set. This is most reliably done at open time, by specifying
O_CLOEXECforopen(), modifier flag"e"forfopen(),SOCK_CLOEXECforsocket()and so on. At the moment, it looks as though only about 70% of them are close-on-execute.Exceptions to this, where a file descriptor explicitly needs to be inherited by the game:
/dev/null. In practice it is inherited from whatever was Steam's stdin when it was launched, which seems correct.sd_journal_stream_fd(), or/dev/null. In practice they are inherited from whatever was Steam's stdout/stderr when it was launched, which seems correct.Steps for reproducing this issue:
reaperparent, the reaper's/bin/sh -cparent, and the main Steam process/bin/shand thereaperare 0, 1, 2, and maybe a small number of game-specific pipes etc. used for coordination between Steam and the reaper/bin/sh -cprocess (and most of those end up in the game itself), including:~/.steam/steam.pipefifo, open for reading (if the game reads from this, then commands sent to Steam by other games or Steam instances will be lost)/dev/hidraw*devices (but presumably the game is meant to open these itself if it wants to use raw HID?)/dev/shm/u1000-ValveIPCSharedObj-Steam, open read/write/dev/shm/u1000-Shm_*, open read/writegameoverlayrenderer.soremotecache.vdf, open for writing/proc/$pid/status