Files
AnyPS5/docs/dev/debt/changes/fix-windows-sharedmemory-token-namespaces.md

2.1 KiB

libkernel

change (libkernel, Windows) - named objects are regular files in the current user

  • shm_open, shm_unlink (libkernel, Windows) - named objects are regular files in the current user's temporary directory under AnyPS5-shm-<SID>-elevated or AnyPS5-shm-<SID>-unelevated, identified by SHA-1 of the exact guest name. Processes with the same user SID and token elevation state share objects, so two titles using the same name share the object; elevated and UAC-filtered processes do not share. Namespace operations use a cross-session named mutex, while file-size changes and writes use a mutex keyed by the host file identity; unlink renames the visible object to a unique internal name so already-open handles remain usable while the guest name can be recreated. Orphaned files are reaped when the last tracked guest descriptor closes or opportunistically during a later open. Closing through host stdio wrappers does not update this bookkeeping or reap immediately. The namespace directory has a protected ACL for the owner, SYSTEM and Administrators; newly created objects map the guest owner read/write bits after applying the guest creation mask. fchmod updates those owner permissions on the descriptor's file object. Guest group/other permission classes are not represented independently on Windows. The owner's read permission also grants execute, so a read-only descriptor can be mapped PROT_EXEC as FreeBSD 11.4's shm_mmap allows; objects created by earlier builds lack it until fchmod. Mappings take a regular file's checks and paths (guest_named_shm_windows_mapping). No behavior here has been measured on PS5. Lifecycle, cross-process resize/write, and mode behavior are exercised by Windows tests. See Microsoft's file sharing modes, DeleteFile and mutex objects.