feat(libkernel): support named shared memory on Linux #3555

Merged
lisn0 merged 7 commits from upstream-pr/3555 into main 2026-10-11 21:55:31 +00:00
lisn0 commented 2026-10-11 13:06:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by lisn0 on 2026-10-11T13:06:57Z.


What

Linux guests can create and reopen named shared-memory objects, size and map them through guest APIs, and unlink their names while existing descriptors and mappings remain usable. Recreating an unlinked name creates a distinct empty object.

  • Add named shm_open and shm_unlink, translated guest flags/errors and unlink permission checks.
  • Support shared and private guest mappings through the allocation tracker, retaining the write-watch scan fallback for file-backed aliases.
  • Apply shared-memory size bounds to descriptor writes, vector/AIO writes and seeks, and serialize cooperating operations while pinning descriptors against reuse.
  • Honor the guest umask for newly created named objects without changing host umask or existing-object permissions. Pin mmap descriptors before validation so descriptor reuse cannot redirect mappings.
  • Add lifecycle, multiprocess concurrency, descriptor-reuse and guest/host permission-mask regressions. Document host namespace requirements and remaining limitations in TechnicalDebt.md.

This is Linux-only. The separate experimental Windows work is not included.

Tested

Latest: rebased onto 0a8b1d32b12a6d6a3acd462787750b482bf78884 (head dec6661d). The only conflict was the libkernel_sys/Export.cpp include block; main's Windows CreateSymbolicLinkW/readlink changes are kept and umask still goes through the libc creation-mask helper. On an x86-64 Linux host:

  • Full project build (cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON, all targets) succeeded.
  • All 17 relevant CTest tests that exist on Linux passed with zero skips: guest_shm_open, the six guest_named_shm_* tests (open, lifecycle, descriptor_reuse, permissions, io_descriptor_reuse, concurrency), guest_kernel_sys, guest_memory, guest_filesystem, guest_directory_entries, guest_file_timestamps, guest_dup, guest_file_vector, guest_aio, guest_kernel_fcntl and patched_libraries. (guest_directory_buffer and guest_directory_close are Windows-only targets.)

Earlier rounds (contribution commits unchanged by git range-diff across rebases): repository conventions checker and git diff --check passed; Clang static analysis reported no findings in the changed production translation units; standalone named shared-memory tests passed with ASan/UBSan and warnings as errors; syscall tracing verified namespace locking and lifecycle operations. Both new regressions reproduced failures before their corresponding fixes and passed afterward.

Not tested: full test suite, Windows runtime, PS5 titles or console hardware. Full Linux and Windows workflow validation remains for the repository's maintainer-triggered Build workflow. Linux procfs and /dev/shm are required; advisory locking does not cover external host operations, unrelated objects serialize, and descriptor operations require spare host descriptors. SHA-1 name collisions and invalid non-null name pointers remain documented limitations.

Review corrections

  • Moved creation-mask state to libc behind C-linkage helpers. Their literal _nid_no_patch suffix survives NID patching; both libkernel and libkernel_sys resolve the same state.
  • Snapshot device/inode before descriptor classification and reject a mismatched pinned duplicate. A regression forces another thread to close/reuse the descriptor for a second named object at both the path-probe and namespace-lock boundaries, and forces replacement with an ordinary file before the path probe. Negative classification also compares the current device/inode with the initial snapshot before allowing native fallback. All 18 scenarios (six operations at three boundaries) preserve the second object's data, size and offset. This compares file identity, not open-file-description identity. It does not synchronize the entire descriptor table; ordinary native fallback remains subject to concurrent close/reuse after its final validation.
  • Replaced runtime __FILE__ opens with temporary-file fixtures in lifecycle and mmap descriptor-reuse tests. Old fixtures failed with source paths remapped to a nonexistent location; corrected fixtures passed with the same remapping.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); no silent stubs added
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source — no new third-party code added
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4819269594 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3555). Originally posted by [lisn0](https://github.com/lisn0) on 2026-10-11T13:06:57Z. --- ### What Linux guests can create and reopen named shared-memory objects, size and map them through guest APIs, and unlink their names while existing descriptors and mappings remain usable. Recreating an unlinked name creates a distinct empty object. - Add named `shm_open` and `shm_unlink`, translated guest flags/errors and unlink permission checks. - Support shared and private guest mappings through the allocation tracker, retaining the write-watch scan fallback for file-backed aliases. - Apply shared-memory size bounds to descriptor writes, vector/AIO writes and seeks, and serialize cooperating operations while pinning descriptors against reuse. - Honor the guest umask for newly created named objects without changing host umask or existing-object permissions. Pin mmap descriptors before validation so descriptor reuse cannot redirect mappings. - Add lifecycle, multiprocess concurrency, descriptor-reuse and guest/host permission-mask regressions. Document host namespace requirements and remaining limitations in `TechnicalDebt.md`. This is Linux-only. The separate experimental Windows work is not included. ### Tested Latest: rebased onto `0a8b1d32b12a6d6a3acd462787750b482bf78884` (head `dec6661d`). The only conflict was the `libkernel_sys/Export.cpp` include block; main's Windows `CreateSymbolicLinkW`/`readlink` changes are kept and `umask` still goes through the libc creation-mask helper. On an x86-64 Linux host: - Full project build (`cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON`, all targets) succeeded. - All 17 relevant CTest tests that exist on Linux passed with zero skips: `guest_shm_open`, the six `guest_named_shm_*` tests (open, lifecycle, descriptor_reuse, permissions, io_descriptor_reuse, concurrency), `guest_kernel_sys`, `guest_memory`, `guest_filesystem`, `guest_directory_entries`, `guest_file_timestamps`, `guest_dup`, `guest_file_vector`, `guest_aio`, `guest_kernel_fcntl` and `patched_libraries`. (`guest_directory_buffer` and `guest_directory_close` are Windows-only targets.) Earlier rounds (contribution commits unchanged by `git range-diff` across rebases): repository conventions checker and `git diff --check` passed; Clang static analysis reported no findings in the changed production translation units; standalone named shared-memory tests passed with ASan/UBSan and warnings as errors; syscall tracing verified namespace locking and lifecycle operations. Both new regressions reproduced failures before their corresponding fixes and passed afterward. Not tested: full test suite, Windows runtime, PS5 titles or console hardware. Full Linux and Windows workflow validation remains for the repository's maintainer-triggered Build workflow. Linux procfs and `/dev/shm` are required; advisory locking does not cover external host operations, unrelated objects serialize, and descriptor operations require spare host descriptors. SHA-1 name collisions and invalid non-null name pointers remain documented limitations. ### Review corrections - Moved creation-mask state to libc behind C-linkage helpers. Their literal `_nid_no_patch` suffix survives NID patching; both libkernel and libkernel_sys resolve the same state. - Snapshot device/inode before descriptor classification and reject a mismatched pinned duplicate. A regression forces another thread to close/reuse the descriptor for a second named object at both the path-probe and namespace-lock boundaries, and forces replacement with an ordinary file before the path probe. Negative classification also compares the current device/inode with the initial snapshot before allowing native fallback. All 18 scenarios (six operations at three boundaries) preserve the second object's data, size and offset. This compares file identity, not open-file-description identity. It does not synchronize the entire descriptor table; ordinary native fallback remains subject to concurrent close/reuse after its final validation. - Replaced runtime `__FILE__` opens with temporary-file fixtures in lifecycle and mmap descriptor-reuse tests. Old fixtures failed with source paths remapped to a nonexistent location; corrected fixtures passed with the same remapping. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); no silent stubs added - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source — no new third-party code added - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
MarcZX10 commented 2026-10-11 13:09:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T13:09:07Z.


I found a descriptor-reuse race in the pinning path. SharedMemoryLock checks /proc/self/fd/<fd> in IsHostSharedMemoryDescriptor(value), then acquires the /dev/shm namespace flock and only afterward duplicates value with F_DUPFD_CLOEXEC. That flock does not serialize the emulator's close_nid_postfix or dup2_nid_postfix (neither is routed through this lock). If another thread closes and reuses the descriptor for a different named shared-memory object between the check and fcntl, the duplicate still passes the broad /dev/shm/anyps5-shm- prefix test, and the bounded write/truncate/seek can operate on the wrong object.

Could the guest descriptor close/replacement path be synchronized with this pin operation, or could the duplicated descriptor's file identity be verified against the original descriptor identity before use? A regression should race an operation against close plus reuse for a second named object and assert that the second object's size/data never changes. This is especially relevant to the PR's claim that these operations pin descriptors against reuse.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109358462 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3555#issuecomment-6109358462). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T13:09:07Z. --- I found a descriptor-reuse race in the pinning path. `SharedMemoryLock` checks `/proc/self/fd/<fd>` in `IsHostSharedMemoryDescriptor(value)`, then acquires the `/dev/shm` namespace flock and only afterward duplicates `value` with `F_DUPFD_CLOEXEC`. That flock does not serialize the emulator's `close_nid_postfix` or `dup2_nid_postfix` (neither is routed through this lock). If another thread closes and reuses the descriptor for a *different* named shared-memory object between the check and `fcntl`, the duplicate still passes the broad `/dev/shm/anyps5-shm-` prefix test, and the bounded write/truncate/seek can operate on the wrong object. Could the guest descriptor close/replacement path be synchronized with this pin operation, or could the duplicated descriptor's file identity be verified against the original descriptor identity before use? A regression should race an operation against close plus reuse for a second named object and assert that the second object's size/data never changes. This is especially relevant to the PR's claim that these operations pin descriptors against reuse.
github-actions[bot] commented 2026-10-11 13:25:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T13:25:57Z.


Progress report (e2ea125 → 9ac63c0)

📉 System libraries: 85.6% (-0.02%, +1 declared functions)

🆕 1 declared as stubs
Library Name
libkernel shm_unlink_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109503652 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3555#issuecomment-6109503652). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T13:25:57Z. --- <!-- progress-report --> ### Progress report (e2ea125 → 9ac63c0) 📉 **System libraries**: 85.6% (-0.02%, +1 declared functions) <details> <summary>🆕 1 declared as stubs</summary> | Library | Name | | - | - | | libkernel | `shm_unlink_nid_postfix` | </details>
adriadam10 commented 2026-10-11 13:33:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T13:33:07Z.

Review: CHANGES_REQUESTED


Built and ran this merged onto current main (Linux). The five new tests pass and fail without the change, but there are three problems:

  • patched_libraries fails because of this PR: libkernel_sys.prx: undefined symbol: _ZN4File33ExchangeCreationMask_nid_no_patchEt. umask_nid_postfix (core/libs/prx/libkernel_sys/Export.cpp:57) now calls a function defined in libkernel, which libkernel_sys cannot resolve, so the module no longer loads. Keep the mask somewhere both libraries can reach (or define it in libkernel_sys and let libkernel query it through an existing shared library), and rerun ctest -R patched_libraries.
  • Descriptor pinning is racy (core/libs/prx/libkernel/File/src/SharedMemory.cpp:234-243), as @MarcZX100 reported: IsHostSharedMemoryDescriptor(value) is checked, then the namespace flock is taken, then value is duplicated. close/dup2 do not take that lock, so another thread can close and reuse the fd for a different named object in between, and the bounded write/truncate/seek then hits the wrong object. The duplicate passing the /dev/shm/anyps5-shm- prefix test does not prove it is the same file. Please compare the duplicate's fstat identity (dev/ino) with the original descriptor's after F_DUPFD_CLOEXEC, or synchronise the close/dup2 path with the pin, and add the regression MarcZX100 describes (race an operation against close + reuse for a second object and assert the second object never changes). The "pins descriptors against reuse" claim is not true until then.
  • core/libs/tests/GuestNamedShmLifecycle.cpp:166 opens __FILE__ at run time as the "ordinary file". The test fails (guest errno=2) whenever the source path embedded in the binary does not exist at run time (cached or distributed builds, relocated trees). Create a temporary file in the test instead.

Also not verified here: the Windows branches (the PR CI only runs Conventions) and anything that needs a real title.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5483494224 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3555#pullrequestreview-5483494224). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T13:33:07Z. **Review:** CHANGES_REQUESTED --- Built and ran this merged onto current `main` (Linux). The five new tests pass and fail without the change, but there are three problems: - `patched_libraries` fails because of this PR: `libkernel_sys.prx: undefined symbol: _ZN4File33ExchangeCreationMask_nid_no_patchEt`. `umask_nid_postfix` (`core/libs/prx/libkernel_sys/Export.cpp:57`) now calls a function defined in libkernel, which libkernel_sys cannot resolve, so the module no longer loads. Keep the mask somewhere both libraries can reach (or define it in libkernel_sys and let libkernel query it through an existing shared library), and rerun `ctest -R patched_libraries`. - Descriptor pinning is racy (`core/libs/prx/libkernel/File/src/SharedMemory.cpp:234-243`), as @MarcZX100 reported: `IsHostSharedMemoryDescriptor(value)` is checked, then the namespace flock is taken, then `value` is duplicated. `close`/`dup2` do not take that lock, so another thread can close and reuse the fd for a different named object in between, and the bounded write/truncate/seek then hits the wrong object. The duplicate passing the `/dev/shm/anyps5-shm-` prefix test does not prove it is the same file. Please compare the duplicate's `fstat` identity (dev/ino) with the original descriptor's after `F_DUPFD_CLOEXEC`, or synchronise the close/dup2 path with the pin, and add the regression MarcZX100 describes (race an operation against close + reuse for a second object and assert the second object never changes). The "pins descriptors against reuse" claim is not true until then. - `core/libs/tests/GuestNamedShmLifecycle.cpp:166` opens `__FILE__` at run time as the "ordinary file". The test fails (`guest errno=2`) whenever the source path embedded in the binary does not exist at run time (cached or distributed builds, relocated trees). Create a temporary file in the test instead. Also not verified here: the Windows branches (the PR CI only runs Conventions) and anything that needs a real title.
MarcZX10 commented 2026-10-11 13:46:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T13:46:08Z.


Thanks for adding GuestNamedShmDescriptorReuse.cpp; it covers descriptor replacement during the mmap permission check. I still see the race I described in the other descriptor operations:

  1. SharedMemoryLock recognizes the guest fd with IsHostSharedMemoryDescriptor(value).
  2. It acquires the namespace lock, then duplicates value.
  3. It checks only that the duplicate has the general /dev/shm/anyps5-shm- prefix.

If another thread replaces the guest fd with a second named shared-memory object between steps 1 and 2, the duplicate passes that prefix check and WriteSharedMemory, PwriteSharedMemory, TruncateSharedMemory or SeekSharedMemory can act on the second object. The new test replaces the fd with an ordinary file during the mmap path, so it does not exercise this constructor path.

Could you add a test that interposes F_DUPFD_CLOEXEC after the initial path check, swaps in a second named shared-memory fd, and verifies a bounded write/truncate through the first guest fd never changes the second object? The implementation needs to pin the descriptor before relying on its identity, or serialize this path with guest close/replacement.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109680184 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3555#issuecomment-6109680184). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T13:46:08Z. --- Thanks for adding `GuestNamedShmDescriptorReuse.cpp`; it covers descriptor replacement during the `mmap` permission check. I still see the race I described in the other descriptor operations: 1. `SharedMemoryLock` recognizes the guest fd with `IsHostSharedMemoryDescriptor(value)`. 2. It acquires the namespace lock, then duplicates `value`. 3. It checks only that the duplicate has the general `/dev/shm/anyps5-shm-` prefix. If another thread replaces the guest fd with a *second named shared-memory object* between steps 1 and 2, the duplicate passes that prefix check and `WriteSharedMemory`, `PwriteSharedMemory`, `TruncateSharedMemory` or `SeekSharedMemory` can act on the second object. The new test replaces the fd with an ordinary file during the mmap path, so it does not exercise this constructor path. Could you add a test that interposes `F_DUPFD_CLOEXEC` after the initial path check, swaps in a second named shared-memory fd, and verifies a bounded write/truncate through the first guest fd never changes the second object? The implementation needs to pin the descriptor before relying on its identity, or serialize this path with guest close/replacement.
MarcZX10 commented 2026-10-11 13:57:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T13:57:55Z.


Thanks for the follow-up. I reviewed 34acf247: SharedMemoryLock now captures the original file identity and compares it with the pinned descriptor, and the new I/O descriptor-reuse test swaps in a second named object at both the path-probe and namespace-lock boundaries across six operations. That covers the race from my comment; the replacement object is checked for unchanged size, bytes and offset.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109783728 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3555#issuecomment-6109783728). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T13:57:55Z. --- Thanks for the follow-up. I reviewed `34acf247`: `SharedMemoryLock` now captures the original file identity and compares it with the pinned descriptor, and the new I/O descriptor-reuse test swaps in a second named object at both the path-probe and namespace-lock boundaries across six operations. That covers the race from my comment; the replacement object is checked for unchanged size, bytes and offset.
lisn0 commented 2026-10-11 14:27:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by lisn0 on 2026-10-11T14:27:55Z.


thanks for the review @MarcZX100
@adriadam10 i pushed the fixes in 34acf247b and 2ebcd06f8, the shared mask is now in libc with c linkage, i added descriptor identity checks and reuse regressions, and replaced the source file opens with temporary files
the linux tests passed, the patched library loading check passed for libc, libkernel and libkernel_sys, and the fixtures also passed with source paths remapped to a missing location
can you have another look?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110049235 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3555#issuecomment-6110049235). Originally posted by [lisn0](https://github.com/lisn0) on 2026-10-11T14:27:55Z. --- thanks for the review @MarcZX100 @adriadam10 i pushed the fixes in 34acf247b and 2ebcd06f8, the shared mask is now in libc with c linkage, i added descriptor identity checks and reuse regressions, and replaced the source file opens with temporary files the linux tests passed, the patched library loading check passed for libc, libkernel and libkernel_sys, and the fixtures also passed with source paths remapped to a missing location can you have another look?
lisn0 commented 2026-10-11 21:29:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by lisn0 on 2026-10-11T21:29:43Z.


Rebased onto 0a8b1d32 to resolve the conflict in libkernel_sys/Export.cpp (include block only; main's Windows symlink/readlink changes kept). Full Linux Release build is clean and all 17 relevant Linux tests pass, including patched_libraries. Description updated.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6113983582 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3555#issuecomment-6113983582). Originally posted by [lisn0](https://github.com/lisn0) on 2026-10-11T21:29:43Z. --- Rebased onto 0a8b1d32 to resolve the conflict in libkernel_sys/Export.cpp (include block only; main's Windows symlink/readlink changes kept). Full Linux Release build is clean and all 17 relevant Linux tests pass, including patched_libraries. Description updated.
github-actions[bot] commented 2026-10-11 21:38:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T21:38:39Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#3651 docs/dev/TechnicalDebt.md L437-438
#3764 docs/dev/TechnicalDebt.md L403
#3787 core/libs/prx/libkernel/DirectMemory/DirectMemory.cpp L832
core/libs/prx/libkernel/DirectMemory/DirectMemory.hpp L32
docs/dev/TechnicalDebt.md L403
#3861 core/libs/prx/libkernel/File/src/Stdio.cpp L191
#3874 docs/dev/TechnicalDebt.md L402-403
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114064195 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3555#issuecomment-6114064195). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T21:38:39Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #3651 | `docs/dev/TechnicalDebt.md` [L437-438](https://github.com/boykopovar/AnyPS5/blob/1be2ca2028f1caf4640a765941bfca2fae7d53f2/docs/dev/TechnicalDebt.md#L437-L438) | | | | #3764 | `docs/dev/TechnicalDebt.md` [L403](https://github.com/boykopovar/AnyPS5/blob/1be2ca2028f1caf4640a765941bfca2fae7d53f2/docs/dev/TechnicalDebt.md#L403) | | | | #3787 | `core/libs/prx/libkernel/DirectMemory/DirectMemory.cpp` [L832](https://github.com/boykopovar/AnyPS5/blob/1be2ca2028f1caf4640a765941bfca2fae7d53f2/core/libs/prx/libkernel/DirectMemory/DirectMemory.cpp#L832)<br>`core/libs/prx/libkernel/DirectMemory/DirectMemory.hpp` [L32](https://github.com/boykopovar/AnyPS5/blob/1be2ca2028f1caf4640a765941bfca2fae7d53f2/core/libs/prx/libkernel/DirectMemory/DirectMemory.hpp#L32)<br>`docs/dev/TechnicalDebt.md` [L403](https://github.com/boykopovar/AnyPS5/blob/1be2ca2028f1caf4640a765941bfca2fae7d53f2/docs/dev/TechnicalDebt.md#L403) | | | | #3861 | `core/libs/prx/libkernel/File/src/Stdio.cpp` [L191](https://github.com/boykopovar/AnyPS5/blob/1be2ca2028f1caf4640a765941bfca2fae7d53f2/core/libs/prx/libkernel/File/src/Stdio.cpp#L191) | | | | #3874 | `docs/dev/TechnicalDebt.md` [L402-403](https://github.com/boykopovar/AnyPS5/blob/1be2ca2028f1caf4640a765941bfca2fae7d53f2/docs/dev/TechnicalDebt.md#L402-L403) | | |
adriadam10 commented 2026-10-11 21:44:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T21:44:12Z.

Review: APPROVED


Checked on Linux merged onto current main: scoped build + ctest 176/176, including the 7 new shm tests, patched_libraries and guest_ioctl_getsid. Write bounds and lseek limits match FreeBSD uipc_shm.c (uiomove_object, shm_seek).

Added one commit on your branch: restored two blank lines changed by accident (TechnicalDebt.md line 3, DirectMemory.cpp before EraseReservations). Rebased onto current main; build and ctest pass again after it. Merging once CI is green.

Non-blocking notes: every write/pwrite/seek/ftruncate on any descriptor now does an fstat plus a /proc/self/fd readlink before falling back to the native call; and pwrite now returns the errno instead of throwing. A follow-up could cache the shm check if the cost shows up.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5485096105 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3555#pullrequestreview-5485096105). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T21:44:12Z. **Review:** APPROVED --- Checked on Linux merged onto current `main`: scoped build + ctest 176/176, including the 7 new shm tests, `patched_libraries` and `guest_ioctl_getsid`. Write bounds and `lseek` limits match FreeBSD `uipc_shm.c` (`uiomove_object`, `shm_seek`). Added one commit on your branch: restored two blank lines changed by accident (`TechnicalDebt.md` line 3, `DirectMemory.cpp` before `EraseReservations`). Rebased onto current `main`; build and ctest pass again after it. Merging once CI is green. Non-blocking notes: every write/pwrite/seek/ftruncate on any descriptor now does an `fstat` plus a `/proc/self/fd` readlink before falling back to the native call; and `pwrite` now returns the errno instead of throwing. A follow-up could cache the shm check if the cost shows up.
Sign in to join this conversation.
No reviewers
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!3555
No description provided.