Skip to content

test(libSceSystemService): accept the write watch diagnostic before the LoadExec child's line - #11258

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
wachi35676:fix/libSceSystemService-load-exec-stderr-runtime-lines
Oct 26, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
wachi35676:fix/libSceSystemService-load-exec-stderr-runtime-lines

Conversation

@wachi35676

@wachi35676 wachi35676 commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

What

guest_system_load_exec_standard_error fails on every run on Linux hosts whose kernel lacks asynchronous userfaultfd write protection (before 6.7, e.g. WSL2's 6.6 or Debian 12's 6.1). It aborts without a message (Subprocess aborted), and several open PRs list it as failing on main in their containers (#10479, #10755, #10767, #11167).

The test requires the re-executed child's host standard error to be exactly started <mode>\n. On such a kernel the runtime first prints its start-up diagnostic [memory] write watch unavailable: asynchronous userfaultfd write protection failed (Invalid argument); guest memory is compared instead (GuestWriteWatch.cpp) to the same stream, so the exact comparison fails. strace of the child shows the diagnostic, then started list\n, then exit 0. With APS5_NO_WRITE_WATCH=1 the unchanged test passes.

The check now skips that one line, [memory] write watch unavailable: ... (matched by its exact prefix), when it comes first. The rest of the host stream must still be exactly started <mode>\n, and the guest stream must still be empty. Any other leading line still fails. This is a test-only change with no runtime code.

Tested

  • Linux, WSL2 Ubuntu 24.04 (kernel 6.6.87.2), GCC 13.3, Release, BUILD_TESTING=ON, main 90f918f (re-run at fff18d2 with the narrower match: 3/3 pass):
    • main: the test aborts on every run.
    • This change: it passes 3/3 (--repeat until-fail:3).
    • With both dup2 calls that give the host standard error back to descriptor 2 removed (Export.cpp StartHostExecutable, LoadExec.cpp Replace), the updated test still fails, so it still catches the bug it guards.
    • Full ctest: 23 failures on main and 23 with this change. This test drops out of the list. The rest are the same lavapipe agc_* and pr_overlap_encoding failures in both runs, plus guest_memory's mapping-cost timing ratio, which failed once under -j 4 and passes alone 3/3.
  • Windows 11, WinLibs GCC 15.2.0, Release: full build. The test is only registered on Linux and macOS. guest_system*, loadexec* and lnc_util* (22 tests) pass.
  • python tools/check_conventions.py --base upstream/main passes.
  • macOS: not tested.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code). I ran the builds and tests above on my machine.

🤖 Generated with Claude Code

https://claude.ai/code/session_01En5cnt6RwCiNXDJwm9t8Tf

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reported WSL2 reproduction explains the failure and the test still checks the child line and guest stream.


bool HostOutputIs(const std::string& text, const std::string& line) {
std::size_t begin = 0;
while (begin < text.size() && text[begin] == '[') {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One non-blocking test-hardening point: this skips every leading line beginning with [ rather than only the runtime's [memory] write watch unavailable: diagnostic. For example, [unexpected]\nstarted list\n is accepted as the exact expected output. Could this match the known startup-diagnostic prefix (or otherwise constrain accepted diagnostics) so unrelated child stderr cannot be hidden?

…he LoadExec child's line

guest_system_load_exec_standard_error compared the host standard error of
the re-executed child with "started <mode>\n" exactly. On a Linux kernel
without asynchronous userfaultfd write protection (before 6.7, such as
WSL2's 6.6) libc prints "[memory] write watch unavailable: ..." to the
host standard error at start-up, so the comparison failed and the test
aborted on every run. That one diagnostic line is now skipped when it
comes first; the rest of the host stream must still be the child's line
exactly, and the guest pipe must still be empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01En5cnt6RwCiNXDJwm9t8Tf
@wachi35676
wachi35676 force-pushed the fix/libSceSystemService-load-exec-stderr-runtime-lines branch from 813dd0f to fff18d2 Compare October 25, 2026 23:39
@wachi35676 wachi35676 changed the title test(libSceSystemService): accept runtime diagnostics before the LoadExec child's line test(libSceSystemService): accept the write watch diagnostic before the LoadExec child's line Oct 25, 2026
@wachi35676

Copy link
Copy Markdown
Contributor Author

@MarcZX10 Thanks, fixed in fff18d2. The check now skips only a first line that begins with [memory] write watch unavailable: (the exact prefix GuestWriteWatch.cpp prints). Any other leading line, such as your [unexpected]\nstarted list\n, no longer equals started list\n, so the test fails. The rest of the host stream and the empty guest stream are checked as before.

Re-run on WSL2 Ubuntu 24.04 (kernel 6.6, GCC 13.3, Release) at fff18d2: guest_system_load_exec_standard_error passes 3/3. check_conventions.py passes.

AI-assisted: yes (Claude Code); results above were run on this machine.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed exact head fff18d2f3b12e1654d266bb84f2b8337b5fea0b8. The test now skips only the leading host diagnostic with the emitted [memory] write watch unavailable: prefix; it requires a newline and still compares all remaining host output exactly, while requiring an empty guest stream. This addresses the earlier concern that arbitrary leading output could pass. The author reports the focused Linux test passes 3/3 on the new head and still fails if either host-stderr duplication is removed; Windows related tests and conventions also pass. I did not rerun those local tests. Hosted policy/convention checks pass; product jobs are path-skipped. No blocking issue remains.

@oneandonlydean oneandonlydean self-assigned this Oct 26, 2026
@oneandonlydean
oneandonlydean merged commit d93f7c6 into boykopovar:main Oct 26, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants