Files
AnyPS5/docs/dev/debt/changes/fix-libkernel-batch-map-guest-pointers.md
aasishdairel aa04cdc4c3 fix(libkernel): copy batch map entries through guest copies
sceKernelBatchMap2 and sceKernelMemoryPoolBatch read each entry of the
guest batch array through the guest pointer and passed &entry.start of
that array into DoMapDirect and _mapFlexible, which read the hint and
wrote the result pointer through the raw guest memory. An unreadable
entries array or unwritable result slot faulted the host instead of
returning an error.

Each entry is now read with GuestCopyIn_nid_no_patch into a local, the
map operations run against the local, and the start a map operation
produced is stored back to the entry with GuestCopyOut_nid_no_patch.
A copy failure returns SCE_KERNEL_ERROR_EFAULT and stops the batch;
num_entries_out keeps reporting the number of entries whose operation
ran and whose start was stored.
2026-11-17 00:54:42 +05:30

7 lines
1.3 KiB
Markdown

# libkernel
## add Functional
- [sceKernelBatchMap and sceKernelBatchMap2](../../../core/libs/prx/libkernel/DirectMemory/Export.cpp) (libkernel) - each entry of the guest batch array is read with `GuestCopyIn_nid_no_patch` into a local before it is operated on, and the start a map operation (0 or 3) produced is stored back to the entry with `GuestCopyOut_nid_no_patch`, so an unreadable array or an unwritable entry start returns `SCE_KERNEL_ERROR_EFAULT` (0x8002000e) instead of faulting the host. The count reported through `num_entries_out` stays the number of entries whose operation ran and whose start was stored; a copy failure stops the batch. The console's fault behaviour for an unreadable array or unwritable entry is unmeasured, so these are host-safety fallbacks that preserve caller `errno`.
- [sceKernelMemoryPoolBatch](../../../core/libs/prx/libkernel/DirectMemory/MemoryPoolExport.cpp) (libkernel) - each entry of the guest batch array is read with `GuestCopyIn_nid_no_patch` into a local before it is operated on, so an unreadable array returns `SCE_KERNEL_ERROR_EFAULT` (0x8002000e) instead of faulting the host, with the processed count still reported through `num_entries_out` and the batch stopped at the failing entry. The console's fault behaviour for an unreadable array is unmeasured, so this is a host-safety fallback that preserves caller `errno`.