From nobody Fri Dec 13 01:43:57 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 4Y8XDt21vrz5h24T; Fri, 13 Dec 2024 01:43:58 +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 4Y8XDt0TkVz4jJM; Fri, 13 Dec 2024 01:43:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734054238; 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=WBdavUopBnWjxbzw7ejg+duElCW1qc3etK29AinaJr8=; b=aX/7xSZ3fyWIWDWC61qbpA9wMgLh2X+rL7wMyfHeZ08uXzsjTueTBF4WxCutUKzl/AICg6 p2QMBl5gX3D3HjEryN+1BpuXb0mcwIHt8cu4JQcwr/qiZ5C9oD8PYgfAhBy0/3P5PCgXNn 7sjRGlJBfEHPfX1ieMGBr7IbUzkS4Ga9pY0kJmZ7sKOEML9pNYtaWJuPBjmWZmzfcbrG7a kS9lV993bz4GA5MYfBoUR2s4eOrMuLo2h8osc8aRYiwuarsERcpQ4uG7FNLuvf/geX/vSH c6ctPaPJ6zNE4svp+cA/EzPJnzEUJSY6T4gbeeCW/xb/U4wM0mwZEzfbvJG7Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734054238; 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=WBdavUopBnWjxbzw7ejg+duElCW1qc3etK29AinaJr8=; b=afTPeKbRANm1Sv+AMv7i8sOvPpHahnwwxkpMkguR0Ee5b31BbBrZzyAjdjgYcorD8bhNhV lhNgzN40fb9+mcJ1mXacXpyIZM/XUBlJxwpaM77aw5xp7OGT2noAJtcsqqKJRRHvKQsjfx dDk0+YMuUk2ZW9AMWwS6aqLMDoaAIOZ/gh9YpJ8HxkNBg+Gh7uceR/Ucmu+kgJop1ZPncc ex4NMIxz6JyUhAzhEexwG99x6S6WGbteYmxTLktOYW5bm0uEPYaAJLTZzO/8qC45ilSohy 71Oq+8lsbQyGLaYpLBHMEi2mQeY4eCLTNPMlUbUejDt00aQahOuI1eESDHCf/g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1734054238; a=rsa-sha256; cv=none; b=Awj2/tmclRkjtFWZF12ojoTidjAJ00RCWY/efnTKLNdeE8EOYek4PLGuO0kuPpWEH8FKT/ 2bWxjqBITF/DlnFzUIKxT3Blc8kOiwSHU1czqT4ft41Yd1dTwEIRavqcxGxHmizpBD6D4R kcJ4N6Kv+OjaZK8PB6ONG57kK18TEQgVP3fhs6bbG8JYcVFQx6TberksJfLU8r498uB2hR LVH7Ovn30n0kCELhMLrhSoYU66NdbuANMpvVMeISxUAKpNDUzMtUBhWeE5rD0NfU9dojfc Quc038XGAVn7W3wMTNa270dnhBLBLlkV2JY9d4rKGizKBLBhCA6XD/BdP3kU/A== 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 4Y8XDt04tXzHGr; Fri, 13 Dec 2024 01:43:58 +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 4BD1hvYQ033735; Fri, 13 Dec 2024 01:43:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BD1hvXI033732; Fri, 13 Dec 2024 01:43:57 GMT (envelope-from git) Date: Fri, 13 Dec 2024 01:43:57 GMT Message-Id: <202412130143.4BD1hvXI033732@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 8e3c0a69fed2 - stable/14 - livedump: Silence KASAN and KMSAN when livedumping 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/stable/14 X-Git-Reftype: branch X-Git-Commit: 8e3c0a69fed2805157f61c5024e0948b48f80559 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8e3c0a69fed2805157f61c5024e0948b48f80559 commit 8e3c0a69fed2805157f61c5024e0948b48f80559 Author: Mark Johnston AuthorDate: 2024-11-25 21:11:37 +0000 Commit: Mark Johnston CommitDate: 2024-12-13 01:34:14 +0000 livedump: Silence KASAN and KMSAN when livedumping The livedumper triggers reports from both of these sanitizers since it necessarily accesses uninitialized or freed memory. Add a flag to silence reports from both sanitizers. Reviewed by: mhorne, khng MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D47714 (cherry picked from commit 37cef00192ef1347d27ac64be419267a4ba604ac) --- sys/kern/kern_vnodedumper.c | 2 ++ sys/kern/subr_asan.c | 3 +++ sys/kern/subr_msan.c | 6 ++++++ sys/sys/proc.h | 1 + 4 files changed, 12 insertions(+) diff --git a/sys/kern/kern_vnodedumper.c b/sys/kern/kern_vnodedumper.c index 0104369b9d67..78979f906abd 100644 --- a/sys/kern/kern_vnodedumper.c +++ b/sys/kern/kern_vnodedumper.c @@ -117,8 +117,10 @@ livedump_start(int fd, int flags, uint8_t compression) if (error != 0) goto out; + curthread->td_pflags2 |= TDP2_SAN_QUIET; dump_savectx(); error = minidumpsys(livedi, true); + curthread->td_pflags2 &= ~TDP2_SAN_QUIET; EVENTHANDLER_INVOKE(livedumper_finish); out: diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c index bd143a816932..c934ff83874e 100644 --- a/sys/kern/subr_asan.c +++ b/sys/kern/subr_asan.c @@ -395,6 +395,9 @@ kasan_shadow_check(unsigned long addr, size_t size, bool write, if (__predict_false(!kasan_enabled)) return; + if (__predict_false(curthread != NULL && + (curthread->td_pflags2 & TDP2_SAN_QUIET) != 0)) + return; if (__predict_false(size == 0)) return; if (__predict_false(kasan_md_unsupported(addr))) diff --git a/sys/kern/subr_msan.c b/sys/kern/subr_msan.c index 029c5ed8df96..b596443de2aa 100644 --- a/sys/kern/subr_msan.c +++ b/sys/kern/subr_msan.c @@ -179,6 +179,9 @@ kmsan_report_hook(const void *addr, msan_orig_t *orig, size_t size, size_t off, if (__predict_false(KERNEL_PANICKED() || kdb_active || kmsan_reporting)) return; + if (__predict_false(curthread != NULL && + (curthread->td_pflags2 & TDP2_SAN_QUIET) != 0)) + return; kmsan_reporting = true; __compiler_membar(); @@ -232,6 +235,9 @@ kmsan_report_inline(msan_orig_t orig, unsigned long pc) if (__predict_false(KERNEL_PANICKED() || kdb_active || kmsan_reporting)) return; + if (__predict_false(curthread != NULL && + (curthread->td_pflags2 & TDP2_SAN_QUIET) != 0)) + return; kmsan_reporting = true; __compiler_membar(); diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 3815571cd46f..c43d00a223f7 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -568,6 +568,7 @@ enum { #define TDP2_COMPAT32RB 0x00000002 /* compat32 ABI for robust lists */ #define TDP2_ACCT 0x00000004 /* Doing accounting */ #define TDP2_EFIRT 0x20000000 /* In firmware (EFI RT) call */ +#define TDP2_SAN_QUIET 0x00000008 /* Disable warnings from K(A|M)SAN */ /* * Reasons that the current thread can not be run yet.