Skip to content

VideoOut: every video_out_flip test segfaults on macOS reading argv after the main stack moved; fix branch ready #14372

Open

Description

@Betr0x

What happens

On macOS every video_out_flip_* test segfaults at the start of runTests (27 of 27): EXC_BAD_ACCESS (code=2) reading argv[1].

Title, test or build step

ctest: video_out_flip_* (core/libs/prx/libSceVideoOut/tests/Flip.cpp).

AnyPS5 commit

main 5c9837bfe7, plus the open macOS build PRs main still needs (#10552, #11447, #11049, #4630, #7631, #7804, #11554), plus #11119.

System

macOS 27.0.1, Apple M4, MoltenVK 1.4.2 (Vulkan SDK 1.4.363.0), Apple clang 21, x86-64 Release under Rosetta 2.

Host report

Not relevant: the test stops before it opens a device.

Steps to reproduce

ctest --test-dir build-mac -R "^video_out_flip" -j1

Log

* thread #2, stop reason = EXC_BAD_ACCESS (code=2, address=0x304166d20)
    frame #0: video_out_flip_tests`runTests(int, char**) + 56

runTests+56 is movq 0x8(%r14), %r15, which loads argv[1].

What was checked

On macOS, main in Flip.cpp saves argc and argv in statics and starts the guest with Aps5StartGuest_nid_no_patch. Since #12126, Aps5StartGuest_nid_no_patch moves the main thread's stack out of the guest arena when the two overlap, as they do on macOS 27. It then frees the old stack. argv lives on that stack. MoveHostStack copies it for *_NSGetArgv(), but the test still reads its saved pointer. GuestMainStackMove.cpp reads *_NSGetArgv() after the move instead.

A fix is ready: Betr0x:test/videoout-flip-macos-moved-argv. On macOS the guest entry calls runTests(*_NSGetArgc(), *_NSGetArgv()) and nothing else changes. With it:

  • Under ctest, all 27 entries report skipped, no display or Vulkan device, because ctest runs them with SDL_VIDEODRIVER=offscreen or dummy and SDL's offscreen driver has no Vulkan on macOS.
  • Run directly with SDL's Cocoa driver and each test's own environment from its ctest definition, all 26 modes pass (VideoOut flip tests passed).

I'll open it as a pull request once #11119 is merged, since the open-PR limit applies until then.

AI-assisted: yes

Activity

  1. Jawschamp commented on Nov 10, 2026

    @Jawschamp
    Contributor

    Hi @Betr0x, now that #11119 has merged (Nov 8), are you still planning to open the PR from your fix branch for this? Happy to help test or review it. If you'd rather hand it off, just let me know and I can pick it up, keeping you credited as co-author.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions