feat(libSceNKWebKit): implement WTF::OSAllocator commit, decommit and releaseDecommitted #23725
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/23725"
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 Callimann8 on 2026-11-19T14:35:12Z.
What
Implements the three remaining
WTF::OSAllocatorexports in libSceNKWebKit. They were throwing stubs inExport.cpp:WTF::OSAllocator::commit(void*, size_t, bool, bool)(_ZN3WTF11OSAllocator6commitEPvmbb, NIDNeYe5cZQXg8)WTF::OSAllocator::decommit(void*, size_t)(_ZN3WTF11OSAllocator8decommitEPvm, NIDCFjj7pKSrS4)WTF::OSAllocator::releaseDecommitted(void*, size_t)(_ZN3WTF11OSAllocator18releaseDecommittedEPvm, NIDUFKtijmAhkM)They go next to the existing
hintMemoryNotNeededSooninsrc/WtfPlatformDefaults.cpp. The PS5 11.x OSAllocatorPlayStation.cpp callsmemory_extra::vss::commit,decommitandreleaseand doesRELEASE_ASSERT(success)on each. Here they use the guest libkernel calls:commitsets the range to read, or read and write whenwritableis true, withmprotect.executableis ignored, as that file asserts it is false.decommitsets the range to no access withmprotect. The guestmadvisedoes nothing, so the page contents stay.releaseDecommittedunmaps the range withmunmap.When the call fails they call
WTFCrash, where the console code hasRELEASE_ASSERT. The debt fragment adds this to the existing "WTF PlayStation platform defaults" entry and drops the three names from the callable-exports table. The threeint ...()placeholders are dropped fromInventoryExports.hpp.Tested
Linux (Ubuntu 24.04, GCC 13), no title. Extended
nkwebkit_wtfplatformdefaults_tests(now linked with libkernel). It maps a guestPROT_NONErange, commits it writable and writes both ends, commits it read-only and reads them back, decommits it, commits and decommits half of it, decommits zero bytes, and checks withmincorethat the range is mapped beforereleaseDecommittedand gone after it. Built it in the full CMake build and ran it with ctest: it passes.python3 tools/debt_fold.py --checkpasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-19T14:36:34Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
ac0a9d0f81:tools/check_conventions.pypassed.nkwebkit_wtfplatformdefaults_testsbuilt cleanly.nkwebkit_wtfplatformdefaults):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/WtfPlatformDefaultsExports.hpp,core/libs/prx/libSceNKWebKit/src/WtfPlatformDefaults.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me