From nobody Tue Oct 24 14:37:42 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 4SFF5f5HS4z4y6m8; Tue, 24 Oct 2023 14:37:42 +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 4SFF5f4M5Vz4l1p; Tue, 24 Oct 2023 14:37:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698158262; 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=hZv9DVCFIsGTkOkdS+jNfpn6bbhJdPkPbnerbB8qY1g=; b=Lgu5U2yh2qsfBUlTPZuVXvFsa6CHyTR8JXAUs51GW4UDQH2jvDdctuAAovFLMtAJa/4Xxd ghoClcukXSfao/HD9Glxv2bCr1q7UQGye07RaCH05wJ27Fk2PoUwu4iMUvQxTLwL8w1uvO PEkEzY7rgfa36hn4MoUoH4GxerS4TQO+dVGeWsEmUnb0Juhx3S2XVxHt/txnVyufTngta3 wvyUyRr8TosecYV5ssoEwE5dqNR/51IN7EjLFuA8KHt3Y1aM8GQ06M5jAABCrY+NHiGUX9 fRpGo3hcolDaPUGibItLzXEDOx7GHRSIIC9WtU/pa8dxNcODyeCs3F+8vWSkCg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1698158262; a=rsa-sha256; cv=none; b=OCfz/KMz6F89/CmP6/VJIT+b5qO9CTVveUx5aLgQXlK1TBgksYCuVb5WNLcTHBDc9o9DB2 GCf3l6tVzsimDwp4CRYXBazG34emktzc/rpiVAkGwgLY6E9MyVEfis6LNRzMcSBT1ZXLxY RAFCKDvab7z5lBwScOdVCqdS+dym/kfB+WRPJvJIzaGF3Y9oyZ4AmbqaYLtLQf5TwW6phW VmjBPSdoEmECaT7SYiA98aYLciwLQ1sT0JAZ7AlWVecmpq2mcueTeK443yhFxm1B/H0/bv bhWIFpzu4k4UgvItDSqnWW9+KT3bpHzj/Q7nZEawL2MWK8FbgDHY7tVZ+L9yUA== 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=1698158262; 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=hZv9DVCFIsGTkOkdS+jNfpn6bbhJdPkPbnerbB8qY1g=; b=Gb5f+Rw24AKkUkJsi3CFFRUGddpupm+ghNa25lVitaY5uuThprJ7LPCfRiEP5gdgj7wnud FICyeLAx3ay484lu/bcce3IOIp9glybMZgvHwi39ca7LygNNtwfxxFQW9hieJy6F6iijPH sRNCfglMXotvzDkx6T08Gfm+S/TZiTBEwzCpSaFvfZFDHZKf/9uO3Ua8T3HAbfHgSkm25i KDsmD0sNRGOoljMIBwuVa3mwxPhl+e6U/XKZZzI5ihpT10ZxSzT1J7F9J8iwCRhupwFXxx +OYp9L/zA3nOPDXB07lFMMGKZdQmD9os8TLiBYsP1G0EjZLgoS18J5pmRWeY6w== 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 4SFF5f31p0zBt0; Tue, 24 Oct 2023 14:37:42 +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 39OEbgeN089495; Tue, 24 Oct 2023 14:37:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39OEbgls089492; Tue, 24 Oct 2023 14:37:42 GMT (envelope-from git) Date: Tue, 24 Oct 2023 14:37:42 GMT Message-Id: <202310241437.39OEbgls089492@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: 5edc166571c4 - releng/14.0 - 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/releng/14.0 X-Git-Reftype: branch X-Git-Commit: 5edc166571c44e61140e3b0cc8105c2a63bd47a4 Auto-Submitted: auto-generated The branch releng/14.0 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=5edc166571c44e61140e3b0cc8105c2a63bd47a4 commit 5edc166571c44e61140e3b0cc8105c2a63bd47a4 Author: Zhenlei Huang AuthorDate: 2023-10-12 10:14:48 +0000 Commit: Zhenlei Huang CommitDate: 2023-10-24 14:35:51 +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 Approved by: re (gjb) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42138 (cherry picked from commit db5d0bc868be669ed6588ebeccf8c02e76aabc41) (cherry picked from commit 6f8ef4d6e44ee27a08c14ab6a892ffccf332bcf7) --- 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; \