casaroli commented on code in PR #20764:
URL: https://github.com/apache/nuttx/pull/20764#discussion_r4308525301


##########
binfmt/script.c:
##########
@@ -177,6 +181,22 @@ static int script_loadbinary(FAR struct binary_s *binp,
       return ret;
     }
 
+#ifdef CONFIG_BINFMT_CHECKEXEC
+  /* The script needs execute permission, as its interpreter does */
+
+  ret = file_fstat(&file, &st);
+  if (ret >= 0)
+    {
+      ret = binfmt_checkexecperm(st.st_mode, st.st_uid, st.st_gid);
+    }
+
+  if (ret < 0)
+    {
+      file_close(&file);
+      return ret;
+    }
+#endif
+

Review Comment:
   No. After the script, load_module() loads the interpreter, and its loader 
(ELF, NXFLAT or builtin) sets binp->uid, gid and mode from the interpreter 
file. exec_module() uses them only for the set-user-ID and set-group-ID bits, 
which are ignored for a script, as on Linux.



-- 
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]

Reply via email to