From nobody Thu Oct 19 14:02:48 2023 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 4SB8Yj4XL5z4xT7R; Thu, 19 Oct 2023 14:02:49 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SB8Yj12qyz4Ryj; Thu, 19 Oct 2023 14:02:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697724169; 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=GuoGWudm8vV1CwfvkAldB+e98TXHAZgf0rXrvnso+84=; b=KnmiNvGPO70yFhit/GpswXcPuCEq0CGgZFlgpC2BeoURI33DnqdKNoz6JnGUja/MqyhkQz v0hz56ZMK2Dr7Tv0TpwVtNicZVHZdutH42uYHjPrtQ0NofHOV9sQ7o6OfisAx0Cd3sDlhw V9V82jg/hkbxhThD+oloxqzjL4Gv2+17eqMOHMApH50lSVXQ8pDehdkI0vRvCRIuTRi3A9 z2zW0Uwh1kufqssWaZt22K5CzqHP3KVLPsaV9vVMxhYcKQMtkluDzfW27GUgJJ/y/1LxB4 rLTQvFjRZe0rT8SHPcuVSFEHAIQ0qm5Jk8mcBzHXWSCUfKoKsZR8C4Po5Vl32A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697724169; a=rsa-sha256; cv=none; b=NX3pFPQbWhmUvm5NzQezUaMl/XXNqwMKQRsn/5FfUky9FZsWfZlbUFmpUWIhdAbDQMo0kv lR8AtxRGs1yrOrIxoDqhfcnd/Ooy6T3d5zy4u+Q++YKaw+F5Th7JyzUy8zc8RM1CphLdfG 6Ted4TvI7wq7aHIUUvxPiodwTEhjUMNMQFQS4z82iMLtWB06uWOACS6LOuCDrW3r1M307M 1EHhWlC3y38bM/r3PhqEj6QSa0tTLtSp1KvEQbiDdxkR9kqYY2wDeGrI4YuQDAm8JSWuzb 2SmYSHrmgVlfLJcD343JoNJGKD9OXWq+XVjJiU1f6gfTvf8ppowxfXWP7QIKlw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697724169; 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=GuoGWudm8vV1CwfvkAldB+e98TXHAZgf0rXrvnso+84=; b=nZ7i1IzOvnz9Y5N5p4XML2QrM2/swKIP2r5jxGhY/i3crki1ODG7H2ijP8+zb4Br1VllZU /73tOGar6C5ahdDmXXlnhxVlNMn4Hmv8iJi1wZaVhs2funHbVbekq0GW1d0SUkghAzmMRR UXNKQZ3ZjnE95rdpPEanx3SndGKwvpApy813KaxxDbwL2iXzS3SEZEAKEzZbnUz/RL3cGt 6FHFlpDng0Jep/Zeehjo8BqjT/bhOnK2/7ogdzxPEics0A3phcwBj+7AH9G2BpaaKZEZ7I N88YaKp3KkmIkc7MWoViA9qgPGAdjihX5nifgSLeH+b5iCJezrUZj4JDv1vteg== 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 4SB8Yh74kNzsTg; Thu, 19 Oct 2023 14:02:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39JE2mcb044859; Thu, 19 Oct 2023 14:02:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39JE2mqN044856; Thu, 19 Oct 2023 14:02:48 GMT (envelope-from git) Date: Thu, 19 Oct 2023 14:02:48 GMT Message-Id: <202310191402.39JE2mqN044856@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: 1b289728e93d - stable/14 - kmsan: Add corresponding sysctl knob for loader tunable 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1b289728e93d1000e6ca03354c8bc4209ea8da51 Auto-Submitted: auto-generated The branch stable/14 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=1b289728e93d1000e6ca03354c8bc4209ea8da51 commit 1b289728e93d1000e6ca03354c8bc4209ea8da51 Author: Zhenlei Huang AuthorDate: 2023-10-12 10:14:49 +0000 Commit: Zhenlei Huang CommitDate: 2023-10-19 14:00:56 +0000 kmsan: Add corresponding sysctl knob for loader tunable The loader tunable 'debug.kmsan.disabled' does not have corresponding sysctl MIB entry. Add it so that it can be retrieved, and `sysctl -T` will also report it correctly. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42138 (cherry picked from commit 1d2b743784f7527a6840fe35ddb7e34cd41bc17a) --- sys/kern/subr_msan.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/kern/subr_msan.c b/sys/kern/subr_msan.c index 57caeb454b42..54948370a14a 100644 --- a/sys/kern/subr_msan.c +++ b/sys/kern/subr_msan.c @@ -108,15 +108,13 @@ static uint8_t msan_dummy_shad[PAGE_SIZE] __aligned(PAGE_SIZE); static uint8_t msan_dummy_write_shad[PAGE_SIZE] __aligned(PAGE_SIZE); static uint8_t msan_dummy_orig[PAGE_SIZE] __aligned(PAGE_SIZE); static msan_td_t msan_thread0; -static bool kmsan_enabled __read_mostly; - static bool kmsan_reporting = false; /* * Avoid clobbering any thread-local state before we panic. */ #define kmsan_panic(f, ...) do { \ - kmsan_enabled = false; \ + kmsan_disabled = true; \ panic(f, __VA_ARGS__); \ } while (0) @@ -142,6 +140,11 @@ SYSCTL_BOOL(_debug_kmsan, OID_AUTO, panic_on_violation, CTLFLAG_RWTUN, &panic_on_violation, 0, "Panic if an invalid access is detected"); +static bool kmsan_disabled __read_mostly = true; +#define kmsan_enabled (!kmsan_disabled) +SYSCTL_BOOL(_debug_kmsan, OID_AUTO, disabled, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, + &kmsan_disabled, 0, "KMSAN is disabled"); + static MALLOC_DEFINE(M_KMSAN, "kmsan", "Kernel memory sanitizer"); /* -------------------------------------------------------------------------- */ @@ -599,7 +602,7 @@ kmsan_init(void) thread0.td_kmsan = &msan_thread0; /* Now officially enabled. */ - kmsan_enabled = true; + kmsan_disabled = false; } /* -------------------------------------------------------------------------- */