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)
Fri, Oct 10, 5:31 PM
Unknown Object (File)
Fri, Oct 10, 12:22 PM
Unknown Object (File)
Fri, Oct 10, 12:22 PM
Unknown Object (File)
Fri, Oct 10, 5:35 AM
Unknown Object (File)
Wed, Sep 17, 3:10 PM
Unknown Object (File)
Sep 15 2025, 11:26 AM
Unknown Object (File)
Sep 12 2025, 12:35 AM
Unknown Object (File)
Sep 11 2025, 5:18 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