From nobody Thu Oct 12 10:15:31 2023 X-Original-To: dev-commits-src-main@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 4S5lrh3sW8z4nhfL; Thu, 12 Oct 2023 10:15:32 +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 4S5lrh1j1dz3Tqy; Thu, 12 Oct 2023 10:15:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697105732; 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=SGhuOgV+M3UpAFBVXjEWUTkv96qGx4l90ECrpwds5HE=; b=apSc3amuUg+YK0nfKLSDby/gRJvPGIqSN5/vQif/4EYw9Xrkxs0/z00aCmrWEFlIVX8I6g G1EONcxD1gJCyVuorEdJ+xoYowbtGUHCgQPcCpJMnFXJHszeB67ub+8KaarYQ1BGENQ4M6 2e1QX/v6INMzXFgXDi5AoC7NSt54HklzR+RH8RDDn/TrZOl5rrsNT9svm9aErToS+2ESvB gIPHAQTOxbd+702PZziQWnmQrlHvKJ3/32XQzSXrrf9o4psM71W4Wf3HhNoLC9RLfb6GdR oD6K/8NVYOHIwF3aeMD7VsMWpuc+sZbJdn+fzktVcwuloa/VVk6krtVB44yFOQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697105732; a=rsa-sha256; cv=none; b=DsQDmxFZ03Xg0vu/4hZsRfEllgVteVnLtxqmoOa+oWauhTGJx9dsKFnFyzuP1cyz8bMh6/ 99s/u2e2PZJjGDwxFoN2yWWdYJFZ/CWkUOpFzXENOOwv6bAPr1FWjZVP4wH6RIfCZf8eCi fw8w55zGA+fI6IZkGAl/LGgZq2aSQ1XhVsQ0WUANIkk2aoz6bKVkXPtSp4g0w+GetfOvDO JGuh5o8Uz+WNoQfFNj2DYyAUVsKEKFDRfvOi8OAjfgk7z5+dSUEDFo7dLa0HDRd/zqneku Qf6reaS78ERg76g4gFJbaPfUVLfBeq/Jd/5yVEXYKjF/6wS5ZA6GSlTl6OgR6g== 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=1697105732; 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=SGhuOgV+M3UpAFBVXjEWUTkv96qGx4l90ECrpwds5HE=; b=cyo6v4QXLK9FpvLghjw7ta8k5hDnwqxWQuBTVxwTgtyQ3e/3ej+DN6xOoYK45gKiz/L/Gy LMZGEqtpE4zE/Vxl4xIARLMkfysaLE/wHJYyNRCnWBTYuJABKNat56uLvATQcdr93gLS4/ 43IpXm/j66eh7vY865Z4DHHWOGlgrIuSUoMIDG2c9UPDiWDMN078gXxEQ1393BmFfElqGk T19WrO1wC3uxyAO5nXmngV+fj6u1g04XPUqjZo53Q33+8idJ+4Im0sp5aYvw6ivOh3Ry1Z 8eJoS0bESk5BFk1ARMz62VVyvT0+bmui6PBjPbLneTTNz4zmsMYQBYt12LsxmQ== 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 4S5lrh0W6Tz10Tv; Thu, 12 Oct 2023 10:15:32 +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 39CAFV1C073279; Thu, 12 Oct 2023 10:15:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39CAFVoQ073276; Thu, 12 Oct 2023 10:15:31 GMT (envelope-from git) Date: Thu, 12 Oct 2023 10:15:31 GMT Message-Id: <202310121015.39CAFVoQ073276@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 1d2b743784f7 - main - kmsan: Add corresponding sysctl knob for loader tunable List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 1d2b743784f7527a6840fe35ddb7e34cd41bc17a Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=1d2b743784f7527a6840fe35ddb7e34cd41bc17a commit 1d2b743784f7527a6840fe35ddb7e34cd41bc17a Author: Zhenlei Huang AuthorDate: 2023-10-12 10:14:49 +0000 Commit: Zhenlei Huang CommitDate: 2023-10-12 10:14:49 +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 --- 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; } /* -------------------------------------------------------------------------- */