xiaoxiang781216 commented on code in PR #20425:
URL: https://github.com/apache/nuttx/pull/20425#discussion_r4154530811


##########
syscall/syscall_uaccess.c:
##########
@@ -308,6 +311,120 @@ int uaccess_umount2(FAR const char *target, unsigned int 
flags)
 }
 #endif
 
+static bool uaccess_owns(pid_t tid)
+{
+  FAR struct tcb_s *tcb;
+
+  if (tid == 0 || nxsched_capable(PR_CAP_ADMIN))
+    {
+      return true;
+    }
+
+  tcb = nxsched_get_tcb(tid);
+  return tcb == NULL || tcb->group == nxsched_self()->group;
+}
+
+int uaccess_kill(pid_t pid, int sig)
+{
+  if (sig != 0 && !uaccess_owns(pid))
+    {
+      set_errno(EPERM);
+      return ERROR;
+    }
+
+  return kill(pid, sig);
+}
+
+int uaccess_tgkill(pid_t pid, pid_t tid, int sig)

Review Comment:
   why do the special check in mkssycall.c? it's better to do the check in the 
code directly



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