Commit graph

21 commits

Author SHA1 Message Date
Martin Stjernholm
2d6ee0286e Allow otapreopt_chroot to use stdin and stdout pipes.
Test: See https://r.android.com/2681675
Bug: 293639539
Change-Id: I89ed8bcf5b5307736c53f9b345ac8a288584afad
2023-08-07 21:21:20 +01:00
Nikita Ioffe
7c808247a7 Revert "Allow otapreopt_chroot to call otadexopt binder service"
Revert submission 1750144-otapreopt_chroot_speed_up

Reason for revert: Breaks postinstall step on some devices
Reverted Changes:
I56dec13c8:Add ota_dexopt_aidl_interface
Ib32cbbbf8:Allow otapreopt_chroot to call otadexopt binder se...
I02e80a8e6:Move otadexopt-related logic to otapreopt_chroot b...

Bug: 190817237
Change-Id: I96e02566779cf16626354b0d71e6d48f2ab35490
2021-07-06 17:06:22 +00:00
Nikita Ioffe
ed3407eaac Allow otapreopt_chroot to call otadexopt binder service
Before otapreopt_script was indirectly interacting with otadexopt binder
service via `shell cmd otadexopt` interface, but now the interaction is
moved to otapreopt_chroot binary to reduce amount of times we need to
run this binary.

For more context see: aosp/1750143.

Test: m
Bug: 190223331
Change-Id: Ib32cbbbf8f3bd9b5c1b696e39f776631ae60d712
2021-06-30 15:37:05 +01:00
Alex Light
16dfb432b3 Use postinstall file_contexts
Previously we would mount OTA images with a 'context=...' mount
option. This meant that all selinux contexts were ignored in the ota
image, limiting the usefulness of selinux in this situation. To fix
this the mount has been changed to not overwrite the declared contexts
and the policies have been updated to accurately describe the actions
being performed by an OTA.

Bug: 181182967
Test: Manual OTA of blueline
Merged-In: I5eb53625202479ea7e75c27273531257d041e69d
Change-Id: I5eb53625202479ea7e75c27273531257d041e69d
2021-03-24 17:00:35 -07:00
Treehugger Robot
8c885f0b36 Merge "Allow LOOP_CONFIGURE ioctl in otapreopt_chroot" 2021-03-11 06:22:04 +00:00
Jeff Vander Stoep
4c0259d5c7 Fix otapreopt_chroot
A number of things have changed, such as how the linkerconfig is
managed. Update permissions to reflect the changes.

Bug: 181182967
Test: Manual OTA of cuttlefish
Change-Id: I32207eb7c5653969e5cef4830e18f8c8fb330026
2021-03-05 14:50:29 -08:00
Alex Light
0869230220 Allow LOOP_CONFIGURE ioctl in otapreopt_chroot
This ioctl is called by mount in otapreopt_chroot

Test: manual
Bug: 181182967
Change-Id: I37b8538f3e0aae6c66ea1af3d60c4eb340dcea62
2021-03-03 01:33:34 +00:00
Nikita Ioffe
f0f047aeaa Temporarily allow otapreopt_chroot to query ro.cold_boot_done prop
Test: presubmit
Bug: 172829167
Bug: 165948777
Change-Id: If7ead4ec43496795e31432db8d3493dbc6fc5e07
2020-11-10 20:38:45 +00:00
Andreas Gampe
1a5db599ce Sepolicy: Allow otapreopt to mount logical partitions
Logical partitions are handled through libdm. Allow access to
device-mapper.

Bug: 128867786
Test: m
Change-Id: I6979487b91d24b7309c876f2bdc26a827e2fcd1e
2019-03-22 12:13:05 -07:00
Roland Levillain
66f40a8b2d Allow otapreopt_chroot to use a flattened Runtime APEX package.
- Allow (again) `otapreopt` (running as `postinstall_dexopt`) to
  execute `dex2oat` from `/postinstall` -- this is for the case where
  it is located in a flattened Runtime APEX in
  `/postinstall/system/apex`.
- Allow `dex2oat` to read directories under `/postinstall`.
- Allow `otapreopt_chroot` to unmount flattened APEX packages under
  `/postinstall/system/apex` (which are bind-mounted in
  `/postinstall/apex`).

Test: A/B OTA update test (asit/dexoptota/self_full).
Bug: 127543974
Bug: 123684826
Bug: 113373927
Change-Id: Ie023ee5c64989ea071e1683f31073a70c93cac18
2019-03-19 14:44:22 +00:00
Andreas Gampe
3c581e2064 Sepolicy: Allow otapreopt_chroot to find linker
The linker is behind a symlink. Allow to read and follow.

Bug: 128840749
Test: m
Test: manual a/b ota
Test: DexoptOtaTests
Change-Id: I15bd76e517ab3cebf13ebd42ff6e5dae42364c83
2019-03-18 10:55:32 -07:00
Andreas Gampe
d6fdcefaa8 Sepolicy: Move otapreopt_chroot to private
Move complete domain to private/. Move referencing parts in domain
and kernel to private.

Bug: 128840749
Test: m
Change-Id: I5572c3b04e41141c8f4db62b1361e2b392a5e2da
2019-03-18 10:54:42 -07:00
Jiyong Park
5a74473d1b No need to bind-mount bionic libraries
This is a partial revert of https://android-review.googlesource.com/c/platform/system/sepolicy/+/891474

The mount points at /bionic are gone. Therefore, init and
otapreopt_chroot do not need to bionic-mount bionic libraries.
Corresponding policies are removed.

Bug: 125549215
Bug: 113373927
Bug: 120266448
Test: m; device boots
Change-Id: I9d9d7ec204315fb5b66beec4e6a3c529bd827590
2019-03-15 14:28:27 +09:00
Roland Levillain
446b2fedce Allow otapreopt to use bind-mounted Bionic artifacts from the Runtime APEX.
Allow `otapreopt_chroot` to:
- bind-mount Bionic artifacts from the Runtime APEX
  (`/postinstall/apex/com.android.runtime`) into `/postinstall/bionic/`;
- read the `/postinstall/system/bin/linker(64)` symlink to
  `/postinstall/bionic/bin/linker(64)` when executing
  `/postinstall/system/bin/otapreopt`.

Allow `otapreopt` (running as `postinstall_dexopt`) to:
- read directories under `/postinstall`.

Test: m otapreopt_chroot
Test: A/B OTA update test (asit/dexoptota/self_full).
Bug: 113373927
Bug: 120266448
Change-Id: I6de9df12d5fd84f1dd92798efed5f2d8b72d3ebe
2019-01-31 19:09:08 +00:00
Roland Levillain
a42ebf4128 Introduce a postinstall_apex_mnt_dir label for /postinstall/apex.
Directory `/postinstall/apex` is used as a mount point for a tmpfs
filesystem during A/B OTA updates. APEX packages from the new system
partition are mounted ("activated") in subdirectories of
`/postinstall/apex`, so that they are available when `otapreopt` is
running.

Directory `/postinstall/apex` used to be of type `tmpfs` for SELinux
purposes. The new `postinstall_apex_mnt_dir` label is more
restrictive, and tightens permissions granted to `otapreopt_chroot`,
`otapreopt` (running as `postinstall_dexopt`), and `dex2oat`,
regarding the apexd logic recently added to `otapreopt_chroot`.

Test: A/B OTA update test (asit/dexoptota/self_full).
Bug: 113373927
Bug: 120796514
Change-Id: I03f0b0433d9c066a0c607f864d60ca62fc68c990
2019-01-29 10:09:50 +00:00
Roland Levillain
9f28f8b360 Fix comment about transition from otapreopt_chroot to postinstall_dexopt.
Test: n/a
Change-Id: Id29de05c9dc4cf6771292050bbd8946bbb939cdd
2019-01-28 12:40:12 +00: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
Roland Levillain
7094d4f505 Allow oatpreopt_chroot to deactivate APEX packages in /postinstall/apex.
Allow `otapreopt_chroot` to:
- unmount APEX packages (ext4 images) mounted in `/postinstall/apex`;
- access `/dev/block`.

Deactivating APEX packages (unmounting them from `/postinstall/apex`
and detaching the corresponding loop devices) is part of the tear-down
phase run at the end of `oatpreopt_chroot`.

Test: A/B OTA update test (asit/dexoptota/self_full).
Bug: 113373927
Bug: 120796514
Change-Id: Ida07d2ceda31c7296228d973b26ff642f6533274
2019-01-23 16:19:28 +00:00
Roland Levillain
0a6c2d013a Allow otapreopt_chroot to mount APEX packages using apexd logic.
Allow `otapreopt_chroot` to:
- read SELinux policy files;
- open and read the contents of `/postinstall/system/apex`;
- read the `persist.apexd.verity_on_system` system property;
- create loop devices with `/dev/loop-control`;
- access loop devices;
- configure read-ahead of loop devices;
- mount a tmpfs filesystem in `/postinstall/apex`;
- manipulate the tmpfs filesystem mounted in `/postinstall/apex`;
- mount APEX packages in `/postinstall/apex`.

Allow the kernel to:
- read `otapreopt_chroot`'s file descriptors;
- read files under `/postinstall`.

Allow `otapreopt` (running as "postinstall_dexopt") to:
- read data from `/postinstall/apex`.

Allow `dex2oat` to:
- access `/postinstall/apex`.

Test: A/B OTA update test (asit/dexoptota/self_full).
Bug: 113373927
Bug: 120796514
Change-Id: I204df92611dc710fdc97b22cd67d088ffd991210
2019-01-17 21:42:46 +00:00
Alex Klyubin
f5446eb148 Vendor domains must not use Binder
On PRODUCT_FULL_TREBLE devices, non-vendor domains (except vendor
apps) are not permitted to use Binder. This commit thus:
* groups non-vendor domains using the new "coredomain" attribute,
* adds neverallow rules restricting Binder use to coredomain and
  appdomain only, and
* temporarily exempts the domains which are currently violating this
  rule from this restriction. These domains are grouped using the new
  "binder_in_vendor_violators" attribute. The attribute is needed
  because the types corresponding to violators are not exposed to the
  public policy where the neverallow rules are.

Test: mmm system/sepolicy
Test: Device boots, no new denials
Test: In Chrome, navigate to ip6.me, play a YouTube video
Test: YouTube: play a video
Test: Netflix: play a movie
Test: Google Camera: take a photo, take an HDR+ photo, record video with
      sound, record slow motion video with sound. Confirm videos play
      back fine and with sound.
Bug: 35870313
Change-Id: I0cd1a80b60bcbde358ce0f7a47b90f4435a45c95
2017-03-24 07:54:00 -07:00
dcashman
cc39f63773 Split general policy into public and private components.
Divide policy into public and private components.  This is the first
step in splitting the policy creation for platform and non-platform
policies.  The policy in the public directory will be exported for use
in non-platform policy creation.  Backwards compatibility with it will
be achieved by converting the exported policy into attribute-based
policy when included as part of the non-platform policy and a mapping
file will be maintained to be included with the platform policy that
maps exported attributes of previous versions to the current platform
version.

Eventually we would like to create a clear interface between the
platform and non-platform device components so that the exported policy,
and the need for attributes is minimal.  For now, almost all types and
avrules are left in public.

Test: Tested by building policy and running on device.

Change-Id: Idef796c9ec169259787c3f9d8f423edf4ce27f8c
2016-10-06 13:09:06 -07:00