libkernel: Windows anonymous shm_open (SHM_ANON) descriptors are not recognised as shared memory #11372
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by tablefrogpillow on 2026-10-26T09:33:53Z.
Split out from #11291 and PR #11296 (review by MarcZX10), to track the Windows case separately.
On Windows, a descriptor returned by anonymous
shm_open(SHM_ANON, ...)is not recognised as shared memory, so any code that branches onIsSharedMemoryDescriptor_nid_no_patchtreats it as an ordinary host file.Observed symptom (reported on Windows by wachi35676 and MarcZX10 in #11291 / #11296; I have not run Windows myself):
fpathconf/_fpathconfon such a descriptor returns the UFS pathconf constants (_PC_LINK_MAX32767,_PC_NAME_MAX255, …) instead ofEOPNOTSUPP. A namedshm_open("/name", ...)descriptor and a kqueue descriptor both behave correctly on Windows.Mechanism (current
main,core/libs/prx/libkernel/File/src/SharedMemory.cpp):shm_openpath (shm_open_nid_postfix) callsCreateAnonymousFile()and returns the descriptor without recording it insharedDescriptorAccess.IsHostSharedMemoryDescriptorreturnsfalsefor any descriptor not present insharedDescriptorAccess, so the anonymous descriptor is never recognised./memfd:anyps5 shm_openlink name read from/proc/self/fd, which is why the Linux behaviour is correct.Possible fix: record anonymous descriptors in
sharedDescriptorAccesson Windows (or otherwise identify the%TEMP%\…\anyps5-shm-*object created byCreateAnonymousFile) so recognition matches Linux. This needs a Windows build to verify; I test on Linux.AI-assisted: yes (Claude Code).