tech-kern archive

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

re: ktrace -p nonexistent process causes a panic



isn't this caused by uninitialised pointer accesses in sys_ktrace()?

        if (KTROP(SCARG(uap, ops)) != KTROP_CLEAR) {
  ... code to init fp ...
        }
        error = ktrace_common(l, SCARG(uap, ops), SCARG(uap, facs),
            SCARG(uap, pid), fp);
        if (fp != NULL) {
                if (error != 0) {
                        /* File unused. */
                        fd_abort(curproc, fp, fd);
                } else {
                        /* File was used. */
                        fd_abort(curproc, NULL, fd);

either way fp is garbage on the stack at this point if not
KTROP_CLEAR.  the uses in ktrace_common() won't fault, but the
fd_abort()s will (which is where we see the panic).

can people see if this works ok if fp is initialised to NULL?
(either at the top of the function or preferably as an else
clause right above the call to ktrace_common().


.mrg.


Home | Main Index | Thread Index | Old Index