sceKernelSignalSema throws on a zero count (Marvel's Wolverine) #2748
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 tv7 on 2026-10-10T12:45:33Z.
Title: Marvel's Wolverine (PPSA03671).
Build: Windows 11 Pro (10.0.26200), MinGW GCC 15.2.0 (WinLibs UCRT), Release, RTX 3070. Still present on
mainb69270dd9.A few minutes in, the title ends with:
A
Job Lo 2thread callssceKernelSignalSema(sem, count)with a valid semaphore and a count computed asmin(a, b) - c(ELF 0x3ccc1eb..0x3ccc20c), which is 0 here, and ignores the return value.sceKernelSignalSemathrows forcount <= 0.Other implementations do not stop on a zero count: shadPS4 (
semaphore.cpp,Signal) and Kyty (Kernel/Semaphore.cpp) treat it as a no-op that returns OK; fpPS4's olderps4_sema.pasreturnsEINVAL. Not checked on hardware.Fix ready
I can't open PRs while intake is paused, so it is on my fork for anyone who can take it:
tv7/AnyPS5
fix/signal-sema-zero-countSemaphore.cpp:count <= 0becomescount < 0, so a zero count adds no tokens and returnsSCE_OK. A null semaphore and a negative count still throw.guest_kernel_errorssignals 0 on a full and on an empty semaphore and checks that the count did not change. It fails onmainwith the exception above and passes with the fix; fullctest706/706 onb5f5362d3,check_conventionspasses.Investigated and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T12:57:41Z.
I refreshed Lexroid’s author-attributed
sceKernelSignalSemachange onto current upstreammain(de5e541d) at22964a33924fb5ed26609839409c5a627c6c3563. A zero count now succeeds without changing semaphore state; null semaphores and negative counts still follow the invalid-argument path.Validation: Linux x86-64, GCC 12.2 Release; rebuilt
libkernel.prxandguest_kernel_error_tests;guest_kernel_errorspassed (1/1). Conventions andgit diff --checkpass. The issue’s Windows red/green and full-suite results are from TheTerr4 on an earlier base; they have not been rerun on this refreshed head.The refreshed branch is
codex/signal-sema-zero-count-2748. I have not opened an upstream PR because intake still requires 20 merged PRs and my count is 15.Imported from boykopovar/AnyPS5. Originally posted by TheTerr4 on 2026-10-10T13:51:17Z.
Verified the patch on Windows, the platform the issue was reported on.
Setup: Windows 11 Pro 10.0.26200, MinGW-w64 GCC 15.2.0 (WinLibs
x86_64-ucrt-posix-seh, r7), Release, NVIDIA RTX 4080 SUPER.935bddc1cherry-picked ontomainba2a0a31without conflicts.guest_kernel_errorsassertions fail on unmodifiedba2a0a31withstd::invalid_argument: sceKernelSignalSema: invalid argument, and pass with the patch.ctest: 702/709 pass. The 7 failures (agc_driver_flat_loads*,agc_driver_global_loads*,agc_driver_pixel_interlock) also fail on unpatchedmainon this machine, with the same errors, so the patch does not cause them.guest_semaphorepasses.tools/check_conventions.pyandgit diff --checkpass.I did not run Wolverine.
Verification run with AI assistance (Claude).