You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "pussuw (via GitHub)" <gi...@apache.org> on 2024/05/31 10:46:46 UTC
[PR] sched/Kconfig: For waitpid(), select SCHED_HAVE_PARENT if BUILD_KERNEL [nuttx]
pussuw opened a new pull request, #12434:
URL: https://github.com/apache/nuttx/pull/12434
## Summary
waitpid() cannot be used in kernel mode unless SCHED_HAVE_PARENT is selected -> just automatically take it into use if waitpid() is needed.
Why? Because without SCHED_HAVE_PARENT waitpid() works in a non-standard way, meaning it does not use SIGCHLD to wake the parent, as it should.
Also, returning the child status via stat_loc corrupts memory as stat_loc points to the parent's address environment:
pid_t nxsched_waitpid(pid_t pid, int *stat_loc, int options)
{
...
group->tg_statloc = stat_loc;
...
}
And later when the status is returned, the child writes to tg_statloc, which points to the parent's address environment -> random memory corruption:
static inline void nxtask_exitwakeup(FAR struct tcb_s *tcb, int status)
{
...
if (group->tg_statloc != NULL)
{
*group->tg_statloc = status << 8;
}
...
}
## Impact
Fix a bug in kernel mode
## Testing
ostest
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] sched/Kconfig: waitpid() depends on SCHED_HAVE_PARENT if BUILD_KERNEL [nuttx]
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko merged PR #12434:
URL: https://github.com/apache/nuttx/pull/12434
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] sched/Kconfig: For waitpid(), select SCHED_HAVE_PARENT if BUILD_KERNEL [nuttx]
Posted by "pussuw (via GitHub)" <gi...@apache.org>.
pussuw commented on PR #12434:
URL: https://github.com/apache/nuttx/pull/12434#issuecomment-2141768726
Noticed this when ostest in kernel mode returns wrong status (-1). Now it works
user_main: Exiting
ostest_main: Exiting with status 0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] sched/Kconfig: For waitpid(), select SCHED_HAVE_PARENT if BUILD_KERNEL [nuttx]
Posted by "pussuw (via GitHub)" <gi...@apache.org>.
pussuw commented on code in PR #12434:
URL: https://github.com/apache/nuttx/pull/12434#discussion_r1622586772
##########
sched/Kconfig:
##########
@@ -755,6 +755,7 @@ endif # SCHED_CHILD_STATUS
config SCHED_WAITPID
bool "Enable waitpid() API"
default n
+ select SCHED_HAVE_PARENT if BUILD_KERNEL
Review Comment:
I tried that but it gave some syntax error. That would be better IMO yes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] sched/Kconfig: For waitpid(), select SCHED_HAVE_PARENT if BUILD_KERNEL [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #12434:
URL: https://github.com/apache/nuttx/pull/12434#discussion_r1622580638
##########
sched/Kconfig:
##########
@@ -755,6 +755,7 @@ endif # SCHED_CHILD_STATUS
config SCHED_WAITPID
bool "Enable waitpid() API"
default n
+ select SCHED_HAVE_PARENT if BUILD_KERNEL
Review Comment:
should we change to `depends on`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org