diff options
| author | zhangyangysu <[email protected]> | 2026-11-02 11:24:11 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-11-02 11:24:11 +0800 |
| commit | 7e7237d64432c65c94e4b931b66c6327dfa40385 (patch) | |
| tree | f87b877f58bb80fd45d9c4098cedb8492b20437f /src/klibc/SConscript | |
| parent | cbc19778d0ae5ef2533a28c0f62c6a399858010a (diff) | |
Fix stack corruption in rt_sdhci_init_host() (#11542)
* 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]>
* [drivers][sdio] avoid SDHCI device name stack overflow
rt_sdhci_init_host() allocated a fixed 32-byte buffer for device-derived object names, but sdio_host_set_name() may copy up to RT_NAME_MAX bytes into the output buffer. When RT_NAME_MAX is larger than 32, this can overwrite the stack and corrupt nearby locals.
Size the temporary name buffer with RT_NAME_MAX, force it to be NUL-terminated, and derive the append offset from the actual string length. Also replace the suffix rt_sprintf() calls with bounded rt_snprintf() so timer and workqueue suffixes cannot overflow the buffer when the base name is already close to RT_NAME_MAX.
Signed-off-by: zhangyangysu <[email protected]>
---------
Signed-off-by: zhangyang <[email protected]>
Signed-off-by: zhangyangysu <[email protected]>
Co-authored-by: yang.zhang <[email protected]>
Diffstat (limited to 'src/klibc/SConscript')
0 files changed, 0 insertions, 0 deletions
