From nobody Fri Nov 22 14:05:10 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Xvxgp6KLxz5dwyq; Fri, 22 Nov 2024 14:05:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xvxgp4qgYz4x9h; Fri, 22 Nov 2024 14:05:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732284310; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rh1kFPKVTKPpakge8A9oxgx7BMfe8XMt7gBmP2AZYB4=; b=e0etBCSnFr5DUomOVOcjsVUtdO7Ew+24WcHALiQ+6qCFYVkzeLEzklLqR4ek4BgAjYog3C BORX0B7DyMk1H2g7TNVF/T/RO4kdHJMFvcz6Gc4gkFO+9UJaReX4VYgLks6b9MIwjs/G1Q r9gjtu4X6RobH2eTjyNPaDmNI273e3TqzFDFKDJOwkL0YrgHHMXOwv45LhY0owBKkK10b0 YFUYzn2dffpm2SJDO5BOTEOVsJaGU3heycfJ+Q7U3hzoJBR5I2WQEKwsAKFtpFgrHRdqjw mF3MVb7aF45OKpZMMrInHDRUcO7Y7uGKjo3SS6xkaqTE8vB+Uc1t3wTSRmyGTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732284310; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rh1kFPKVTKPpakge8A9oxgx7BMfe8XMt7gBmP2AZYB4=; b=Do9KEhipbgNJeH+V18ZTbaVGSQwIuoUhna3r9rvrLGB91JJzVXoxEH1XRgw2wxZTj2dsYa LRa104ZHfFwrANvayeNrz8GprJWQJejqG1AGawMk330x41vkp98Oo+BIO31SKwuMHWH8td ewTtmj3GCnoc1ZaPOPLf5o25OOKfJ/BXLwcghBKMviPXY54PB7n+WyML2kMTGNN3r+/dSN VRP9vvYMvUYbaDlCevMG8jbEdKGpJuwFwDZyq2WDLBbhsuf1OYrAnXT87iKQNljAZNJsBQ JrUOt7ChhNdV0AoPu07Lb9K6wFT3bYz2sVYpSrScQiMxaYjIxX1Oo8oeEt8iHw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732284310; a=rsa-sha256; cv=none; b=G8Jbjv9cYRsVBCRiDFF7Eut7dmUazQjSoPc/u9w+Ovp+xCP7T0VA4roB+gnwu/jHz0fb4w IWk+s5f3zP8nCxtjeY3Uu3kK+Tg+1qUNnqAs1ghi3mewiEUwG07+jrfzkXnph5f6wGLVzJ qTBxMrHORnNK0o80ZPziz7KVWhclFXvCEIUlCbaPHHtKuN3kuw+kR6fRRIpUR08ykReH4+ pTL3gK1cEN+p9ctxr2O6ykzSe6tQuNUoYPWmNtVA0Fh46a3WgQjLe0GrgRfZ0Gncd7J3PE X7LkQoefsftRIvikYqg3Svj7scyfAmaN73WQQ9rzItrH33dFj5oW9EXnV+/Uzg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Xvxgp4RH6zS1Q; Fri, 22 Nov 2024 14:05:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4AME5AUD065123; Fri, 22 Nov 2024 14:05:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AME5A52065120; Fri, 22 Nov 2024 14:05:10 GMT (envelope-from git) Date: Fri, 22 Nov 2024 14:05:10 GMT Message-Id: <202411221405.4AME5A52065120@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: cc3da1955c16 - main - dtrace/amd64: Make invop providers usable with KMSAN enabled List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cc3da1955c16df5eb0019e0fef810696b035b7cf Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=cc3da1955c16df5eb0019e0fef810696b035b7cf commit cc3da1955c16df5eb0019e0fef810696b035b7cf Author: Mark Johnston AuthorDate: 2024-11-22 13:51:37 +0000 Commit: Mark Johnston 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 #include #include +#include #include #include #include @@ -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;