Don't ktrace pledge if it is not enabled.

Index: sys/kern/kern_pledge.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_pledge.c,v
retrieving revision 1.170
diff -u -p -r1.170 kern_pledge.c
--- sys/kern/kern_pledge.c      7 Jun 2016 01:31:54 -0000       1.170
+++ sys/kern/kern_pledge.c      21 Jun 2016 06:32:41 -0000
@@ -574,7 +574,8 @@ pledge_fail(struct proc *p, int error, u
        printf("%s(%d): syscall %d \"%s\"\n", p->p_comm, p->p_pid,
            p->p_pledge_syscall, codes);
 #ifdef KTRACE
-       ktrpledge(p, error, code, p->p_pledge_syscall);
+       if (KTRPOINT(p, KTR_PLEDGE))
+               ktrpledge(p, error, code, p->p_pledge_syscall);
 #endif
        /* Send uncatchable SIGABRT for coredump */
        memset(&sa, 0, sizeof sa);


-- 
Michal Mazurek

Reply via email to