git: eb1413c9a6c7 - main - kinst: exclude cpu_switch

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Wed, 19 Jul 2023 14:59:50 UTC
The branch main has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=eb1413c9a6c785920421664dedd8e5c23fd89834

commit eb1413c9a6c785920421664dedd8e5c23fd89834
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2023-07-19 14:56:29 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2023-07-19 14:56:29 +0000

    kinst: exclude cpu_switch
    
    Reviewed by:    markj
    Approved by:    markj (mentor)
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D40985
---
 sys/cddl/dev/kinst/kinst.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sys/cddl/dev/kinst/kinst.c b/sys/cddl/dev/kinst/kinst.c
index 1c5b4372055d..4bd3047f49db 100644
--- a/sys/cddl/dev/kinst/kinst.c
+++ b/sys/cddl/dev/kinst/kinst.c
@@ -96,6 +96,13 @@ kinst_excluded(const char *name)
 	if (kinst_md_excluded(name))
 		return (true);
 
+	/*
+	 * cpu_switch() can cause a crash if it modifies the value of curthread
+	 * while in probe context.
+	 */
+	if (strcmp(name, "cpu_switch") == 0)
+		return (true);
+
 	/*
 	 * Anything beginning with "dtrace_" may be called from probe context
 	 * unless it explicitly indicates that it won't be called from probe