Commit Graph

54964 Commits

Author SHA1 Message Date
Yifan Hong 44fd7f6166 libsnapshot: bootloader rejects wipe in proper time.
Calls into HAL first to reject wipes early. Otherwise, there may
be a small window where wipes needs to be rejected but bootloader
doesn't know about it.

Consider the following flow in existing code:
1. sets file to merging
2. devices crashes / shuts down before calling into HAL
3. first-stage init maps dm-snapshot-merge
4. reboot into fastbootd / bootloader
5. wipe

At this point, bootloader / fastbootd won't know that merge
has already taken place.

Reorder so that snapshotctl notifies bootloader before writing
the file.

When switching from merging back to none:

0. merge has completed
1. sets file to none
2. devices crashes / shuts down before calling into HAL
3. first-stage init maps dm-linear
4. reboot into fastbootd / bootloader and wipe (fail)
5. reboot, snapshotctl resets state to none (calls into HAL)
6. reboot into fastbootd / bootloader and wipe (successful)

Test: libsnapshot_test
Change-Id: I2b430049c79bf1a751167db7fce74502ac26490a
2019-11-15 01:48:21 -08:00
David Anderson ef8559f481 Merge "libsnapshot: Add a helper for handling data wipes in recovery."
am: a487793fc7

Change-Id: I4bfe66c7632a9cd41f481a2a77c3510ac86c6630
2019-11-14 20:38:29 -08:00
David Anderson a487793fc7 Merge "libsnapshot: Add a helper for handling data wipes in recovery." 2019-11-15 04:27:59 +00:00
Josh Gao 8a243118db unwindstack: fix dangling pointer in LocalUpdatableMaps.
Previously, when reparsing /proc/self/maps, we would remove duplicate
MapInfo entries, but leave the following entry's prev_map pointing
toward the soon-to-be-deleted MapInfo, leading to explosions.

Test: libunwindstack_test
Test: booted with libfdtrack.so preloaded
Change-Id: Ibfb7a8712540fe3aaadc10e9c31938f6ecddf17b
2019-11-14 18:12:57 -08:00
Tom Cherry 9bbb9fd625 Merge "init: make CheckPropertyTriggers() more efficient"
am: bc1d0b09cc

Change-Id: I9dd0109be0d3ca965582b72f94ae271a8ac5f199
2019-11-14 16:09:33 -08:00
Tom Cherry bc1d0b09cc Merge "init: make CheckPropertyTriggers() more efficient" 2019-11-14 23:37:30 +00:00
Tom Cherry 5d89604da2 Merge "liblog: cleanup opaque type usage"
am: 2ebe95ff2a

Change-Id: I88cb96e2bce5558e170782b9041a303efe83f3ff
2019-11-14 15:15:53 -08:00
Nikita Ioffe 82a431eb2f Add a very basic userspace reboot watchdog
Watchdog is just a forked process that is going to fall back to the
full reboot in case device wasn't able to boot in given amount of time.

Currently this amount is hard-coded to 1 minute, but in the future it
will be controlled by a read-only property.

Also added sync calls before and after tearing down services.

Test: adb reboot userspace
Bug: 135984674
Change-Id: Ie6053c9446a6761deae6dc104036bb35b09ef0e2
2019-11-14 23:10:54 +00:00
Tom Cherry 2ebe95ff2a Merge "liblog: cleanup opaque type usage" 2019-11-14 23:07:09 +00:00
Nikita Ioffe 3ac9adffdb Merge "Add sysprops for start & end of userspace reboot"
am: c5282e4c6b

Change-Id: I1fb2fad445cae5c902970e974fe1964809127c41
2019-11-14 13:57:16 -08:00
Nikita Ioffe c5282e4c6b Merge "Add sysprops for start & end of userspace reboot" 2019-11-14 21:50:59 +00:00
Tom Cherry 828db1a901 liblog: cleanup opaque type usage
There's a lot of unnecessary boilerplate around these opaque types,
and this change simplifies it.

Test: liblog-unit-tests
Change-Id: I0c4e133037fd5f04157ac22175181a6a496e18c4
2019-11-14 10:40:42 -08:00
Tom Cherry 1efc4849d7 init: make CheckPropertyTriggers() more efficient
Previously CheckPropertyTriggers() tried to do the entire property
triggers check with one loop.  However, that would require calling
GetProperty() on all properties for all triggers just in case the
property that is being set is used by a given trigger.

This change first checks that the property being set exists in each
trigger and that its value is set such that the trigger would be
triggered, only then does it check that other property triggers are
set to the right value.

Bug: 143922756
Test: boot
Test: substantially fewer GetProperty() calls from
      CheckPropertyTriggers()

Change-Id: I0228cf47328b31963eaf3fc689fb60f711532df4
2019-11-14 09:19:07 -08:00
Tianjie Xu 8d6a8167e0 Merge "Handle the reboot in the recovery user mode"
am: bace5995f1

Change-Id: I032ddc5a6bba23e4a18a447eca00cc72ddc7a64f
2019-11-13 21:08:04 -08:00
Bowgo Tsai 3db881359d Merge "fastbootd: exporting CPU ABI info"
am: afce590601

Change-Id: Id4840227937b73ffea762869e0020aaf7d07c433
2019-11-13 21:04:05 -08:00
Tianjie Xu bace5995f1 Merge "Handle the reboot in the recovery user mode" 2019-11-14 05:03:03 +00:00
Treehugger Robot afce590601 Merge "fastbootd: exporting CPU ABI info" 2019-11-14 04:51:37 +00:00
Marco Ballesio d486138708 Merge "Add support for freezer cgroup"
am: e40d2b1a84

Change-Id: I9658014f701cb41942f5cf04406bde9171f4f791
2019-11-13 17:55:16 -08:00
Treehugger Robot e40d2b1a84 Merge "Add support for freezer cgroup" 2019-11-14 01:42:55 +00:00
Nikita Ioffe c0df1874ad Add sysprops for start & end of userspace reboot
There will be useful in debugging/logging events to statsd.

Also as part of this CL, sys.init.userspace_reboot.in_progress property
is now used as a mean of synchronization. It is set directly in
DoUserspaceReboot, to make sure that all the setprop actions triggered
by userspace-reboot-requested were processed.

Test: adb reboot userspace
Test: adb shell getprop sys.init.userspace_reboot.last_started
Test: adb shell getprop sys.init.userspace_reboot.last_finished
Bug: 135984674
Change-Id: I9debcd4f058e790855200d5295344dafb30e496a
2019-11-14 01:38:05 +00:00
Nick Desaulniers f522f4b748 Merge "libziparchive: fix -Wimplicit-int-float-conversion"
am: 8e2f75e319

Change-Id: If649b5fc45c5c1c0cf40dd95fc989d232eae5b10
2019-11-13 14:38:09 -08:00
Tianjie Xu b6d7ea15b7 Handle the reboot in the recovery user mode
We have switched to "/system/bin/reboot" to perform the reboot. But
accessing the shell for user build under recovery is not allowed by
sepolicy. So adding a special routine to handle this reboot case.

Bug: 141247819
Test: run `adb reboot` in user mode recovery
Change-Id: Ia37438e52c67fd2bd54e923a0fea5817a1455a08
2019-11-13 14:23:09 -08:00
Treehugger Robot 8e2f75e319 Merge "libziparchive: fix -Wimplicit-int-float-conversion" 2019-11-13 22:21:38 +00:00
Tom Cherry f6bc6fa1b7 Merge "init: make triggering shutdown from vendor_init better"
am: b34291bcb6

Change-Id: I2f08e6abb496d089a7b795c6dff44d5e4391bf15
2019-11-13 14:14:07 -08:00
Treehugger Robot b34291bcb6 Merge "init: make triggering shutdown from vendor_init better" 2019-11-13 21:59:38 +00:00
Nick Desaulniers 4e7507ffc2 libziparchive: fix -Wimplicit-int-float-conversion
The value of uncompressed may not be precisely representable when
implicitly casted to an IEEE 754 single precision float.

Assuming the code doesn't need a precise compression ratio, accept the
potential imprecision via explicit cast.

system/core/libziparchive/unzip.cpp:114:68: error: implicit conversion
from 'int64_t' (aka 'long') to 'float' may lose precision
[-Werror,-Wimplicit-int-float-conversion]
  return static_cast<float>(100LL * (uncompressed - compressed)) / uncompressed;
                                                                 ~ ^~~~~~~~~~~~

Change-Id: If46cfa4eb2bb16a7491e52bb5d1c212ed5d59079
Bug: 139945549
Test: lunch hikey960-userdebug && mm
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2019-11-13 13:04:22 -08:00
Tom Cherry 18278d2e9c init: make triggering shutdown from vendor_init better
Previously, we assumed that TriggerShutdown() should never be called
from vendor_init and used property service as a back up in case it
ever did.  We have since then found out that vendor_init may indeed
call TriggerShutdown() and we want to make it just as strict as it is
in init, wherein it will immediately start the shutdown sequence
without executing any further commands.

Test: init unit tests, trigger shuttdown from init and vendor_init
Change-Id: I1f44dae801a28269eb8127879a8b7d6adff6f353
2019-11-13 12:41:34 -08:00
Marco Ballesio 726a68cb40 Add support for freezer cgroup
Adds the freezer cgroup to process groups

Change-Id: Ib7a8dbe776ff156ff3827b9a659365384f3e6ac8
Bug: 143308662
Test: manual - frozen processes aren't scheduled for execution until
unfrozen
2019-11-13 20:21:07 +00:00
Tom Cherry 4a5457481b Merge "init: check property type in host_init_verifier"
am: e91c76b210

Change-Id: Ia6adb374f7f00e36809fb80a4a457d4cafc91292
2019-11-13 10:51:11 -08:00
Tom Cherry e91c76b210 Merge "init: check property type in host_init_verifier" 2019-11-13 18:41:17 +00:00
Tom Cherry 777cbf21df Merge "Use PLOG and TEMP_FAILURE_RETRY for uevent socket errors"
am: 02359c6d96

Change-Id: I6e0a517b28aa112e7305f81874baca1832c7ed8a
2019-11-13 09:00:55 -08:00
Treehugger Robot 02359c6d96 Merge "Use PLOG and TEMP_FAILURE_RETRY for uevent socket errors" 2019-11-13 16:50:46 +00:00
Elliott Hughes d36bf30620 Merge "Ignore nullptr in native_handle_close()."
am: 2ba8c4b0af

Change-Id: Ie5ab3f785779febbfc79e45d7f2f12097d72c274
2019-11-13 08:13:52 -08:00
Tom Cherry ee7c1efe40 Merge "Move init and ueventd scripts from / to /system/etc"
am: 47cdf6c078

Change-Id: Ia46f5dcd439dec4f28c5418195edfb32a92f7ad2
2019-11-13 08:06:10 -08:00
Elliott Hughes 2ba8c4b0af Merge "Ignore nullptr in native_handle_close()." 2019-11-13 16:04:22 +00:00
Tom Cherry edad2bf9b6 Use PLOG and TEMP_FAILURE_RETRY for uevent socket errors
Use TEMP_FAILURE_RETRY() for recvmsg() to prevent failing
unnecessarily from EINTR.  Use PLOG(ERROR) in ueventd to display the
actual error if reading from the uevent socket does fail.

Test: build
Change-Id: I64a22698ce6ffc7573f75b57803551c7b6940e30
2019-11-13 07:21:42 -08:00
Tom Cherry 47cdf6c078 Merge "Move init and ueventd scripts from / to /system/etc" 2019-11-13 14:36:47 +00:00
Bowgo Tsai 33da5c9493 fastbootd: exporting CPU ABI info
CPU ABI info, e.g., arm64-v8a, can be useful to determine image
compatibility, prior to flash. Adding this info in fastbootd.

Bug: 74445765
Test: fastboot getvar cpu-abi # arm64-v8a
Change-Id: Ied494b646c551320295956b7890c0102fdb88382
2019-11-13 17:22:22 +08:00
Jiyong Park 2b879c262e Merge "Rename # vndk tag to # llndk"
am: 563a73e7f7

Change-Id: Icd7db9d6a6991f39cf66c6b49f7bcd747891b5e5
2019-11-12 22:46:36 -08:00
Treehugger Robot 563a73e7f7 Merge "Rename # vndk tag to # llndk" 2019-11-13 06:36:36 +00:00
Jiyong Park b2542d2942 Rename # vndk tag to # llndk
The APIs that are tagged with # vndk are actually for LLNDK libraries.
Although LLNDK is part of VNDK, calling those APIs 'vndk' has given
users a wrong perception that the APIs don't need to be kept stable
because that's the norm for most of the VNDK libraries that are not
LLNDK.

In order to eliminate the misunderstanding, rename the tag to 'llndk' so
that people introducing new such API will realize what they are signing
themselves up for.

Bug: 143765505
Test: m
Merged-In: Iae2acdf1ff4097a64a5c6280797c66abb1d5a5e6
(cherry picked from commit 0e957b82c8)
Change-Id: Iae2acdf1ff4097a64a5c6280797c66abb1d5a5e6
2019-11-13 14:32:44 +09:00
Elliott Hughes 7e42484610 Ignore nullptr in native_handle_close().
Just like native_handle_delete().

Bug: http://b/143898343
Test: new test
Change-Id: I373067aa6c2b03548b218c7011bdbf23bd71f260
2019-11-12 20:23:55 -08:00
Robin Hsu c324e80972 Merge "libsparse: fix memory leak in output_file_close()"
am: 46f9698a11

Change-Id: I2ad649a3198cd09179956e2ca4d921f1a2be02d8
2019-11-12 18:20:25 -08:00
Treehugger Robot 46f9698a11 Merge "libsparse: fix memory leak in output_file_close()" 2019-11-13 02:05:22 +00:00
Elliott Hughes 4a645c7451 Merge "unzip/zipinfo: use float percentages like the RI."
am: 08c9ceaef8

Change-Id: Ia615e884d09d76da8a4d27f46e686b5077810e83
2019-11-12 15:57:10 -08:00
Treehugger Robot 08c9ceaef8 Merge "unzip/zipinfo: use float percentages like the RI." 2019-11-12 23:27:28 +00:00
Elliott Hughes 008759711f unzip/zipinfo: use float percentages like the RI.
Test: my new test runner, specifically developed for ziptool
Change-Id: I1237d02daaf2939eebc4fd5ec19ccdd0de291ad5
2019-11-12 13:53:43 -08:00
Raman Tenneti 4443254774 Merge "Revert "Delay initial accept() until server initialized""
am: 5fff3877a1

Change-Id: I1bce66b314ef2789908faabd00c10e4da2c2bddc
2019-11-12 11:06:59 -08:00
Raman Tenneti 0b8dc11215 Merge "Revert "Support socket activation of adb server""
am: 6657c5d71f

Change-Id: I11e83217bea4327ef7e5d8b3c882f9bdfac0da09
2019-11-12 11:06:34 -08:00
Raman Tenneti 243d810fea Merge "Revert "fix 'adb shell'""
am: 0117aabea0

Change-Id: Ifeaae5bfd99609bf2f8f51b40874638f4a45762d
2019-11-12 11:05:37 -08:00