Re: check KTRPOINT() before calling ktrpledge()

2016-07-09 Thread Philip Guenther
On Mon, Jun 20, 2016 at 11:34 PM, Michal Mazurek  wrote:
> Don't ktrace pledge if it is not enabled.

Committed...through the real reason to do this is that KTRPOINT() is
what guarantees that writing of ktrace records can't loop back into
ktrace.

Philip Guenther



check KTRPOINT() before calling ktrpledge()

2016-06-21 Thread Michal Mazurek
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 -   1.170
+++ sys/kern/kern_pledge.c  21 Jun 2016 06:32:41 -
@@ -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(, 0, sizeof sa);


-- 
Michal Mazurek