Commit graph

17992 commits

Author SHA1 Message Date
Tri Vo
8b3016b5db sepolicy: refactor Android.mk
system/sepolicy/Android.mk has become too large (~2k lines) and hard to
navigate. This patch reorganizes build rules for convenience. No
functional changes are made.

Test: m selinux_policy
Change-Id: I9a022b223b2387a4475da6d8209d561bfea228fb
2019-01-25 18:01:17 +00:00
Tri Vo
f6014e8e62 Merge "Move selinux_denial_metadata to /vendor." 2019-01-25 17:51:48 +00:00
Nick Kralevich
a310da9aec Merge "disallow priv-apps from following untrusted app symlinks." 2019-01-25 17:51:38 +00:00
Michael Wright
24f1d94dfa Add new external vibrator service to system_server
am: e9f1668c17

Change-Id: I20f1293d77262b45ac986d08b0795e4ff85f3095
2019-01-25 08:41:18 -08:00
Roland Levillain
66fcb98464 Clean up APEX-related otapreopt_chroot policies.
Test: A/B OTA update test (asit/dexoptota/self_full).
Bug: 113373927
Bug: 120796514
Change-Id: Icbbe1babe0dceebff2546264ddabe779babba761
2019-01-25 14:36:37 +00:00
Michael Wright
e9f1668c17 Add new external vibrator service to system_server
Bug: 111457573
Test: N/A
Change-Id: I457fd9d13cc481f2687ab39d22240c6ea7231183
2019-01-25 14:26:07 +00:00
Roland Levillain
17e021cb88 Merge changes from topics "runtime-apex-otapreopt_chroot-tear-down", "runtime-apex-installd-support", "runtime-apex-otapreopt_chroot-support"
am: c5ec14ba9a

Change-Id: I174e447b0914a1a8422ad3f1bd7f197088f8a780
2019-01-25 04:09:15 -08:00
Roland Levillain
35247c53c4 Allow oatpreopt to run dex2oat from the Runtime APEX.
am: ab9c053078

Change-Id: I7f56c81bbfc43d877a24c16605aaa556792c973e
2019-01-25 04:08:52 -08:00
Roland Levillain
64515d6131 Allow otapreopt_chroot to mount APEX packages using apexd logic.
am: 0a6c2d013a

Change-Id: I9f2712e43d0483fc41c8df6affb4d0bc55905c9d
2019-01-25 04:08:27 -08:00
Roland Levillain
c5ec14ba9a Merge changes from topics "runtime-apex-otapreopt_chroot-tear-down", "runtime-apex-installd-support", "runtime-apex-otapreopt_chroot-support"
* changes:
  Allow `oatpreopt_chroot` to deactivate APEX packages in `/postinstall/apex`.
  Allow `oatpreopt` to run `dex2oat` from the Runtime APEX.
  Allow `otapreopt_chroot` to mount APEX packages using `apexd` logic.
2019-01-25 11:56:30 +00:00
Jiyong Park
4372bfb5cd Don't audit access for postinstall_mnt_dir
The dynamic linker always calls access(2) on the path. Don't generate SElinux
denials since the linker does not actually access the path in case the path
does not exist or isn't accessible for the process.

Bug: 120996057
Test: copy ping to /data/local/tmp, run it, no selinux denials
Test: bionic unit tests

Change-Id: Idf33ba7bc6c0d657b6ab0abde6bd078e4bb024e5
2019-01-25 20:48:58 +09:00
Carmen Jackson
4a90f2d012 Ensure that memory and binder_driver tracepoints are available in user builds
Bug: 123367055
Test: used Traceur to take a trace on a user build and verified the
tracepoints are in the resultant trace

Change-Id: I39e963762bf2b9f0e427ee217a3b2a246f970902
2019-01-24 23:43:46 -08:00
Martijn Coenen
8dc3148a0f Merge "Add more neverallows to app_zygote policy."
am: c7fb2809bf

Change-Id: Ia9545a1f8e702b76807f1871db4951dee2615ec7
2019-01-24 21:42:02 -08:00
Treehugger Robot
c7fb2809bf Merge "Add more neverallows to app_zygote policy." 2019-01-25 05:24:02 +00:00
Tri Vo
4eb68150aa Move selinux_denial_metadata to /vendor.
selinux_denial_metadate is an concatenation of different bug maps on the
device, including vendor one. This file is only used for debugging, so
we simply move it to /vendor instead of splitting it up.

/vendor/etc/selinux/selinux_denial_metadata has vendor_configs_file
selinux type, which is logd readable.

Bug: 5159394
Test: bug information is still preserved in avc logs, e.g.
audit(0.0:248): avc: denied { read } for
name="u:object_r:vendor_default_prop:s0" dev="tmpfs" ino=18012
scontext=u:r:platform_app:s0:c512,c768
tcontext=u:object_r:vendor_default_prop:s0 tclass=file permissive=0
b/79617173 app=com.android.systemui
Change-Id: Id5eb9abd3bdeed92feb2aca40880903533468d50
2019-01-25 00:13:59 +00:00
Tri Vo
07b658ccd4 Merge "Split system and product sepolicy hashes."
am: 6c9d368ab1

Change-Id: If3fec2aef521fa39450f981820d9bea081b58283
2019-01-24 16:13:43 -08:00
Tri Vo
6c9d368ab1 Merge "Split system and product sepolicy hashes." 2019-01-25 00:04:34 +00:00
Andreas Gampe
261ea86192 Sepolicy: Initial Apexd pre-/postinstall rules
Give apexd permission to execute sh.

Add userdebug_or_eng domains and rules for the test
APEX for pre- and post-install.

Bug: 119260955
Bug: 119261380
Test: atest apexservice_test
Change-Id: I0c4a5e35e096101a53c9d1f212d2db2e63728267
2019-01-24 15:06:17 -08:00
Ng Zhi An
d5315561bc Merge "Update sepolicy with new native boot flag for activity_manager"
am: 055286fc94

Change-Id: I0b127a0fffab93170b79786372c4776b611c014a
2019-01-24 14:10:56 -08:00
Andreas Gampe
f27a6f881d Merge "Sepolicy: Allow apexd to log to kmsg"
am: a1198e58c3

Change-Id: Ia357eb27c82df072cdb90ae7794a97951e6dd21d
2019-01-24 14:09:54 -08:00
Treehugger Robot
055286fc94 Merge "Update sepolicy with new native boot flag for activity_manager" 2019-01-24 22:00:53 +00:00
Andreas Gampe
a1198e58c3 Merge "Sepolicy: Allow apexd to log to kmsg" 2019-01-24 21:45:20 +00:00
Nick Kralevich
87e91237a4 disallow priv-apps from following untrusted app symlinks.
Untrustworthy symlinks dereferenced by priv-apps could cause those apps
to access files they weren't intending to access. Trusted components
such as priv-apps should never trust untrustworthy symlinks from
untrusted apps.

Modify the rules and add a neverallow assertion to prevent regressions.

Bug: 123350324
Test: device boots and no obvious problems.
Change-Id: I8c4a5c9c8571fd29b2844b20b4fd1126db4128c0
2019-01-24 13:08:10 -08:00
Martijn Coenen
e0bbb9f85a Add more neverallows to app_zygote policy.
The app_zygote should never use any unix sockets, except the
logd socket and some sockets only available on userdebug/eng.

Prevent it from using ptrace.

Bug: 111434506
Test: builds
Change-Id: Ic47cfca51fba0b150a136194ba0e4a8a488c9996
2019-01-24 20:27:54 +00:00
Ng Zhi An
c5bf4a3994 Update sepolicy with new native boot flag for activity_manager
Whitelist the persistent system properties that will be used as
flags in activity manager experiments.

Bug: 120794810
Test: m, flash, test getting flag value in ActivityManagerService.java
Change-Id: I90a10bc87d6db3a64347b62fd02e6f0b12ac9fa8
2019-01-24 11:07:17 -08:00
Yabin Cui
fc44e546bd Merge "Add sepolicy for simpleperf_app_runner."
am: 31bd80439f

Change-Id: I8fe49c994ae04a7de968a97d9a82f88e6376d383
2019-01-24 11:04:56 -08:00
Chenbo Feng
ac0b2ee2fd Merge "Allow system_server to write to bpf maps"
am: b761636b9d

Change-Id: I61851a57daef4dbd774007e6b4e8de6376fb4d59
2019-01-24 10:56:06 -08:00
Yabin Cui
31bd80439f Merge "Add sepolicy for simpleperf_app_runner." 2019-01-24 18:39:13 +00:00
Chenbo Feng
b761636b9d Merge "Allow system_server to write to bpf maps" 2019-01-24 18:16:25 +00:00
Torne (Richard Coles)
4049c2d971 Track SELinux denial caused by webview zygote.
am: 0375302f41

Change-Id: Idaac104ee5b1de9a2998c9f0346e161e3459b369
2019-01-24 09:52:20 -08:00
Andreas Gampe
aada5013aa Sepolicy: Allow apexd to log to kmsg
Allow apexd to log to the kernel log. This aids in low-level
diagnostics, when adb is not available.

Test: m
Change-Id: Ib8f286bd917b34f5e8992b37ab230313a4820bf9
2019-01-24 09:21:27 -08:00
Torne (Richard Coles)
0375302f41 Track SELinux denial caused by webview zygote.
The new codepath for creating the classloader in the webview zygote
triggers an selinux denial; track this until it is fixed.

Bug: 123246126
Test: DeviceBootTest.SELinuxUncheckedDenialBootTest
Merged-In: I6835947e81364b5dd43898199108af7b14d31088
Change-Id: I6835947e81364b5dd43898199108af7b14d31088
2019-01-24 11:38:05 -05:00
Peter Kalauskas
a8ee48d499 Merge "Allow lazy HAL to run"
am: b6388fe753

Change-Id: I4781cb62428824cf95fb7e4a925d40545f1a0d68
2019-01-24 07:27:14 -08:00
Peter Kalauskas
b6388fe753 Merge "Allow lazy HAL to run" 2019-01-24 15:11:02 +00:00
Nikita Ioffe
333209541b Merge "Allow dumpstate to write into privileged apps private files"
am: 74ea1f29eb

Change-Id: I5d50d949255ce320eeba1738a4a2a20cf97f6cf4
2019-01-24 05:03:04 -08:00
Treehugger Robot
74ea1f29eb Merge "Allow dumpstate to write into privileged apps private files" 2019-01-24 12:48:21 +00:00
Yiwei Zhang
51ca8c0fd5 Merge "gpuservice: allow cmd gpu vkjson in interactive shell"
am: 26d79ed694

Change-Id: I90cc5980b4ff8932f4ea3fdbec250c0a9e8403da
2019-01-24 02:07:23 -08:00
Treehugger Robot
26d79ed694 Merge "gpuservice: allow cmd gpu vkjson in interactive shell" 2019-01-24 09:53:26 +00:00
Nick Kralevich
3c258dd8e4 Merge "Make Android Studio Instant Run work again"
am: 551eeaf5d5

Change-Id: I6a5cf971bbc17634a97fcf15d27a8c53112a57d5
2019-01-23 21:57:21 -08:00
Treehugger Robot
551eeaf5d5 Merge "Make Android Studio Instant Run work again" 2019-01-24 05:49:02 +00:00
Chenbo Feng
3c3d52e460 Allow system_server to write to bpf maps
The bpf maps for per uid stats need to be regularly cleaned now to
optimize the memory usage and performance. It can only done by
system_server since it is the process that scrapes and read the stats.
So allow it to write to maps to clean the stats. This change also
allows the system server to create PF_KEY sockets since we need a
reliable way to force synchronize the rcu on devices with 4.9 kernel.

Test: CtsUsageStatsTestCases
Bug: 79171384
Change-Id: I6564a56a5906a958f7d8e1d290b85de3f6fa121d
2019-01-24 03:44:25 +00:00
Peter Kalauskas
b1bdbb58cf Allow lazy HAL to run
Test: Manual
Change-Id: Ic4c3fd5b2d8d709573f8cc6332a6340d28d3ba26
2019-01-23 15:29:05 -08:00
Yabin Cui
e5fc21c787 Add sepolicy for simpleperf_app_runner.
Bug: 118835348
Test: build and boot pixel 3.
Test: run simpleperf_app_runner manually.

Change-Id: Ifb6c2ab78e075684bc197d06f761becced8281d1
2019-01-23 23:23:09 +00:00
Siarhei Vishniakou
aee5061689 Merge "Permissions for input_native_boot flags"
am: b1f34ddaf7

Change-Id: I9d61e1c5b5522dafe77ff75219b40772f47382f7
2019-01-23 15:22:31 -08:00
Nikita Ioffe
1ab6affc5c Allow dumpstate to write into privileged apps private files
Bug: 123006652
Bug: 111441001
Fix: 123006652
Test: Wrote a test app using BugreportManager, checked denials in logcat
Change-Id: Id1c4b1d166bc70aec833c3d644e8aea6ae94c35a
2019-01-23 23:13:23 +00:00
Treehugger Robot
b1f34ddaf7 Merge "Permissions for input_native_boot flags" 2019-01-23 23:08:07 +00:00
Nick Kralevich
3e5668f173 Make Android Studio Instant Run work again
system/sepolicy commit ffa2b61330 made
run-as spawned processes run in the runas_app SELinux domain, instead of
the untrusted_app domain.

https://android-review.googlesource.com/q/topic:%22runas_exec%22+(status:open%20OR%20status:merged)

This broke unix socket connections from untrusted_app* to runas_app.
This functionality is used by Android Studio for the Instant Run
feature. See https://developer.android.com/studio/run/

Allow untrusted_apps to connect to listening abstract sockets hosted by
runas_app.

Addresses the following denial:

01-23 11:11:56.084 16272 16272 W e.myapplication: type=1400 audit(0.0:68): avc: denied { connectto } for path=006972736F636B6574000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 scontext=u:r:untrusted_app_27:s0:c169,c256,c512,c768 tcontext=u:r:runas_app:s0:c169,c256,c512,c768 tclass=unix_stream_socket permissive=0 app=com.example.myapplication
01-23 11:11:56.086 16272 16272 V SwapperAgent: Prior agent invocations in this VM: 1
01-23 11:11:56.088 16272 16272 E SwapperAgent: Could not connect to socket

Change-Id: Ia1203f44aebcbec0ff858b8316e147cba7a048a2
Fixes: 123297648
Test: acleung manual testing
2019-01-23 14:58:12 -08:00
Primiano Tucci
79d1dbbc05 Allow iorapd to access perfetto
This requires moving the type declaration of
perfetto traced to public, because iorapd
needs to refer to it.

Denials without this CL:
https://pastebin.com/raw/sxHMeLEU

Bug: 72170747
Test: 1. runcon u:r:iorapd:s0 iorap.cmd.perfetto \
          -v --output-proto /data/misc/iorapd/test
      2. Check that no selinux denials other than
         avc: denied { entrypoint } for path="/system/bin/iorap.cmd.perfetto" dev="sda6" ino=21 scontext=u:r:iorapd:s0 tcontext=u:object_r:system_file:s0 tclass=file permissive=1
         show up (this is a side-effect of runcon).

Change-Id: Iacd1ab201fe9fb2a6302dbd528f42f709cbca054
2019-01-23 22:43:47 +00:00
Yiwei Zhang
6e8191ead0 gpuservice: allow cmd gpu vkjson in interactive shell
Bug: 122860343
Test: adb shell, then 'cmd gpu vkjson'
Change-Id: I2720d1bbc27152f416cd7e61f4dcccb4a13c7b82
2019-01-23 14:28:56 -08:00
Wei Wang
c63f4c2579 Fix prebuilt policy from pi-dev
Bug: 118468011
Bug: 121439388
Test: Build
Change-Id: I208f9f5450ba72f5ed62e9d944c07e25d77ec259
2019-01-23 09:53:09 -08:00