From nobody Sun Dec 19 02:44:38 2021 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 4FD9218E500A; Sun, 19 Dec 2021 02:44:40 +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 4JGn9y50xBz4qKB; Sun, 19 Dec 2021 02:44:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 632121A6F9; Sun, 19 Dec 2021 02:44:38 +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 1BJ2icTc012812; Sun, 19 Dec 2021 02:44:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BJ2icGQ012811; Sun, 19 Dec 2021 02:44:38 GMT (envelope-from git) Date: Sun, 19 Dec 2021 02:44:38 GMT Message-Id: <202112190244.1BJ2icGQ012811@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 10b999149239 - stable/13 - Thread creation privilege for realtime group 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 10b99914923936fcf244af720c2ad8fc4b395378 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639881878; 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=TmXPVpXEYiD89muXvv3JtppWgUevKAsS3xH1yK1H8m8=; b=DFRZfSrhWoB9W5PU3bSD74hHhB/wVqtQdlGhYqHQ6SSsT2MaEkPUS8tvhaKcSd9R2xx2PV T//b2l0dc3sNfIWmRu0//D4UFV2FsN0KGVQY3/2BiaQLETcLc4H08yGmGq19zzDJEfPlM1 ryBhxVfmghpOu7nGczrDMq51mTi2bOJnrtVHfhCFoewbC17k/q0kELeZWIe5MRORQHIxFF Wk7ic+mDBfNYWhr/RPHGIHUpcmWYVm7cgyw9GqdDH23zizrnPep4i6kls1Gf2R8JUfWHdl 9WgvXHZ5z4+AA2M2D1RumqfKoYJIEpAFfLKdaVHoSF8ziUTRJi1qc+WWNGl2tw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639881878; a=rsa-sha256; cv=none; b=bzn7XSyRUcemPvMvSVJ3RTOyIrhU6pS4rh2ORbT+ahkbvbFHR5P/sQmaJLyogNFEv+QYiK tbUcFNRFHariXAkid2qrNML/LaWitc4rx4kTNfHwyHIHYeGCJZawCM2xWySTjT4Q6U0eIn Xq/var0hMy0K8cbiQ2cSdF7iVPd/zuIjRixt/TCWSx0NwWUhK69dKdrLKpKpH0qTtyu6T1 gO85N2xVDy7ogcmg/FfhSMn4W4AhVkoPDuqS+reZ5rxJIducCsbFDDmrh4VSRgMwK61zJi emLndrbdiIZmDCR8mdQ3ESHOND0GlkVXqrvw/iePjO5fZCbjCdpvOz/B7bmy/w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=10b99914923936fcf244af720c2ad8fc4b395378 commit 10b99914923936fcf244af720c2ad8fc4b395378 Author: Florian Walpen AuthorDate: 2021-12-14 21:55:51 +0000 Commit: Konstantin Belousov CommitDate: 2021-12-19 02:42:52 +0000 Thread creation privilege for realtime group (cherry picked from commit e28767f0e17550d8ed030cff0918202e5de101ab) --- share/man/man4/mac_priority.4 | 15 +++++++++------ sys/security/mac_priority/mac_priority.c | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/share/man/man4/mac_priority.4 b/share/man/man4/mac_priority.4 index 6dfb937d1596..868d027d5233 100644 --- a/share/man/man4/mac_priority.4 +++ b/share/man/man4/mac_priority.4 @@ -21,7 +21,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd December 7, 2021 +.Dd December 14, 2021 .Dt MAC_PRIORITY 4 .Os .Sh NAME @@ -79,13 +79,16 @@ priority through the .Xr rtprio 2 system calls. .Ss Privileges Granted -The kernel privileges granted to any process running -with the corresponding group gid is: -.Bl -tag -width ".Dv PRIV_SCHED_RTPRIO" -offset indent +The realtime policy grants the following kernel privileges to any process +running with the realtime group id: +.Bl -inset -offset indent -compact .It Dv PRIV_SCHED_RTPRIO -If it is a member of the realtime group. +.It Dv PRIV_SCHED_SETPOLICY +.El +.Pp +The kernel privilege granted by the idletime policy is: +.Bl -inset -offset indent -compact .It Dv PRIV_SCHED_IDPRIO -If it is a member of the idletime group. .El .Ss Runtime Configuration The following diff --git a/sys/security/mac_priority/mac_priority.c b/sys/security/mac_priority/mac_priority.c index 5c4db72ca657..f460e5195cb9 100644 --- a/sys/security/mac_priority/mac_priority.c +++ b/sys/security/mac_priority/mac_priority.c @@ -64,8 +64,8 @@ SYSCTL_INT(_security_mac_priority, OID_AUTO, idletime_gid, CTLFLAG_RWTUN, static int priority_priv_grant(struct ucred *cred, int priv) { - if (priv == PRIV_SCHED_RTPRIO && realtime_enabled && - groupmember(realtime_gid, cred)) + if ((priv == PRIV_SCHED_RTPRIO || priv == PRIV_SCHED_SETPOLICY) && + realtime_enabled && groupmember(realtime_gid, cred)) return (0); if (priv == PRIV_SCHED_IDPRIO && idletime_enabled &&