1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-29 12:03:03 +00:00

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
This commit is contained in:
Mark Johnston 2024-11-22 13:51:37 +00:00
parent 418d8f0dc2
commit cc3da1955c
2 changed files with 11 additions and 0 deletions

View File

@ -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

View File

@ -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;