From nobody Wed Jun 29 08:49:02 2022 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 6F46B86BB30; Wed, 29 Jun 2022 08:49:02 +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 4LXw9p2VMzz3Gqm; Wed, 29 Jun 2022 08:49:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656492542; 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=eXAN3+dIcfNOfwg2NXMq2f0tmhs7s8PqwnblyTGqYus=; b=sRf6BRZWhbgWFaSoFwhaJhGn6HncsROX20nP1uTqHSJNzWLMFskAAuo96f5ciCcWmSDJE6 Dvs1oxM+6H/H4Vlaoi+EMtv8hz0urL7rig8XzjBvHYQpa5NcCyVFGpwBFtEJ4ntf9AfnZa g4g6DW+uwF6cL22HI8vn2b08MMgnON31FXh43RGlK3DRIyGXm6h6GaBw3vn1FiGELVyagt JznaFdEK8BRrQxGl+rr+WLc9I+zD6qeUybpNZ/mRM0JLerdFAF51IRmO+/EwEVzR5fx04A ZHUdMpgDEk/mKzyCFh+akF8T8LMCOUsgl11diatdByxej3UJKFW2TQKwD/FexA== 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 3271B66AA; Wed, 29 Jun 2022 08:49:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25T8n2cG047141; Wed, 29 Jun 2022 08:49:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25T8n2Kw047140; Wed, 29 Jun 2022 08:49:02 GMT (envelope-from git) Date: Wed, 29 Jun 2022 08:49:02 GMT Message-Id: <202206290849.25T8n2Kw047140@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 15c362aeb778 - main - mac_veriexec: Authorize reads of secured sysctls 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: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 15c362aeb7784385cb464fa364cbdd7a1e64e787 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656492542; 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=eXAN3+dIcfNOfwg2NXMq2f0tmhs7s8PqwnblyTGqYus=; b=idtkpLijTi/Uo5XARbyPF+fFr8Y5SdDzjd21AkhzOwdxGnRT00oC8dHdGtGLicqZAnhJNB xLMFnx5p/RUf8W9y9O/eGRGPqyCc0PS6OSTLWD9m10/sU9DvhMjybVx2R6r06VmXjo2lVb z2+QQYqW5FQc0bgJCWJAoAscTCbYUUXvl0kSJMom1rL5rvsNVoIkvRUiRJ8L4FTmQra87W zOgEnJAd5deF3zWoGmedF4mh7T7gcJWHdlQyMqLokrPRzYFBN+sHFZ1QLjg8pYjk/vE3ZX SbI7KvLqfVIABP48oRDhbTuYFeTa4ABn77C7Uf/alszmG1S9UYloCPCxMUrYQw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656492542; a=rsa-sha256; cv=none; b=olPgjse7Rdt/vC/Q1C4qZbcXM54l7eDDfyi1nja6KIVuVCCru7FrfW+1h0VfUiroE0HhoH sV42umtErCIyjwI5tS2giOJsOUZ6QSyOQHMcurDlt66lQkvDU7eTYzkRhO4ToBjxj7j9d2 miKmXj056TOz6C98kAWMswxYTChYUm2An/9eF/E9ooJ5RrVnXst1isfz/KgzmF/PP+Itjd +YVrb6276NDGBVHUXh8Isr+gXi4orxHlfay9d4FbZ/4KVP1QEK3MqHn8Z7Xiae8QO2G2n0 rhtQGq+GFMRBzpbFjx78UeFPZpCXd09t4BNQ0KLAxkWDdIZSc1mv9mN+M+2w8w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=15c362aeb7784385cb464fa364cbdd7a1e64e787 commit 15c362aeb7784385cb464fa364cbdd7a1e64e787 Author: Wojciech Macek AuthorDate: 2022-06-29 08:48:01 +0000 Commit: Wojciech Macek CommitDate: 2022-06-29 08:48:01 +0000 mac_veriexec: Authorize reads of secured sysctls Writes to sysctls flagged with CTLFLAG_SECURE are blocked if the appropriate secure level is set. mac_veriexec does not behave this way, it blocks such sysctls in read-only mode as well. This change aims to make mac_veriexec behave like secure levels, as it was meant by the original commit ed377cf41. Reviewed by: sjg Differential revision: https://reviews.freebsd.org/D34327 Obtained from: Stormshield --- sys/security/mac_veriexec/mac_veriexec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/security/mac_veriexec/mac_veriexec.c b/sys/security/mac_veriexec/mac_veriexec.c index 7a5b747ef7a2..99a76abd4afb 100644 --- a/sys/security/mac_veriexec/mac_veriexec.c +++ b/sys/security/mac_veriexec/mac_veriexec.c @@ -437,7 +437,7 @@ mac_veriexec_sysctl_check(struct ucred *cred, struct sysctl_oid *oidp, return (0); oid = oidp; - if (oid->oid_kind & CTLFLAG_SECURE) { + if (req->newptr && (oid->oid_kind & CTLFLAG_SECURE)) { return (EPERM); /* XXX call mac_veriexec_priv_check? */ } return 0;