• Home
Name Date Size #Lines LOC

..--

tools/03-May-2024-1,340889

Android.mkD03-May-20246.2 KiB191132

NOTICED03-May-20241 KiB2219

READMED03-May-20245 KiB12197

access_vectorsD03-May-20248.9 KiB889778

adbd.teD03-May-2024262 98

app.teD03-May-20241.6 KiB6760

attributesD03-May-20241.5 KiB6746

bluetooth.teD03-May-2024119 65

bluetoothd.teD03-May-2024186 86

dbusd.teD03-May-2024143 86

debuggerd.teD03-May-2024170 86

device.teD03-May-20242 KiB6461

dhcp.teD03-May-2024307 129

domain.teD03-May-20240

drmserver.teD03-May-2024175 86

file.teD03-May-20244.2 KiB115110

file_contextsD03-May-20248.5 KiB217211

fs_useD03-May-2024775 2218

genfs_contextsD03-May-2024623 1514

global_macrosD03-May-20242.4 KiB4638

gpsd.teD03-May-2024313 1310

hci_attach.teD03-May-2024154 75

init.teD03-May-2024227 98

init_shell.teD03-May-2024182 65

initial_sid_contextsD03-May-2024973 2827

initial_sidsD03-May-2024416 3632

installd.teD03-May-2024163 86

kernel.teD03-May-2024125 65

keys.confD03-May-2024659 2610

keystore.teD03-May-2024162 86

mac_permissions.xmlD03-May-2024624 3018

mediaserver.teD03-May-2024217 97

mlsD03-May-20244.7 KiB12899

mls_macrosD03-May-20241.2 KiB5546

mtp.teD03-May-2024168 97

net.teD03-May-202484 54

netd.teD03-May-2024183 97

nfc.teD03-May-202489 65

ping.teD03-May-2024129 65

policy_capabilitiesD03-May-2024122 64

port_contextsD03-May-202477 42

ppp.teD03-May-2024225 98

property.teD03-May-2024414 1312

property_contextsD03-May-20242 KiB5646

qemud.teD03-May-2024150 76

racoon.teD03-May-2024135 75

radio.teD03-May-2024141 87

rild.teD03-May-2024179 97

rolesD03-May-202429 32

runas.teD03-May-2024172 86

sdcardd.teD03-May-2024139 75

seapp_contextsD03-May-20242 KiB4645

security_classesD03-May-20242.5 KiB141110

selinux-network.shD03-May-20241 KiB181

servicemanager.teD03-May-2024220 86

shell.teD03-May-2024188 97

su.teD03-May-2024138 86

su_user.teD03-May-202491 53

surfaceflinger.teD03-May-2024314 118

system.teD03-May-2024284 129

te_macrosD03-May-20248.9 KiB299271

tee.teD03-May-2024243 1210

ueventd.teD03-May-2024232 87

unconfined.teD03-May-20241.2 KiB2423

usersD03-May-202455 21

vold.teD03-May-2024141 86

watchdogd.teD03-May-2024168 65

wpa_supplicant.teD03-May-2024213 97

zygote.teD03-May-2024143 86

README

1Policy Generation:
2
3Additional, per device, policy files can be added into the
4policy build.
5
6They can be configured through the use of three variables,
7they are:
81. BOARD_SEPOLICY_REPLACE
92. BOARD_SEPOLICY_UNION
103. BOARD_SEPOLICY_DIRS
114. BOARD_SEPOLICY_IGNORE
12
13The variables should be set in the BoardConfig.mk file in
14the device or vendor directories.
15
16BOARD_SEPOLICY_UNION is a list of files that will be
17"unioned", IE concatenated, at the END of their respective
18file in external/sepolicy. Note, to add a unique file you
19would use this variable.
20
21BOARD_SEPOLICY_REPLACE is a list of files that will be
22used instead of the corresponding file in external/sepolicy.
23
24BOARD_SEPOLICY_DIRS contains a list of directories to search
25for BOARD_SEPOLICY_UNION and BOARD_SEPOLICY_REPLACE files. Order
26matters in this list.
27eg.) If you have BOARD_SEPOLICY_UNION := widget.te and have 2
28instances of widget.te files on BOARD_SEPOLICY_DIRS search path.
29The first one found (at the first search dir containing the file)
30gets processed first.
31Reviewing out/target/product/<device>/etc/sepolicy_intermediates/policy.conf
32will help sort out ordering issues.
33
34It is an error to specify a BOARD_POLICY_REPLACE file that does
35not exist in external/sepolicy.
36
37It is an error to specify a BOARD_POLICY_REPLACE file that appears
38multiple times on the policy search path defined by BOARD_SEPOLICY_DIRS.
39eg.) if you specify shell.te in BOARD_SEPOLICY_REPLACE and
40BOARD_SEPOLICY_DIRS is set to
41"vendor/widget/common/sepolicy device/widget/x/sepolicy" and shell.te
42appears in both locations, it is an error. Unless it is in
43BOARD_SEPOLICY_IGNORE to be filtered out. See BOARD_SEPOLICY_IGNORE
44for more details.
45
46It is an error to specify the same file name in both
47BOARD_POLICY_REPLACE and BOARD_POLICY_UNION.
48
49It is an error to specify a BOARD_SEPOLICY_DIRS that has no entries when
50specifying BOARD_SEPOLICY_REPLACE.
51
52BOARD_SEPOLICY_IGNORE is a list of paths (directory + filename) of
53files that are not to be included in the resulting policy. This list
54is passed to filter-out to remove any paths you may want to ignore. This
55is useful if you have numerous config directories that contain a file
56and you want to NOT include a particular file in your resulting
57policy file, either by UNION or REPLACE.
58Eg.) Suppose the following:
59     BOARD_SEPOLICY_DIRS := X Y
60     BOARD_SEPOLICY_REPLACE := A
61     BOARD_SEPOLICY_IGNORE := X/A
62
63     Directories X and Y contain A.
64
65     The resulting policy is created by using Y/A only, thus X/A was
66     ignored.
67
68Example BoardConfig.mk Usage:
69From the Tuna device BoardConfig.mk, device/samsung/tuna/BoardConfig.mk
70
71BOARD_SEPOLICY_DIRS := \
72        device/samsung/tuna/sepolicy
73
74BOARD_SEPOLICY_UNION := \
75        genfs_contexts \
76        file_contexts \
77        sepolicy.te
78
79SPECIFIC POLICY FILE INFORMATION
80
81mac_permissions.xml:
82  ABOUT:
83    The mac_permissions.xml file is used for controlling the mmac solutions
84    as well as mapping a public base16 signing key with an arbitrary seinfo
85    string. Details of the files contents can be found in a comment at the
86    top of that file. The seinfo string, previously mentioned, is the same string
87    that is referenced in seapp_contexts.
88
89    This file can be replaced through BOARD_SEPOLICY_REPLACE containing the
90    value "mac_permissions.xml", or appended to by using the BOARD_SEPOLICY_UNION
91    variable. It is important to note the final processed version of this file
92    is stripped of comments and whitespace. This is to preserve space on the
93    system.img. If one wishes to view it in a more human friendly format,
94    the "tidy" or "xmllint" command will assist you.
95
96  TOOLING:
97    insertkeys.py
98      Is a helper script for mapping arbitrary tags in the signature stanzas of
99      mac_permissions.xml to public keys found in pem files. This script takes
100      a mac_permissions.xml file(s) and configuration file in order to operate.
101      Details of the configuration file (keys.conf) can be found in the subsection
102      keys.conf. This tool is also responsible for stripping the comments and
103      whitespace during processing.
104
105      keys.conf
106        The keys.conf file is used for controlling the mapping of "tags" found in
107        the mac_permissions.xml signature stanzas with actual public keys found in
108        pem files. The configuration file can be used in BOARD_SEPOLICY_UNION and
109        BOARD_SEPOLICY_REPLACE variables and is processed via m4.
110
111        The script allows for mapping any string contained in TARGET_BUILD_VARIANT
112        with specific path to a pem file. Typically TARGET_BUILD_VARIANT is either
113        user, eng or userdebug. Additionally, one can specify "ALL" to map a path to
114        any string specified in TARGET_BUILD_VARIANT. All tags are matched verbatim
115        and all options are matched lowercase. The options are "tolowered" automatically
116        for the user, it is convention to specify tags and options in all uppercase
117        and tags start with @.
118
119        NOTE: The pem files are base64 encoded and PackageManagerService, mac_permissions.xml
120              and setool all use base16 encodings.
121