diff options
| author | yang.zhang <[email protected]> | 2026-05-03 08:58:55 +0800 |
|---|---|---|
| committer | Rbb666 <[email protected]> | 2026-05-26 16:56:36 +0800 |
| commit | d4f4c50b9e60223078a7178e47d338ca484bcbc0 (patch) | |
| tree | baeb59660a6014fe26c91b2775c727463d5b0a73 /.github | |
| parent | 208a09e074cf67879b31925ff5d25328781afc2b (diff) | |
lwp: fix pid leak on exec failure before task startup
When msh tries to execute a non-ELF path, lwp_execve() may allocate a PID
before lwp_load() fails. The old error path only dropped the LWP reference,
leaving the PID tree entry pointing to a freed LWP.
In an init-less boot flow, this can poison pid 1 after a failed command from
msh. A later LWP launch may then treat the stale pid 1 entry as a valid parent
LWP, resulting in invalid pgrp/session state and a job-control assertion during
process exit.
Add lwp_pid_rollback() for exec/spawn failures before the process becomes
runnable. Unlike lwp_pid_put(), it always releases the PID lock and does not
enter the "no more pid allocation" state when the PID tree becomes empty.
Use the rollback helper in lwp_execve() failure paths after PID allocation.
Signed-off-by: zhangyang <[email protected]>
Diffstat (limited to '.github')
0 files changed, 0 insertions, 0 deletions
