Commit graph

4967 commits

Author SHA1 Message Date
Florian Mayer
5e52281372 Allow Java domains to be Perfetto producers.
This is needed to get Java heap graphs.

Test: flash aosp; profile system_server with setenforce 1

Bug: 136210868

Change-Id: I87dffdf28d09e6ce5f706782422510c615521ab3
2019-10-10 10:40:26 +01:00
Eric Biggers
0c8a90693a Merge changes from topic "fscrypt-key-mgmt-improvements"
* changes:
  Export vold ro.crypto.volume.flags property
  Allow vold to use new ioctls to add/remove fscrypt keys
2019-10-07 19:09:44 +00:00
Bill Peckham
d0dc1a057d Moving recovery resources from /system to /vendor
This change is part of a topic that moves the recovery resources from the
system partition to the vendor partition, if it exists, or the vendor directory
on the system partition otherwise. The recovery resources are moving from the
system image to the vendor partition so that a single system image may be used
with either an A/B or a non-A/B vendor image. The topic removes a delta in the
system image that prevented such reuse in the past.

The recovery resources that are moving are involved with updating the recovery
partition after an update. In a non-A/B configuration, the system boots from
the recovery partition, updates the other partitions (system, vendor, etc.)
Then, the next time the system boots normally, a script updates the recovery
partition (if necessary). This script, the executables it invokes, and the data
files that it uses were previously on the system partition. The resources that
are moving include the following.

* install-recovery.sh
* applypatch
* recovery-resource.dat (if present)
* recovery-from-boot.p (if present)

This change includes the sepolicy changes to move the recovery resources from
system to vendor. The big change is renaming install_recovery*.te to
vendor_install_recovery*.te to emphasize the move to vendor. Other changes
follow from that. The net result is that the application of the recovery patch
has the same permissions that it had when it lived in system.

Bug: 68319577
Test: Ensure that recovery partition is updated correctly.
Change-Id: If29cb22b2a7a5ce1b25d45ef8635e6cb81103327
2019-10-04 14:40:27 -07:00
Tri Vo
f53c57287d Merge "sepolicy: fix missing label on vendor_service_contexts" 2019-10-03 22:29:53 +00:00
Yifan Hong
8cbaad3e4c Merge changes Idfe99d40,I3cba28cc,Ibd53cacb
* changes:
  Add rules for snapshotctl
  dontaudit update_engine access to gsi_metadata_file.
  update_engine: rules to apply virtual A/B OTA
2019-10-03 18:58:07 +00:00
Yifan Hong
a4b3e6f62a dontaudit update_engine access to gsi_metadata_file.
update_engine tries to determine the parent path for all devices (e.g.
/dev/block/by-name) by reading the default fstab and looking for the misc
device. ReadDefaultFstab() checks whether a GSI is running by checking
gsi_metadata_file. We never apply OTAs when GSI is running, so just deny
the access.

Test: no selinux denials
Fixes: 139283697

Change-Id: I3cba28ccb6871b328ab697a4a8f3476ac72f7bed
2019-10-02 12:46:47 -07:00
Yifan Hong
07a99e16e4 update_engine: rules to apply virtual A/B OTA
- /data/gsi/ota/* now has the type ota_image_data_file. At runtime
  during an OTA, update_engine uses libsnapshot to talk to gsid
  to create these images as a backing storage of snapshots. These
  "COW images" stores the changes update_engine has applied to
  the partitions.
  If the update is successful, these changes will be merged to the
  partitions, and these images will be teared down. If the update
  fails, these images will be deleted after rolling back to the
  previous slot.

- /metadata/gsi/ota/* now has the type ota_metadata_file. At runtime
  during an OTA, update_engine and gsid stores update states and
  information of the created snapshots there. At next boot, init
  reads these files to re-create the snapshots.

Beside these assignments, this CL also allows gsid and update_engine
to have the these permissions to do these operations.

Bug: 135752105
Test: apply OTA, no failure
Change-Id: Ibd53cacb6b4ee569c33cffbc18b1b801b62265de
2019-10-02 12:46:47 -07:00
Roshan Pius
1086c7d71d wifi_stack: Move to network_stack process
The wifi stack APK will run inside the network_stack process. So, move
the sepolicy rules for wifi stack inside the network stack rules.

Bug: 135691051
Test: Manual tests
- manual connect to wifi networks
- Remove networks
Test: Will send for ACTS wifi regression testing
Change-Id: I9d5da80852f22fa1d12b2dbbc76b9e06c1275310
(cherry-picked from b83abf7af3df64e0d3c1b22548f2344b55aece28)
2019-10-02 11:49:43 -07:00
Tri Vo
3e70db526e sepolicy: fix missing label on vendor_service_contexts
Vendors can publish services with servicemanager only on non-Treble
builds. vendor_service_contexts is not meant to be read by
servicemanager.

5bccbfefe4/public/servicemanager.te (22)

Bug: 141333155
Test: create /vendor/etc/selinux/vendor_service_contexts and make sure it is
correctly labeled.
Change-Id: Ib68c50e0cdb2c39f0857a10289bfa26fa11b1b3c
2019-10-01 15:23:27 -07:00
Suren Baghdasaryan
5bccbfefe4 Merge "sepolicy: Allow lmkd access to vmstat file" 2019-10-01 16:35:14 +00:00
Tri Vo
b398dbb9ea Merge "sepolicy: remove ashmemd" 2019-10-01 16:22:57 +00:00
Eric Biggers
53c3a1171f Export vold ro.crypto.volume.flags property
Allow vendor-init to set the new property ro.crypto.volume.flags so that
vendors can configure file-based encryption on adoptable storage to use
v2 encryption policies.  This is analogous to the existing properties
ro.crypto.volume.contents_mode and ro.crypto.volume.filenames_mode.

Bug: 140500999
Test: see If64028d8580584b2c33c614cabd5d6b93657f608
Change-Id: Ibde73e0556b6a08e2653149c1cdbf39cdcae6112
2019-09-30 13:11:52 -07:00
Eric Biggers
36ae6631e3 Allow vold to use new ioctls to add/remove fscrypt keys
Also add neverallow rules to enforce that unintended domains aren't
allowed to use any of the fscrypt ioctls.

(Originally based on a patch by Satya Tangirala <satyat@google.com>)

Bug: 140500828
Test: see I296ef78138578a3fd773797ac0cd46af1296b959
Change-Id: I01e81edf0d948af254ddf4275702e7224b2698e4
2019-09-30 13:11:49 -07:00
Robert Shih
75c0fa4517 Merge "Allow apps to access hal_drm" 2019-09-30 18:08:32 +00:00
Suren Baghdasaryan
d210b7e729 sepolicy: Allow lmkd access to vmstat file
Lmkd needs read access to /proc/vmstat to read workingset_refault and
pgscan metrics.

Bug: 132642304
Test: lmkd_unit_test
Change-Id: I7db1b85552c6ca2d5ad76041ca29687146bde769
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-09-30 16:57:35 +00:00
Robert Shih
f58be478de Allow apps to access hal_drm
Bug: 134787536
Test: MediaDrmClearkeyTest#testClearKeyPlaybackCenc
Change-Id: I931ccdfa3b78c7210f9f94e94b48d2d6908a371d
Merged-In: I931ccdfa3b78c7210f9f94e94b48d2d6908a371d
2019-09-30 04:51:24 +00:00
Eric Biggers
b57af5d0e6 Allow shell to get encryption policy for CTS
Allow the shell domain to use the FS_IOC_GET_ENCRYPTION_POLICY and
FS_IOC_GET_ENCRYPTION_POLICY_EX ioctls so that we can write a CTS test
which checks that the device complies with the CDD requirements to use
appropriate algorithms for file-based encryption.

The information returned by these ioctls is already available in logcat,
but scraping the log for a CTS test seems fragile; I assume that people
would prefer a more robust solution.

For more details see change I9082241066cba82b531e51f9a5aec14526467162

Bug: 111311698
Test: the CTS test works after this change.
Change-Id: Ib9ce6b42fcfb6b546eb80a93ae8d17ac5a433984
2019-09-27 15:24:27 -07:00
Tri Vo
bfcddbe25e sepolicy: remove ashmemd
Bug: 139855428
Test: m selinux_policy
Change-Id: I8d7f66b16be025f7cb9c5269fae6fd7540c2fdc9
2019-09-27 17:43:53 +00:00
Treehugger Robot
e612ecd6ed Merge "sepolicy: ashmem entry point for libcutils" 2019-09-26 17:56:53 +00:00
Tom Cherry
38dfd3080a Merge changes from topic "boringssl-kmsg"
* changes:
  Redirect boringssl_self_test stdio to kmsg
  allow init to open kmsg_debug
2019-09-25 19:56:03 +00:00
Tri Vo
a7f61021b7 sepolicy: ashmem entry point for libcutils
This duplicated ashmem device is intended to replace ashmemd.

Ashmem fd has a label of the domain that opens it. Now with ashmemd
removed, ashmem fds can have labels other than "ashmemd", e.g.
"system_server". We add missing permissions to make ashmem fds usable.

Bug: 139855428
Test: boot device
Change-Id: Iec8352567f1e4f171f76db1272935eee59156954
2019-09-25 11:26:18 -07:00
yuguoxu
a894a1aa66 Export vold FDE algorithm properties
ro.crypto.fde_algorithm
ro.crypto.fde_sector_size
ro.crypto.volume.contents_mode

These properties were not added to sepolicy export2vold. vold can't access
crypto algorithm type when flashing a GSI image and when the properties are in
/vendor/build.prop. This prevents FDE from working.

Bug: 141518844
Change-Id: I234bda439f6be7a2211a194856baf75800396232
Signed-off-by: yuguoxu <yuguoxu@allwinnertech.corp-partner.google.com>
2019-09-25 16:29:54 +00:00
Tom Cherry
7108a21d59 allow init to open kmsg_debug
The 'stdio_to_kmsg' option will print stdout and stderr to
kmsg_debug.  This requires init to be able to open kmsg_debug.

Test: services with stdio_to_kmsg can print to kmsg_debug
Change-Id: I63f0af8f079f7327c1224aa9e46f19d6549d875b
2019-09-24 12:45:57 -07:00
Tao Bao
987aa96d30 install_recovery no longer needs to access /cache.
applypatch (called by install_recovery) used to back up the source
partition to /cache when installing the recovery image on non-A/B
devices. The change from the same topic drops the backup behavior.

The access to /cache was also the reason for having dac_override_allowed
(applypatch runs as root:root, while /cache is owned by system:cache
with 0770).

Bug: 68319577
Test: Invoke the code that installs recovery image; check that recovery
      is installed successfully without denials.
Change-Id: I0533ba82260d0adb23b328e6eef8bd6dda3d0439
2019-09-23 11:35:47 -07:00
Inseob Kim
07c6671bc4 Merge "Add attributes for exported properties" 2019-09-20 03:01:21 +00:00
Inseob Kim
19b99f18c8 Add attributes for exported properties
This introduces some attributes that can be used to restrict access to
exported properties so that one can easily check from which the
properties can be accessed, and that OEMs can extend their own exported
properties.

Bug: 71814576
Bug: 131162102
Test: boot aosp_cf_x86_phone-userdebug
Test: logcat | grep "avc: "
Change-Id: I6f988ec1cb94fa64563ca6cb91b7702da5d604e3
2019-09-19 05:07:50 +00:00
Treehugger Robot
ff75b228ae Merge "idmap: add binderservice permissions" 2019-09-18 14:18:08 +00:00
Jeff Vander Stoep
0f00cd283e idmap: add binderservice permissions
Allow dumpsys to dump process information for bug reports.

Test: build
Test: adb bugreport
Bug: 140541614
Change-Id: Ia361e8c8de2cc5f798e746dffcf067393fd6bcae
2019-09-18 13:47:09 +02:00
Treehugger Robot
4db20c6922 Merge "neverallow init *:process noatsecure" 2019-09-17 06:08:18 +00:00
Paul Crowley
2367ba358f Allow toolbox to rm -rf /data/per_boot
Bug: 140882488
Test: create files and dirs in /data/per_boot, check they're removed.
Change-Id: Idf0ba09cbe51cbff6a7b2a464c4651a1f7fcf343
2019-09-16 10:18:57 -07:00
Nick Kralevich
a1458c64d3 neverallow init *:process noatsecure
The use of sensitive environment variables, such as LD_PRELOAD, is disallowed
when init is executing other binaries. The use of LD_PRELOAD for init spawned
services is generally considered a no-no, as it injects libraries which the
binary was not expecting. This is especially problematic for APEXes. The use
of LD_PRELOAD via APEXes is a layering violation, and inappropriately loads
code into a process which wasn't expecting that code, with potentially
unexpected side effects.

Test: compiles
Bug: 140789528
Change-Id: Ia781ec7318e700cddfd52df97c504b771f413504
2019-09-16 09:50:32 -07:00
Steven Thomas
726150eda4 Merge "Allow access to the "refresh_rate_switching" system property" 2019-09-13 00:55:33 +00:00
Tom Cherry
2176375a8a Merge "ueventd: allow using external firmware handlers" 2019-09-12 22:52:37 +00:00
Steven Thomas
f98c3902c2 Allow access to the "refresh_rate_switching" system property
Bug: 136592946
Bug: 138261472

Test: Ran with the patch applied, confirmed surface flinger can access
the system property.

Change-Id: I259a488399c5e698de384322852ea81ea1a96e7d
Merged-In: I259a488399c5e698de384322852ea81ea1a96e7d
2019-09-11 18:30:50 -07:00
Treehugger Robot
535d297a5f Merge "Root of /data belongs to init (re-landing)" 2019-09-10 04:14:17 +00:00
Treehugger Robot
4cacfc3bdf Merge "domain.te: remove /proc/sys/vm/overcommit_memory read access" 2019-09-10 00:29:37 +00:00
Treehugger Robot
aa31e64e83 Merge "Access to HALs from untrusted apps is blacklist-based" 2019-09-10 00:22:07 +00:00
Paul Crowley
aed0f76ee9 Root of /data belongs to init (re-landing)
Give /data itself a different label to its contents, to ensure that
only init creates files and directories there.

This change originally landed as aosp/1106014 and was reverted in
aosp/1116238 to fix b/140402208. aosp/1116298 fixes the underlying
problem, and with that we can re-land this change.

Bug: 139190159
Bug: 140402208
Test: aosp boots, logs look good
Change-Id: I1a366c577a0fff307ca366a6844231bcf8afe3bf
2019-09-09 14:42:01 -07:00
Nick Kralevich
003e858205 domain.te: remove /proc/sys/vm/overcommit_memory read access
Remove everyone's ability to read /proc/sys/vm/overcommit_memory.
Android's jemalloc implementation no longer uses this file.

init.te had multiple rules which allowed writing to this file. Get rid of
the duplicate rule.

Bug: 140736217
Test: compiles and boots
Test: bypass setup wizard and start the browser, browse the web
Change-Id: I5a2d5f450f5dde5dd55a0cedd7fbd55a6ac0beed
2019-09-09 13:39:28 -07:00
Mathieu Chartier
6e85cd91d0 Merge "Remove ability to set profilebootimage and profilesystemserver" 2019-09-09 20:08:33 +00:00
Mathieu Chartier
3079462443 Remove ability to set profilebootimage and profilesystemserver
These properties should no longer be specified in the vendor rom.

Bug: 139883463
Test: manual

(cherry picked from commit 1f6eda4111)

Exempt-From-Owner-Approval: Cherry-pick from master
Merged-In: I510c917fa3c60dcbd3f104ebe619f34c69c821e6
Change-Id: I8b7cf03d7a2faceb03b83edcb47e831fbc8c8918
2019-09-09 19:49:10 +00:00
Treehugger Robot
9aa263055b Merge "Revert "Root of /data belongs to init"" 2019-09-06 23:13:48 +00:00
Paul Crowley
d98e311952 Revert "Root of /data belongs to init"
This reverts commit 206b6535f1.

Reason for revert: Droidfood is blocked
Bug: 140402208
Change-Id: I1d1eb014747ba5c5bb656342e53b8c4e434878d1
2019-09-06 19:59:17 +00:00
Martin Stjernholm
53f223346d Merge "Rename the context for the ART APEX." 2019-09-06 14:37:16 +00:00
Jiyong Park
e95c704b6f Access to HALs from untrusted apps is blacklist-based
Before this change, access to HALs from untrusted apps was prohibited
except for the whitelisted ones like the gralloc HAL, the renderscript
HAL, etc. As a result, any HAL that is added by partners can't be
accessed from apps. This sometimes is a big restriction for them when
they want to access their own HALs in the same-process HALs running in
apps. Although this is a vendor-to-vendor communication and thus is not
a Treble violation, that was not allowed because their HALs are not in
the whitelist in AOSP.

This change fixes the problem by doing the access control in the
opposite way; access to HALs are restricted only for the blacklisted
ones.

All the hwservice context that were not in the whitelist are now put
to blacklist.

This change also removes the neverallow rule for the binder access to
the halserverdomain types. This is not needed as the protected
hwservices living in the HAL processes are already not accessible; we
have a neverallow rule for preventing hwservice_manager from finding
those protected hwservices from untrusted apps.

Bug: 139645938
Test: m

Merged-In: I1e63c11143f56217eeec05e2288ae7c91e5fe585
(cherry picked from commit 580375c923)

Change-Id: I4e611091a315ca90e3c181f77dd6a5f61d3a6468
2019-09-06 14:10:38 +09:00
Treehugger Robot
cd1d6deaa5 Merge "neverallow_macros: add watch* perms" 2019-09-05 19:43:19 +00:00
Martin Stjernholm
d7951d2647 Rename the context for the ART APEX.
Test: Boot (with default flattened APEXes)
Bug: 135753770
Change-Id: I551e88a250d3bd891f63a6bccee0682d0d0de7cf
2019-09-05 19:49:05 +01:00
Nick Kralevich
6a7a72b07a neverallow_macros: add watch* perms
In cases where directory read access has been neverallowed via
no_rw_dir_perms, also neverallow the various watch* permissions.
If read was disallowed by the neverallow assertions, there's an
assumption that watch was also intended to not be allowed. Make that
assumption explicit.

References:
* https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=ac5656d8a4cdd93cd2c74355ed12e5617817e0e7
* c4ab8edf74
* dddbaaf1e8

Test: compiles
Change-Id: I8139eaf1165a5090c7b48e45f353170e58ddf1d9
2019-09-05 09:54:43 -07:00
Paul Crowley
e9465fceb6 Merge "Root of /data belongs to init"
am: b935b6c664

Change-Id: I39a36ec663c98ac55be886e886da4afbf34e9cf2
2019-08-29 23:10:42 -07:00
Paul Crowley
206b6535f1 Root of /data belongs to init
Give /data itself a different label to its contents, to ensure that
only init creates files and directories there.

Bug: 139190159
Test: aosp boots, logs look good
Change-Id: I3ee654a928bdab3f5d435ab6ac24040d9bdd9abe
2019-08-29 15:08:21 -07:00