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
F144457572: D52262.id161228.diff
Sun, Feb 8, 1:19 PM
F144329949: D52262.id162231.diff
Sat, Feb 7, 9:25 PM
Unknown Object (File)
Mon, Feb 2, 8:13 PM
Unknown Object (File)
Sat, Jan 31, 8:28 AM
Unknown Object (File)
Dec 12 2025, 7:59 AM
Unknown Object (File)
Dec 12 2025, 12:16 AM
Unknown Object (File)
Nov 22 2025, 2:42 PM
Unknown Object (File)
Nov 17 2025, 8:59 PM
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