Commit graph

3143 commits

Author SHA1 Message Date
Paul Crowley
ce187e7fd6 Merge "Remove libfscrypt now it's in libfs_mgr"
am: 43f8298bdd

Change-Id: I0eaafaa461fa2ec6153a3e3bf49926b2efc610b7
2019-10-30 20:31:55 -07:00
Paul Crowley
43f8298bdd Merge "Remove libfscrypt now it's in libfs_mgr" 2019-10-31 03:17:23 +00:00
Paul Crowley
8bf310b9f3 Remove libfscrypt now it's in libfs_mgr
Now that we include libfscrypt in libfs_mgr via whole_static_libs we
should not reference it directly.

Bug: 143307095
Test: treehugger
Change-Id: I4cd138b50131ec8ce7835d9604c89c99cae53212
2019-10-30 13:34:49 -07:00
Xin Li
b89717b9c3 DO NOT MERGE - qt-qpr1-dev-plus-aosp-without-vendor@5915889 into stage-aosp-master
Bug: 142003500
Change-Id: Ib50f11f8f97ebd427da22b31e484777ef3210fe6
2019-10-30 11:50:46 -07:00
Paul Crowley
18b8ad91b8 Merge changes from topics "fscrypt-options", "fstab-options"
am: c17827b095

Change-Id: I9a992f0da7b5199b40ce650c2eb20258cab2b562
2019-10-28 19:23:05 -07:00
Paul Crowley
0ae752dcc3 Replace "flags" property with "options" with same format as fstab
am: f612b8b5ab

Change-Id: I30c51da82bdeb27a2dae7251762bb1a5241afcb8
2019-10-28 19:22:55 -07:00
Paul Crowley
c17827b095 Merge changes from topics "fscrypt-options", "fstab-options"
* changes:
  Use new encryption_options fstab entry
  Replace "flags" property with "options" with same format as fstab
2019-10-29 02:00:36 +00:00
Paul Crowley
a50f6c3c2c Use new encryption_options fstab entry
Bug: 143307095
Test: change cuttlefish fstab
Change-Id: Ia40daafc9b573c40f29c74dc2ef513fba3fc2bf9
2019-10-28 13:36:35 -07:00
Nikita Ioffe
3dbe996112 Merge "Rename ENFORCE_UID to ENFORCE_SYSTEM_OR_ROOT"
am: f37dff724b

Change-Id: Iaa1ce493c5fc67e280e4e3d656f434ad86e74f80
2019-10-28 03:13:59 -07:00
Nikita Ioffe
f37dff724b Merge "Rename ENFORCE_UID to ENFORCE_SYSTEM_OR_ROOT" 2019-10-28 09:55:34 +00:00
Xin Li
c21f19338e [automerger skipped] Merge "Merge Coral/Flame into AOSP master"
am: be4ff998ac -s ours
am skip reason: change_id I7191bd73d8621831c5802e02817f459f1da32754 with SHA1 a2c2182b65 is in history

Change-Id: If1bc31b59c868707ff2b4ee406bcad0fa9da25d3
2019-10-26 23:39:50 -07:00
Xin Li
119618a381 [automerger skipped] Merge Coral/Flame into AOSP master
am: 8a9454c35c -s ours
am skip reason: change_id I7191bd73d8621831c5802e02817f459f1da32754 with SHA1 a2c2182b65 is in history

Change-Id: I0e4e568d378d9412f2239f37ba2c475ad4f5f30b
2019-10-26 22:36:06 -07:00
Xin Li
be4ff998ac Merge "Merge Coral/Flame into AOSP master" 2019-10-27 04:44:29 +00:00
Nikita Ioffe
e1fd48999b Rename ENFORCE_UID to ENFORCE_SYSTEM_OR_ROOT
A little bit more self-explanatory name that explicitly says that root
is also allowed.

Test: builds
Change-Id: Ice20ffcba2a0994c599dbebace252138ffd827de
Merged-In: Ice20ffcba2a0994c599dbebace252138ffd827de
2019-10-26 15:51:17 +01:00
Paul Crowley
e96e670746 Merge "Use new C++ libfscrypt interface."
am: 7e43d985cf

Change-Id: Ie2a437086f901d4e353e71ac5db8751f518bd833
2019-10-25 11:14:52 -07:00
Paul Crowley
7e43d985cf Merge "Use new C++ libfscrypt interface." 2019-10-25 18:05:26 +00:00
Xin Li
8a9454c35c Merge Coral/Flame into AOSP master
Bug: 141248619
Change-Id: I487bba24e1c3cef357a408424665f0348162345d
Merged-In: I7191bd73d8621831c5802e02817f459f1da32754
2019-10-25 10:28:41 -07:00
Paul Crowley
f612b8b5ab Replace "flags" property with "options" with same format as fstab
Bug: 143307095
Test: Set override, check policy is as expected with sm set-virtual-disk
Change-Id: Iec31d7530b15d6d4564100816c821394e0708d53
2019-10-24 23:24:27 -07:00
Paul Crowley
5e53ff6e8f Use new C++ libfscrypt interface.
Bug: 143307095
Test: treehugger
Change-Id: I420ba6223bd67d6fec5382a11a72b7aa124294c9
2019-10-24 20:49:52 -07:00
TreeHugger Robot
e9679eaa46 Merge "Skip QD1A.190821.011 in stage-aosp-master" into stage-aosp-master 2019-10-24 00:26:50 +00:00
Paul Lawrence
a2c2182b65 Merge "Make sure CtsCheckpointTestCases passes"
am: 21799c8f7d

Change-Id: I7191bd73d8621831c5802e02817f459f1da32754
2019-10-23 15:25:08 -07:00
Treehugger Robot
21799c8f7d Merge "Make sure CtsCheckpointTestCases passes" 2019-10-23 20:13:50 +00:00
Paul Lawrence
4c757fb6cc Make sure CtsCheckpointTestCases passes
Bug: 141639903
Bug: 141499347
Test: Cts test CtsCheckpointTestCases passes
Change-Id: Id5e9c0df969340e0b8f08436daa027614c45b380
2019-10-23 09:40:45 -07:00
Nikita Ioffe
e182b26d64 Merge "vold: implement resetCheckpoint"
am: 4eeebff8d5

Change-Id: I86e933c27ebeaadbc3653d1da412180743d8f519
2019-10-18 15:16:35 -07:00
Nikita Ioffe
4eeebff8d5 Merge "vold: implement resetCheckpoint" 2019-10-18 21:44:35 +00:00
Xin Li
6881ac80c7 Skip QD1A.190821.011 in stage-aosp-master
Bug: 141248619
Change-Id: Ie1bf139b15621fc9cc1270865b03ec0f459d15ed
2019-10-16 15:19:32 -07:00
Nikita Ioffe
a5798fc115 vold: implement resetCheckpoint
It will be used by userspace reboot to reset checkpoint state, to make
sure that when /data is remounted, it will be remounted in checkpointing
if a checkpoint was requested beforee userspace reboot.

Test: /system/bin/vdc startCheckpoint 1
      /system/bin/vdc needsCheckpoint (returns 0)
      /system/bin/vdc resetCheckpoint
      /system/bin/vdc needsCheckpoint (returns 1)

Bug: 135984674
Change-Id: Ia29238686289b4eed93e2fb936a8b3d894b94dc9
2019-10-12 00:43:04 +01:00
Eric Biggers
de5c9ad178 Merge changes from topic "fscrypt-key-mgmt-improvements"
am: 22d50012b0

Change-Id: I97a1990aa2f0bdaf2a622555774b737bfc6d26ab
2019-10-07 12:27:17 -07:00
Eric Biggers
12a9212ac1 vold: use new ioctls to add/remove fscrypt keys when supported
am: f3dc4203dd

Change-Id: I31edb0db46b471233e716b5d277460bb99693d78
2019-10-07 12:27:11 -07:00
Eric Biggers
22d50012b0 Merge changes from topic "fscrypt-key-mgmt-improvements"
* changes:
  vold: support v2 encryption policies
  vold: use new ioctls to add/remove fscrypt keys when supported
2019-10-07 19:09:44 +00:00
Eric Biggers
83a73d7d50 vold: support v2 encryption policies
Add support for setting v2 encryption policies when configured in the
fstab (for internal storage) or in system properties (for adoptable
storage), and for installing and evicting the keys for such policies.

v2 policies support the same encryption modes and flags as v1 policies,
but internally they use a more standard, secure, and flexible KDF.  Due
to this, some future features will be supported by v2 policies only.

Bug: 140500999
Test: Configured a device to use v2 encryption policies (applied the
      needed kernel patches and added
      "fileencryption=aes-256-xts:aes-256-cts:v2" to fstab, and set the
      corresponding system properties for adoptable storage).  Wiped
      userdata, booted device and checked logs to verify that v2
      policies were being used.

      Also enabled virtual SD card and formatted as adoptable storage;
      verified it works and that v2 policies were being used on it.

      Also created, started, and stopped a 2nd user and verified their
      keys were evicted.

      Also verified that the device comes up again after rebooting.

      Also verified that a device using v1 encryption policies continues
      to work, both with and without an updated kernel -- including
      stopping a user so that their keys get evicted.

Change-Id: If64028d8580584b2c33c614cabd5d6b93657f608
2019-10-04 16:04:36 -07:00
Tao Bao
51143b3555 Merge "Mark libvold_headers as recovery_available."
am: 4a13731f08

Change-Id: I52df6333c5c6ce47d9c2cbc3e80d50dc4939c9d1
2019-10-03 17:16:41 -07:00
Treehugger Robot
4a13731f08 Merge "Mark libvold_headers as recovery_available." 2019-10-04 00:01:53 +00:00
Tao Bao
b1bbc7079c Mark libvold_headers as recovery_available.
recovery modules use <cryptfs.h> (in particular CRYPT_FOOTER_OFFSET).

Test: mmma bootable/recovery
Change-Id: I97b038476ccbeb0a5ac4a6cde86063325bdbb152
2019-10-02 10:50:53 -07:00
Eric Biggers
f3dc4203dd vold: use new ioctls to add/remove fscrypt keys when supported
When the kernel supports the new fscrypt key management ioctls, use them
instead of add_key() and keyctl_unlink().

This will be needed in order to support v2 encryption policies, since v2
encryption policies only support the new ioctls.

The new ioctls have other advantages too.  For example,
FS_IOC_REMOVE_ENCRYPTION_KEY automatically evicts exactly the necessary
kernel objects, so the drop_caches sysctl is no longer needed.  This
makes evicting keys faster and more reliable.
FS_IOC_REMOVE_ENCRYPTION_KEY also detects if any files are still open
and therefore couldn't be "locked", whereas this went undetected before.

Therefore, to start out this patch adds support for using the new ioctls
for v1 encryption policies, i.e. on existing devices.

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

Bug: 140500828
Test: tested that a device using v1 policies continues to work, both
      with and without an updated kernel.  See
      If64028d8580584b2c33c614cabd5d6b93657f608 for more details.
      Also checked via the log that the filesystem-level keyring is in
      fact used when supported.
Change-Id: I296ef78138578a3fd773797ac0cd46af1296b959
2019-09-30 13:11:42 -07:00
Daniel Rosenberg
05ce174e84 Merge "Add drosen to OWNERS" am: c0b0795dd6 am: a2e3823145
am: b1372f810c

Change-Id: I84e4b344f245986ced4d9ad4ba05451a4ac7c5ef
2019-09-26 15:07:51 -07:00
Daniel Rosenberg
b1372f810c Merge "Add drosen to OWNERS" am: c0b0795dd6
am: a2e3823145

Change-Id: Iec54c02c4242f73d3522a2407c3825017be751d6
2019-09-26 15:01:22 -07:00
Daniel Rosenberg
a2e3823145 Merge "Add drosen to OWNERS"
am: c0b0795dd6

Change-Id: Ice2ac2518cb8f384f8ce8a2a12a5a50febe53e15
2019-09-26 14:54:42 -07:00
Daniel Rosenberg
c0b0795dd6 Merge "Add drosen to OWNERS" 2019-09-26 21:30:15 +00:00
Daniel Rosenberg
bc139af7ce Add drosen to OWNERS
Test: build/make/tools/checkowners.py -c -v system/vold/OWNERS
Change-Id: Ic774577a0368f8cdbeb043f8021aec7457198276
2019-09-23 15:52:17 -07:00
Paul Lawrence
315855b541 [automerger skipped] Fix crash in mainline
am: 1b535e41fd -s ours
am skip reason: change_id I135099625f77344d1f8d2e8688735871c44ef2f5 with SHA1 9a6d1f73e5 is in history

Change-Id: Ibfc9efb88aaac867a710529631a30fe33ba570d3
2019-09-19 02:03:24 -07:00
Paul Lawrence
1b535e41fd Fix crash in mainline
Current behavior:

Assume not checkpointing
cp_startCheckpoint creates the file in metadata
cp_needsCheckpoint will now set isCheckpointing to true
cp_commitCheckpoint will now think there is a checkpoint, and try to
commit it. This will fail on ext4 and it will return false, leading to
bad things.

cp_startCheckpoint is called when staging an apex module for update.
After this point, several things could go wrong:

If a keystore key is deleted, it calls cp_needsCheckpoint to see if the
delete should be deferred until cp_commitCheckpoint. The delete will now
be deferred, meaning that this key will never be deleted, using up the
key sots in trustzone

If a trim is scheduled through idle maintenance, this also calls
cp_needsCheckpoint, so the trims will not occur.

If either of these happens before a system crash, the device will not
recover since the system calls commitCheckpoint which will now crash.

When the system then goes on to reboot, the checkpoint will not be
triggered, since the commitCheckpoint call will have deleted the
checkpoint flag file before crashing.

Bug: 138952436
Test: vdc checkpoint startCheckpoint 5
      vdc checkpoint needsCheckpoint
      vdc checkpoint commitChanges
      stop;start

      commitChanges fails, then device loops

      After applying this test, commitChanges succeeds and device does
      not loop

Change-Id: I135099625f77344d1f8d2e8688735871c44ef2f5
Merged-In: I135099625f77344d1f8d2e8688735871c44ef2f5
2019-09-18 23:22:30 +00:00
Paul Crowley
a7e15f91ac [automerger skipped] Create a per-boot key on each boot
am: ccc84dec96 -s ours
am skip reason: change_id I74077bf8f727dab726c25f512ed7406a74cbe0bf with SHA1 c8a3ef3f3c is in history

Change-Id: I25f74556643e36061dd82c9947e1c5bd23563d13
2019-09-18 10:29:49 -07:00
Paul Crowley
ccc84dec96 Create a per-boot key on each boot
Bug: 140882488
Test: Booted twice, checked logs to ensure encryption
    is different each time, adb created files in directory.
Cherry-Picked-From: c8a3ef3f3c
Merged-In: I74077bf8f727dab726c25f512ed7406a74cbe0bf
Change-Id: I74077bf8f727dab726c25f512ed7406a74cbe0bf
2019-09-17 18:44:18 +00:00
Paul Crowley
d678142ac6 Merge "Create a per-boot key on each boot" am: dab5ddf663 am: 6db7fa72a5
am: 03336816a7

Change-Id: I79b13f2fa4c002d5242a5d498ec5db385b7199bd
2019-09-16 23:14:14 -07:00
Paul Crowley
03336816a7 Merge "Create a per-boot key on each boot" am: dab5ddf663
am: 6db7fa72a5

Change-Id: I2543c7cd24fcdbd13b08e9afc4d1e0a448dc3373
2019-09-16 23:07:10 -07:00
Paul Crowley
6db7fa72a5 Merge "Create a per-boot key on each boot"
am: dab5ddf663

Change-Id: Iee4dabdcccedcbf652ae23edb4d20404947a765c
2019-09-16 23:01:13 -07:00
Paul Crowley
dab5ddf663 Merge "Create a per-boot key on each boot" 2019-09-17 05:40:05 +00:00
Eric Biggers
81adf14c15 Merge "vold: use system-clang-format" am: 7e65d8dd00 am: c302876a95
am: acafcd49a8

Change-Id: Ibaad762902b51eb7fee705b2667a023cf3cea433
2019-09-16 14:43:31 -07:00
Eric Biggers
acafcd49a8 Merge "vold: use system-clang-format" am: 7e65d8dd00
am: c302876a95

Change-Id: Id9e2301657352c7d8f06bea899574f01d316a1c9
2019-09-16 14:31:42 -07:00