tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Softfloat userland needing to properly deliver SIGFPE traps



On Sat, Jan 22, 2011 at 10:11:48AM +0100, Martin Husemann wrote:
> How about the variant below - it allows a process to deliver arbitrary
> signals to itself, but only SI_USER/SI_QUEUE variants to foreign processes.

Ooops, here is the patch...

Martin

Index: sys_sig.c
===================================================================
RCS file: /cvsroot/src/sys/kern/sys_sig.c,v
retrieving revision 1.30
diff -c -u -r1.30 sys_sig.c
--- sys_sig.c   10 Jan 2011 04:39:18 -0000      1.30
+++ sys_sig.c   22 Jan 2011 09:08:53 -0000
@@ -223,20 +223,22 @@
        if ((u_int)ksi->ksi_signo >= NSIG)
                return EINVAL;
 
-       if (ksi->ksi_pid != l->l_proc->p_pid)
-               return EPERM;
-
-       if (ksi->ksi_uid != kauth_cred_geteuid(l->l_cred))
-               return EPERM;
-
-       switch (ksi->ksi_code) {
-       case SI_USER:
-       case SI_QUEUE:
-               break;
-       default:
-               return EPERM;
+       if (pid != l->l_proc->p_pid) {
+               if (ksi->ksi_pid != l->l_proc->p_pid)
+                       return EPERM;
+
+               if (ksi->ksi_uid != kauth_cred_geteuid(l->l_cred))
+                       return EPERM;
+
+               switch (ksi->ksi_code) {
+               case SI_USER:
+               case SI_QUEUE:
+                       break;
+               default:
+                       return EPERM;
+               }
        }
-               
+
        if (pid > 0) {
                /* kill single process */
                mutex_enter(proc_lock);


Home | Main Index | Thread Index | Old Index