Commit graph

33603 commits

Author SHA1 Message Date
Alessio Balsini
27b2b6d8f5 mediaprovider_app can access BPF resources am: fd3e9d838e
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1907857

Change-Id: I3b059674434fd067efef4e999f5b4887d2a2efba
2021-12-07 00:36:42 +00:00
Alessio Balsini
fd3e9d838e mediaprovider_app can access BPF resources
The FUSE daemon in MediaProvider needs to access the file descriptor of
its pinned BPF program and the maps used to commuicate with the kernel.

Bug: 202785178
Test: adb logcat FuseDaemon:V \*:S (in git_master)
Ignore-AOSP-First: mirroring AOSP for prototyping
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: I99d641658d37fb765ecc5d5c0113962f134ee1ae
2021-12-06 19:12:55 +00:00
Victor Hsieh
33aa1a3c52 Allow composd to create odrefresh staging directory
composd in responsible to prepare the staging directory for odrefresh
(in the VM) to write the output to. Temporary output should be put in a
staged directory with a temporary apex_art_staging_data_file context.
When a compilation is finished, the files can then be moved to the final
directory with the final context.

Bug: 205750213
Test: No denials

Change-Id: I9444470b31518242c1bb84fc755819d459d21d68
2021-12-06 08:41:31 -08:00
Jiyong Park
3db645b83d Allow microdroid_manager to read /proc/bootconfig
... so that it can ensure that the bootconfig hasn't changed since the
last boot.

Bug: 208639280
Test: m
Change-Id: I2310a0df0ebbef9d6fe47dbad2538ecbe7bc84e6
2021-12-06 21:16:09 +09:00
Thiébaud Weksteen
95824753b2 Merge "Migrate insertkeys.py to Python3" am: eb424f43f2
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1908682

Change-Id: Icf95d913dbbf2a57bb0d29253530b9903b7ea793
2021-12-06 08:35:57 +00:00
Thiébaud Weksteen
eb424f43f2 Merge "Migrate insertkeys.py to Python3" 2021-12-06 08:21:39 +00:00
Thiébaud Weksteen
9870725336 Migrate insertkeys.py to Python3
PEM files are ASCII-encoded, open them as text file (as opposed to
binary). Avoid relying on __del__. Introduce a prologue and epilogue
methods to emit the <policy> tag only once per output.

Test: build plat_mac_permissions.xml on bramble and compare with
      previous version; identical
Test: build product_mac_permissions.xml on bramble and compare with
      previous version; identical
Test: build system_ext_mac_permissions.xml on bramble and compare with
      previous version; identical
Test: build vendor_mac_permissions.xml on bramble and compare with
      previous version; identical
Bug: 200119288
Change-Id: Iced0acf75bff756453918a411aecb9f4ef8f825d
2021-12-06 13:46:23 +11:00
Victor Hsieh
7b8647e628 Allow composd to read ART's properties am: 1f117c26c6
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1908176

Change-Id: I66ef9b455449df1e5b20163c7d9824d2799f7294
2021-12-03 20:38:10 +00:00
Victor Hsieh
1f117c26c6 Allow composd to read ART's properties
Only ro.zygote is currently used, though we'll need to a few others of
the same property context.

Bug: 205750213
Test: composd_cmd forced-odrefresh # less SELinux denial
Change-Id: I2efbbc1637142f522a66c47bdd17471c4bde227a
2021-12-02 17:58:23 -08:00
Treehugger Robot
f4d3471aac Merge "Remove 26.0 and 27.0 compat support" am: 26950bb361
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1903972

Change-Id: I4b9eb4e5d85cc0a0f49eabd47ce23aaf95db7213
2021-12-02 06:46:29 +00:00
Treehugger Robot
26950bb361 Merge "Remove 26.0 and 27.0 compat support" 2021-12-02 06:26:58 +00:00
Treehugger Robot
9a922c3ce2 Merge "Add logd.ready" am: f5646ff42b
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1895329

Change-Id: I0a0bfe16bf07ecf9cf231f175125dffaa22c4689
2021-12-02 03:49:13 +00:00
Treehugger Robot
f5646ff42b Merge "Add logd.ready" 2021-12-02 03:34:00 +00:00
Inseob Kim
9dc6d70044 Remove 26.0 and 27.0 compat support
Treble doesn't support T system + O vendor, so removing 26.0 (N) and
27.0 (O) prebuilts and compat files.

Bug: 207815515
Test: build
Change-Id: I98d5972221a8e77f3c45fc48ff50bb2b8eb94275
2021-12-02 10:22:10 +09:00
Inseob Kim
ae574d77d3 Merge "Add hal_dumpstate_service to ignore" am: 7182b2e56b
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1908650

Change-Id: Id04ec79fd5635f00a0ec5adb3652f65bfd2dae95
2021-12-02 00:55:30 +00:00
Thiébaud Weksteen
bc0d972e48 Merge "Migrate tests/ to Python 3" am: df4f088f9e
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1903451

Change-Id: Iddceab2ad8786cbf7bedeac43a3896e5ca6e0ee3
2021-12-02 00:55:17 +00:00
Inseob Kim
7182b2e56b Merge "Add hal_dumpstate_service to ignore" 2021-12-02 00:43:51 +00:00
Thiébaud Weksteen
df4f088f9e Merge "Migrate tests/ to Python 3" 2021-12-02 00:29:18 +00:00
Inseob Kim
a00439e69a Add hal_dumpstate_service to ignore
Bug: 208705795
Test: build
Change-Id: I211e6e0b98c964ba34db5ffd4bcf7a3cf959a8b5
2021-12-02 09:23:06 +09:00
Treehugger Robot
b5bf051407 Merge "Add 32.0 mapping files" am: 6cf460c45e
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1906312

Change-Id: Ifbc5006fd172b306f052ed5d40f39a4d41d25f79
2021-12-01 23:25:54 +00:00
Treehugger Robot
6cf460c45e Merge "Add 32.0 mapping files" 2021-12-01 23:10:38 +00:00
Thiébaud Weksteen
f24b457dd0 Migrate tests/ to Python 3
In general, it appears that libselinux and libsepol interpret paths and
contexts as bytes. For instance, selabel_file(5) mentions about the path
field of file_contexts:

  Strings representing paths are processed as bytes (as opposed to
  Unicode), meaning that non-ASCII characters are not matched
  by a single wildcard.

libsepol also uses primitives such as strchr[1], which explicitly
operate at the byte level (see strchr(3)). However, practically, Android
paths and contexts all uses ASCII characters.

Use the str type (i.e., Unicode) for all Python code to avoid a larger
refactoring. Ensure we convert to bytes for inputs and outputs of
libsepolwrap.so. The encoding "ascii" is used, which will raise an error
should a context or type contain non-ASCII characters.

Update headers to match development/docs/copyright-templates.

[1] https://cs.android.com/android/platform/superproject/+/master:external/selinux/libsepol/src/context_record.c;l=224;drc=454466e2e49fd99f36db78396e604962b8682cb4

Bug: 200119288
Test: lunch aosp_bramble-userdebug && m
Test: atest --host fc_sort_test
Test: manually run searchpolicy
Change-Id: I72d41a35f90b2d4112e481cd8d7408764a6c8132
2021-12-01 21:45:13 +00:00
Treehugger Robot
e45a840e75 Merge "microdroid: Run apk mount utils from MM" am: 2d059f520c
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1902671

Change-Id: I829f2ab93f64f825fff004fc3220b58882e21ed2
2021-12-01 18:07:48 +00:00
Treehugger Robot
2d059f520c Merge "microdroid: Run apk mount utils from MM" 2021-12-01 17:06:44 +00:00
Kedar Chitnis
3591bd6749 Merge "Update sepolicy to add dumpstate device service for AIDL HAL" am: bb0315bab9
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1895075

Change-Id: I07009a4ecb9c6ab1712853b15ce6a10914b5babe
2021-12-01 12:30:31 +00:00
Kedar Chitnis
bb0315bab9 Merge "Update sepolicy to add dumpstate device service for AIDL HAL" 2021-12-01 12:16:33 +00:00
Inseob Kim
2df19cba08 microdroid: Run apk mount utils from MM
For now, the command for apkdmverity and zipfuse is hard-coded in the
init script file. To support passing extra APKs, microdroid_manager
needs to parse the vm config, and then manually run apkdmverity and
zipfuse with appropriate parameters.

Bug: 205224817
Test: atest MicrodroidHostTestCases ComposHostTestCases
Change-Id: I482b548b2a414f3b5136cea199d551cc88402caf
2021-12-01 19:46:33 +09:00
Chris Weir
7129b929e3 Give Netlink Interceptor route_socket perms
VTS for Netlink Interceptor needs access to netlink_route_socket, and
other services routing traffic to Netlink Interceptor may as well.

Bug: 201467304
Test: VtsHalNetlinkInterceptorV1_0Test
Change-Id: Ic52e54f1eec7175154d2e89e307740071b1ba168
2021-12-01 04:08:19 +00:00
Inseob Kim
bee558e4bb Add 32.0 mapping files
Steps taken to produce the mapping files:

1. Add prebuilts/api/32.0/plat_pub_versioned.cil from the
/vendor/etc/selinux/plat_pub_versioned.cil file built on sc-v2-dev with
lunch target aosp_arm64-eng. Add prebuilts/api/32.0/vendor_sepolicy.cil
as an empty file.

When adding plat_pub_versioned.cil, leave only type and typeattribute
statements, removing the other statements: allow, neverallow, role, etc.

2. Add new file private/compat/32.0/32.0.cil by doing the following:
- copy /system/etc/selinux/mapping/32.0.cil from sc-v2-dev
aosp_arm64-eng device to private/compat/32.0/32.0.cil
- remove all attribute declaration statement (typeattribute ...) and
sort lines alphabetically
- some selinux types were added/renamed/deleted w.r.t 32 sepolicy.
Find all such types using treble_sepolicy_tests_32.0 test.
- for all these types figure out where to map them by looking at
31.0.[ignore.]cil files and add approprite entries to 32.0.[ignore.]cil.

This change also enables treble_sepolicy_tests_32.0 and installs
32.0.cil mapping file onto the device.

Bug: 206330997
Test: m treble_sepolicy_tests_32.0
Test: m 32.0_compat_test
Test: m selinux_policy
Change-Id: I8b2991e64e2f531ce12db7aaacad955e4e8ed687
2021-12-01 10:58:25 +09:00
Yifan Hong
0ad8b6a1d2 recovery: allow to talk to health HAL.
On non-A/B devices, recovery needs to check if battery
is okay before applying the update. This requires
talking to the AIDL health HAL if the device uses
AIDL health HAL.

Test: manually calling GetBatteryInfo and check for denials
Bug: 170338625
Bug: 177269435
Change-Id: Ia89353cfff023376a4176c0582312bdcab00b5e6
2021-11-30 16:44:42 -08:00
Treehugger Robot
5607594999 Merge "Restrict system_server_startup domain" am: 825936c473
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1903593

Change-Id: I8e77864d385f06e8151425cc72c277cb8d60df55
2021-11-30 10:42:59 +00:00
Treehugger Robot
825936c473 Merge "Restrict system_server_startup domain" 2021-11-30 10:29:10 +00:00
Inseob Kim
94fbbb68e7 Add SEPolicy prebuilts for Sv2 (API 32) am: 43b6a317bc
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1906311

Change-Id: Ib4c30188bba177c551de8712b4a0cf684f937146
2021-11-30 07:17:40 +00:00
Ramji Jiyani
32646fe4c7 Add selinux context for /system_dlkm
Bug: 200082547
Test: Manual
Signed-off-by: Ramji Jiyani <ramjiyani@google.com>
Change-Id: I2207e0b3d508f9a97374724e72fd428a0eae480c
2021-11-30 06:20:47 +00:00
Jiyong Park
ff3048349a Add logd.ready
logd.ready is a system property that logd sets when it is ready to
serve incoming socket requests for reading and writing logs. Clients of
logd (e.g. logcat) can use this to synchronize with logd, otherwise they
may experience a crash due to the refused socket connection to logd when
they are started before logd is ready.

Bug: 206826522
Test: run microdroid. see logcat logs are shown immediately
Change-Id: Iee13485b0f4c2beda9bc8434f514c4e32e119492
2021-11-30 15:10:53 +09:00
Inseob Kim
43b6a317bc Add SEPolicy prebuilts for Sv2 (API 32)
Bug: 206330997
Test: Build
Change-Id: I26082be343b15c9d6c7cabf0acd44711fbcc8113
2021-11-30 12:04:43 +09:00
Treehugger Robot
2c95edf2af Merge "Grant BetterBug access ot WM traces attributes" am: 53b6de0642
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1903230

Change-Id: Iac94b461b51ad6373de2c7a35e04aaea3f554394
2021-11-29 18:53:37 +00:00
Treehugger Robot
53b6de0642 Merge "Grant BetterBug access ot WM traces attributes" 2021-11-29 18:38:12 +00:00
Nataniel Borges
6b624a5a0c Grant BetterBug access ot WM traces attributes
Currently BetterBug (privileged app) cannot access the details form
/data/misc/wmtrace.

Test: access a trace from /data/misc/wmtrace/ in betterbug
Change-Id: I4cf864ab4729e85f05df8f9e601a75ff8b92bdc8
2021-11-29 18:22:58 +01:00
Paul Lawrence
b669669504 Merge "Allow bpfloader to read fuse's bpf_prog number" am: 04cddf8af2
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1894198

Change-Id: I04f766b5c312fb6b8c56e63ae9ed90a09e081baa
2021-11-29 16:33:03 +00:00
Paul Lawrence
04cddf8af2 Merge "Allow bpfloader to read fuse's bpf_prog number" 2021-11-29 16:18:42 +00:00
Treehugger Robot
7d68e1e458 Merge "Make 31.0 prebuilts and compat files up to date" am: 906797a9bc
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1903979

Change-Id: I68bba8b9556c1f53e27b3b5a78886afc63f2dd23
2021-11-29 13:14:27 +00:00
Treehugger Robot
906797a9bc Merge "Make 31.0 prebuilts and compat files up to date" 2021-11-29 13:03:45 +00:00
sunliang
fd0be879cc Change the label of /product/overlay to u:object_r:system_file:s0 am: e8d1e97ef2
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1903975

Change-Id: Iea550473af3cbfce4fead51e763b76ed316d6de4
2021-11-29 11:44:33 +00:00
Inseob Kim
5a8afdcfa6 Make 31.0 prebuilts and compat files up to date
Bug: 208126864
Test: m selinux_policy 31.0_compat_test treble_sepolicy_tests_31.0
Change-Id: Ic97d17b39f7307ed5af200c97c8c09ca0511c216
2021-11-29 19:40:59 +09:00
sunliang
e8d1e97ef2 Change the label of /product/overlay to u:object_r:system_file:s0
Overlayfs product/overlay in init first stage is allowed in AndroidS.
product/overlay directory contains RRO apks, it is plausible to allow
dumpstate to access it since dumpstate will call df command.
Or there will be an avc denial:
01-01 07:09:37.234 13582 13582 W df : type=1400 audit(0.0:1717): avc: denied { getattr } for path="/product/overlay"
dev="overlay" ino=2 scontext=u:r:dumpstate:s0 tcontext=u:object_r:vendor_overlay_file:s0 tclass=dir permissive=0

Actually, it is more reasonable to set /product/overlay to u:object_r:system_file:s0 since
there already had definiitions releated to /product/overlay
/mnt/scratch/overlay/(system|product)/upper u:object_r:system_file:s0
/(product|system/product)/vendor_overlay/[0-9]+/.*          u:object_r:vendor_file:s0

Bug: https://b.corp.google.com/u/0/issues/186342252

Signed-off-by: sunliang <sunliang@oppo.com>
Change-Id: I493fab20b5530c6094bd80767a24f3250d7117a8
2021-11-29 08:24:37 +00:00
Hungming Chen
ffa08bbd21 [NC#1] netd: allow netd to setup packet socket for clatd
Needed because the packet socket setup has been moved from clatd
to netd.

Test: manual test
    1. Connect to ipv6-only wifi.
    2. Try IPv4 traffic.
       $ ping 8.8.8.8
Change-Id: If6c3ba70cd7b3a44a31b8deab088303c22838da8
2021-11-26 20:28:29 +08:00
Alan Stokes
665c295efc Restrict system_server_startup domain
This seems like an oversight when system_server_startup was
introduced (commit caf42d615d).

Test: Presubmits
Change-Id: Ia371caa8dfc2c250d6ca6f571cf002e25703e793
2021-11-26 11:41:51 +00:00
Jiyong Park
7dec0b50f6 Merge "app_data_file is the only app_data_file_type that is allowed for crosvm" am: cc82a6ae89
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1903450

Change-Id: I6564c95e4d7a8463f43de0f610447650fdeb9617
2021-11-26 06:31:52 +00:00
Jiyong Park
cc82a6ae89 Merge "app_data_file is the only app_data_file_type that is allowed for crosvm" 2021-11-26 06:11:03 +00:00