patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152177168


##########
binfmt/binfmt_execmodule.c:
##########
@@ -266,6 +266,10 @@ int exec_module(FAR struct binary_s *binp,
 
   pid = tcb->cmn.pid;
 
+#ifdef CONFIG_SCHED_USER_IDENTITY
+  tcb->cmn.group->tg_uid = binp->proguid;

Review Comment:
   > I think that is depended on the fork and setuid policy from app. But we 
can set a default UID when task is creating.
   
   Everything I have read states that the UID should be the UID of the parent.  
setuid() should be able to change the UID.
   
   NuttX currently sets the user and group IDs of normally created tasks to the 
IDs of the parent:  
https://github.com/apache/nuttx/blob/master/sched/group/group_create.c#L91  I 
think an inconsistent policy for executable modules would be a bad idea.
   
   In Unix systems there is an effective UID (euid) and a real UID (ruid).  
Both are inherited from the parent.  The unprivileged child can change is 
effective UID but not its real UID.
   
   When running executable files on a file system, the behavior differs 
depending on the state of ST_NOSUID permission bit on the file.  Are you trying 
to emulate setting the UID from the UID in the executable file permissions?
   
   I certainly think we as a project need to agree on this policy before we 
commit to it.  This has long term implications for behavior and compatibility 
with POSIX and other *nix systems.
   



-- 
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-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to