• Home
  • History
  • Annotate
  • only in /external/sepolicy/tools/sepolicy-analyze/
NameDateSize

..12-Mar-20154 KiB

Android.mk12-Mar-2015379

dups.c12-Mar-20153 KiB

dups.h12-Mar-2015193

neverallow.c12-Mar-201512.8 KiB

neverallow.h12-Mar-2015223

perm.c12-Mar-2015690

perm.h12-Mar-2015205

README12-Mar-20154.3 KiB

sepolicy-analyze.c12-Mar-20151.4 KiB

typecmp.c12-Mar-20158.5 KiB

typecmp.h12-Mar-2015208

utils.c12-Mar-20151.9 KiB

utils.h12-Mar-2015361

README

1sepolicy-analyze
2    A component-ized tool for performing various kinds of analysis on a
3    sepolicy file.  The current kinds of analysis that are currently
4    supported include:
5
6    TYPE EQUIVALENCE (typecmp)
7    sepolicy-analyze out/target/product/<board>/root/sepolicy typecmp -e
8
9    Display all type pairs that are "equivalent", i.e. they are
10    identical with respect to allow rules, including indirect allow
11    rules via attributes and default-enabled conditional rules
12    (i.e. default boolean values yield a true conditional expression).
13
14    Equivalent types are candidates for being coalesced into a single
15    type.  However, there may be legitimate reasons for them to remain
16    separate, for example: - the types may differ in a respect not
17    included in the current analysis, such as default-disabled
18    conditional rules, audit-related rules (auditallow or dontaudit),
19    default type transitions, or constraints (e.g. mls), or - the
20    current policy may be overly permissive with respect to one or the
21    other of the types and thus the correct action may be to tighten
22    access to one or the other rather than coalescing them together,
23    or - the domains that would in fact have different accesses to the
24    types may not yet be defined or may be unconfined in the policy
25    you are analyzing.
26
27    TYPE DIFFERENCE (typecmp)
28    sepolicy-analyze out/target/product/<board>/root/sepolicy typecmp -d
29
30    Display type pairs that differ and the first difference found
31    between the two types.  This may be used in looking for similar
32    types that are not equivalent but may be candidates for coalescing.
33
34    DUPLICATE ALLOW RULES (dups)
35    sepolicy-analyze out/target/product/<board>/root/sepolicy dups
36
37    Displays duplicate allow rules, i.e. pairs of allow rules that
38    grant the same permissions where one allow rule is written
39    directly in terms of individual types and the other is written in
40    terms of attributes associated with those same types.  The rule
41    with individual types is a candidate for removal.  The rule with
42    individual types may be directly represented in the source policy
43    or may be a result of expansion of a type negation (e.g. domain
44    -foo -bar is expanded to individual allow rules by the policy
45    compiler).  Domains with unconfineddomain will typically have such
46    duplicate rules as a natural side effect and can be ignored.
47
48    PERMISSIVE DOMAINS (permissive)
49    sepolicy-analyze out/target/product/<board>/root/sepolicy permissive
50
51    Displays domains in the policy that are permissive, i.e. avc
52    denials are logged but not enforced for these domains.  While
53    permissive domains can be helpful during development, they
54    should not be present in a final -user build.
55
56    NEVERALLOW CHECKING (neverallow)
57    sepolicy-analyze out/target/product/<board>/root/sepolicy neverallow \
58    [-w] [-d] [-f neverallows.conf] | [-n "neverallow string"]
59
60    Check whether the sepolicy file violates any of the neverallow rules
61    from the neverallows.conf file or a given string,  which contain neverallow
62    statements in the same format as the SELinux policy.conf file, i.e. after
63    m4 macro expansion of the rules from a .te file.  You can use an entire
64    policy.conf file as the neverallows.conf file and sepolicy-analyze will
65    ignore everything except for the neverallows within it.  You can also
66    specify this as a command-line string argument, which could be useful for
67    quickly checking an individual expanded rule or group of rules. If there are
68    no violations, sepolicy-analyze will exit successfully with no output.
69    Otherwise, sepolicy-analyze will report all violations and exit
70    with a non-zero exit status.
71
72    The -w or --warn option may be used to warn on any types, attributes,
73    classes, or permissions from a neverallow rule that could not be resolved
74    within the sepolicy file.  This can be normal due to differences between
75    the policy from which the neverallow rules were taken and the policy
76    being checked.  Such values are ignored for the purposes of neverallow
77    checking.
78
79    The -d or --debug option may be used to cause sepolicy-analyze to emit the
80    neverallow rules as it parses them.  This is principally a debugging facility
81    for the parser but could also be used to extract neverallow rules from
82    a full policy.conf file and output them in a more easily parsed format.
83