fix(libkernel): avoid semaphore count overflow #315
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/315"
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 RomainROCH on 2026-10-02T04:22:32Z.
What
Check a semaphore signal against the remaining capacity before adding it. The previous signed addition could overflow before the maximum-count check, accepting an excessive signal and corrupting the token count.
The regression covers INT_MAX-1 plus 2 and plus INT_MAX, an exact-limit signal, rejection at full capacity, and an ordinary small limit. Polling the original number of tokens after rejection verifies that the counter is unchanged.
Tested
74586bab57.Checklist
main; no other open PR implements the same functions