- Nov 24, 2023
-
-
Ludovico de Nittis authored
pv-wrap: Fix minor issues caught by the test suite See merge request !634
-
- Nov 23, 2023
-
-
Ludovico de Nittis authored
pv-wrap: Don't try to construct a sysroot for a NULL path See merge request !633
-
Ludovico de Nittis authored
subprocess: Avoid using timeout(1) to impose a timeout on subprocesses Closes #88 See merge request !626
-
Ludovico de Nittis authored
subprocess: Start the subprocess asynchronously, then wait for it See merge request !628
-
- Nov 22, 2023
-
-
Simon McVittie authored
No functional changes. The vast majority of our delta was merged: our only remaining changes are to use a slightly older WAFFLE_API_VERSION, and apply https://gitlab.freedesktop.org/mesa/waffle/-/merge_requests/146 as local delta. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
There appears to be a once-per-process memory leak in wegl_display_init(), which is uninteresting for a short-lived process. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
Previously we allocated one GVariant per loop, but only freed the last. When building with AddressSanitizer, this caused a crash which is reported to systemd-coredump if used (but the JSON output was valid, and the test suite can't assert that check-xdg-portal succeeds because on some test systems it might not, so the crash did not cause a test failure). Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
No functional change intended, it just uses a little less memory. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
The SrtSysroot passes it to a function that is annotated as not validly accepting NULL, which is caught by recent functions of UBSan. In practice _srt_sysroot_new() would have returned NULL in this situation anyway. Fixes: 1d08d563 "pv-wrap: Use a SrtSysroot to represent the interpreter root" Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
- Nov 21, 2023
-
-
Simon McVittie authored
Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Ludovico de Nittis authored
Add a tool to verify runtimes against a mtree manifest See merge request !631
-
- Nov 17, 2023
-
-
Simon McVittie authored
Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
This will make it easy to verify that `SteamLinuxRuntime_sniper` and `SteamLinuxRuntime_soldier` are intact: .../SteamLinuxRuntime_sniper/pressure-vessel/bin/pv-verify and only slightly more difficult to do the same for SLR 1.0: .../SteamLinuxRuntime_soldier/pressure-vessel/bin/pv-verify \ .../SteamLinuxRuntime A more explicit version of the first command is: .../SteamLinuxRuntime_sniper/pressure-vessel/bin/pv-verify \ --mtree=.../SteamLinuxRuntime_sniper/mtree.txt.gz \ -- \ .../SteamLinuxRuntime_sniper/pressure-vessel but the defaults are sensible. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
This will allow a similar code path that verifies instead of applying. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
This provides a convenient way to check whether the depot has the contents we believe it should. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
This matches the output of bsdtar (libarchive), for example: bsdtar -cf- --format=mtree -C ~/tmp . and NetBSD mtree(8) (the mtree-netbsd package in Debian), for example: mtree -c -p ~/tmp | mtree -C Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
There are too many false positives if we do. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
The key trick here is that on any halfway modern kernel, we can use waitid() in a background thread with the WNOWAIT flag, which pauses until the subprocess has exited but does not reap it, allowing the main thread to wait for it again, this time without WNOWAIT, causing the subprocess to be reaped. This is considerably faster than the previous implementation, around 30% on both x86 and ARM. I considered using a GThreadPool to reuse the short-lived threads, but that's more complex and doesn't actually seem to be any faster than creating and destroying the thread every time. Resolves: #88 Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
We expect that "most" subprocesses will exit shortly after closing their stdout and stderr, so by the time we have read their output, polling their exit status will probably succeed. In practice, this mostly counteracts the performance penalty from the previous commit on x86. On ARM emulating x86 with FEX-Emu, it's still inconveniently slow (time taken > my patience to wait for it). Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
This is more difficult than you might think, because until GLib 2.78 (which is far too new for us to depend on), there was a potential race condition between g_child_watch_source_new()'s use of waitpid(), and a kill() in the same main-context. We don't really want to use g_child_watch_source_new() anyway, because we don't know whether this library is going to be loaded by a process that is blocking SIGCHLD or handling SIGCHLD itself. Avoiding timeout(1) can result in a significant speedup on ARM hardware emulating x86 via FEX-Emu, which makes executable startup disproportionately expensive: each new executable needs to re-initialize the interpreter, which is normally fine, but the cost builds up when we run a very large number of very small processes. Avoiding timeout(1) is also good for robustness: in the past, Canonical's Steam Snap app has had an AppArmor profile that did not allow arbitrary coreutils commands to be run. In this initial implementation, we poll the process every 100ms. This is *much* slower than blocking (it adds up to 100ms to every subprocess execution, resulting in a slowdown from around 8 to 96 seconds for steam-runtime-system-info on x86), but it can be used as a fallback. It's in this commit to have an opportunity to test the fallback code path. Subsequent commits will speed this up again. Helps: #88 Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
This is a step towards being able to do other things while we are waiting, in particular killing the subprocess with a signal if it times out (for which we would need to do coordinate between a thread that calls waitpid(), and a thread that iterates the main-context to handle the timeout). Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Ludovico de Nittis authored
pv-adverb: Show contents of ld.so.cache if debug output is enabled See merge request !630
-
Ludovico de Nittis authored
subprocess: Add a SrtCompletedSubprocess object to represent the result See merge request !625
-
Ludovico de Nittis authored
Add an object encapsulating the execution environment for helper subprocesses See merge request !629
-
- Nov 16, 2023
-
-
Simon McVittie authored
This is loosely based on the API of Python's `subprocess.CompletedProcess`. It intentionally isn't exposed to code outside its translation unit until it has finished running. This takes over the functionality of _srt_process_timeout_wait_status(), which is used automatically when needed for timeout(1), and can also be requested explicitly with SRT_HELPER_FLAGS_SHELL_EXIT_STATUS if using a wrapper that encodes exit status in the same way such as sh(1) or env(1). No functional change intended. The formatting of debug messages will be a little different, because I've used SRT_SUBPROCESS_OUTPUT_CAPTURE_DEBUG instead of open-coding its equivalent. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
During refactoring I noticed that this function was capturing stdout and stderr, but didn't actually do anything with them. Let's have these in a debug log. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
This ensures that if our log output has been redirected to the systemd Journal, the helper's diagnostic output will follow. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
During refactoring I noticed that these would previously have inherited the parent process's stdout and stderr file descriptors, potentially interfering with machine-readable output on stdout. Clean that up. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
The `display` and `graphics-drivers` checks historically didn't, but that seems more like accident than design. We can add a way to avoid this filtering if we find that we need it in future. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
Now that SrtSubprocessRunner knows both the SrtTestFlags and SrtHelperFlags, it can always set the timeout appropriately. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
This encapsulates `g_spawn_sync()` with a useful set of flags and behaviours, and will let us move the responsibility for handling features like timeouts between `get_helper()` and `spawn_sync()`. To make that work, try harder to pass the same flags to both `get_helper()` and `spawn_sync()`. For `architecture`, `display`, `graphics-drivers` and `libdl`, no behaviour change is intended. `display` and `graphics-drivers` should probably not be using `KEEP_GAMEOVERLAYRENDERER` (there's no real reason to do so) but for now, preserve existing behaviour. For `library`, we were previously passing `G_SPAWN_SEARCH_PATH` to `g_spawn_sync()`, but it would have had no practical effect, because we're using the absolute path to a helper executable. Drop that flag. For `graphics`, we were previously searching the `PATH` for everything except `check-gl`. Consistently search the `PATH` in all cases. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
If we make _srt_inspect_library responsible for filtering out the gameoverlayrenderer.so from LD_PRELOAD itself, then we can give it the unmodified execution environment as its argument. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
Previously we ignored the parameter and used default values here. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
my_environ had the same content as custom_environ, so we can use our new const-correct wrapper _srt_environ_getenv without any casts or copying. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
This will let us bundle together more of the subprocess handling for running helpers. For now, it is just a container for the environment, helpers path and test flags. This is an immutable value-object which does not change after it has been constructed, meaning that we can share it between threads if that becomes useful in future. No functional change intended. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
This makes us somewhat more const-correct, reducing the scope for accidents. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-