git: cc3da1955c16 - main - dtrace/amd64: Make invop providers usable with KMSAN enabled
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 22 Nov 2024 14:05:10 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=cc3da1955c16df5eb0019e0fef810696b035b7cf commit cc3da1955c16df5eb0019e0fef810696b035b7cf Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2024-11-22 13:51:37 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2024-11-22 14:03:40 +0000 dtrace/amd64: Make invop providers usable with KMSAN enabled - Use a fresh context when entering dtrace_invop() via a breakpoint exception. - Mark the #BP trapframe as initialized. MFC after: 2 weeks --- sys/cddl/dev/dtrace/amd64/dtrace_asm.S | 8 ++++++++ sys/cddl/dev/dtrace/amd64/dtrace_subr.c | 3 +++ 2 files changed, 11 insertions(+) diff --git a/sys/cddl/dev/dtrace/amd64/dtrace_asm.S b/sys/cddl/dev/dtrace/amd64/dtrace_asm.S index 4c18fbf08220..217d8c2936eb 100644 --- a/sys/cddl/dev/dtrace/amd64/dtrace_asm.S +++ b/sys/cddl/dev/dtrace/amd64/dtrace_asm.S @@ -58,6 +58,8 @@ ENTRY(dtrace_invop_start) + KMSAN_ENTER + /* * #BP traps with %rip set to the next address. We need to decrement * the value to indicate the address of the int3 (0xcc) instruction @@ -77,6 +79,12 @@ call dtrace_invop addq $16, %rsp +#ifdef KMSAN + movq %rax, %r12 + KMSAN_LEAVE + movq %r12, %rax +#endif + cmpl $DTRACE_INVOP_PUSHL_EBP, %eax je bp_push cmpl $DTRACE_INVOP_CALL, %eax diff --git a/sys/cddl/dev/dtrace/amd64/dtrace_subr.c b/sys/cddl/dev/dtrace/amd64/dtrace_subr.c index 09b820241e50..81aa53d00bd8 100644 --- a/sys/cddl/dev/dtrace/amd64/dtrace_subr.c +++ b/sys/cddl/dev/dtrace/amd64/dtrace_subr.c @@ -33,6 +33,7 @@ #include <sys/systm.h> #include <sys/kernel.h> #include <sys/malloc.h> +#include <sys/msan.h> #include <sys/proc.h> #include <sys/smp.h> #include <sys/dtrace_impl.h> @@ -68,6 +69,8 @@ dtrace_invop(uintptr_t addr, struct trapframe *frame, void **scratch) dtrace_invop_hdlr_t *hdlr; int rval; + kmsan_mark(frame, sizeof(*frame), KMSAN_STATE_INITED); + td = curthread; td->t_dtrace_trapframe = frame; rval = 0;