From: claudio Date: Thu, 16 Feb 2023 08:50:57 +0000 (+0000) Subject: Like other ktrace functions make ktruser() callable without kernel lock X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f0c3f6133587290f414e0f9ec00004b740bf036b;p=openbsd Like other ktrace functions make ktruser() callable without kernel lock by takeing the lock around ktrwrite2(). OK miod@ cheloha@ --- diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 8f304925d43..16860982808 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_ktrace.c,v 1.110 2023/02/09 08:00:31 guenther Exp $ */ +/* $OpenBSD: kern_ktrace.c,v 1.111 2023/02/16 08:50:57 claudio Exp $ */ /* $NetBSD: kern_ktrace.c,v 1.23 1996/02/09 18:59:36 christos Exp $ */ /* @@ -335,8 +335,11 @@ ktruser(struct proc *p, const char *id, const void *addr, size_t len) else memp = stkbuf; error = copyin(addr, memp, len); - if (error == 0) + if (error == 0) { + KERNEL_LOCK(); ktrwrite2(p, &kth, &ktp, sizeof(ktp), memp, len); + KERNEL_UNLOCK(); + } if (memp != stkbuf) free(memp, M_TEMP, len); }