* refactor(ipc): extract generic SysV IPC permission module
* feat(ipc): implement System V semaphore syscalls
* test(ipc): add SysV semaphore dunitest suite
* style(ipc): satisfy kernel formatting checks
* style(ipc): translate SysV semaphore comments to English
* fix(ipc): make IPC_SET permission updates atomic
* fix(ipc): make semaphore set allocation fallible
* feat(ipc): implement SysV SEM_UNDO lifecycle
* fix(ipc): mark allocated IDs in release builds
* fix(ipc): prioritize const semaphore waiters
* fix(process): preserve reaped PID identity
* fix(process): preserve exec locking in prepared namespace publication
Signed-off-by: longjin <longjin@dragonos.org>
* fix(ipc): harden semaphore allocation and Linux syscall semantics
Signed-off-by: longjin <longjin@dragonos.org>
* test(fuse): handle background writeback in direct-drain assertions
Validate complete cached-page coverage before direct writes without assuming a fixed writeback partition. Cover tail-first writeback deterministically and close open files on failure to avoid contaminating later mount-isolation tests.
Signed-off-by: longjin <longjin@dragonos.org>
* fix(ipc): make bulk semaphore buffers fallible and prepare queue growth unlocked
Return ENOMEM for SETALL and GETALL buffer allocation failures. Prepare spare waiting-queue capacity only after a blocked operation needs growth, then revalidate and publish without allocating under the namespace lock. Preserve FIFO order and release replaced storage outside the lock. Add a 32000-element SETALL/GETALL regression.
Signed-off-by: longjin <longjin@dragonos.org>
* fix(ipc): prepare undo registry growth outside the namespace lock
Request spare capacity before publishing a first-time undo group. Allocate outside the manager lock, then revalidate the set and registration state before moving Weak entries into the prepared buffer. Keep replaced storage for unlocked disposal and preserve mark-after-insertion and duplicate prevention. Add coverage for competing growth and repeated registration.
Signed-off-by: longjin <longjin@dragonos.org>
* fix(ipc): scope semaphore undo cleanup and defer wakeups
Associate undo groups with each semaphore set so control operations no longer scan unrelated groups. Reuse published records for the registration fast path and preserve unlocked spare-capacity preparation.
Publish queued results under the namespace lock and drain an allocation-free completion batch after unlocking across semop, semctl and exit replay. Keep completed entries alive and detach links iteratively.
Add set-local undo and bulk removal regressions. Validate with make kernel, kernel workspace tests, 69 Linux host tests, 69 DragonOS guest tests and 20 complete guest repeats.
Signed-off-by: longjin <longjin@dragonos.org>
* fix(ipc): reclaim unused semaphore undo registry storage
Unlink retired groups using their existing records and release failed or canceled missing associations only when no published record or shared waiter remains. Preserve the original whole-group replay critical section.
Reclaim empty registries without allocation and shrink sparse registries through unlocked fallible preparation and locked revalidation. Keep allocation failure and competing growth outside syscall success semantics.
Add persistent-set undo churn and shrink revalidation coverage. Kernel and workspace builds, host capacity/failure checks, 70 Linux tests, 70 DragonOS tests and 20 full guest repeats passed.
Signed-off-by: longjin <longjin@dragonos.org>
* fix(ipc): skip empty unshare installs and cache the maximum ID index
Return no prepared install when unshare has no replacement state or undo detachment. Preserve validation and required SYSVSEM/NEWIPC work.
Track the highest used index in the existing IPC allocator, using its bitmap only when removing the maximum. Make semaphore information queries read the cache without scanning the object table.
Add allocator and syscall regressions. Validate kernel/workspace builds, four allocator tests, 50000 randomized allocator steps, installation failure injection, Linux and guest semaphore 72/72, 20 full guest repeats, and SHM 61 passed with four environment skips.
Signed-off-by: longjin <longjin@dragonos.org>
* fix(namespace): make prepared fs copies fallible
Signed-off-by: longjin <longjin@dragonos.org>
* fix(ipc): prepare semaphore storage outside the lock and unlink waiters directly
Signed-off-by: longjin <longjin@dragonos.org>
* fix(dunitest): use real deadlines when collecting child output
Signed-off-by: longjin <longjin@dragonos.org>
* fix(ipc): reuse live undo records and replay one set at a time
Signed-off-by: longjin <longjin@dragonos.org>
* fix(ipc): defer semaphore removal reclamation until after unlock
Signed-off-by: longjin <longjin@dragonos.org>
* fix(ipc): cache wait counts and retain zero undo records
Signed-off-by: longjin <longjin@dragonos.org>
* docs: remove sem undo implementation plan and design spec
Signed-off-by: longjin <longjin@dragonos.org>
* refactor(ipc): separate semaphore state, operations and undo lifecycle
Split semaphore ABI, namespace management, atomic execution and wait queues into focused modules. Centralize terminal publication without rescanning known queues, and represent undo retirement with an explicit phase.
Preserve syscall paths, locking and deferred reclamation. Move existing tests with their owning modules and add atomic-attempt regression coverage.
Signed-off-by: longjin <longjin@dragonos.org>
* perf(ipc): preindex semaphore scratch and reclaim undo record storage
Signed-off-by: longjin <longjin@dragonos.org>
* fix(ipc): correct semaphore ABI and index undo records
Signed-off-by: longjin <longjin@dragonos.org>
* fix(ipc): replay detached undo outside fs publication barrier
Preserve the old IPC namespace and actor across namespace publication, then release the fs reference guard before replay. Validate copied SETALL values before checking for concurrent removal.
Signed-off-by: longjin <longjin@dragonos.org>
* fix(ipc): skip semaphore queue scans when waiter state is unchanged
Track both committed semaphore values and shared undo adjustments in the existing completion result. Preserve the result through the immediate undo path and use it for immediate scans and queued retries.
Debt-only changes must still retry waiters because they can turn a blocked shared SEM_UNDO operation into ERANGE. Add user-space coverage for immediate and queued debt-only changes.
Signed-off-by: longjin <longjin@dragonos.org>
* test(ipc): preserve creator group access after semaphore IPC_SET
Cover creator and current group membership through both primary and supplementary groups after changing gid. Check read/write access, unrelated-group denial, and the separate owner-only IPC_SET/IPC_RMID boundary.
Linux 6.6 ipcperms checks both cgid and gid, so retain the existing kernel behavior.
Signed-off-by: longjin <longjin@dragonos.org>
* perf(ipc): index semaphore set undo associations
Keep dense association storage and its group-identity index together. Prepare both buffers outside the manager lock, recheck capacity before publication, and repair moved slots on constant-time expected removal.
Preserve Weak identity lifetimes, deferred RMID cleanup, geometric growth and best-effort unlocked reclamation. Extend registry regression coverage for removal, deduplication and concurrent capacity changes.
Signed-off-by: longjin <longjin@dragonos.org>
* fix(ci): match syscall boot markers literally
The rcS marker contains brackets that were incorrectly interpreted as a regex character class, causing the monitor to misclassify a system that had already entered userspace.
Add host tests executing the actual predicate against literal, binary, CRLF, missing and misleading log inputs. Keep existing timeout and failure policies unchanged.
Signed-off-by: longjin <longjin@dragonos.org>
---------
Signed-off-by: mistcoversmyeyes <mingjiangyu1@qq.com>
Signed-off-by: longjin <longjin@dragonos.org>
Co-authored-by: longjin <longjin@dragonos.org>