From nobody Fri Nov 03 04:09:48 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 4SM6hX4n3Pz4ymWV; Fri, 3 Nov 2023 04:09: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 4SM6hX4Kplz4Ryd; Fri, 3 Nov 2023 04:09:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698984588; 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=/b1wu9MAWUeqTdUqrr2nRAvqgrwzWdYESGT8dj0jJRU=; b=NppP0+UFaQFTPVt8fBkUP90ahpCWSWLM2M0y25KgU+X5Wr9so0cgW2nKNYbR/TAIENeslT bM5aTbf6jAZrxpRSYL9+76OvDRUGfqo9bbxOBWkZXUgrHbQ80PABjwFjHdRN3wAVvCt/4V J1j425jt/TuNkS4yoBQPd+3+kgdEIbfGvot2nHgTEc8p0fUfGhqkbYxmHfkp6BQqlUHYOx 9bZkJ9UcvuTV2yYj0c25nIv9LdvAq4GTbQOfgnlv8ntqov/r/8GGYj0PBUrCLZlnWhIUDn rAVFEi+JUShbvIPH5RgJmKUsWJvtWwG3KNqh00CoBGOfwF08nOeSOyOFd4xbCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698984588; 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=/b1wu9MAWUeqTdUqrr2nRAvqgrwzWdYESGT8dj0jJRU=; b=xuMzer8IxEdBAXdVc20OMTVuYu2P6Qm90HbKNJS3NFKtpufKTrDr9dO8greSKfpIa58DT1 QDbWO2UcUD9GARbKVa6yY3zli2/rQC44nT9U5lolxDWnFau4bQbtKi3cIJ7hzQeeywSy2Z bSb1EQDsDk0MvRatc+aUP8O4+hUps04SBV6VgwGxvTizLuJI39+obsPiC3ht1DxwP5Zl5M qlrscckFioDJNTkj9GtXsCXhicRZMvmEjsef5FCUbikldmWnp0nXwaIzRSUytHLb6dG3IR 4O3ZtKZuTp/x1XZUvETGFsO4DLf0C99NMp7NEVlBv/4mfHJaLtgX+YxV1No9Ag== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1698984588; a=rsa-sha256; cv=none; b=wSzkkN1jVa0vZwUOHvEUuU+PwiebnANS4BezZ5oIkE/66TbSg2AQ7yScMYuhJpy3fP6rYB gzXjxRiYnKLIt70TnKPVtbBUxVfvlHYyAaKTDAYbUjfyA4EzRegKpSM4Y24JpvHQmN0x3Z fWISkg0b304z/HxNeXKnIhg/uuEwSmYmYyt0p0J8fgiiZovWEw/fOSoiypKH+/UrV5Si1G mHtRXUxj7s1AGnrc9YlBO3unUoaQ91gAsz3cf0doycxuyTQLy7Oj5QLbybTPjJtq4WX0JP 7LfCFBR1xHSM+TuDGm3cXn3xYuoq4qKFLXVpIvPs0Rbcj3T97RFsRSsxZHz/ig== 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 4SM6hX3GvYzxZ5; Fri, 3 Nov 2023 04:09: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 3A349mqk080947; Fri, 3 Nov 2023 04:09:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3A349mEg080944; Fri, 3 Nov 2023 04:09:48 GMT (envelope-from git) Date: Fri, 3 Nov 2023 04:09:48 GMT Message-Id: <202311030409.3A349mEg080944@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: bb8d4411e0c6 - main - veriexec: Simplify the initialization of 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: bb8d4411e0c668415538f66fb25e6b38bb910cdd Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=bb8d4411e0c668415538f66fb25e6b38bb910cdd commit bb8d4411e0c668415538f66fb25e6b38bb910cdd Author: Zhenlei Huang AuthorDate: 2023-11-03 04:08:27 +0000 Commit: Zhenlei Huang CommitDate: 2023-11-03 04:08:27 +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 --- 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;