Page MenuHomeFreeBSD

cred: kern_setgroups(): Internally use int as number of groups' type
ClosedPublic

Authored by olce on Oct 4 2024, 8:07 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 16, 1:58 PM
Unknown Object (File)
Thu, Nov 7, 3:30 PM
Unknown Object (File)
Thu, Nov 7, 11:39 AM
Unknown Object (File)
Sat, Nov 2, 10:14 PM
Unknown Object (File)
Wed, Oct 30, 11:52 AM
Unknown Object (File)
Mon, Oct 28, 10:13 PM
Unknown Object (File)
Mon, Oct 28, 1:18 AM
Unknown Object (File)
Oct 11 2024, 12:07 PM
Subscribers

Details

Summary

sys_setgroups() (and sys_getgroups()) was changed in commit "kern: fail
getgroup and setgroup with negative int" (4bc2174a1b48) to take the
number of groups as an 'int' (for sys_getgroups(), this is a mandatory
requirement to be POSIX-compliant; for sys_setgroups(), it's arguably
for consistency).

All our internal APIs related to groups on 'struct ucred', as well as
related members on the latter, treat that number as an 'int' as well
(and not a 'u_int').

Consequently, to avoid surprises, change kern_setgroups() to behave the
same, and fix audit_arg_groupset() accordingly. With that change,
everything is handled with signed integers internally.

Update sanity checks accordingly.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

olce requested review of this revision.Oct 4 2024, 8:07 AM
mhorne added inline comments.
sys/kern/kern_prot.c
823
This revision is now accepted and ready to land.Mon, Oct 28, 5:30 PM
olce marked an inline comment as done.Tue, Oct 29, 4:39 PM
olce added inline comments.
sys/kern/kern_prot.c
823

Done in my repository.

This revision was automatically updated to reflect the committed changes.
olce marked an inline comment as done.