relinker: macOS loader tests time out under ctest -j because each new Mach-O file is assessed on its first launch #13208

Closed
opened 2026-10-30 06:23:20 +00:00 by Cool-Coder174 · 0 comments
Cool-Coder174 commented 2026-10-30 06:23:20 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Cool-Coder174 on 2026-10-30T06:23:20Z.


What happens

On macOS, ctest -j 12 on the relinker-only build fails a different set of native-execution tests on each run with subprocess.TimeoutExpired; each of them passes when run alone. macOS assesses every new Mach-O file the first time it is executed or loaded, and the queued assessments push single runs past the tests' 10 s run timeouts.

Title, test or build step

macos_trace_imports, macos_guest_weak_imports, macos_guest_weak_exports, macos_executable_exports (relinker-only build)

AnyPS5 commit

main 5ecef095b and 102c4f95a, nothing merged on top

System

macOS 26.6.2 (25G83), Intel Core i9-9880H (8 cores), Apple clang 21.0.0, CMake 4.0.1, Ninja, Python 3.11.6. No third-party security software; Apple's syspolicyd, XProtect and amfid only.

Steps to reproduce

cmake -S . -B build-relinker -G Ninja -DCMAKE_BUILD_TYPE=Release -DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON
cmake --build build-relinker --parallel
ctest --test-dir build-relinker --output-on-failure -j 12

Three runs on 5ecef095b failed 2, 4 and 1 tests: macos_executable_exports, macos_guest_weak_exports, macos_guest_weak_imports, windows_fixed_base, select_tests_FixtureBuildTests, performance_compare. One of the runs overlapped a CMake configure.

Log

subprocess.TimeoutExpired: Command '['build-relinker/core/relinker/test-temp/anyps5-macos-executable-exports-jnkjbk_l/exports']' timed out after 10 seconds

log show --info --predicate 'subsystem == "com.apple.syspolicy.exec"' for the first run of a new file:

syspolicyd: Unsigned code in: PST: (path: cd5ff7ac13a5412e), (team: (null)), (id: (null)), (bundle_id: (null))
syspolicyd: Checking legacy notarization
syspolicyd: Doing an XProtect scan b/c not exempt
syspolicyd: GK Xprotect results: PST: (path: cd5ff7ac13a5412e), ... XPScan: 0,...
syspolicyd: GK scan complete: PST: (path: cd5ff7ac13a5412e), ... 7, 7, 0

What was checked

  • The first run of a new executable or the first dlopen of a new dylib waits for the assessment: 0.5 to 0.75 s for an empty program, about 2 s for a converted module. Later runs of the same file take 0.01 s.
  • The verdict is kept per file, not per content. A renamed or hard-linked file is not assessed again. A byte copy is, also with an ad-hoc signature (codesign -s -).
  • Avoidable part: macos_trace_imports, macos_guest_weak_imports and macos_guest_weak_exports compile their shared libraries once and write a byte copy into every case, so each case is assessed again. Assessments per test run, counted from the not exempt lines: 24, 13 and 8. With hard links instead of copies: 10, 10 and 7.
  • macos_trace_imports takes 13 s alone and 54 to 55 s under -j 12, over the 30 s limit in CONTRIBUTING.md. With hard links: 6 s alone, 21 to 32 s under -j 12.
  • Remaining part: every converted output is a new file, so it is assessed once by design. With hard links, the full suite passed in 2 of 3 runs under -j 12; the third failed macos_executable_exports (first run of its converted output over the 10 s run timeout) and performance_compare (20 s limit under load, no new Mach-O file involved).
  • Adding the responsible app to System Settings > Privacy & Security > Developer Tools did not change not exempt on macOS 26.6.2, also after relaunching it. The responsible process was confirmed with responsibility_get_pid_responsible_for_pid.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6114327691 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/13208). Originally posted by [Cool-Coder174](https://github.com/Cool-Coder174) on 2026-10-30T06:23:20Z. --- ### What happens On macOS, `ctest -j 12` on the relinker-only build fails a different set of native-execution tests on each run with `subprocess.TimeoutExpired`; each of them passes when run alone. macOS assesses every new Mach-O file the first time it is executed or loaded, and the queued assessments push single runs past the tests' 10 s run timeouts. ### Title, test or build step `macos_trace_imports`, `macos_guest_weak_imports`, `macos_guest_weak_exports`, `macos_executable_exports` (relinker-only build) ### AnyPS5 commit `main` 5ecef095b and 102c4f95a, nothing merged on top ### System macOS 26.6.2 (25G83), Intel Core i9-9880H (8 cores), Apple clang 21.0.0, CMake 4.0.1, Ninja, Python 3.11.6. No third-party security software; Apple's `syspolicyd`, XProtect and `amfid` only. ### Steps to reproduce ```sh cmake -S . -B build-relinker -G Ninja -DCMAKE_BUILD_TYPE=Release -DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON cmake --build build-relinker --parallel ctest --test-dir build-relinker --output-on-failure -j 12 ``` Three runs on 5ecef095b failed 2, 4 and 1 tests: `macos_executable_exports`, `macos_guest_weak_exports`, `macos_guest_weak_imports`, `windows_fixed_base`, `select_tests_FixtureBuildTests`, `performance_compare`. One of the runs overlapped a CMake configure. ### Log ```text subprocess.TimeoutExpired: Command '['build-relinker/core/relinker/test-temp/anyps5-macos-executable-exports-jnkjbk_l/exports']' timed out after 10 seconds ``` `log show --info --predicate 'subsystem == "com.apple.syspolicy.exec"'` for the first run of a new file: ```text syspolicyd: Unsigned code in: PST: (path: cd5ff7ac13a5412e), (team: (null)), (id: (null)), (bundle_id: (null)) syspolicyd: Checking legacy notarization syspolicyd: Doing an XProtect scan b/c not exempt syspolicyd: GK Xprotect results: PST: (path: cd5ff7ac13a5412e), ... XPScan: 0,... syspolicyd: GK scan complete: PST: (path: cd5ff7ac13a5412e), ... 7, 7, 0 ``` ### What was checked - The first run of a new executable or the first `dlopen` of a new dylib waits for the assessment: 0.5 to 0.75 s for an empty program, about 2 s for a converted module. Later runs of the same file take 0.01 s. - The verdict is kept per file, not per content. A renamed or hard-linked file is not assessed again. A byte copy is, also with an ad-hoc signature (`codesign -s -`). - Avoidable part: `macos_trace_imports`, `macos_guest_weak_imports` and `macos_guest_weak_exports` compile their shared libraries once and write a byte copy into every case, so each case is assessed again. Assessments per test run, counted from the `not exempt` lines: 24, 13 and 8. With hard links instead of copies: 10, 10 and 7. - `macos_trace_imports` takes 13 s alone and 54 to 55 s under `-j 12`, over the 30 s limit in CONTRIBUTING.md. With hard links: 6 s alone, 21 to 32 s under `-j 12`. - Remaining part: every converted output is a new file, so it is assessed once by design. With hard links, the full suite passed in 2 of 3 runs under `-j 12`; the third failed `macos_executable_exports` (first run of its converted output over the 10 s run timeout) and `performance_compare` (20 s limit under load, no new Mach-O file involved). - Adding the responsible app to System Settings > Privacy & Security > Developer Tools did not change `not exempt` on macOS 26.6.2, also after relaunching it. The responsible process was confirmed with `responsibility_get_pid_responsible_for_pid`.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#13208
No description provided.