Current-Users archive

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

filemon(4) crash if fed non-existent PID (and fix)



If you feed a non-existent PID to filemon, it will fault the kernel.
This minimal patch at least stops the immediate crash.

====

--- ./sys/dev/filemon/filemon.c
+++ ./sys/dev/filemon/filemon.c
@@ -308,11 +308,11 @@
                tp = proc_find(*((pid_t *) data));
                mutex_exit(proc_lock);
                error = kauth_authorize_process(curproc->p_cred,
                    KAUTH_PROCESS_CANSEE, tp,
                    KAUTH_ARG(KAUTH_REQ_PROCESS_CANSEE_ENTRY), NULL, NULL);
-               if (!error) {
+               if ((tp) && (!error)) {
                        filemon->fm_pid = tp->p_pid;

                }
                break;


Home | Main Index | Thread Index | Old Index