Page MenuHomeFreeBSD

unix: SCM_CREDS: Restore passing the effective GID
ClosedPublic

Authored by olce on Aug 29 2025, 11:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 4, 1:40 AM
Unknown Object (File)
Tue, Mar 24, 5:03 PM
Unknown Object (File)
Mon, Mar 16, 11:36 PM
Unknown Object (File)
Sun, Mar 15, 6:53 AM
Unknown Object (File)
Wed, Mar 11, 11:55 PM
Unknown Object (File)
Feb 28 2026, 1:49 PM
Unknown Object (File)
Feb 28 2026, 8:03 AM
Unknown Object (File)
Feb 28 2026, 6:11 AM
Subscribers

Details

Summary

cmcred_groups[0] in 'struct cmsgcred' must be the effective GID.

Note that the code in unp_addsockcred() filling up 'struct
sockcred'/'struct sockcred2' (LOCAL_CREDS/LOCAL_CREDS_PERSISTENT
options) was in fact "wrong" before 'cr_gid' was moved out of
cr_groups[], in the sense that it would transmit the effective GID
twice, both separately as 'sc_egid' and as the first element of
'sc_groups'. It is now exact, so is left unchanged, which causes
a difference in output (the effective GID is no more in 'sc_groups',
unless it is also a supplementary group) that is unlikely to affect
applications in practice.

Fixes: be1f7435ef218b1d ("kern: start tracking cr_gid outside of cr_groups[]")
Sponsored by: The FreeBSD Foundation

Diff Detail

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