-
Notifications
You must be signed in to change notification settings - Fork 587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nshlib/builtin: check background task before restore the signal #2990
Conversation
fix crash if: CONFIG_SCHED_WAITPID=n CONFIG_SCHED_CHILD_STATUS=y The old signal will be restored only when sigaction is saved to avoid invaild access. Signed-off-by: chao an <[email protected]>
@@ -234,7 +234,13 @@ int nsh_builtin(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, | |||
|
|||
/* Restore the old actions */ | |||
|
|||
sigaction(SIGCHLD, &old, NULL); | |||
# ifndef CONFIG_SCHED_WAITPID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the above commit to reflect this modification
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR only solves the crash issue, it should not appear in the code comments, and the comments above have already indicated the relevant behavior
@@ -234,7 +234,13 @@ int nsh_builtin(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, | |||
|
|||
/* Restore the old actions */ | |||
|
|||
sigaction(SIGCHLD, &old, NULL); | |||
# ifndef CONFIG_SCHED_WAITPID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need "# ifndef CONFIG_SCHED_WAITPID", keep align with line 92
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line 135 already have this check if CONFIG_SCHED_WAITPID is defined
Summary
nshlib/builtin: check background task before restore the signal
fix crash if:
CONFIG_SCHED_WAITPID=n
CONFIG_SCHED_CHILD_STATUS=y
The old signal will be restored only when sigaction is saved to avoid invaild access.
Signed-off-by: chao an [email protected]
Impact
N/A
Testing
cmake -B build -DBOARD_CONFIG=qemu-armv7a/rpserver_ivshmem -GNinja
cmake --build build -t menuconfig
qemu-system-arm -cpu cortex-a7 -nographic -machine virt,highmem=off -kernel build/nuttx -nographic