summaryrefslogtreecommitdiff
path: root/lib/libsys/getgroups.2
AgeCommit message (Collapse)Author
2025-10-10getgroups.2: Simplifications; Be clearer on programs to be modifiedOlivier Certner
In the STANDARDS section, stop mentioning behavior that is not prescribed by POSIX and make sure to specify which alternative we implement (as POSIX allows to return or not the effective group ID). Say more clearly that programs treating specially the first slot of the returned array must be modified. Consistently use "group ID" instead of "GID". These changes are going to be MFCed into stable/14 as part of MFCing commit 4be38acc826f ("getgroups.2: Clarify, mention ascending order, add SECURITY CONSIDERATIONS"), so the current commit will be MFCed to stable/15 only. MFC after: 1 hour MFC to: stable/15 Sponsored by: The FreeBSD Foundation
2025-09-17getgroups.2: Clarify, mention ascending order, add SECURITY CONSIDERATIONSOlivier Certner
Clarify and be more precise about the behavior of getgroups(2), in particular with respect to 'gidsetlen'. Prefer a terminology referring to POSIX terms, i.e., use "supplementary groups" instead of "group access list". Say that getgroups(2) reports the supplementary groups in strictly ascending order and returns the cardinal of the set they form (and mention this has been the case since FreeBSD 14.3). Add a new SECURITY CONSIDERATIONS section contrasting the new behavior after commit 9da2fe96ff2e ("kern: fix setgroups(2) and getgroups(2) to match other platforms") with the historical one. While here, fix some style. Note for MFC to stable/14: The content will have to be revised as the new behavior is not in place. The latter should be mentioned as upcoming in 15. Reviewed by: gbe (older version) MFC after: 5 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D52286
2025-08-14kern: fix setgroups(2) and getgroups(2) to match other platformsKyle Evans
On most other platforms observed, including OpenBSD, NetBSD, and Linux, these system calls have long since been converted to only touching the supplementary groups of the process. This poses both portability and security concerns in porting software to and from FreeBSD, as this subtle difference is a landmine waiting to happen. Bugs have been discovered even in FreeBSD-local sources, since this behavior is somewhat unintuitive (see, e.g., fix 48fd05999b0f for chroot(8)). Now that the egid is tracked outside of cr_groups in our ucred, convert the syscalls to deal with only supplementary groups. Some remaining stragglers in base that had baked in assumptions about these syscalls are fixed in the process to avoid heartburn in conversion. For relnotes: application developers should audit their use of both setgroups(2) and getgroups(2) for signs that they had assumed the previous FreeBSD behavior of using the first element for the egid. Any calls to setgroups() to clear groups that used a single array of the now or soon-to-be egid can be converted to setgroups(0, NULL) calls to clear the supplementary groups entirely on all FreeBSD versions. Co-authored-by: olce (but bugs are likely mine) Relnotes: yes (see last paragraph) Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D51648
2024-02-05libsys: relocate implementations and manpagesBrooks Davis
Remove core system call implementations and documentation to lib/libsys and lib/libsys/<arch> from lib/libc/sys and lib/libc/<arch>/<sys>. Update paths to allow libc to find them in their new home. Reviewed by: kib, emaste, imp Pull Request: https://github.com/freebsd/freebsd-src/pull/908