From nobody Mon Nov 13 03:57:36 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 4STFxs0Mrtz50kf8; Mon, 13 Nov 2023 03:57:37 +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 4STFxr6ykRz4GVY; Mon, 13 Nov 2023 03:57:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699847857; 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=1nSGBq3dZNmbMK0ZRmGl6qaMe4QrqPCi4WaA1HHA/JU=; b=siPSgm19fC5oPyU15Afgya+KHzwTCjjbxEJXplfg5WS1xhXLXwpqhaCWQr4U388vV6m35F N4GOi2McqyzclgIfJ9dZfGqp3CDviPsA8K5jP6GQgxi6f1k6EbQFXIqZJnZ0gtyL7VdGav V7JD8SyJK++f8zw7FwwxaeoEJFeGVXZEMP+kN4sel/YzK4mhtbMvSNYuAoOwuqV+Mmmazm 3fobabgqHRBB9iZh9UxmB5QmFRKDKPB0URev2UYo8x/wlke7bWN0qV0r6Sc4ZhE6qpA5zP gtinVkdLjgyI9JqeKCGnm/4QVF+m5dCkBVvQSaUg75rAzmZD5Z3JxAaPnUClXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699847857; 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=1nSGBq3dZNmbMK0ZRmGl6qaMe4QrqPCi4WaA1HHA/JU=; b=t7glv5wJSEEFV8rdKxxPvGabLYOSiuzJ8Y3lGaHk9nYftuPryx52aiaq72btzW2yn4U6V2 MiAjdgJxaZ0CQq/fX1oX6oeNbNRqcs69vETPM3YbdP9U9MRJjUayb4hoddwalh4FDXz/XQ alSnHBIgrJImfiNvABS3KqiApo6Bj6KpokiwyTG3WSGShh0Mg7NILC3FfcGg82SXHnzNR5 r1xUmGvEaGmRs9qZ4zKbWUupc8SFnBDMHU7DnhltFyI2qnC5chc24MjKG0JII05H2eVW0+ bHOasR/462KjY8lTZx8EInwhTPcazjIK1dVYzUymNe2OaN99ny3zaQKCQ0ryMQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1699847857; a=rsa-sha256; cv=none; b=rixvzrs/hlwkweBhet1QzpBypeRoMUiLW1dEiS15p+fmlY97OgpBC2Bi78bG/szbJ+ShsF 6iqntrepcIEgLdfIXgbQ3vqFlml4Yuc6q07MGL5qFGpObXpehCTwDjIgu8U4Y8eNYR1YPZ 22Uwr6szENbQcGyD2wqFqhyzxnA8EQHiXZDTbLMNuPPyv7BCdRK4Es+dswOdUH1X1s4W6q wyRO2V2SQSPsJU1+kwMZpDYdkKGbMw1mjp2Zuk6CLRFtUYsFFJrnZYJ0IazlpXUGjcCUOF HtiQIeiWl8ruZeIgnr4zUutzJHpPEWvW5baZh0f7F2KWrO7UGJ7i3nJ2e3sXBw== 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 4STFxr63x1zqTH; Mon, 13 Nov 2023 03:57:36 +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 3AD3vaP3009070; Mon, 13 Nov 2023 03:57:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AD3vaw1009067; Mon, 13 Nov 2023 03:57:36 GMT (envelope-from git) Date: Mon, 13 Nov 2023 03:57:36 GMT Message-Id: <202311130357.3AD3vaw1009067@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: b388201875bf - stable/14 - veriexec: Simplify the initialization of 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: b388201875bf28939cd32cec6bd786bf0667956d Auto-Submitted: auto-generated The branch stable/14 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=b388201875bf28939cd32cec6bd786bf0667956d commit b388201875bf28939cd32cec6bd786bf0667956d Author: Zhenlei Huang AuthorDate: 2023-11-03 04:08:27 +0000 Commit: Zhenlei Huang CommitDate: 2023-11-13 03:56:57 +0000 veriexec: Simplify the initialization of loader tunable The loader tunable 'security.mac.veriexec.block_unlink' has been already flagged with CTLFLAG_RDTUN, no need to re-fetch it with TUNABLE_INT_FETCH. While here move the definition of sysctl knob out of function body, which is more common in FreeBSD. No functional change intended. Reviewed by: stevek MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42132 (cherry picked from commit bb8d4411e0c668415538f66fb25e6b38bb910cdd) --- sys/security/mac_veriexec/mac_veriexec.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sys/security/mac_veriexec/mac_veriexec.c b/sys/security/mac_veriexec/mac_veriexec.c index 57f3b6c307fa..7ac09e2acf0f 100644 --- a/sys/security/mac_veriexec/mac_veriexec.c +++ b/sys/security/mac_veriexec/mac_veriexec.c @@ -105,6 +105,8 @@ SYSCTL_PROC(_security_mac_veriexec, OID_AUTO, db, static int mac_veriexec_slot; static int mac_veriexec_block_unlink; +SYSCTL_INT(_security_mac_veriexec, OID_AUTO, block_unlink, CTLFLAG_RDTUN, + &mac_veriexec_block_unlink, 0, "Veriexec unlink protection"); MALLOC_DEFINE(M_VERIEXEC, "veriexec", "Verified execution data"); @@ -797,12 +799,6 @@ mac_veriexec_init(struct mac_policy_conf *mpc __unused) EVENTHANDLER_REGISTER(vfs_unmounted, mac_veriexec_vfs_unmounted, NULL, EVENTHANDLER_PRI_LAST); - /* Fetch tunable value in kernel env and define a corresponding read-only sysctl */ - mac_veriexec_block_unlink = 0; - TUNABLE_INT_FETCH("security.mac.veriexec.block_unlink", &mac_veriexec_block_unlink); - SYSCTL_INT(_security_mac_veriexec, OID_AUTO, block_unlink, - CTLFLAG_RDTUN, &mac_veriexec_block_unlink, 0, "Veriexec unlink protection"); - /* Check if unlink control is activated via tunable value */ if (!mac_veriexec_block_unlink) mac_veriexec_ops.mpo_vnode_check_unlink = NULL;