Page MenuHomeFreeBSD

cred: Hide internal flag CRED_FLAG_CAPMODE
ClosedPublic

Authored by olce on Oct 4 2024, 8:07 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 26, 9:35 AM
Unknown Object (File)
Mon, Dec 23, 9:54 PM
Unknown Object (File)
Mon, Dec 23, 3:02 AM
Unknown Object (File)
Mon, Dec 16, 5:25 PM
Unknown Object (File)
Mon, Dec 9, 12:58 AM
Unknown Object (File)
Nov 15 2024, 8:19 PM
Unknown Object (File)
Nov 6 2024, 5:13 PM
Unknown Object (File)
Oct 29 2024, 6:17 PM
Subscribers

Details

Summary

This flag is used in field 'cr_flags', which is never directly visible
outside the kernel. That field is however exported through 'struct
kinfo_proc' objects (field 'ki_cr_flags'), either from the kernel via
sysctls or from libkvm, and is supposed to contain exported flags
prefixed with KI_CRF_ (currently, KI_CRF_CAPABILITY_MODE and
KI_CRF_GRP_OVERFLOW, this second one being a purely userland one
signaling overflow of 'ki_groups').

Make sure that KI_CRF_CAPABILITY_MODE is the flag actually exported and
tested by userland programs, and hide the internal CRED_FLAG_CAPMODE.
As both flags are currently defined to the same value, this doesn't
change the KBI, but of course does change the KPI. A code search via
GitHub and Google fortunately doesn't reveal any outside uses for
CRED_FLAG_CAPMODE.

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

LGTM with one question. Seems fine to break the KPI here when the kinfo_getproc(3) page basically says "read sys/user.h for documentation of the structure's fields".

lib/libkvm/kvm_proc.c
159–160

Not your fault but this assignment is weird here, and should appear above ki_ruid, no?

sys/sys/ucred.h
42

Is it intentional that you are also hiding this declaration?

This revision is now accepted and ready to land.Oct 7 2024, 7:32 PM
olce marked an inline comment as done.Oct 8 2024, 8:42 AM
olce added inline comments.
lib/libkvm/kvm_proc.c
159–160

Yes, not my fault. ;-) It is so small a change that I'll move that line up in the same commit.

sys/sys/ucred.h
42

Yes, nothing in this header references struct loginclass except struct ucred.

sys/sys/ucred.h
42

👍

olce marked 3 inline comments as done.Oct 14 2024, 3:12 PM

Moved up the assignment of ki_uid in my tree.

This revision was automatically updated to reflect the committed changes.