Details
Quick summary
Since #19233, /dev/urandom is misdetected as an optical raw device on macOS, so sys_ss_random_number_generator() fails and kills the main thread on any game that calls it.
Details
#19233 gave fs::is_optical_raw_device() a POSIX body; previously it returned false unconditionally off-Windows. On macOS is_optical_device_node() is:
#elif defined(__APPLE__)
return S_ISCHR(file_info.st_mode);
/dev/urandom is a character device, so it is treated as an optical drive. fs::file::open() then calls get_raw_device_size(), which on macOS compiles neither the Linux (BLKGETSIZE64) nor the BSD (DIOCGMEDIASIZE) branch and falls back to lseek(fd, 0, SEEK_END) — 0 for a character device. Size 0 is read as "no disc mounted", so the fd is closed and m_file is never assigned:
if (!raw_device_size) { ::close(fd); g_tls_error = fs::error::noent; return; }
sys_ss.cpp:148 then sees !rnd and throws.
Verified by running that logic standalone on macOS 15.7.3 / M4 Max:
is_optical_raw_device("/dev/urandom") = TRUE
open() -> fd=3 (succeeds)
get_raw_device_size(fd) = 0 -> open aborted
Log — the guest request is an ordinary 64-byte call:
W sys_ss: sys_ss_random_number_generator(pkg_id=2, buf=*0xd007e688, size=0x40)
F ... SIG: Thread terminated due to fatal error:
sys_ss_random_number_generator(): Failed to generate pseudo-random numbers
(in file .../sys_ss.cpp:150[:3]) (errno=19)
(errno=19 is the "may be irrelevant" stale-errno print from StrFmt.cpp, not the cause.)
Likely also affects FreeBSD via the S_ISCHR || S_ISBLK branch. Linux is unaffected (requires S_ISBLK plus major 11/7).
Suggested fix: restrict the macOS check to real disk nodes (/dev/rdisk*), or probe with DKIOCGETBLOCKCOUNT, which fails on non-disk character devices.
Build with regression
All three attached logs use identical settings on the same machine. The last-good log shows 3 successful RNG calls and 0 failures; both broken logs fail on the first call.
System configuration
Apple M4 Max, macOS 15.7.3, native arm64 build. Seen with MotorStorm: Apocalypse (BCUS98242, v1.06), but not game-specific.
Last working build
v0.0.42-19894-d9799c7f
First broken build
v0.0.42-19896-a99fde6f
Attach 3 log files
1-last-working-0.0.42-19894.log.gz
2-first-broken-0.0.42-19896.log.gz
3-latest-main-arm-0.0.42-19909.log.gz
I have attached all 3 required log files
Yes
Attach the RSX (.rrc) or RenderDoc (.rdc) capture files for visual issues
No response
System configuration
Apple M4 Max, macOS 15.7.3, native arm64 build. Default config aside from
RSX FIFO Fetch Accuracy: Fast &
Multithreaded RSX: true
Which seems unrelated was just trying to wrangle motorstorm on m4
Details
Quick summary
Since #19233,
/dev/urandomis misdetected as an optical raw device on macOS, sosys_ss_random_number_generator()fails and kills the main thread on any game that calls it.Details
#19233 gave
fs::is_optical_raw_device()a POSIX body; previously it returnedfalseunconditionally off-Windows. On macOSis_optical_device_node()is:/dev/urandomis a character device, so it is treated as an optical drive.fs::file::open()then callsget_raw_device_size(), which on macOS compiles neither the Linux (BLKGETSIZE64) nor the BSD (DIOCGMEDIASIZE) branch and falls back tolseek(fd, 0, SEEK_END)— 0 for a character device. Size 0 is read as "no disc mounted", so the fd is closed andm_fileis never assigned:sys_ss.cpp:148then sees!rndand throws.Verified by running that logic standalone on macOS 15.7.3 / M4 Max:
Log — the guest request is an ordinary 64-byte call:
(
errno=19is the "may be irrelevant" stale-errno print fromStrFmt.cpp, not the cause.)Likely also affects FreeBSD via the
S_ISCHR || S_ISBLKbranch. Linux is unaffected (requiresS_ISBLKplus major 11/7).Suggested fix: restrict the macOS check to real disk nodes (
/dev/rdisk*), or probe withDKIOCGETBLOCKCOUNT, which fails on non-disk character devices.Build with regression
a99fde6f, the Add BD Drive support for Linux, macOS and FreeBSD #19233 merge commit)All three attached logs use identical settings on the same machine. The last-good log shows 3 successful RNG calls and 0 failures; both broken logs fail on the first call.
System configuration
Apple M4 Max, macOS 15.7.3, native arm64 build. Seen with MotorStorm: Apocalypse (BCUS98242, v1.06), but not game-specific.
Last working build
v0.0.42-19894-d9799c7f
First broken build
v0.0.42-19896-a99fde6f
Attach 3 log files
1-last-working-0.0.42-19894.log.gz
2-first-broken-0.0.42-19896.log.gz
3-latest-main-arm-0.0.42-19909.log.gz
I have attached all 3 required log files
Yes
Attach the RSX (.rrc) or RenderDoc (.rdc) capture files for visual issues
No response
System configuration
Apple M4 Max, macOS 15.7.3, native arm64 build. Default config aside from
RSX FIFO Fetch Accuracy: Fast&Multithreaded RSX: trueWhich seems unrelated was just trying to wrangle motorstorm on m4