git: dd5c76309ad9 - stable/15 - MAC/do: Restore matching the first supplementary group
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 23 Sep 2025 12:03:36 UTC
The branch stable/15 has been updated by olce:
URL: https://cgit.FreeBSD.org/src/commit/?id=dd5c76309ad98c9b058a79f6b674c5dfc44631c1
commit dd5c76309ad98c9b058a79f6b674c5dfc44631c1
Author: Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2025-08-27 15:22:26 +0000
Commit: Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-09-23 12:02:43 +0000
MAC/do: Restore matching the first supplementary group
As 'cr_gid' was in fact stored in cr_groups[0],
rule_grant_supplementary_groups() would loop only on further elements of
cr_groups[]. Now that cr_groups[0] is not 'cr_gid' anymore, but some
supplementary group, take it into account.
Fixes: be1f7435ef218b1d ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after: 5 days
MFC to: stable/15
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52271
(cherry picked from commit d39756f23fe223d14ff00b1392ba39e94d5eadbc)
---
sys/security/mac_do/mac_do.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c
index 7a5ac2e01f75..6f3e63d06198 100644
--- a/sys/security/mac_do/mac_do.c
+++ b/sys/security/mac_do/mac_do.c
@@ -1650,7 +1650,7 @@ rule_grant_supplementary_groups(const struct rule *const rule,
const bool current_has_supp = (gid_flags & MDF_CURRENT) != 0 &&
(gid_flags & MDF_SUPP_MASK) != 0;
id_nb_t rule_idx = 0;
- int old_idx = 1, new_idx = 1;
+ int old_idx = 0, new_idx = 0;
if ((gid_flags & MDF_ANY_SUPP) != 0 &&
(gid_flags & MDF_MAY_REJ_SUPP) == 0)