Page MenuHomeFreeBSD

kern: rename crsetgroups_fallback, document it in ucred(9)
ClosedPublic

Authored by kevans on Thu, Jul 31, 5:00 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Aug 15, 5:06 AM
Unknown Object (File)
Fri, Aug 15, 1:23 AM
Unknown Object (File)
Thu, Aug 14, 12:43 PM
Unknown Object (File)
Wed, Aug 13, 5:58 PM
Unknown Object (File)
Mon, Aug 11, 7:26 AM
Unknown Object (File)
Wed, Aug 6, 4:00 PM
Unknown Object (File)
Tue, Aug 5, 9:21 PM
Unknown Object (File)
Tue, Aug 5, 3:52 PM
Subscribers

Details

Summary

Most kernel ucred modification should likely be using this API, rather
than crsetgroups() directly, to avoid potential security issues. As of
FreeBSD 15.0, crsetgroups() *only* sets supplementary groups, while
crsetgroups_and_egid() will do both using an array of the same style
that previous versions used for crsetgroups() -- i.e., the first element
is the egid, and the remainder are supplementary groups.

Unlike the previous iteration of crsetgroups(), crsetgroups_and_egid()
is less prone to misuse as the caller must provide a default egid to use
in case the array is empty. This is particularly useful for groups
being set from data provided by userland.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 65857
Build 62740: arc lint + arc unit

Event Timeline

olce accepted this revision.EditedThu, Jul 31, 2:16 PM

The first sentence of the commit message ("Most kernel ucred modification should likely be using this API, rather than crsetgroups() directly, to avoid potential security issues.") is probably too strong. Putting it first obfuscates somewhat the bulk of the message, i.e., the fact that crsetgroups_and_egid() is in fact tailored to an already existing array with the effective gid in slot 0, whereas crsetgroups() only takes an array of supplementary groups. crsetgroups_and_egid() should be the preferred API only for an already existing array supposed to have the egid in the first slot.

Suggested by: olce
This revision is now accepted and ready to land.Thu, Jul 31, 2:16 PM