fix(libkernel): consume queried module info in address matching #18111
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18111"
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 HenriksApsitis on 2026-11-10T13:27:31Z.
What
Fix the query-to-match sequence reported for LEGO Voyagers (PPSA23732) in #8675. This is a current producer/consumer mismatch, not another implementation of the original #8676 fix.
__elf_phdr_match_addrrecognizes aModuleInfoExonly when its first word equalssizeof(ModuleInfoEx). Since merged #10230 (3717573887504046961817cebbe89b70f23203df),sceKernelGetModuleInfoFromAddrdeliberately returns zero there, matching the reporter's PS5 firmware 13.60 measurements. Passing its unchanged result to the matcher therefore falls into thedl_phdr_infoparser and treats module-name bytes as a header pointer.Make the supported pointer ABI explicit as
const ModuleInfoEx*and consume its already-relocated segment records regardless ofst_size. Remove the FreeBSD-layout fallback: #337 explicitly inferred that signature without a title or console check, whereas #8675 documents the title passing the module-info query's object. Accepting zero as a second layout tag would be ambiguous with a legitimatedl_phdr_info.dlpi_addr == 0. The export name, NID and machine-level argument ABI are unchanged.Preserve the existing ModuleInfoEx branch's executable protection check, eight-byte remaining-range rule and four-segment bound. Migrate the synthetic coverage to that record type and add the real query-to-match sequence for both accepted query flags, a non-executable data control, record non-mutation and range/count limits. Record the unmeasured console edge semantics in debt.
Tested
CachyOS Linux
7.3.1-1-cachyos, AMD Ryzen 5 9600X, GCC 16.2.1, CMake 4.4.5, Ninja 1.13.2, Python 3.14.9. Clean isolated full-runtime Release configuration withBUILD_TESTING=ON; only the relevant test targets and their runtime/fixture dependencies were built, not the whole runtime suite. Reproduction baseline698b6ed1215316a5f85bcd0e9939e4a96ed52b7d; publication base706573b02fb1e473092498cce6ee1b5c2ac856af; final head50695b0d9b299297f1bd642aed8767909deefdb4. The four-file patch is byte-identical after rebasing; the seven focused tests were rebuilt and repeated on the final clean head.guest_elf_phdr_matchandguest_module_infopass (2/2). Adding only the real query-to-match regression makesguest_elf_phdr_matchfail with SIGSEGV (CTest exit 8).query=0 size=0 ... segments=4, then faults at__elf_phdr_match_addr_nid_postfix+48,cmpl $0x1,(%rax). The identical executable against candidate libraries printsmatch=1and exits zero. No record fields are rewritten between query and match.guest_elf_phdr_match,guest_module_info,guest_dynamic_loader,guest_dynamic_loader_variant_names,guest_unwind_module_info,guest_unwind_module_info_failure, andguest_kernel_sys_module_internalpass three repetitions each (7 distinct tests, 21 executions, no skips). The six neighboring controls also pass three repetitions each against the saved baseline libraries.a92061808b33b2727a5e0b835bbba08ef667b31855177c2764df53eafe6be00e; the final rebased diff has that same digest. Reviewers did not execute the builds/tests reported above.Full
pr_overlap.py --base main --branch audit/module-info-query-match-candidate --repo boykopovar/AnyPS5 --jobs 4inspected 1,987 open PRs and 115 shared-file/export candidates against main706573b02fb1e473092498cce6ee1b5c2ac856af. It exited 2, not a clean pass: 38 other branches conflict with the base, so their shared files could not be compared automatically. Manually compared all 38 API-verified fetched heads against each of their merge bases (39 comparisons; #10442 has two), retaining full diffs and pins. None changes this helper, its declaration, its regression or its new debt entry. #5021's shared code adds macOS unwind-table handling; #6149 changes module-start arguments; #11215 changes an unrelated context-function declaration. The rest share only unrelated debt entries or blank-line formatting. No dependency is required from these comparisons.Manual overlap audit: exact heads
151294f979ab00aaff2f702314425caf61a72790— feat(aot): consolidate native ARM64 compiler, runtime and consumersa407a5ef836405798b7e248b876acd66aa3f39e7— fix(libkernel): provide default arguments block for DT_INIT on Linuxa9b6788f8bb0142043c145484f4323831869f11a— fix(libkernel): prevent use-after-free on pthread semaphore destruction and notification racef06949da78cf801f47702e27f0dd987f4b80e184— feat(libkernel): support SEEK_DATA and SEEK_HOLE in lseekf4155ddf0711db1cb09dd64459065c46ac6dbe8e— feat(libkernel): support kevent read and write events on regular filescb750ff85695ea65ff493d321c3242407536895b— feat(libkernel): report open, read and close notes on watched files2456bc05a2e885120c5b282ecc0f46eb0a8b4fe2— fix(threads): run Windows pthread and small fiber stacks in guest VA range7faf2fff1fffad65690a893f489943616d129aaa— feat(libc): support archive-backed stdio reads020917ce9e31d15f27c4bd53c3965cfaf8502e0c— perf(agc): keep unimported label stores on the CPU550810d74a304089683fd7f6994315974df0aaa1— feat(libkernel): implement four pthread_attr forms355d421183ec89484dd02158f70f58b60c28d191— docs(debt): cite firmware 10.01 kernel data for four libkernel entriesb208fd6b210d26e58b969d2341404b4cf085f5b0— feat(libkernel): implement the named ksem semaphoresd07deaa187134d4e2482a5f48aeea9f1f5601ab3— feat(libkernel_sys): implement POSIX message queuesc045c1e91fe983f7e3e513692110e15b16470953— feat(libkernel_sys): implement kmq_notify registration3a75bf46109389bd33cfbb9724b59b8546a47d7d— feat(libkernel_sys): implement sigqueuef8698a0b663a95a51f59839c42e245bf0f5598e0— feat(libkernel): keep the SIGIO owner of a pipe for F_GETOWN and F_SETOWN0bc531a0a29be507638f5edaa51645a8169aed4f— feat(libkernel): answer tcgetpgrp and tcsetpgrp on a pipe with its SIGIO ownerdb41fa38767f3347af18c7308d517e7359c13950— fix(libkernel): honor caller-provided pthread stacks77fe6e4d65af36605aa4be5d7b2ab3e8b8f3165b— perf(agc): store an unimported label at once when unfinished work leaves guest memory alone7c3ff4148c2e20144a7d455dc5e6af560297bd7e— feat(libkernel): implement __Ux86_64_setcontextf013da972573fa4dfca95607f2462501d6ad2234— feat(relinker): execute supported scalar guest GS accesses on Windowsb813f34cfbbadc2d73e879b1e973491add56377c— feat(relinker): support short scalar guest GS instructions5551631d9e9263e8634e44d272d683966e1d18b5— feat(relinker): support SSE guest GS memory accessesf16c9e062bd1d7607e1b3c976a6071904a81960c— feat(relinker): support VEX guest GS memory accessesef5ae8ee9074486c4715f8b10c75ffdb87c735cf— fix(libkernel): wait for the rest of a MSG_WAITALL stream receive in the guest layer32121ca48d0abf5e1c11e7c601636d10ec8cb77d— feat(libkernel): cancel blocked POSIX reads with owned operations8f34999f2fad40fcf704765c3dedcafe5d157fa7— fix(libkernel): preserve blocking sockets over nonblocking native transportbf740fcd275bc7e9c8a78cbfce94da554e0e78b0— feat(libkernel): cancel blocked POSIX writes with partial progress99dee9956598573e0f66bd0dae68040cfad574ad— feat(libkernel): support deferred cancellation in POSIX accept3385df150895b96c763650fdf78bc3526274f412— fix(libkernel): validate null pointers in pthread rwlock functions4cd962f4ca01fbfbe836d61b7a6952844aa54abe— fix(libkernel): return SCE_KERNEL_ERROR_EINVAL for null key in scePthreadKeyCreate4d105ce487cac38c209496c2f8cbe3ae340d39da— docs(debt): separate entries with blank lines and drop derived export totals7d75cace5a99f4029e8699f806fa6fe7b40170fe— fix(libkernel): return EFAULT from JIT shared memory queries for unwritable pointers8f54a85c1cdd9810bc64d8cc765c603f97c94aa4— feat(libkernel): follow FreeBSD for SO_ACCEPTFILTER on a listening socketa5d352f04d1375b14cd4eac88c6691e346dc5bf1— feat(libkernel_sys): implement mount, unmount and nmount privilege checks3bd7e736346200b05f4504a2aaf42f2757659bfd— fix(libkernel): fail scePthreadGetname and pthread_getname_np with EFAULT on an unwritable bufferaf179438e196e5143b999a852a25ea68dffd904c— test(libkernel): name the exception fault test's assembly symbols for Mach-O6b9840b9a63301c5b1e15e8fccca82a4e6400bfa— fix(libSceNet): keep close-on-exec for fcntl on a sceNetSocket socket as FreeBSD doesThis manual result does not turn the automatic exit 2 into a passing gate.
No console, LEGO Voyagers or other title run; no native Windows/macOS execution, complete runtime suite, GPU validation or performance claim. The related title evidence belongs to the original issue/PR reporters. Exact range-boundary and invalid-pointer console behavior remain unmeasured.
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)