* Find attributes for a type with sepol @ 2015-09-23 22:39 Roberts, William C 2015-09-24 12:43 ` James Carter 0 siblings, 1 reply; 13+ messages in thread From: Roberts, William C @ 2015-09-23 22:39 UTC (permalink / raw) To: selinux@tycho.nsa.gov [-- Attachment #1: Type: text/plain, Size: 143 bytes --] How would one find all the attributes of a type with libsepol, can someone point me to any relevant structures or functions? Thanks, Bill [-- Attachment #2: Type: text/html, Size: 1907 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Find attributes for a type with sepol 2015-09-23 22:39 Find attributes for a type with sepol Roberts, William C @ 2015-09-24 12:43 ` James Carter 2015-09-24 12:59 ` Stephen Smalley 0 siblings, 1 reply; 13+ messages in thread From: James Carter @ 2015-09-24 12:43 UTC (permalink / raw) To: Roberts, William C, selinux@tycho.nsa.gov On 09/23/2015 06:39 PM, Roberts, William C wrote: > How would one find all the attributes of a type with libsepol, can someone point me to any relevant structures or functions? > The policydb_t structure has type_attr_map field which maps types to an ebitmap of attributes. Jim -- James Carter <jwcart2@tycho.nsa.gov> National Security Agency ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Find attributes for a type with sepol 2015-09-24 12:43 ` James Carter @ 2015-09-24 12:59 ` Stephen Smalley 2015-09-24 13:58 ` Joshua Brindle 0 siblings, 1 reply; 13+ messages in thread From: Stephen Smalley @ 2015-09-24 12:59 UTC (permalink / raw) To: James Carter, Roberts, William C, selinux@tycho.nsa.gov On 09/24/2015 08:43 AM, James Carter wrote: > On 09/23/2015 06:39 PM, Roberts, William C wrote: >> How would one find all the attributes of a type with libsepol, can >> someone point me to any relevant structures or functions? >> > > The policydb_t structure has type_attr_map field which maps types to an > ebitmap of attributes. It also has the reverse map (attr_type_map) if you want that. In Android, external/sepolicy/tools/sepolicy-analyze has examples of using both maps. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Find attributes for a type with sepol 2015-09-24 12:59 ` Stephen Smalley @ 2015-09-24 13:58 ` Joshua Brindle 2015-09-29 18:15 ` William Roberts 0 siblings, 1 reply; 13+ messages in thread From: Joshua Brindle @ 2015-09-24 13:58 UTC (permalink / raw) To: Stephen Smalley; +Cc: James Carter, Roberts, William C, selinux@tycho.nsa.gov Stephen Smalley wrote: > On 09/24/2015 08:43 AM, James Carter wrote: >> On 09/23/2015 06:39 PM, Roberts, William C wrote: >>> How would one find all the attributes of a type with libsepol, can >>> someone point me to any relevant structures or functions? >>> >> The policydb_t structure has type_attr_map field which maps types to an >> ebitmap of attributes. > > It also has the reverse map (attr_type_map) if you want that. > > In Android, external/sepolicy/tools/sepolicy-analyze has examples of > using both maps. > seinfo also knows how to do it, if you need more examples: $ seinfo -x -tuntrusted_app sepolicy untrusted_app bluetoothdomain netdomain appdomain domain ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Find attributes for a type with sepol 2015-09-24 13:58 ` Joshua Brindle @ 2015-09-29 18:15 ` William Roberts 2015-09-29 19:11 ` Joshua Brindle 0 siblings, 1 reply; 13+ messages in thread From: William Roberts @ 2015-09-29 18:15 UTC (permalink / raw) To: Joshua Brindle; +Cc: Stephen Smalley, selinux@tycho.nsa.gov [-- Attachment #1: Type: text/plain, Size: 1388 bytes --] Out of curiosity, whats the purpose of the types field in the struct type_datum? This seems to never have anything in it. Also, conditional.h has a field called bool, this would seem to conflict with stdbool.h, whats the consensus on renaming this to boolean perhaps? On Thu, Sep 24, 2015 at 6:58 AM, Joshua Brindle <brindle@quarksecurity.com> wrote: > Stephen Smalley wrote: > >> On 09/24/2015 08:43 AM, James Carter wrote: >> >>> On 09/23/2015 06:39 PM, Roberts, William C wrote: >>> >>>> How would one find all the attributes of a type with libsepol, can >>>> someone point me to any relevant structures or functions? >>>> >>>> The policydb_t structure has type_attr_map field which maps types to an >>> ebitmap of attributes. >>> >> >> It also has the reverse map (attr_type_map) if you want that. >> >> In Android, external/sepolicy/tools/sepolicy-analyze has examples of >> using both maps. >> >> > seinfo also knows how to do it, if you need more examples: > > $ seinfo -x -tuntrusted_app sepolicy > untrusted_app > bluetoothdomain > netdomain > appdomain > domain > > _______________________________________________ > Selinux mailing list > Selinux@tycho.nsa.gov > To unsubscribe, send email to Selinux-leave@tycho.nsa.gov. > To get help, send an email containing "help" to > Selinux-request@tycho.nsa.gov. > -- Respectfully, William C Roberts [-- Attachment #2: Type: text/html, Size: 2507 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Find attributes for a type with sepol 2015-09-29 18:15 ` William Roberts @ 2015-09-29 19:11 ` Joshua Brindle 2015-09-29 19:33 ` William Roberts 0 siblings, 1 reply; 13+ messages in thread From: Joshua Brindle @ 2015-09-29 19:11 UTC (permalink / raw) To: William Roberts; +Cc: Stephen Smalley, selinux@tycho.nsa.gov William Roberts wrote: > Out of curiosity, whats the purpose of the types field in the struct > type_datum? This seems to never have anything in it. > type_datum is used for both types and attributes (as designated by the flavor field). In the attribute case the types field is the ebitmap of types have have this attribute. It is set in checkpolicy, look at policy_define.c:define_typeattribute(). > Also, conditional.h has a field called bool, this would seem to conflict > with stdbool.h, whats the consensus on renaming this to boolean perhaps? > probably... > > On Thu, Sep 24, 2015 at 6:58 AM, Joshua Brindle<brindle@quarksecurity.com> > wrote: > >> Stephen Smalley wrote: >> >>> On 09/24/2015 08:43 AM, James Carter wrote: >>> >>>> On 09/23/2015 06:39 PM, Roberts, William C wrote: >>>> >>>>> How would one find all the attributes of a type with libsepol, can >>>>> someone point me to any relevant structures or functions? >>>>> >>>>> The policydb_t structure has type_attr_map field which maps types to an >>>> ebitmap of attributes. >>>> >>> It also has the reverse map (attr_type_map) if you want that. >>> >>> In Android, external/sepolicy/tools/sepolicy-analyze has examples of >>> using both maps. >>> >>> >> seinfo also knows how to do it, if you need more examples: >> >> $ seinfo -x -tuntrusted_app sepolicy >> untrusted_app >> bluetoothdomain >> netdomain >> appdomain >> domain >> >> _______________________________________________ >> Selinux mailing list >> Selinux@tycho.nsa.gov >> To unsubscribe, send email to Selinux-leave@tycho.nsa.gov. >> To get help, send an email containing "help" to >> Selinux-request@tycho.nsa.gov. >> > > > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Find attributes for a type with sepol 2015-09-29 19:11 ` Joshua Brindle @ 2015-09-29 19:33 ` William Roberts 2015-09-29 19:35 ` Joshua Brindle 0 siblings, 1 reply; 13+ messages in thread From: William Roberts @ 2015-09-29 19:33 UTC (permalink / raw) To: Joshua Brindle; +Cc: selinux, Stephen Smalley [-- Attachment #1: Type: text/plain, Size: 1902 bytes --] On Sep 29, 2015 12:12 PM, "Joshua Brindle" <brindle@quarksecurity.com> wrote: > > William Roberts wrote: >> >> Out of curiosity, whats the purpose of the types field in the struct >> type_datum? This seems to never have anything in it. >> > > type_datum is used for both types and attributes (as designated by the flavor field). In the attribute case the types field is the ebitmap of types have have this attribute. What about if its a type, is it an ebitmap of attrs? It is set in checkpolicy, look at policy_define.c:define_typeattribute(). > > > >> Also, conditional.h has a field called bool, this would seem to conflict >> with stdbool.h, whats the consensus on renaming this to boolean perhaps? >> > > probably... > > >> >> On Thu, Sep 24, 2015 at 6:58 AM, Joshua Brindle<brindle@quarksecurity.com > >> wrote: >> >>> Stephen Smalley wrote: >>> >>>> On 09/24/2015 08:43 AM, James Carter wrote: >>>> >>>>> On 09/23/2015 06:39 PM, Roberts, William C wrote: >>>>> >>>>>> How would one find all the attributes of a type with libsepol, can >>>>>> someone point me to any relevant structures or functions? >>>>>> >>>>>> The policydb_t structure has type_attr_map field which maps types to an >>>>> >>>>> ebitmap of attributes. >>>>> >>>> It also has the reverse map (attr_type_map) if you want that. >>>> >>>> In Android, external/sepolicy/tools/sepolicy-analyze has examples of >>>> using both maps. >>>> >>>> >>> seinfo also knows how to do it, if you need more examples: >>> >>> $ seinfo -x -tuntrusted_app sepolicy >>> untrusted_app >>> bluetoothdomain >>> netdomain >>> appdomain >>> domain >>> >>> _______________________________________________ >>> Selinux mailing list >>> Selinux@tycho.nsa.gov >>> To unsubscribe, send email to Selinux-leave@tycho.nsa.gov. >>> To get help, send an email containing "help" to >>> Selinux-request@tycho.nsa.gov. >>> >> >> >> > [-- Attachment #2: Type: text/html, Size: 3083 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Find attributes for a type with sepol 2015-09-29 19:33 ` William Roberts @ 2015-09-29 19:35 ` Joshua Brindle 2015-09-29 19:36 ` William Roberts 0 siblings, 1 reply; 13+ messages in thread From: Joshua Brindle @ 2015-09-29 19:35 UTC (permalink / raw) To: William Roberts; +Cc: selinux, Stephen Smalley William Roberts wrote: > On Sep 29, 2015 12:12 PM, "Joshua Brindle"<brindle@quarksecurity.com> > wrote: >> William Roberts wrote: >>> Out of curiosity, whats the purpose of the types field in the struct >>> type_datum? This seems to never have anything in it. >>> >> type_datum is used for both types and attributes (as designated by the > flavor field). In the attribute case the types field is the ebitmap of > types have have this attribute. > > What about if its a type, is it an ebitmap of attrs? No, but as Stephen said below there is a type_attr_map that contains that. > > It is set in checkpolicy, look at policy_define.c:define_typeattribute(). >> >> >>> Also, conditional.h has a field called bool, this would seem to conflict >>> with stdbool.h, whats the consensus on renaming this to boolean perhaps? >>> >> probably... >> >> >>> On Thu, Sep 24, 2015 at 6:58 AM, Joshua Brindle<brindle@quarksecurity.com >>> wrote: >>> >>>> Stephen Smalley wrote: >>>> >>>>> On 09/24/2015 08:43 AM, James Carter wrote: >>>>> >>>>>> On 09/23/2015 06:39 PM, Roberts, William C wrote: >>>>>> >>>>>>> How would one find all the attributes of a type with libsepol, can >>>>>>> someone point me to any relevant structures or functions? >>>>>>> >>>>>>> The policydb_t structure has type_attr_map field which maps types to > an >>>>>> ebitmap of attributes. >>>>>> >>>>> It also has the reverse map (attr_type_map) if you want that. >>>>> >>>>> In Android, external/sepolicy/tools/sepolicy-analyze has examples of >>>>> using both maps. >>>>> >>>>> >>>> seinfo also knows how to do it, if you need more examples: >>>> >>>> $ seinfo -x -tuntrusted_app sepolicy >>>> untrusted_app >>>> bluetoothdomain >>>> netdomain >>>> appdomain >>>> domain >>>> >>>> _______________________________________________ >>>> Selinux mailing list >>>> Selinux@tycho.nsa.gov >>>> To unsubscribe, send email to Selinux-leave@tycho.nsa.gov. >>>> To get help, send an email containing "help" to >>>> Selinux-request@tycho.nsa.gov. >>>> >>> >>> > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Find attributes for a type with sepol 2015-09-29 19:35 ` Joshua Brindle @ 2015-09-29 19:36 ` William Roberts 2015-09-29 20:19 ` William Roberts 0 siblings, 1 reply; 13+ messages in thread From: William Roberts @ 2015-09-29 19:36 UTC (permalink / raw) To: Joshua Brindle; +Cc: Stephen Smalley, selinux [-- Attachment #1: Type: text/plain, Size: 2268 bytes --] On Sep 29, 2015 12:35 PM, "Joshua Brindle" <brindle@quarksecurity.com> wrote: > > William Roberts wrote: >> >> On Sep 29, 2015 12:12 PM, "Joshua Brindle"<brindle@quarksecurity.com> >> wrote: >>> >>> William Roberts wrote: >>>> >>>> Out of curiosity, whats the purpose of the types field in the struct >>>> type_datum? This seems to never have anything in it. >>>> >>> type_datum is used for both types and attributes (as designated by the >> >> flavor field). In the attribute case the types field is the ebitmap of >> types have have this attribute. >> >> What about if its a type, is it an ebitmap of attrs? > > > No, but as Stephen said below there is a type_attr_map that contains that. OK that explains why its empty. > > >> >> It is set in checkpolicy, look at policy_define.c:define_typeattribute(). >>> >>> >>> >>>> Also, conditional.h has a field called bool, this would seem to conflict >>>> with stdbool.h, whats the consensus on renaming this to boolean perhaps? >>>> >>> probably... >>> >>> >>>> On Thu, Sep 24, 2015 at 6:58 AM, Joshua Brindle< brindle@quarksecurity.com >>>> wrote: >>>> >>>>> Stephen Smalley wrote: >>>>> >>>>>> On 09/24/2015 08:43 AM, James Carter wrote: >>>>>> >>>>>>> On 09/23/2015 06:39 PM, Roberts, William C wrote: >>>>>>> >>>>>>>> How would one find all the attributes of a type with libsepol, can >>>>>>>> someone point me to any relevant structures or functions? >>>>>>>> >>>>>>>> The policydb_t structure has type_attr_map field which maps types to >> >> an >>>>>>> >>>>>>> ebitmap of attributes. >>>>>>> >>>>>> It also has the reverse map (attr_type_map) if you want that. >>>>>> >>>>>> In Android, external/sepolicy/tools/sepolicy-analyze has examples of >>>>>> using both maps. >>>>>> >>>>>> >>>>> seinfo also knows how to do it, if you need more examples: >>>>> >>>>> $ seinfo -x -tuntrusted_app sepolicy >>>>> untrusted_app >>>>> bluetoothdomain >>>>> netdomain >>>>> appdomain >>>>> domain >>>>> >>>>> _______________________________________________ >>>>> Selinux mailing list >>>>> Selinux@tycho.nsa.gov >>>>> To unsubscribe, send email to Selinux-leave@tycho.nsa.gov. >>>>> To get help, send an email containing "help" to >>>>> Selinux-request@tycho.nsa.gov. >>>>> >>>> >>>> >> > [-- Attachment #2: Type: text/html, Size: 4001 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Find attributes for a type with sepol 2015-09-29 19:36 ` William Roberts @ 2015-09-29 20:19 ` William Roberts 2015-09-29 20:25 ` Stephen Smalley 0 siblings, 1 reply; 13+ messages in thread From: William Roberts @ 2015-09-29 20:19 UTC (permalink / raw) To: Joshua Brindle; +Cc: Stephen Smalley, selinux@tycho.nsa.gov [-- Attachment #1: Type: text/plain, Size: 3054 bytes --] On Tue, Sep 29, 2015 at 12:36 PM, William Roberts <bill.c.roberts@gmail.com> wrote: > > On Sep 29, 2015 12:35 PM, "Joshua Brindle" <brindle@quarksecurity.com> > wrote: > > > > William Roberts wrote: > >> > >> On Sep 29, 2015 12:12 PM, "Joshua Brindle"<brindle@quarksecurity.com> > >> wrote: > >>> > >>> William Roberts wrote: > >>>> > >>>> Out of curiosity, whats the purpose of the types field in the struct > >>>> type_datum? This seems to never have anything in it. > >>>> > >>> type_datum is used for both types and attributes (as designated by the > >> > >> flavor field). In the attribute case the types field is the ebitmap of > >> types have have this attribute. > >> > >> What about if its a type, is it an ebitmap of attrs? > > > > > > No, but as Stephen said below there is a type_attr_map that contains > that. > > OK that explains why its empty. > So is this information only available at compile time? I see that the types field is empty for both attributes and types. Perhaps my code is wrong to do this, but I can loop over the ebitmap entries from the attr_type and type_attr maps just fine. > > >> It is set in checkpolicy, look at > policy_define.c:define_typeattribute(). > >>> > >>> > >>> > >>>> Also, conditional.h has a field called bool, this would seem to > conflict > >>>> with stdbool.h, whats the consensus on renaming this to boolean > perhaps? > >>>> > >>> probably... > >>> > >>> > >>>> On Thu, Sep 24, 2015 at 6:58 AM, Joshua Brindle< > brindle@quarksecurity.com > >>>> wrote: > >>>> > >>>>> Stephen Smalley wrote: > >>>>> > >>>>>> On 09/24/2015 08:43 AM, James Carter wrote: > >>>>>> > >>>>>>> On 09/23/2015 06:39 PM, Roberts, William C wrote: > >>>>>>> > >>>>>>>> How would one find all the attributes of a type with libsepol, can > >>>>>>>> someone point me to any relevant structures or functions? > >>>>>>>> > >>>>>>>> The policydb_t structure has type_attr_map field which maps types > to > >> > >> an > >>>>>>> > >>>>>>> ebitmap of attributes. > >>>>>>> > >>>>>> It also has the reverse map (attr_type_map) if you want that. > >>>>>> > >>>>>> In Android, external/sepolicy/tools/sepolicy-analyze has examples of > >>>>>> using both maps. > >>>>>> > >>>>>> > >>>>> seinfo also knows how to do it, if you need more examples: > >>>>> > >>>>> $ seinfo -x -tuntrusted_app sepolicy > >>>>> untrusted_app > >>>>> bluetoothdomain > >>>>> netdomain > >>>>> appdomain > >>>>> domain > >>>>> > >>>>> _______________________________________________ > >>>>> Selinux mailing list > >>>>> Selinux@tycho.nsa.gov > >>>>> To unsubscribe, send email to Selinux-leave@tycho.nsa.gov. > >>>>> To get help, send an email containing "help" to > >>>>> Selinux-request@tycho.nsa.gov. > >>>>> > >>>> > >>>> > >> > > > > > _______________________________________________ > Selinux mailing list > Selinux@tycho.nsa.gov > To unsubscribe, send email to Selinux-leave@tycho.nsa.gov. > To get help, send an email containing "help" to > Selinux-request@tycho.nsa.gov. > -- Respectfully, William C Roberts [-- Attachment #2: Type: text/html, Size: 5559 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Find attributes for a type with sepol 2015-09-29 20:19 ` William Roberts @ 2015-09-29 20:25 ` Stephen Smalley 2015-09-29 20:51 ` William Roberts 0 siblings, 1 reply; 13+ messages in thread From: Stephen Smalley @ 2015-09-29 20:25 UTC (permalink / raw) To: William Roberts, Joshua Brindle; +Cc: selinux@tycho.nsa.gov On 09/29/2015 04:19 PM, William Roberts wrote: > So is this information only available at compile time? I see that the > types field is > empty for both attributes and types. Perhaps my code is wrong to do > this, but > I can loop over the ebitmap entries from the attr_type and type_attr > maps just > fine. Yes, it is discarded from the binary policy, which instead has type_attr_map and attr_type_map. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Find attributes for a type with sepol 2015-09-29 20:25 ` Stephen Smalley @ 2015-09-29 20:51 ` William Roberts 2015-09-29 21:04 ` Stephen Smalley 0 siblings, 1 reply; 13+ messages in thread From: William Roberts @ 2015-09-29 20:51 UTC (permalink / raw) To: Stephen Smalley; +Cc: Joshua Brindle, selinux@tycho.nsa.gov [-- Attachment #1: Type: text/plain, Size: 865 bytes --] On Tue, Sep 29, 2015 at 1:25 PM, Stephen Smalley <sds@tycho.nsa.gov> wrote: > On 09/29/2015 04:19 PM, William Roberts wrote: > >> So is this information only available at compile time? I see that the >> types field is >> empty for both attributes and types. Perhaps my code is wrong to do >> this, but >> I can loop over the ebitmap entries from the attr_type and type_attr >> maps just >> fine. >> > > Yes, it is discarded from the binary policy, which instead has > type_attr_map and attr_type_map. > > According to a comment in the struct attr_type_map is discarded as well, which would make sense given that the per-attribute type map is thrown away as well. aosp/external/selinux/libsepol/include/sepol$ grep -rn 'attr_type_map' * policydb/policydb.h:575: ebitmap_t *attr_type_map; /* not saved in the binary policy */ -- Respectfully, William C Roberts [-- Attachment #2: Type: text/html, Size: 1786 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Find attributes for a type with sepol 2015-09-29 20:51 ` William Roberts @ 2015-09-29 21:04 ` Stephen Smalley 0 siblings, 0 replies; 13+ messages in thread From: Stephen Smalley @ 2015-09-29 21:04 UTC (permalink / raw) To: William Roberts; +Cc: Joshua Brindle, selinux@tycho.nsa.gov On 09/29/2015 04:51 PM, William Roberts wrote: > > > On Tue, Sep 29, 2015 at 1:25 PM, Stephen Smalley <sds@tycho.nsa.gov > <mailto:sds@tycho.nsa.gov>> wrote: > > On 09/29/2015 04:19 PM, William Roberts wrote: > > So is this information only available at compile time? I see > that the > types field is > empty for both attributes and types. Perhaps my code is wrong to do > this, but > I can loop over the ebitmap entries from the attr_type and type_attr > maps just > fine. > > > Yes, it is discarded from the binary policy, which instead has > type_attr_map and attr_type_map. > > According to a comment in the struct attr_type_map is discarded as well, > which would make sense > given that the per-attribute type map is thrown away as well. > > aosp/external/selinux/libsepol/include/sepol$ grep -rn 'attr_type_map' * > policydb/policydb.h:575:ebitmap_t *attr_type_map;/* not saved in the > binary policy */ It is re-created on load; see policydb_read(). So it is always available to you. ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2015-09-29 21:04 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-09-23 22:39 Find attributes for a type with sepol Roberts, William C 2015-09-24 12:43 ` James Carter 2015-09-24 12:59 ` Stephen Smalley 2015-09-24 13:58 ` Joshua Brindle 2015-09-29 18:15 ` William Roberts 2015-09-29 19:11 ` Joshua Brindle 2015-09-29 19:33 ` William Roberts 2015-09-29 19:35 ` Joshua Brindle 2015-09-29 19:36 ` William Roberts 2015-09-29 20:19 ` William Roberts 2015-09-29 20:25 ` Stephen Smalley 2015-09-29 20:51 ` William Roberts 2015-09-29 21:04 ` Stephen Smalley
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.