mirror of
https://github.com/apache/nuttx.git
synced 2026-05-10 15:30:25 +08:00
bugfix: share kernel thread group should not dup files from caller group
after this commits commit e7fa4cae6cbf567266985c8072db1f51ad480943 Author: Yanfeng Liu <yfliu2008@qq.com> Date: Fri May 17 06:11:52 2024 +0800 sched/tcb: use shared group for kthreads all kernel thread share group idle and should not dup filelist to this group Signed-off-by: guohao15 <guohao15@xiaomi.com> Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
@@ -79,15 +79,19 @@ int group_setuptaskfiles(FAR struct task_tcb_s *tcb,
|
||||
#ifndef CONFIG_FDCLONE_DISABLE
|
||||
DEBUGASSERT(rtcb->group);
|
||||
|
||||
/* Duplicate the parent task's file descriptors */
|
||||
/* With the exception of kernel threads, duplicate the parent task's
|
||||
* file descriptors.
|
||||
*/
|
||||
|
||||
if (group != rtcb->group)
|
||||
if (group != rtcb->group &&
|
||||
(tcb->cmn.flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_KERNEL)
|
||||
{
|
||||
ret = fdlist_copy(&rtcb->group->tg_fdlist,
|
||||
&group->tg_fdlist, actions, cloexec);
|
||||
}
|
||||
|
||||
if (ret >= 0 && actions != NULL)
|
||||
if (ret >= 0 && actions != NULL &&
|
||||
(tcb->cmn.flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_KERNEL)
|
||||
{
|
||||
ret = spawn_file_actions(&tcb->cmn, actions);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user