From nobody Thu Oct 19 14:02:47 2023 X-Original-To: dev-commits-src-branches@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 4SB8Yh158wz4xTgY; Thu, 19 Oct 2023 14:02:48 +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 4SB8Yh0Hspz4Rs9; Thu, 19 Oct 2023 14:02:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697724168; 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=KWfeeH9iiSfY556+aEo8GF8K9q6QRI0iSIxi7GsMxPM=; b=BVIHCGn4kUrNzauAqEpDqkTAsBvCI//TfzSN5V5uZVqUgEpcdRG3DW5tAdHvOnv9t/D7Bn XZxtizq2dVz8vkjVAeAEfS+RBgIel5xgvIws/GdgdfhJGMD2xWM2qVNVgzPQJXPhCUO2Mf 65+i3tSYv5TBYd6/3Z6iZp+nHav8CskVytS5RTp0T/nYjiBVrCGzAbyHdgQvSEDdD90AoO PGrXx+YakvVzumFdD4FZTmXQd52F6j3/iUDdYDEUvcNe0dHc/Qzr61olbktYmA0ngw9uK+ iL82rYLoDz4rPhcCcP8FCA3WzdD9+/8btKfTLDf/xrr9nUACjFpDAizQBrz2Xg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697724168; a=rsa-sha256; cv=none; b=AgX5pch244pLbN3XX6MmiYO2VLtW2gvY+R62bnRDnh8r+ikBIeT6GXL9GLHLUZzQFmdkK1 EsGsOUEggBvygSLCmB+89QTf/k7FHHZJgFtASHDdq3AMlgUxvhIO+BlcY+Z5acQb/XEwPv f0/bBf3lmzlSq7mdvGXol849LpwO7Au90Qrg1cX8E3d4A/LyRxBRHZvTNs7cDtw2USFmyZ 4+Grkj8cERuiq5MIlzTEp2QYnvk3gGUYlKC/RZmLTKoS55oRJwYMCCYeIsK9puEDo9gJvf cstA7Iu6hGnA9kKxoOzH49VbqoG3iIYw+rp9Iu4E8sVFmV9JRJ1JyALR1t7LcQ== 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=1697724168; 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=KWfeeH9iiSfY556+aEo8GF8K9q6QRI0iSIxi7GsMxPM=; b=pNYw3jCB+CuOYGdcz5v4zlPKmUSnIYoffLjk6TI+1tRKzXmzXbkUIzxqkb7T18LY5sf4tm jL3mqBmlGufxYh4M9PTSIwMd6iqdgRB36OvLLakNC50czCM08Jhm53dOFSju9AdFT4K8YW t93YlyZPKmhtYSffj91RHIqh3C+G7adk1v0EOVFz0CPnZ5tnVdzZpmqnjd/PccTwNFKXwa 8Z3joW2WBv0scPhGjPC3wCE/TxGcuhHuxnE8WZwmYwwie/SEk/2mee9qPJJYVISFKbz+oz RXHbl06VfBwcifeIKBgSYll4skJpZbLNztCv9GcNr2rpBWY2LDD8CE5DWRGQlA== 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 4SB8Yg6GFBzsc3; Thu, 19 Oct 2023 14:02:47 +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 39JE2lLN044804; Thu, 19 Oct 2023 14:02:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39JE2lMH044801; Thu, 19 Oct 2023 14:02:47 GMT (envelope-from git) Date: Thu, 19 Oct 2023 14:02:47 GMT Message-Id: <202310191402.39JE2lMH044801@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: 6f8ef4d6e44e - stable/14 - kasan: Add corresponding sysctl knob for loader tunable List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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: 6f8ef4d6e44ee27a08c14ab6a892ffccf332bcf7 Auto-Submitted: auto-generated The branch stable/14 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=6f8ef4d6e44ee27a08c14ab6a892ffccf332bcf7 commit 6f8ef4d6e44ee27a08c14ab6a892ffccf332bcf7 Author: Zhenlei Huang AuthorDate: 2023-10-12 10:14:48 +0000 Commit: Zhenlei Huang CommitDate: 2023-10-19 14:00:56 +0000 kasan: Add corresponding sysctl knob for loader tunable The loader tunable 'debug.kasan.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 db5d0bc868be669ed6588ebeccf8c02e76aabc41) --- sys/kern/subr_asan.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c index 44c96435a499..c3664d9cf6c2 100644 --- a/sys/kern/subr_asan.c +++ b/sys/kern/subr_asan.c @@ -92,7 +92,10 @@ SYSCTL_INT(_debug_kasan, OID_AUTO, panic_on_violation, CTLFLAG_RDTUN, &panic_on_violation, 0, "Panic if an invalid access is detected"); -static bool kasan_enabled __read_mostly = false; +#define kasan_enabled (!kasan_disabled) +static bool kasan_disabled __read_mostly = true; +SYSCTL_BOOL(_debug_kasan, OID_AUTO, disabled, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, + &kasan_disabled, 0, "KASAN is disabled"); /* -------------------------------------------------------------------------- */ @@ -136,7 +139,7 @@ kasan_init(void) kasan_md_init(); /* Now officially enabled. */ - kasan_enabled = true; + kasan_disabled = false; } void @@ -180,7 +183,7 @@ kasan_code_name(uint8_t code) #define REPORT(f, ...) do { \ if (panic_on_violation) { \ - kasan_enabled = false; \ + kasan_disabled = true; \ panic(f, __VA_ARGS__); \ } else { \ struct stack st; \