Commit graph

8 commits

Author SHA1 Message Date
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
David Anderson
53ea513bdf Allow gsid to create and access loop devices.
gsid creates loop devices when it cannot use device-mapper. This can
occur when images are split into multiple files (for example, FAT32) or
when a device is unencrypted, or FBE without metadata encryption. In
addition to accessing /dev/loop-control and loop devices, it also needs
LOOP_SET_DIRECT_IO and LOOP_SET_BLOCK_SIZE to optimize writes.

Bug: 134536978
Test: gsi_tool install works on crosshatch with metadata encryption
      disabled

Change-Id: I3f0aee1d0757e4b299deee74a8c1077846d56292
2019-07-11 16:36:25 -07:00
David Anderson
95fbedd1b0 Allow gsid to read dm nodes from sysfs.
This is needed now that libfiemap_writer reads from dm/name to find
device-mapper names.

Bug: 134536978
Test: gsi_tool install
Change-Id: I10e1234f2ea39c92b43ace97fa76878358dfc476
2019-06-07 14:59:00 -07:00
David Anderson
0b1094cc23 Allow init to mkdir inside /data/gsi.
Bug: 133435561
Test: adb shell gsi_tool install
Change-Id: Iaa610c72d8098e157bb89e321624369f86f4ea19
2019-05-23 13:45:00 -07:00
David Anderson
6557d87b0f Add sepolicy for installing GSIs to external storage.
To install GSIs on external storage (such as sdcards), gsid needs some
additional privileges:
 - proc_cmdline and device-tree access to call ReadDefaultFstab().
   This is ultimately used to check whether system's dm-verity has
   check_at_most_once enabled, which is disallowed with sdcards.
 - vfat read/write access to write files to the sdcard. Note that
   adopted sdcards are not supported here.
 - read access to the sdcard block device. To enable this without
   providing access to vold_block_device, a new sdcard_block_device
   label was added. Devices must apply this label appropriately to
   enable gsid access.
 - FIBMAP access for VFAT filesystems, as they do not support FIEMAP.
   This only appears to work by granting SYS_RAWIO.

Bug: 126230649
Test: adb shell su root gsi_tool install --install_dir=/mnt/media_rw/...
      works without setenforce 0

Change-Id: I88d8d83e5f61d4c0490f912f226fe1fe38cd60ab
2019-03-27 17:12:51 -07:00
David Anderson
8fe3c74654 Add sepolicy for gsid properties, and allow system_server to read them.
Bug: 123777418
Test: manual test
Change-Id: I9f8c721dfd074e638573d85cf1d8045a69c3854e
2019-02-19 21:08:09 +00:00
David Anderson
db90b91ea0 Full sepolicy for gsid.
Bug: 122556707
Test: manual test
Change-Id: I2536deefb3aa75deee4aeae7df074349b705b0f0
2019-02-08 05:56:58 +00:00
David Anderson
6d53efcf46 sepolicy for gsid
Bug: 122556707
Test: gsid starts
Change-Id: Ib05ddb79051436f51cd236de04027a3b12ee87a9
Signed-off-by: Sandeep Patil <sspatil@google.com>
2019-01-15 20:43:33 -08:00