Page MenuHomeFreeBSD

MAC/do: 'struct rule': IDs and types as 'u_int', rename fields
ClosedPublic

Authored by olce on Nov 15 2024, 5:08 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 27, 10:20 AM
Unknown Object (File)
Fri, Dec 27, 9:52 AM
Unknown Object (File)
Fri, Dec 27, 9:13 AM
Unknown Object (File)
Fri, Dec 27, 7:29 AM
Unknown Object (File)
Fri, Dec 27, 6:50 AM
Unknown Object (File)
Sat, Dec 21, 8:08 AM
Unknown Object (File)
Mon, Dec 16, 2:30 AM
Unknown Object (File)
Mon, Dec 9, 12:17 PM

Details

Summary

This revision is part of a series. Click on the Stack tab below to see the context.
This series has also been squeezed into D47633 to provide an overall view.

Commit message:
This is in preparation for introducing a common conversion function for
IDs and to simplify code a bit by removing the from-IDs union and not
having to introduce a new one for to-IDs in a later commit.

Diff Detail

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

Event Timeline

olce requested review of this revision.Nov 15 2024, 5:08 PM
This revision is now accepted and ready to land.Nov 19 2024, 8:06 AM
sys/security/mac_do/mac_do.c
47–48

TODO: Re-reading this code, I think (int)(uid_t)-1 == -1 doesn't match my intent as it will always be considered true by any decent compiler on 2-complement machines and consequently cannot detect if uid_t is effectively a signed type.

olce retitled this revision from MAC/do: 'struct rule': IDs as int, rename fields to MAC/do: 'struct rule': IDs and types as 'u_int', rename fields.

Use u_int instead of int, as uid_t and gid_t are in fact unsigned integers, and not signed ones as I initially assumed. (Since we are compiling with -fwrapv, this doesn't matter for correctness of execution, but is conceptually wrong.)

This revision now requires review to proceed.Nov 27 2024, 10:12 AM
This revision is now accepted and ready to land.Dec 2 2024, 8:55 AM