Sepol related questions
1) What purpose does user_datum_t->cache serve, and how is it different from the list of authorized roles (user_datum_t->roles.roles) I can't remember this field being there - is this something recently added as part of the modules patch. I ask because my user loading code does not set any bits in this cache, and neither does genusers... after which policydb_context_is_valid fails in this path:
if (!ebitmap_get_bit(&usrdatum->cache, c->role - 1))
/* user may not be associated with role */ return 0;
2) What is the proper fallback user
mls level and mls range on an mls-enabled system
when the user hasn't configured those parameters.
What is the proper fallback mls field,
in a context where it's missing, on an mls-enabled system.
3) Is the context string as returned bycontext_struct_to_string (services.c) supposed
to be null terminated - and also is
the string passed to sepol_context_to_sid
supposed to be null terminated. If so,
what purpose does the buffer size serve?
Signature · 8 lines
Ivan Gyurdiev <[email protected]> Cornell University -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 7 lines · Ivan Gyurdiev
2) What is the proper fallback user
mls level and mls range on an mls-enabled system when the user hasn't configured those parameters.What is the proper fallback mls field,
in a context where it's missing, on an mls-enabled system.
IIUC, there is no planned fallback for the MLS field except for the kernel's handling of inodes, which is needed to allow seamless upgrade from non-MLS to MLS. James has a patch under development to default the MLS field of existing inodes to the MLS value of the 'file' initial SID, as defined in policy/initial_sid_contexts, where that value would be set to system high in a real MLS policy and just s0 in the Red Hat MCS policy.
Quoted 6 lines
3) Is the context string as returned by
context_struct_to_string(services.c) supposed to be null terminated - and also is
the string passed tosepol_context_to_sidsupposed to be null terminated. If so, what purpose does the buffer size serve?
Originally, context strings were always nul terminated (and the length included the nul terminator); the separate length allowed a program to handle the context completely opaquely if it had no need to interpret it in any way (not even as a string) and avoided recomputation of the length, as the constructor of the context always knows that length. When we migrated to the xattr API and wanted to allow use of the attr utilities (setfattr/getfattr) for SELinux attributes as well, we ran into an issue where they do not consider the null terminator as part of the attribute value for strings, instead just using the length, so we had to deal with that situation both when setting a context and when getting a context. Thus, context_to_sid (both in kernel and in libsepol) no longer assumes that the input value is nul-terminated, and getfilecon no longer assumes that the value returned by the kernel (via the xattr API) is nul-terminated (but it adds the nul terminator before returning the context to the caller). So applications can always assume that the context returned by any libselinux or libsepol function will be nul terminated.
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.