From nobody Mon Dec 16 14:46:16 2024 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 4YBjS91qgBz5hWZV; Mon, 16 Dec 2024 14:46:17 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YBjS86wflz4fR9; Mon, 16 Dec 2024 14:46:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734360377; 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=MWhOWKg/uJo1pxHHa2YAN4kyC0S7wtQ/x5UmsmFqdog=; b=dXnr6MFVJ9WFgZgcCiVjxtpIA3dLINuEbQiwdeppjB7yBAx4N5eCCPtJy2GEKN0iJJyi3v BRmMDdFRVHPjydMtvrL+kzMlg9QrPmSef800p6J7gg8l+u3PRRWXIcE7ZE0kfB/vewc4Mo wZz2ljpQxAppColGUCM47f3BzEQ+Fb7XtOyR0FK+LEkdNCBD5fZ0wsNHGyz5BRbW7a6x/e NBlzKVDCmwh0Ny8BldxwnAGmKQnYUuEJl2OOykAd/+iwLSJrjhH0OaddSVF2HNhz96BBvi 5ywc/vISG27/hwfgGtNopTMWJJ66JcSA6HNj8hKbFH5VlRWC1wH+MU/zWktnkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734360377; 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=MWhOWKg/uJo1pxHHa2YAN4kyC0S7wtQ/x5UmsmFqdog=; b=lhf6locHIRL4f33xnejAnQlTXGyTMXFKLIXerHvJYSRt3CHZsGKle6BAUF1EwJ2/iZPGPQ r1ywXdmUyZWnj79OPZ3U1reF8qHrTbmFF+lvAOHZ0SjcDfVLA80IG+lcdL62fAo4L91aKC u40YUpvFl19weFLDePHB4po+yf9Fw72B9Vb//asEYtyL/xiffqJoLVkDFFMGlVlsbay2Db vigW2Hn92adB1DMZtuxNHHN/1nPkSDHHGn9BcXvdGoBAjkP+yAvzBfwIzHwZTfAlzze6y0 TIiNLGhBiWEafd7MUZaNS93MOutpqAKdjFjb58J2auuiBnrIwbkrLeBH6i5kYA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1734360377; a=rsa-sha256; cv=none; b=g6JKkD7T73RsRL3zZYxlui5CXluubs34RDfpXJl/eIPgkNT/aPJlYsCgSKTPLtwn2X6HXl KYpYsyvRRKjYN3H9lwya8AjC4SN/+aAYHBffqKScXbdLcBeJBcXirkvI1P/DThOnXs0ERS 2LcUgONpQP099iJT40/j4c0+oPj8bV042YFPBAXLwQNI4ixCm448OUet1q44VZlFocb336 yW6BiqRXBwhT7P4i5UjT6J8SCYfHuHxzWUMv63GM9x7yZEHguoSUH2P1wBCARfAjl8Sf8n i1BrvXER+WsvUR5/jLRWouK692V0g0NzLrkBbkV7KmZRLG5ZyyjLfEtuOZvjsg== 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 4YBjS86VTKzxYN; Mon, 16 Dec 2024 14:46:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4BGEkGOs054348; Mon, 16 Dec 2024 14:46:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BGEkGX8054345; Mon, 16 Dec 2024 14:46:16 GMT (envelope-from git) Date: Mon, 16 Dec 2024 14:46:16 GMT Message-Id: <202412161446.4BGEkGX8054345@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: de701f9bdbe0 - main - MAC/do: Apply a rule on real UID/GID instead of effective ones 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: de701f9bdbe0ede691a0439d1c469082b94fe234 Auto-Submitted: auto-generated The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=de701f9bdbe0ede691a0439d1c469082b94fe234 commit de701f9bdbe0ede691a0439d1c469082b94fe234 Author: Olivier Certner AuthorDate: 2024-11-29 14:39:17 +0000 Commit: Olivier Certner CommitDate: 2024-12-16 14:42:40 +0000 MAC/do: Apply a rule on real UID/GID instead of effective ones We intend MAC/do to authorize transitions based on the "real" identity information of the calling process, rather than transiently-acquired effective IDs. Reviewed by: bapt Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D47845 --- sys/security/mac_do/mac_do.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 44c33d7cfa57..7ec34b20c882 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -1906,9 +1906,9 @@ rule_grant_setcred(const struct rule *const rule, static bool rule_applies(const struct rule *const rule, const struct ucred *const cred) { - if (rule->from_type == IT_UID && rule->from_id == cred->cr_uid) + if (rule->from_type == IT_UID && rule->from_id == cred->cr_ruid) return (true); - if (rule->from_type == IT_GID && groupmember(rule->from_id, cred)) + if (rule->from_type == IT_GID && realgroupmember(rule->from_id, cred)) return (true); return (false); }