Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

system-vold: Commit

system/vold


Commit MetaInfo

Revisión1b535e41fd6c1b666cf806aae782cf621b7782bc (tree)
Tiempo2019-09-19 08:22:30
AutorPaul Lawrence <paullawrence@goog...>
CommiterDaniel Rosenberg

Log Message

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

Cambiar Resumen

Diferencia incremental

--- a/Checkpoint.cpp
+++ b/Checkpoint.cpp
@@ -244,6 +244,11 @@ bool cp_needsRollback() {
244244 }
245245
246246 bool cp_needsCheckpoint() {
247+ // Make sure we only return true during boot. See b/138952436 for discussion
248+ static bool called_once = false;
249+ if (called_once) return isCheckpointing;
250+ called_once = true;
251+
247252 bool ret;
248253 std::string content;
249254 sp<IBootControl> module = IBootControl::getService();
@@ -317,6 +322,8 @@ static void cp_healthDaemon(std::string mnt_pnt, std::string blk_device, bool is
317322 } // namespace
318323
319324 Status cp_prepareCheckpoint() {
325+ // Log to notify CTS - see b/137924328 for context
326+ LOG(INFO) << "cp_prepareCheckpoint called";
320327 if (!isCheckpointing) {
321328 return Status::ok();
322329 }
Show on old repository browser