Repository navigation
Conversation
51a69fa to
15cbdfa
Compare
15cbdfa to
ba55d38
Compare
The forced-phone case of t_motion_hid (ceaf6d6) passed (float[]){0} as the rotation, one float, while motion_set reads three (motion_map_apply in motion_fusion.h), so the test read two floats past the array on the stack. It passed by chance; AddressSanitizer reports a stack-buffer-overflow at motion_fusion.h:45 (found by the asan target of seedds#412). The rotation is now (float[]){0, 0, 0}, which is what the case means: no rotation. Checked: make -C dm/host/tests run passes (hid players: 119 checks), and with seedds#412's asan target the report is gone.
ba55d38 to
835bf0f
Compare
…tchet Roadmap item seedds#313. The host tests ran under sanitizers only in a few hand-written targets (tsan, memory-tsan, the 16k memory test). Now: - make -C dm/host/tests GAME=<id> asan runs every test of run under AddressSanitizer and UndefinedBehaviorSanitizer, built into build/asan; - make -C dm/host/tests GAME=<id> tsan-threads runs the twelve tests that start threads under ThreadSanitizer, built into build/tsan; - make -C dm/gfx/tex/tests asan runs t_tex under ASan and UBSan. The rules are the plain ones, compiled with SAN (the extra flags) into a folder of their own, so the plain build is unchanged. The flags, options and lists are in dm/sanitizers/: ignorelist.txt (ASan, UBSan) and tsan.supp (TSan). Each entry names the finding and why it is not fixed here, so CI fails only on a new one; a fix removes its entry. Today's: - the HLE tables are walked as arrays of their sections (not a finding); - t_nro gives init and fini offsets below the module base (test fixture); - hle_audren.c reads a command header misaligned while it tries a wrong layout on an SDK 4/6 list (host, open); - aout.pos handed across AudioOutputUnitStop, which TSan cannot see (CoreAudio is not instrumented); - au_create writes a->au after the output is in g_aos while the watchdog reads it (host, open); - thread_main sets host_work without G after the thread is in g_all, read by thr_runnable (host, open); - t_condvar exits without joining its threads (test). The tests keep stderr in sanitizer builds (the reports go there), t_altstack counts ASan's live bytes (its zone statistics do not go down on free), and test_memory_profile.py takes the build folder from DM_TEST_BUILD. CI runs the three targets in a job of its own, so their time shows. docs/development.md says how to run them and how to add or remove an entry. Checked on an M-series Mac: plain run, tsan and memory-tsan pass; asan (32 s), tsan-threads (25 s) and the texture asan (1 s) pass with the lists, and fail with an entry removed (thr_runnable, the HLE table globals, the h_ro functions, the audren alignment entries). Tool tests (348, 17 skipped), test_docs and the lint ratchet (0 new) pass.
835bf0f to
9fe0583
Compare
Integrate the sanitizer targets, HID fixture correction and pinned Xcode 27.1 CI toolchain from #412, #443 and #421. Select the matching runner for the new sanitizer job as well as the four existing jobs. Decode audio command headers without alignment assumptions and validate their extents before consuming them. Finish AudioUnit construction before publishing an output to lifecycle and watchdog readers. Publish pthread handles under the scheduler lock and serialize startup, priority and QoS fields with their readers. Remove all three real-bug suppressions. Add unaligned/truncated header coverage, an output-publication assertion and priority/QoS registration checks, including QoS-enabled TSan CI cases. Document the mechanisms and retain only fixture/framework exceptions. Plain host, ASan/UBSan, TSan, 40 QoS startup stress runs, the complete Metal graphics suite, 525 Python tests (20 skipped), lint, all 178 iOS source compiles and the unsigned synthetic iOS app build passed. Gameplay regression results are reported with the PR follow-up. Fixes #409 Fixes #410 Fixes #411 Co-authored-by: v0lumehi <[email protected]>
|
Applied directly to The three initial host findings are fixed at their causes, and their suppressions are absent:
All three original reports reproduced without their suppressions before the fixes. The remaining exceptions cover the documented fixture/framework cases, not these host bugs. No game-specific rule, runtime retry, timeout or feature cut was added. Validation passed: plain host tests; host ASan/UBSan; all host TSan targets; 40 additional QoS/startup runs across both preemption modes; 5,334 texture checks under ASan/UBSan; the complete local Metal graphics suite; 525 Python tests (20 skipped); the lint ratchet (0 new findings); all 178 iOS source compiles; and the unsigned synthetic iOS app build. No device signing or installation was performed. The game report names candidate The final rebase includes main's memory-test repair (f1bb192); its equivalent observation-gate fixture adapters were retained, and the repaired tests pass. Main CI: all five test/build jobs passed, and lint passed, on the exact pushed commit. The five-game selection covers the SDK 6 parser (Fire Emblem: Three Houses), Wonder's renderer path, Xenoblade 2's threaded engine, and Kirby/Odyssey's scheduler and service paths. Fire Emblem has no committed smoke route, so its harness result covers the shader/interface checks only; SDK 6 parsing is exercised by the host tests. Other games are unchecked. Full route comparisons used matching temporary launch wrappers that unset The full five-game comparison passed. I also inspected a candidate screenshot from each of the four routes. Complete regression reportregress.py check (full): PASSBaseline
Fire Emblem Three Houses
|
…coverage per PR (seedds#313) The roadmap (seedds#313) asks which code the tests reach and which lines of a change they run. A coverage job now answers that in its job summary, with no external service and no threshold: it reports, it never fails. C: `make coverage` in dm/host/tests and dm/gfx/tex/tests builds the same test rules again through seedds#412's SAN hook with clang's source-based coverage, into build/cov and cov/ (dm/sanitizers/coverage.mk), so the plain build stays as it is. Each test process writes its raw profile in continuous mode (%c), so the children that t_fpslock, t_preempt and others fork and end with _exit count too (without it hle_fpslock.c read 0%). llvm-profdata merges, llvm-cov exports JSON without the tests, third-party code and generated headers. The coverage run uses make -i: it measures, the plain run is the test. Python: coverage.py over dm/tools/tests, measuring dm/tools, dm/gfx/tools, dm/games and scripts, subprocesses included (the tests run many tools with sys.executable); configured in pyproject.toml, pinned in .github/requirements/coverage.txt. dm/tools/coverage_report.py writes the Markdown: totals per area, the 15 largest files and, given a base, the changed C, Objective-C and Python lines the tests run and those they do not, counting only lines the data knows. llvm-cov lines are rebuilt from the export's segments as `llvm-cov show` marks them (checked line for line on five host files), not from its per-function summaries, which count shared lines twice. In CI the pull request's merge commit gives HEAD^1 as the base, so fetch-depth 2 is enough. The raw reports are uploaded on every run. Checked on an M-series Mac: make coverage in both folders (host 29 s, textures 1 s), the tool tests under coverage (96 s); host 56.5% of 6,487 lines, CPU textures 86.3% of 233, Python tools 36.2% of 11,763; the reporter against 659c69d~1 (seedds#351: 186 of 203 changed lines run); unittest discover over dm/tools/tests (372 tests, OK), test_docs, and lint_python.py (0 new).
Integrate the sanitizer targets, HID fixture correction and pinned Xcode 27.1 CI toolchain from seedds#412, seedds#443 and seedds#421. Select the matching runner for the new sanitizer job as well as the four existing jobs. Decode audio command headers without alignment assumptions and validate their extents before consuming them. Finish AudioUnit construction before publishing an output to lifecycle and watchdog readers. Publish pthread handles under the scheduler lock and serialize startup, priority and QoS fields with their readers. Remove all three real-bug suppressions. Add unaligned/truncated header coverage, an output-publication assertion and priority/QoS registration checks, including QoS-enabled TSan CI cases. Document the mechanisms and retain only fixture/framework exceptions. Plain host, ASan/UBSan, TSan, 40 QoS startup stress runs, the complete Metal graphics suite, 525 Python tests (20 skipped), lint, all 178 iOS source compiles and the unsigned synthetic iOS app build passed. Gameplay regression results are reported with the PR follow-up. Fixes seedds#409 Fixes seedds#410 Fixes seedds#411 Co-authored-by: v0lumehi <[email protected]>
Update: rebased on
main84ca44b. #296's Pro Controller motion tests build through$(CLANG)too. With #443 underneath,run,asanandtsan-threadspass.Update: the first CI runs failed on known races reported under other names. GitHub's runner (Xcode 26.6) inlined
au_release_pendingintoau_stop_atandthr_runnableintodm_yield_to_core_peers, so the suppressions for those functions didn't match. Locally, Xcode 27.1 reported them under their own names. The TSan builds now use-fno-inline, so every function keeps its own frame on any toolchain. TSan judges the order of accesses, not their timing, so this doesn't hide anything. CI is green. #421 moves CI to Xcode 27.1, the project's toolchain.Part of #313 ("Code quality checks in CI").
Problem
Data races and undefined behaviour in the host show up as rare hangs or wrong results in some game, and are found by hand (like the CPU completion race you found in #158/#213). None of the host tests ran under a sanitizer.
Change
dm/sanitizers/:sanitizers.mk: the flags and options, and a stamp that rebuilds when they or the lists change;ignorelist.txt(ASan, UBSan) andtsan.supp(TSan): a ratchet. Every entry names its finding (file:line) and why it's listed. The job fails only on a new finding, and an entry goes with its fix.dm/host/tests/Makefile:clang→$(CLANG);make asan: every test inrununder ASan and UBSan, built intobuild/asan;make tsan-threads: the 12 tests that start threads, under TSan, built intobuild/tsan.The plain build is unchanged.
dm/gfx/tex/tests/Makefile:make asanfort_tex.sanitizersjob of its own intests.yml(macos-26, 20 min timeout, logs uploaded on failure). It runs the three targets in about a minute and a half after checkout.t_altstack.ccounts ASan's live bytes (ASan's zone statistics don't go down on free);test_memory_profile.pytakes the build folder fromDM_TEST_BUILD(registered indocs/env_switches.tsv).docs/development.md(Continuous integration: what runs, how to run it locally, how an entry comes and goes),06-dev-loop.md§6.Not in this PR:
dm/gfx/tests, whose Makefile #307 restructures. Its CPU-only tests get the same targets in a follow-up on top of #307, taking their list from #307's run list.The lists
hle_ent_*,hle_force_*__DATA,swhle/swforceh_ro_LoadModule/Unloadt_nro.c:48→hle_ro.c:75,:89cmd_ok/cmd_size/cmd_idhle_audren.c:200-203null_sink,au_release_pendinghle_audio.caout.posAudioOutputUnitStop, which TSan can't see (CoreAudio isn't instrumented)au_createhle_audio.c:210vs:284t_audiorun in two)t_condvar.ct_condvar.c:53_exitwithout joiningthr_runnablehle_thread.c:293vs:130No host code is changed here. The three bugs have their own issues, each with a repro and a possible fix.
Checked (Apple silicon, -j8)
make -C dm/host/tests GAME=010015100B514000 run… asan(clean build)… tsan-threads(clean build)make -C dm/gfx/tex/tests asanall passed: 5334/5334test_docs, lint ratchetRemoval check: with each entry removed in turn, its target fails with the expected report. For example, without
thr_runnable:data race hle_thread.c:293 in thread_main; without the HLE globals:global-buffer-overflowint_fs_commit_list.