xiaoxiang781216 commented on code in PR #19900:
URL: https://github.com/apache/nuttx/pull/19900#discussion_r3840273623
##########
sched/group/group_create.c:
##########
@@ -98,6 +98,62 @@ static inline void group_inherit_identity(FAR struct
task_group_s *group)
# define group_inherit_identity(group)
#endif
+#ifdef CONFIG_FS_CHROOT
+/****************************************************************************
+ * Name: group_inherit_chroot
+ *
+ * Description:
+ * Inherit the chroot jail from the parent task group. Kernel threads
+ * share g_kthread_group and must not inherit a user jail.
+ *
+ * Input Parameters:
+ * group - The new task group.
+ * ttype - The type of the new thread (TCB_FLAG_TTYPE_* value).
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int group_inherit_chroot(FAR struct task_group_s *group,
+ uint8_t ttype)
+{
+ FAR struct tcb_s *rtcb;
+ FAR struct task_group_s *rgroup;
+
+ if (ttype == TCB_FLAG_TTYPE_KERNEL)
+ {
+ return OK;
+ }
+
+ rtcb = this_task();
+ rgroup = rtcb->group;
+
+ DEBUGASSERT(group != NULL && rgroup != NULL);
+
+ if (rgroup->tg_root == NULL)
+ {
+ return OK;
+ }
+
+ if (rgroup->tg_rootrel != NULL)
Review Comment:
remove rel
##########
sched/group/group_create.c:
##########
@@ -98,6 +98,62 @@ static inline void group_inherit_identity(FAR struct
task_group_s *group)
# define group_inherit_identity(group)
#endif
+#ifdef CONFIG_FS_CHROOT
+/****************************************************************************
+ * Name: group_inherit_chroot
+ *
+ * Description:
+ * Inherit the chroot jail from the parent task group. Kernel threads
+ * share g_kthread_group and must not inherit a user jail.
+ *
+ * Input Parameters:
+ * group - The new task group.
+ * ttype - The type of the new thread (TCB_FLAG_TTYPE_* value).
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int group_inherit_chroot(FAR struct task_group_s *group,
+ uint8_t ttype)
+{
+ FAR struct tcb_s *rtcb;
+ FAR struct task_group_s *rgroup;
+
+ if (ttype == TCB_FLAG_TTYPE_KERNEL)
+ {
+ return OK;
+ }
+
+ rtcb = this_task();
+ rgroup = rtcb->group;
+
+ DEBUGASSERT(group != NULL && rgroup != NULL);
+
+ if (rgroup->tg_root == NULL)
+ {
+ return OK;
+ }
+
+ if (rgroup->tg_rootrel != NULL)
+ {
+ group->tg_rootrel = strdup(rgroup->tg_rootrel);
+ if (group->tg_rootrel == NULL)
+ {
+ return -ENOMEM;
+ }
+ }
+
+ group->tg_root = rgroup->tg_root;
Review Comment:
why need hold tg_root
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]