Commit graph

3044 commits

Author SHA1 Message Date
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
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
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 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
c302876a95 Merge "vold: use system-clang-format"
am: 7e65d8dd00

Change-Id: Ib0e898e67aa0032d53e52676a93b56b0640e11cf
2019-09-16 14:20:47 -07:00
Eric Biggers
7e65d8dd00 Merge "vold: use system-clang-format" 2019-09-16 21:03:26 +00:00
Eric Biggers
f220170923 vold: use system-clang-format
Link .clang-format to the standard .clang-format file (4-space-indent
version) from build/soong, rather than use a custom file.

Among other changes, the standard file has the "IncludeBlocks: Preserve"
setting, so include blocks stay in order.

Don't actually reformat all the code yet.

Test: Tried 'clang-format -i $(find . -name \*.cpp -o -name \*.h)'
      and checked that the changes look sane.
Change-Id: I11ecbd03b31e44ba7b3e01175a6fc317f8173ab0
2019-09-16 12:00:40 -07:00
Paul Crowley
a462a57b18 Merge "Add ebiggers to OWNERS"
am: 88dba9a558

Change-Id: I70868eab667ea5566164ec4d8a5d19e230a89736
2019-09-16 10:42:06 -07:00
Paul Crowley
88dba9a558 Merge "Add ebiggers to OWNERS" 2019-09-16 17:23:02 +00:00
Paul Crowley
c8a3ef3f3c 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.
Change-Id: I74077bf8f727dab726c25f512ed7406a74cbe0bf
2019-09-13 15:46:48 -07:00
Paul Crowley
a13d33af46 Add ebiggers to OWNERS
Test: n/a
Change-Id: I08ece80400dae0c0d25c2fcef7168bbed9034745
2019-09-13 15:06:45 -07:00
Shawn Willden
0b895c13bc Merge "Request rollback resistance for FBE keys."
am: aae52f4816

Change-Id: Ie2143da9b9b1d2e76faa958d1a04d2be6b0045e7
2019-09-12 09:29:15 -07:00
Treehugger Robot
aae52f4816 Merge "Request rollback resistance for FBE keys." 2019-09-12 15:20:45 +00:00
Xin Li
69a1fd86d3 Merge qt-r1-dev-plus-aosp-without-vendor (5817612) into stage-aosp-master
Bug: 135460123
Change-Id: I1605f33ede34c8289a6eede94b62c8695df81b63
Merged-In: I24f07ba89ba6e6dac8adc2a6bb654d75d2b73d3e
2019-09-08 13:07:03 -07:00
Steven Moreland
e3b772e0f7 Merge "Remove libhwbinder/libhidltransport deps"
am: 88a19b6fe1

Change-Id: I24f07ba89ba6e6dac8adc2a6bb654d75d2b73d3e
2019-09-06 14:32:26 -07:00
Treehugger Robot
88a19b6fe1 Merge "Remove libhwbinder/libhidltransport deps" 2019-09-06 20:12:41 +00:00
Steven Moreland
4496ef9d34 Remove libhwbinder/libhidltransport deps
Since these were combined into libhidlbase.

Bug: 135686713
Test: build only (libhwbinder/libhidltransport are empty)
Change-Id: I890b572d537d66ecb49effd8efc782279c52956e
2019-09-05 14:18:22 -07:00
Xin Li
d3ceab2566 Merge "DO NOT MERGE - Merge Android 10 into master" 2019-09-05 16:53:32 +00:00
Xin Li
85a94961df DO NOT MERGE - Merge Android 10 into master
Bug: 139893257
Change-Id: I9dc8417f0d87c87eac13437834e69a52c1887258
2019-09-04 13:35:31 -07:00
Paul Lawrence
3096e373be Merge "Fix ext4/metadata/udc issue"
am: ee867be1f1

Change-Id: I69b89b464a4d04b27e1da7d3990dcbec9525afe4
2019-08-27 08:45:00 -07:00
Paul Lawrence
ee867be1f1 Merge "Fix ext4/metadata/udc issue" 2019-08-27 15:21:58 +00:00
Paul Lawrence
6c5944f899 Merge "Fix crash in mainline"
am: 3a0d51f6b7

Change-Id: I63925fd090707f56076a59349c237a83f4ec8234
2019-08-26 18:32:29 -07:00
Treehugger Robot
3a0d51f6b7 Merge "Fix crash in mainline" 2019-08-27 01:01:28 +00:00
Paul Lawrence
9a6d1f73e5 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
2019-08-26 15:23:14 -07:00
Paul Lawrence
556bd755e6 Merge "Fix race condition is commitCheckpoint"
am: 1059810759

Change-Id: I3cb7931ee01d208cb6f5f435aa5fc40cacd78b65
2019-08-22 17:32:17 -07:00
Treehugger Robot
1059810759 Merge "Fix race condition is commitCheckpoint" 2019-08-23 00:11:38 +00:00
Paul Lawrence
1d57f686a3 Fix race condition is commitCheckpoint
If cp_commitCheckpoint is called twice at the same time, the second call
to setBowState will fail.

Add lock to remove possibility, and protect all uses of isCheckpointing

Bug: 138952436
Test: Boots after flashing in checkpoint mode
Change-Id: I131298adc506c3c176774d15e642b13d5f991087
2019-08-22 09:55:32 -07:00
Paul Lawrence
4b140d397f Fix ext4/metadata/udc issue
Test: Cannot test since no device supports this combo
Bug: 137924328
Change-Id: I451c90e0826ede71876f3e4f260e7083f3ab3fdb
2019-08-14 10:00:09 -07:00
android-build-team Robot
c4fd7be670 Snap for 5797917 from 6c5e453f9e to qt-c2f2-release
Change-Id: I92e29452f176731c03fc482e5394cc5fad17c9c9
2019-08-13 03:09:06 +00:00
Jaegeuk Kim
2af145ef20 secdiscard: should call fsync to avoid reordering IOs
am: 6c5e453f9e

Change-Id: I90de814c136171d4ff2ce913b801171e7f27c70e
2019-08-12 11:39:55 -07:00