CR_CANSEEOTHERGIDS(9)
π CR_CANSEEOTHERGIDS(9) β the kernel dev manual, bestie edition β¨
okay so this is a page from the Kernel Developer's Manual (section 9, kernel functions, iykyk) and honestly? it's giving "internal helper energy" but we're gonna learn it anyway because that's what besties do π«Ά
π NAME π
cr_canseeothergids β the little function that decides whether subjects are allowed to see entities that live in a totally disjoint group set π
β¨ SYNOPSIS β¨
int
cr_canseeothergids(struct ucred *u1, struct ucred *u2);
like, two credential pointers in, one int out. simple. iconic. no notes. π
πΈ DESCRIPTION πΈ
so first thing first, bestie: this function is internal. it's not a main character, it's a supporting character π. its whole functionality is integrated into the function cr_bsd_visible(9), and like β that's the one you should actually be calling instead. fr fr. don't @ me.
what it does do: it checks whether a subject associated with credentials u1 is denied from seeing a subject or object associated with credentials u2, according to a policy that says both credentials have to share at least one group in common π«. if they don't share a group, the seeing gets denied.
for this determination, the real and supplementary group IDs are used β but not the effective group IDs, as per realgroupmember(9). the way that effective gids are just... not invited to this party π
and when does this policy even kick in? it's active if and only if the sysctl(8) variable security.bsd.see_other_gids is set to zero. that's it. that's the switch. β¨
also, as usual, the superuser (effective user ID 0) is exempt from this policy β provided that:
- the
sysctl(8)variablesecurity.bsd.suser_enabledis non-zero, and - no active MAC policy explicitly denies the exemption (see
priv_check_cred(9))
β οΈ note the "provided that" bestie β root isn't automatically free, the exemption has to actually be live and not blocked by MAC. read the fine print, it's giving β¨conditions applyβ¨
π RETURN VALUES π
cr_canseeothergids() returns 0 if any of these slay conditions are true:
- the policy is disabled, or
- the credentials share at least one common group, or
u1has a privilege that exempts it from the policy π
otherwise? it returns ESRCH. that's the "nope, denied, blocked, go home" π
π¦ SEE ALSO π¦
and that's the page!! π this one shipped from Debian, dated August 18, 2023 β so yeah, credit where credit's due, mwah π go call cr_bsd_visible(9) like I told you, and stay hydrated ππ§π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2003 Joseph Koshy <jkoshy@FreeBSD.org>
- Copyright (c) 2023 Olivier Certner <olce.freebsd@certner.fr>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms