Skip to content

Commit 57d8390

Browse files
guohao15xiaoxiang781216
authored andcommitted
bugfix: share kernel thread group should not dup files from caller group
after this commits commit e7fa4ca Author: Yanfeng Liu <[email protected]> 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 <[email protected]> Signed-off-by: dongjiuzhu1 <[email protected]>
1 parent 74d5276 commit 57d8390

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

sched/group/group_setuptaskfiles.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,19 @@ int group_setuptaskfiles(FAR struct task_tcb_s *tcb,
7979
#ifndef CONFIG_FDCLONE_DISABLE
8080
DEBUGASSERT(rtcb->group);
8181

82-
/* Duplicate the parent task's file descriptors */
82+
/* With the exception of kernel threads, duplicate the parent task's
83+
* file descriptors.
84+
*/
8385

84-
if (group != rtcb->group)
86+
if (group != rtcb->group &&
87+
(tcb->cmn.flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_KERNEL)
8588
{
8689
ret = fdlist_copy(&rtcb->group->tg_fdlist,
8790
&group->tg_fdlist, actions, cloexec);
8891
}
8992

90-
if (ret >= 0 && actions != NULL)
93+
if (ret >= 0 && actions != NULL &&
94+
(tcb->cmn.flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_KERNEL)
9195
{
9296
ret = spawn_file_actions(&tcb->cmn, actions);
9397
}

0 commit comments

Comments
 (0)