Commit graph

792 commits

Author SHA1 Message Date
Maciej Żenczykowski
b13921c3f0 much more finegrained bpf selinux privs for networking mainline
Goal is to gain a better handle on who has access to which maps
and to allow (with bpfloader changes to create in one directory
and move into the target directory) per-map selection of
selinux context, while still having reasonable defaults for stuff
pinned directly into the target location.

BPFFS (ie. /sys/fs/bpf) labelling is as follows:
  subdirectory   selinux context      mainline  usecase / usable by
  /              fs_bpf               no (*)    core operating system (ie. platform)
  /net_private   fs_bpf_net_private   yes, T+   network_stack
  /net_shared    fs_bpf_net_shared    yes, T+   network_stack & system_server
  /netd_readonly fs_bpf_netd_readonly yes, T+   network_stack & system_server & r/o to netd
  /netd_shared   fs_bpf_netd_shared   yes, T+   network_stack & system_server & netd [**]
  /tethering     fs_bpf_tethering     yes, S+   network_stack
  /vendor        fs_bpf_vendor        no, T+    vendor

* initial support for bpf was added back in P,
  but things worked differently back then with no bpfloader,
  and instead netd doing stuff by hand,
  bpfloader with pinning into /sys/fs/bpf was (I believe) added in Q
  (and was definitely there in R)

** additionally bpf programs are accesible to netutils_wrapper
   for use by iptables xt_bpf extensions

'mainline yes' currently means shipped by the com.android.tethering apex,
but this is really another case of bad naming, as it's really
the 'networking/connectivity/tethering' apex / mainline module.
Long term the plan is to merge a few other networking mainline modules
into it (and maybe give it a saner name...).

The reason for splitting net_private vs tethering is that:
  S+ must support 4.9+ kernels and S era bpfloader v0.2+
  T+ must support 4.14+ kernels and T beta3 era bpfloader v0.13+

The kernel affects the intelligence of the in-kernel bpf verifier
and the available bpf helper functions.  Older kernels have
a tendency to reject programs that newer kernels allow.

/ && /vendor are not shipped via mainline, so only need to work
with the bpfloader that's part of the core os.

Bug: 218408035
Test: TreeHugger, manually on cuttlefish
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I674866ebe32aca4fc851818c1ffcbec12ac4f7d4
(cherry picked from commit 15715aea32)
2022-06-22 16:07:42 -07:00
Patrick Rohr
f1c63a4e91 sepolicy: allow TUNSETLINK and TUNSETCARRIER
This is required for testing new ethernet APIs in T.

This change is not identical to the corresponding AOSP change
because it also needs to update the T prebuilts.

Test: TH
Bug: 171872016
(cherry picked from commit 02b55354bd)
(cherry picked from commit 69fa8ca6f2)
Change-Id: I036e48530e37f7213a21b250b858a37fba3e663b
2022-06-22 16:07:28 -07:00
Benedict Wong
a6471611cc Add xfrm netlink permissions for system server
This change enables xfrm netlink socket use for the system server,
and the network_stack process. This will be used by IpSecService
to configure SAs, and network stack to monitor counters & replay
bitmaps for monitoring of IPsec tunnels.

This patch updates the prebuilts, in addition to the changes to the
master source.

Bug: 233392908
Test: Compiled
(cherry picked from commit b25b4bf53f)
(cherry picked from commit 8b7c1cbd5e)
Change-Id: I55e03a3ca7793b09688f603c973c38bd2f6e7c7f
2022-06-22 16:07:16 -07:00
Patrick Rohr
7e3e7e4a41 Fix system server and network stack netlink permissions
Give system_server and network_stack the same permissions as netd.
This is needed as we are continuously moving code out of netd into
network_stack and system_server.

This change is not identical to the corresponding AOSP change
because it also needs to update the T prebuilts.

Test: TH
Bug: 233300834
(cherry picked from commit ab02397814)
(cherry picked from commit d0478822ce)
Change-Id: Ic98c6fc631ee98bef4b5451b6b52d94e673b4f3c
2022-06-22 16:06:55 -07:00
Treehugger Robot
11a9ff428d Merge "Allow remote_prov_app to find mediametrics." 2022-06-22 06:14:28 +00:00
Max Bires
d1cd55f660 Allow remote_prov_app to find mediametrics.
This change allows remote_prov_app to find mediametrics. This is a
permission that all apps have. It is now needed for remote_prov_app due
to a new feature related to provisioning Widevine through the MediaDrm
framework.

Bug: 235491155
Test: no selinux denials related to remote_prov_app
Change-Id: Id3057b036486288358a9a84100fe808eb56df5fe
Merged-In: Id3057b036486288358a9a84100fe808eb56df5fe
2022-06-15 13:42:32 -07:00
Steven Terrell
c402a02164 Merge "Add System Property Controlling Animators" am: 06c506940e
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/2118925

Change-Id: Ieee8f322c099443e6e533d8475501e55e9748511
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-08 16:11:44 +00:00
Steven Terrell
879f41c5f2 Add System Property Controlling Animators
Adding a new system property that will act as a toggle
enabling/disabling the framework changes that were submitted to prevent
leaked animators.

Bug: 233391022

Test: manual.

Merged-In: I57225feb50a3f3b4ac8c39998c47f263ae211b66
Change-Id: Ifc339efc1c3a5e19920b77d1f24bef19c39d5f44
2022-06-07 20:22:10 +00:00
Rubin Xu
b7a8225fd8 Merge "Allow Bluetooth stack to read security log sysprop" am: ab73c8f1c8
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/2096793

Change-Id: Iae1a538a9112569421c87de5ca082e066b6991f2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-25 12:01:57 +00:00
Rubin Xu
ab73c8f1c8 Merge "Allow Bluetooth stack to read security log sysprop" 2022-05-25 11:43:49 +00:00
Sanjana Sunil
8f37c1b762 Merge "Allow zygote to relabel sdk_sandbox_system_data_file" am: 26750b9a0c
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/2101653

Change-Id: I0762945569e84d4a9cb6f98553c4e641812955c7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-20 22:34:10 +00:00
Samiul Islam
6b309bd4e3 Merge "Create a separate label for sandbox root directory" am: 61bd67072c
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/2098133

Change-Id: I667c2888a2c4f82cd3a891c03b273b477ccd79d6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-20 12:48:30 +00:00
Sanjana Sunil
563016314c Allow zygote to relabel sdk_sandbox_system_data_file
To perform sdk sandbox data isolation, the zygote gets the selinux label
of SDK sandbox storage (e.g. /data/misc_{ce,de}/<user-id>/sdksandbox)
before tmpfs is mounted onto /data/misc_{ce,de} (or other volumes). It
relabels it back once bind mounting of required sandbox data is done.
This change allows for the zygote to perform these operations.

Bug: 214241165
Test: atest SdkSandboxStorageHostTest
Change-Id: I28d1709ab4601f0fb1788435453ed19d023dc80b
2022-05-20 11:24:32 +00:00
Samiul Islam
61bd67072c Merge "Create a separate label for sandbox root directory" 2022-05-20 07:21:19 +00:00
Nicolas Geoffray
c90a5313a7 sysfs_fs_f2fs for zygote. am: 36c1ef6672
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/2100138

Change-Id: I0afc1d81d4d485c88fee6e2d4a99fe3abf93d9da
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-19 18:03:17 +00:00
Nicolas Geoffray
36c1ef6672 sysfs_fs_f2fs for zygote.
Test: boot
Bug: 223366272

(cherry picked from commit d68b089d59)

Merged-In: I163c343d8af9c578c840d7c710854fce15c29903
Change-Id: Ia67bbe89d61e8badb128d4c13570d8049f91d7a2
2022-05-19 16:53:41 +01:00
Mohammad Samiul Islam
d2ffd35cc0 Create a separate label for sandbox root directory
Currently, app process can freely execute path at
`/data/misc_ce/0/sdksandbox/<package-name>` since it's labeled as system
file. They can't read or write, but use 403/404
error to figure out if an app is installed or not.

By changing the selinux label of the parent directory:
`/data/misc_ce/0/sdksandbox`, we can restrict app process from executing
inside the directory and avoid the privacy leak.

Sandbox process should only have "search" permission on the new label so
that it can pass through it to its data directory located in
`/data/misc_ce/0/sdksandbox/<package-name>/<per-sdk-dir>`.

Bug: 214241165
Test: atest SdkSandboxStorageHostTest
Test: `adb shell cd /data/misc_ce/0/sdksandbox` gives error
Test: manual test to verify webview still works
Change-Id: Id8771b322d4eb5532eaf719f203ca94035e2a8ed
Merged-In: Id8771b322d4eb5532eaf719f203ca94035e2a8ed
2022-05-19 16:01:15 +01:00
Treehugger Robot
3b660a7982 Merge "Allow vendor_init to read device config vendor_system_native properties" am: 1fa1ef4e0d
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/2099111

Change-Id: I73fbfddbc4658b8aafca11645f114d3a4111e4d1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-19 08:34:15 +00:00
Treehugger Robot
1fa1ef4e0d Merge "Allow vendor_init to read device config vendor_system_native properties" 2022-05-19 08:05:16 +00:00
Richard Chang
8073874dc4 Merge "Update sepolicy prebuilts to sync vendor_system_native prop changes" am: e14ad82c98
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/2098910

Change-Id: I809c92aac30e65a855a0e5f2180f5e8a76529dd2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-18 13:29:30 +00:00
Richard Chang
6c29066f65 Allow vendor_init to read device config vendor_system_native properties
Let vendor_init can react Vendor System Native Experiment
changes via persist.device_config.vendor_system_native.* properties.

Bug: 223685902
Test: Build and check no avc denied messages in dmesg
Change-Id: If69d1dab02d6c36cdb1f6e668887f8afe03e5b0e
Merged-In: If69d1dab02d6c36cdb1f6e668887f8afe03e5b0e
2022-05-18 05:16:12 +00:00
Richard Chang
e14ad82c98 Merge "Update sepolicy prebuilts to sync vendor_system_native prop changes" 2022-05-17 10:56:44 +00:00
Treehugger Robot
4f7c309ddf Merge "Grant permission for mediatranscoding hal_allocator for OMX platforms" into android12-tests-dev am: d4a7420e0c am: 8183cf27b5 am: e39f583a14
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1966599

Change-Id: I56578e87356fd81425cabec8008192ee56ee3117
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-16 23:23:07 +00:00
Treehugger Robot
e39f583a14 Merge "Grant permission for mediatranscoding hal_allocator for OMX platforms" into android12-tests-dev am: d4a7420e0c am: 8183cf27b5
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1966599

Change-Id: I24f4a6b12d0a65a06a2341227baa6cbb16db93d8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-16 23:19:53 +00:00
Satoshi Niwa
c4632424b8 Set expandattribute false for property attributes in prebuilts am: fa3b250ad1 am: ae167c2105 am: 7c80be1c0e am: 4295510ad5
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1435472

Change-Id: Ie22601291b8b24f5c4816425b26d091398684862
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-16 23:17:49 +00:00
Treehugger Robot
8183cf27b5 Merge "Grant permission for mediatranscoding hal_allocator for OMX platforms" into android12-tests-dev am: d4a7420e0c
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1966599

Change-Id: Ia0141797ab1eeac4ebdc08a265e252120ae2ddd8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-16 23:05:01 +00:00
Satoshi Niwa
4295510ad5 Set expandattribute false for property attributes in prebuilts am: fa3b250ad1 am: ae167c2105 am: 7c80be1c0e
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1435472

Change-Id: Ibbc11d08ad95664a3b89fd5a58fc88826cd54241
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-16 23:03:24 +00:00
Satoshi Niwa
7c80be1c0e Set expandattribute false for property attributes in prebuilts am: fa3b250ad1 am: ae167c2105
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1435472

Change-Id: I1664242c71d499e270da02c4dd70bc8b13029178
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-16 22:49:45 +00:00
Richard Chang
50dbf2c5ef Update sepolicy prebuilts to sync vendor_system_native prop changes
This CL partially cherry-picks ag/18350151 to
update prebuilts. Other parts are already included by
aosp/2083463.

Bug: 226456604
Bug: 223685902
Test: Build
Change-Id: I1ddb1db855a13671e7b76b48d84e4f1ab5a63374
2022-05-16 08:16:59 +00:00
Treehugger Robot
5d2ae41212 [MS82.4] Update sepolicy prebuilts am: 6cbd833218
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/2096697

Change-Id: I553abe9d02b016f382e885803c8efdf999d85775
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-13 10:48:02 +00:00
Treehugger Robot
6cbd833218 [MS82.4] Update sepolicy prebuilts
This CL partially cherry-picks ag/18156623 to
update prebuilts. Other parts are already included by
aosp/2069127.

Test: m
Bug: 230289468
Change-Id: If52dea348c01113fe1504eb7e51f6780f0ed4a11
2022-05-13 14:36:07 +08:00
Rubin Xu
a274858e3b Allow Bluetooth stack to read security log sysprop
Bluetooth stack needs to read persist.logd.security and
ro.organization_owned sysprop (via __android_log_security())
to control security logging for Bluetooth events.

Bug: 232283779
Test: manual
Change-Id: Ic8162cd4a4436981a15acea6ac75079081790525
2022-05-12 15:44:57 +01:00
Yurii Zubrytskyi
ac14146a95 platform/system/sepolicy - SEPolicy Prebuilts for Tiramisu am: 9d9c730f1c
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/2083163

Change-Id: I82afd93fc40e78a7ea4026c591e8bbaff320ec9b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-03 02:21:49 +00:00
Yurii Zubrytskyi
9d9c730f1c platform/system/sepolicy - SEPolicy Prebuilts for Tiramisu
Bug: 225745567
Test: Build
Change-Id: I49fb91c7a60fb1e871bdf3553d978bb16c476fd7
Merged-In: I49fb91c7a60fb1e871bdf3553d978bb16c476fd7
(cherry picked from commit f9a00364c8)
2022-05-02 13:24:45 +09:00
Zim
abfe4c00e7 Allow MediaProvider to access the media metrics service
This allows MediaProvider call certain MediaCodec APIs

Also update prebuilts for API 32.

Test: atest TranscodeTest
Bug: 190422448
(cherry picked from commit 57401bc71f)
(cherry picked from commit c38b81ce4f)
Merged-In: Ied609152e6a9ba6d17b70db325ca33f1cb345eb8
Change-Id: Ied609152e6a9ba6d17b70db325ca33f1cb345eb8
2022-03-02 18:17:57 -08:00
Treehugger Robot
dd30d8381e Merge "Remove compat test from treble sepolicy tests" am: 8e6b55a13d am: 7e5a5e8b1f
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1985246

Change-Id: I4f27384fb7e79471f34b73e58a1978ad1311e42d
2022-02-17 02:08:30 +00:00
Treehugger Robot
7e5a5e8b1f Merge "Remove compat test from treble sepolicy tests" am: 8e6b55a13d
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1985246

Change-Id: I9b7cb61dfb0dc823d39c8e35d1fff323675a835d
2022-02-17 01:46:44 +00:00
Inseob Kim
73f43ff847 Remove compat test from treble sepolicy tests
Treble sepolicy tests check whether previous versions are compatible to
ToT sepolicy or not. treble_sepolicy_tests_for_release.mk implements it,
but it also includes a compat test whether ToT sepolicy + {ver} mapping
+ {ver} plat_pub_versioned.cil can be built together or not. We
definitely need such tests, but we already have a test called "compat
test" which does exactly that, and testing it again with Treble sepolicy
tests is just redundant. The only difference between those two is that
Treble sepolicy tests can also test system_ext and product compat files,
which was contributed by a partner.

The ultimate goal here is to migrate *.mk to Soong, thus merging these
two tests (compat, Treble) into one. As we've already migrated the
compat test to Soong, this change removes the compat test part from
treble sepolicy tests. Instead, the compat test will be extended so it
can test system_ext and product compat files too.
prebuilts/api/{ver}/plat_pub_versioned.cil and
prebuilts/api/{ver}/vendor_sepolicy.cil are also removed as they aren't
used anymore: vendor_sepolicy.cil is an empty stub, and
plat_pub_versioned.cil can be built from the prebuilt source files.

Bug: 33691272
Test: m selinux_policy
Change-Id: I72f5ad0e8bbe6a7c0bbcc02f0f902b953df6ff1a
2022-02-16 04:09:29 +00:00
Thiébaud Weksteen
69d3e66ae3 Merge changes from topic "presubmit-am-47892e9f11d746939b74901bbda929d2" into sc-v2-dev-plus-aosp
* changes:
  [automerge] Grant getpgid to system_server on zygote 2p: c816666f40
  Grant getpgid to system_server on zygote
2022-02-15 04:57:57 +00:00
Xin Li
f1f2839e6e Merge "Merge sc-v2-dev-plus-aosp-without-vendor@8084891" into stage-aosp-master 2022-02-14 17:31:17 +00:00
Xin Li
77c821174e Merge sc-v2-dev-plus-aosp-without-vendor@8084891
Bug: 214455710
Merged-In: I129b5cb74259c9c028483e84c9b2ac3597c24701
Change-Id: I47ca55be668b9b2aabf86963b65b1403130ab802
2022-02-11 06:58:07 +00:00
Keith Mok
61220c8175 Merge "Update SEPolicy apexd for API 32" am: 9984dcb28e am: 64a1571f5d
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1976997

Change-Id: Ie8074e60e624d10f3b34672246db62e19b4043e6
2022-02-11 05:34:09 +00:00
Keith Mok
16c0a350c5 Update SEPolicy apexd for API 32
The bootchart problem need the selinux policy fix.
But it is missing API 32

Bug: 218729155
Test: Build
Change-Id: Ia011f8bcd52403980c2a6751bb612dd5b770e130
2022-02-11 00:20:17 +00:00
Kevin Rocard
6f135387c4 Grant permission for mediatranscoding hal_allocator for OMX platforms
This is a port of If44653f436d4e5dcbd040af24f03b09ae8e7ac05 which
made this change to prebuilts/api/31.0/private/mediatranscoding.te.

This is required to pass CTS test.

Test: run cts -m CtsMediaTranscodingTestCases -t android.media.mediatranscoding.cts.MediaTranscodingManagerTest#testAddingClientUids
Bug: 207821225
Bug: 213141904
Change-Id: Iefe9f326572976e230eeeec74e612b6e20b31887
2022-02-01 11:01:11 +00:00
Presubmit Automerger Backend
1757cf1027 [automerge] Grant getpgid to system_server on zygote 2p: c816666f40
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/sepolicy/+/16743651

Bug: 216097542
Change-Id: Id15bbd4f7bdb7fd02ef0f67b8065c0306d42e59e
2022-01-31 23:30:15 +00:00
Thiébaud Weksteen
c816666f40 Grant getpgid to system_server on zygote
Should system_server kill zygote on crashes, it will attempt to kill any
process in the same process group. This ensures that no untracked
children are left.

Bug: 216097542
Test: m selinux_policy
Change-Id: Ie16074f76e351d80d9f17be930a731f923f99835
(cherry picked from commit 6390b3f090)
Ignore-AOSP-First: backport with update to prebuilts
2022-02-01 10:29:31 +11:00
Treehugger Robot
6b8707ffe3 Merge "Add Media metrics rule to API 32 prebuilts." am: d5bd56d11f am: 2c1fee1a67
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1965040

Change-Id: Ic1a5a2c28a96b7f7e5b9909122cd882ac68bbe1a
2022-01-28 14:12:35 +00:00
Zim
57401bc71f Allow MediaProvider to access the media metrics service
This allows MediaProvider call certain MediaCodec APIs

Also update prebuilts for API 32.

Test: atest TranscodeTest
Bug: 190422448
Merged-In: Ied609152e6a9ba6d17b70db325ca33f1cb345eb8
Change-Id: Ied609152e6a9ba6d17b70db325ca33f1cb345eb8
2022-01-28 11:49:15 +00:00
Dario Freni
75bc16cba8 Add Media metrics rule to API 32 prebuilts.
Bug: 190422448
Test: presubmit
Change-Id: I304278b9d15f89d0e04d5268af2ac82ac97acd84
2022-01-28 11:47:17 +00:00
Treehugger Robot
c8bd6d6707 Merge "Allow zygote to setattr cgroup" am: e2f870f099 am: 770fec0a15
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1859781

Change-Id: Iff0c5528fd61f6548ec69a6e0921027729d56e60
2022-01-28 11:11:51 +00:00