Commit graph

2946 commits

Author SHA1 Message Date
Treehugger Robot
8d4164f92f Merge "Use correct Statuses from Checkpoint code" 2019-04-23 23:07:27 +00:00
xzj
3348c6e915 Merge "fix data encryption fail when ENCRYPTION_FLAG_NO_UI is set" am: c222ad20ee
am: a921b6795e

Change-Id: Ia297c274b7a2b0005b31f69354fb4a7773f02439
2019-04-19 15:04:40 -07:00
Paul Lawrence
82b3505e2e Use correct Statuses from Checkpoint code
Bug: 130190815
Test: Added fake error to code and checked correct error was caught
Change-Id: If9ab9357f0f961607e15a4ba18d9d85bc9923019
2019-04-19 14:50:59 -07:00
xzj
a921b6795e Merge "fix data encryption fail when ENCRYPTION_FLAG_NO_UI is set"
am: c222ad20ee

Change-Id: I5ebb8825b40c3ce088607f8a4aa6d4fb506f6bd5
2019-04-19 14:15:15 -07:00
Treehugger Robot
c222ad20ee Merge "fix data encryption fail when ENCRYPTION_FLAG_NO_UI is set" 2019-04-19 20:27:44 +00:00
xzj
7e38a3a3c8 fix data encryption fail when ENCRYPTION_FLAG_NO_UI is set
cause: data partition not being umount before real encryption
Change-Id: If5cc084c182d96c6205359b76ee0c474f6a77a2e
2019-04-19 18:07:13 +00:00
Sudheer Shanka
08a7e13025 Update remountUidLegacy to handle "full" mount mode.
am: 36bdf7ab54

Change-Id: I08b881cd744a21cb9127b7a2c22b25c388eb070c
2019-04-19 07:16:04 -07:00
Sudheer Shanka
36bdf7ab54 Update remountUidLegacy to handle "full" mount mode.
Bug: 130791955
Test: manual
Change-Id: I078c2922d1d5a8d16bbb213201a3cad7b1bf4b86
2019-04-18 15:18:30 -07:00
Sandeep Patil
d085b05c89 [automerger skipped] Merge "Add visible logs about fstrim run for block based checkpoints" am: 419528be57
am: 9389f389f5 -s ours
am skip reason: change_id I0cb8b6a85ae787e1ba2cdd7998a46942ca69760f with SHA1 e802d475bf is in history

Change-Id: I9fcc5843f969cbaeda85d4fb296e7416ddb1cde2
2019-04-17 16:06:43 -07:00
Sudheer Shanka
a502c6aa58 Merge "Allow sandboxed apps to access only package specific dirs." into qt-dev
am: 0a9469e923

Change-Id: I66084eae25e8b08d6bdec2ea1f6c7e612a6b8a64
2019-04-17 15:51:04 -07:00
Sandeep Patil
9389f389f5 Merge "Add visible logs about fstrim run for block based checkpoints"
am: 419528be57

Change-Id: I546d5cb3807cd217e9ab992ee517d4a3164566e5
2019-04-17 15:10:43 -07:00
Sudheer Shanka
0a9469e923 Merge "Allow sandboxed apps to access only package specific dirs." into qt-dev 2019-04-17 22:07:47 +00:00
Treehugger Robot
419528be57 Merge "Add visible logs about fstrim run for block based checkpoints" 2019-04-17 21:11:04 +00:00
Sandeep Patil
f8da61f26a Add visible logs about fstrim run for block based checkpoints
Bug: 120095226
Test: Tested by forcing /data/system/last-fstrim last modified time back
      2 years & manually trigger checkpoint using 'vdc checkpoint startCheckpoint 1'

Change-Id: I0cb8b6a85ae787e1ba2cdd7998a46942ca69760f
Merged-In: I0cb8b6a85ae787e1ba2cdd7998a46942ca69760f
Signed-off-by: Sandeep Patil <sspatil@google.com>
2019-04-17 12:55:58 -07:00
Sandeep Patil
3cf3d31a0b Add visible logs about fstrim run for block based checkpoints
am: e802d475bf

Change-Id: If021a8803121094807dc232ad08ca6b984032e23
2019-04-17 10:07:06 -07:00
android-build-team Robot
a736dde3f4 Merge cherrypicks of [7077329, 7077440, 7077330, 7077468, 7076852, 7077469, 7077580, 7077581, 7077582, 7074025, 7077706, 7077707, 7077708, 7077388, 7077583, 7077584, 7077585, 7077726, 7077727, 7077331, 7077332, 7077459, 7077709, 7077710, 7077711, 7077712, 7077460, 7077461, 7077333, 7077334, 7077696] into pi-qpr3-release
Change-Id: Icfc00a7020e3f0589ff268071c8f6d18b6f2a445
2019-04-16 22:41:51 +00:00
Woody Lin
0496e3698f Fsync directories before delete key
The boot failure symptom is reproduced on Walleye devices. System boots
up after taking OTA and try to upgrade key, but keymaster returns "failed
to ugprade key". Device reboots to recovery mode because of the failure,
and finally trapped in bootloader screen. Possible scenario is:

(After taking OTA)
vold sends old key and op=UPGRADE to keymaster
keymaster creates and saves new key to RPMB, responses new key to vold
vold saves new key as temp key
vold renames temp key to main key -------------- (1) -- still in cache
vold sends old key and op=DELETE_KEY to keymaster
keymaster removes old key from RPMB ------------ (2) -- write directly to RPMB
==> SYSTEM INTERRUPTED BY CRASH OR SOMETHING; ALL CACHE LOST.
==> System boots up, key in RPMB is deleted but key in storage is old key.

Solution: A Fsync is required between (1) and (2) to cover this case.

Detail analysis: b/124279741#comment21

Bug: 112145641
Bug: 124279741
Test: Insert fault right after deleteKey in vold::begin (KeyStorage.cpp),
      original boot failure symptom is NOT reproducible.
Change-Id: Ia042b23699c37c94758fb660aecec64d39f39738
Merged-In: Ib8c349d6d033f86b247f4b35b8354d97cf249d26
(cherry picked from commit a598e04a91)
2019-04-16 22:39:59 +00:00
Paul Crowley
4b9c47d70f Fsync directories after creating files
Bug: 112145641
Bug: 124279741
Bug: 120248692
Test: adb shell locksettings set-pin 1111 && \
    adb shell "echo b > /proc/sysrq-trigger"
Change-Id: I53d252942c21365983b4f8b6e0948b1864f195c1
Merged-In: I53d252942c21365983b4f8b6e0948b1864f195c1
(cherry picked from commit 2e58acb412)
2019-04-16 22:39:52 +00:00
Sandeep Patil
e802d475bf Add visible logs about fstrim run for block based checkpoints
Bug: 120095226
Test: Tested by forcing /data/system/last-fstrim last modified time back
      2 years & manually trigger checkpoint using 'vdc checkpoint startCheckpoint 1'

Change-Id: I0cb8b6a85ae787e1ba2cdd7998a46942ca69760f
Signed-off-by: Sandeep Patil <sspatil@google.com>
2019-04-15 10:12:19 -07:00
Sudheer Shanka
a05ea743f0 Allow sandboxed apps to access only package specific dirs.
Bug: 130427780
Test: manual
Test: atest cts/hostsidetests/appsecurity/src/android/appsecurity/cts/ExternalStorageHostTest.java
Change-Id: I7afcea090306336c4033860084a2a436d2bb4740
2019-04-12 16:40:57 -07:00
Woody Lin
dbac71e050 [automerger skipped] Fsync directories before delete key am: a598e04a91 -s ours
am: 3654986ae5 -s ours
am skip reason: change_id Ib8c349d6d033f86b247f4b35b8354d97cf249d26 with SHA1 37c82f5c0f is in history

Change-Id: I3f8153ebd963a10b1633103ccc941389be0164ee
2019-04-10 07:16:45 -07:00
Paul Crowley
7886e9359e [automerger skipped] Fsync directories after creating files am: 2e58acb412 -s ours
am: c6f4d9d5ae -s ours
am skip reason: change_id I53d252942c21365983b4f8b6e0948b1864f195c1 with SHA1 621d9b9732 is in history

Change-Id: I920346bf310aab6a16cea70d6e213fcff325134c
2019-04-10 07:16:34 -07:00
Woody Lin
3654986ae5 [automerger skipped] Fsync directories before delete key
am: a598e04a91 -s ours
am skip reason: change_id Ib8c349d6d033f86b247f4b35b8354d97cf249d26 with SHA1 37c82f5c0f is in history

Change-Id: Ifec2d700dbe6bbe55e65e6e07003d1e77fb3dbc2
2019-04-10 07:06:41 -07:00
Paul Crowley
c6f4d9d5ae [automerger skipped] Fsync directories after creating files
am: 2e58acb412 -s ours
am skip reason: change_id I53d252942c21365983b4f8b6e0948b1864f195c1 with SHA1 621d9b9732 is in history

Change-Id: Icdb62b1d4e6e7ca7d18df1083020d61d9b215165
2019-04-10 07:06:31 -07:00
Narayan Kamath
b553c62bf1 AppFuseUtil: Call ForceUnmount before PrepareDir.
am: 15ad33a8b1

Change-Id: I39e24afab685cfbdcc492d135937bb2e34110818
2019-04-10 01:29:07 -07:00
Narayan Kamath
15ad33a8b1 AppFuseUtil: Call ForceUnmount before PrepareDir.
We'd previously call ForceUnmount after the call to PrepareDir,
which would sometimes fail because the userspace counterpart of a
FUSE FS that was previously mounted at that mountpoint has gone
away. This is usually reproducible after a runtime restart.

Bug: 128459728
Test: Loop (adb shell start; atest MediaStore_Images_MediaTest; adb shell stop;)
Change-Id: I38d3908487123614c338266f983afb04e3ed78d4
2019-04-09 18:45:32 +01:00
Eric Biggers
d019a2950a Merge "Don't drop as many caches when evicting CE key" am: a057b27f2a
am: a30a907c65

Change-Id: Idaab2ccd2e6ad8afd8f45c20a27d1f34333970c1
2019-04-09 04:11:42 -07:00
Paul Crowley
dba96e85f8 Merge changes I40575081,I1ca8f8cf,I38bfd273 am: 1c6a56b27f
am: e6c7dffaa8

Change-Id: I2de88cca316040df8dcdcfbce237a9e4350f26bc
2019-04-09 03:57:24 -07:00
Eric Biggers
a30a907c65 Merge "Don't drop as many caches when evicting CE key"
am: a057b27f2a

Change-Id: Ic98dbb34e6696de5ddcaeccb4ae0108cbe0a1921
2019-04-05 16:00:39 -07:00
Eric Biggers
a057b27f2a Merge "Don't drop as many caches when evicting CE key" 2019-04-05 21:04:22 +00:00
Eric Biggers
ce36868316 Don't drop as many caches when evicting CE key
When a user's CE key is removed, write "2" to /proc/sys/vm/drop_caches
rather than "3".  This avoids unnecessarily evicting the pagecache of
in-use inodes.  It's only necessary to evict the inodes of the relevant
encrypted files, and these are already sync'ed and no longer in-use.
For this mode "2" suffices, as this evicts "reclaimable slab objects",
including inodes; and evicting an inode implies evicting its pagecache.

This matches the recommendation I've made in the documentation for the
fscrypt kernel feature at
https://www.kernel.org/doc/html/latest/filesystems/fscrypt.html#online-attacks

Test: Sanity check that directories are still "locked" properly:
      Unlock device with PIN.  Then in adb shell: 'stop; start;
      sleep 10; ls /data/data/' still shows filenames in ciphertext form.
Change-Id: I1bdf3c420ebf63e98cc314498211061ea36f2942
2019-04-05 12:19:46 -07:00
Paul Crowley
e6c7dffaa8 Merge changes I40575081,I1ca8f8cf,I38bfd273
am: 1c6a56b27f

Change-Id: I8410e8cb691eb0b5e3e721b6b715eb30f28eef51
2019-04-05 12:15:24 -07:00
Paul Crowley
1c6a56b27f Merge changes I40575081,I1ca8f8cf,I38bfd273
* changes:
  clang-format Utils.cpp
  vold: fsync both file and directory after write keys
  vold: Introduce android::vold::writeStringToFile
2019-04-05 18:26:39 +00:00
Sandeep Patil
faad076163 Merge "vdc: print the failed command with failure status." am: b8d17384c5
am: 880deb6add

Change-Id: Ib680ab944a6e197e4afd3f4e2d36dcd345cbf9c8
2019-04-05 10:08:53 -07:00
Paul Crowley
747b421a22 clang-format Utils.cpp
Test: treehugger
Change-Id: I405750812ae037088492bfa7d8db6a8a56cb3425
2019-04-05 04:09:57 -07:00
Tommy Chiu
11621353f2 vold: fsync both file and directory after write keys
Use vold version of writeStringToFile which fsync files, and
manually fsync directories after initialize global DE

(cherry picked from commit a98464f688)

Bug: 71810347
Test: Build pass and reboot stress test.
      Original boot failure symptom is NOT reproducible.
Change-Id: I1ca8f8cf0ccfd01075a9c33f79042e58d99aea26
Merged-In: I1ca8f8cf0ccfd01075a9c33f79042e58d99aea26
2019-04-05 04:06:38 -07:00
Tommy Chiu
97466cb145 vold: Introduce android::vold::writeStringToFile
Remove static definition of writeStringToFile, and
move it from KeyStorage to Utils

(cherry picked from commit 0bd2d11692)

Bug: 71810347
Test: Build pass and reboot stress test.
Change-Id: I38bfd27370ac2372e446dc699f518122e73c6877
Merged-In: I38bfd27370ac2372e446dc699f518122e73c6877
2019-04-05 04:06:18 -07:00
Sandeep Patil
880deb6add Merge "vdc: print the failed command with failure status."
am: b8d17384c5

Change-Id: I6d778f903948cfcee5e377ab22502ed4e1b52ba7
2019-04-04 11:39:35 -07:00
Treehugger Robot
b8d17384c5 Merge "vdc: print the failed command with failure status." 2019-04-04 18:16:27 +00:00
Eric Biggers
2fba74c1e1 Merge "Add missing null terminator for getopt_long()" am: 4d05e017f9
am: 4e3300374b

Change-Id: Ic91066f2abfdc191fe4d0b517fd65d9744387e7b
2019-04-04 09:55:49 -07:00
Eric Biggers
4e3300374b Merge "Add missing null terminator for getopt_long()"
am: 4d05e017f9

Change-Id: I18d49879af84b0d58254eda501e0ed7ea5a3ca11
2019-04-04 09:37:52 -07:00
Sandeep Patil
4377234daa vdc: print the failed command with failure status.
vdc currently only prints generic binder failure status on failure.
This doesn't help debugging early boot failures at all since we don't
know which exact vdc command failed. Fix that by adding the command as
part of the failure message.

Bug: 129946805
Test: Boot cuttlefish

Change-Id: Ic2367cf592d6b5bf23d6d4b1447baa1baf41afe7
Signed-off-by: Sandeep Patil <sspatil@google.com>
2019-04-04 09:35:51 -07:00
Eric Biggers
4d05e017f9 Merge "Add missing null terminator for getopt_long()" 2019-04-04 16:18:18 +00:00
Eric Biggers
f5ef40de83 Add missing null terminator for getopt_long()
getopt_long() assumes an all-zeroes 'struct option' at the end of the
array.  Add it.

Fortunately this isn't causing problems in practice because vold is
always passed valid command line options...

Test: Running 'vold --foo' no longer segfaults.
Change-Id: I2cd3af501cc1aa11327a8062ec492be1d23defdf
2019-04-03 16:32:24 -07:00
Eric Biggers
143498f797 Merge "vold: downgrade lookup_key_ref() failure message to DEBUG level" 2019-04-03 21:38:28 +00:00
Daniel Rosenberg
c7da9acdce Merge "Retry opening loop device" am: c8f5cbb5b1 am: de841f6d89
am: dde25e9167

Change-Id: I14fc99509f8b5f83cc2dd0a035d1b127c581b027
2019-04-02 15:52:12 -07:00
Daniel Rosenberg
dde25e9167 Merge "Retry opening loop device" am: c8f5cbb5b1
am: de841f6d89

Change-Id: Ia0765900543f1778fbbe5d26dcadaff8364a89b5
2019-04-02 15:08:19 -07:00
Daniel Rosenberg
de841f6d89 Merge "Retry opening loop device"
am: c8f5cbb5b1

Change-Id: I5657465fe50f61e3c45e7d13eb5953ef7771d5fa
2019-04-02 14:23:59 -07:00
Daniel Rosenberg
c8f5cbb5b1 Merge "Retry opening loop device" 2019-04-02 20:28:44 +00:00
Eric Biggers
d103404985 vold: downgrade lookup_key_ref() failure message to DEBUG level
Now that lockUserKey() will be called for every user each time the
framework is started, it's a normal case that the key being removed
doesn't exist.  So downgrade the log message about being unable to find
a key from ERROR to DEBUG.

Test: build and boot, message is now debug level.
Change-Id: I2d1dce8dd8825b02982eab1c902aa10fe5b54b84
2019-04-02 11:13:57 -07:00