Commit Graph

53996 Commits

Author SHA1 Message Date
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
Treehugger Robot 8e2f75e319 Merge "libziparchive: fix -Wimplicit-int-float-conversion" 2019-11-13 22:21:38 +00: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
Tom Cherry e91c76b210 Merge "init: check property type in host_init_verifier" 2019-11-13 18:41:17 +00: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 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
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
Treehugger Robot 46f9698a11 Merge "libsparse: fix memory leak in output_file_close()" 2019-11-13 02:05:22 +00: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 5fff3877a1 Merge "Revert "Delay initial accept() until server initialized"" 2019-11-12 18:58:32 +00:00
Raman Tenneti b71b5af783 Revert "Delay initial accept() until server initialized"
This reverts commit 4ad4a11aa8.

Reason for revert: BUG: 144355953

Change-Id: Icb3d87e1f697ff60fc1262798cb19be8705e3740
2019-11-12 18:57:51 +00:00
Raman Tenneti 6657c5d71f Merge "Revert "Support socket activation of adb server"" 2019-11-12 18:56:27 +00:00
Raman Tenneti c77904e3c5 Revert "Support socket activation of adb server"
This reverts commit 4456b5fc15.

Reason for revert: Device boot failure BUG: 144355953

Change-Id: I539400fa2422bd4d6e396634c629a928cd2ac398
2019-11-12 18:55:29 +00:00
Raman Tenneti 0117aabea0 Merge "Revert "fix 'adb shell'"" 2019-11-12 18:54:27 +00:00
Raman Tenneti 4932ada048 Revert "fix 'adb shell'"
This reverts commit cc6d793310.

Reason for revert: Device boot failure. Conflicts while reverting dancol's CL.

Change-Id: Ic6929f20a60369b6f88f3caa22258e52d700f485
2019-11-12 18:52:12 +00:00
Tom Cherry b5f2ec06f5 init: check property type in host_init_verifier
We have all of the 'type' information for properties available during
build time, so let's check this when setting properties in init.

Test: setprop apexd.status bad results in:
host_init_verifier: Command 'setprop apexd.status bad'
(out/soong/.intermediates/system/core/rootdir/init.rc/android_x86_core/init.rc:927)
failed: Property type check failed, value doesn't match expected type
'enum starting ready'
host_init_verifier: Failed to parse init script
'out/soong/.intermediates/system/core/rootdir/init.rc/android_x86_core/init.rc'
with 1 errors
Test: CF builds without that error

Change-Id: Iaad07747c09f4a10b2b816c455d6e8a485357ab9
2019-11-12 10:19:21 -08:00
Maciej Żenczykowski 1d284004af Merge "fix 'adb shell'" 2019-11-12 12:16:24 +00:00
Maciej Żenczykowski cc6d793310 fix 'adb shell'
fcntl uses FD_CLOEXEC not O_CLOEXEC

Test: adb shell now works on cuttlefish
Bug: 144313654
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I5dbac5a46cbc9d24f8622076a3a553028ba648db
2019-11-12 04:09:07 -08:00
Robin Hsu 48c9f6196f libsparse: fix memory leak in output_file_close()
Fix memory leak in output_file_close():
Arguable whose resposibility to free structs allocated inside a file
struct (the caller or the library function), but the following protocol
(i.e. this fix) would better prevent memory leaks:
1) output_file_close() function will free those structs inside a file struct,
   right before closing the file.
   * Note: those structs are originally allocated by other libsparse function.
2) If the caller wants to clean up those struct inside a file struct,
   it may.  Just free those structs, and set the pointer to NULL.
   Afterward, when file_close()'s are called, they won't be free'ed twice.

Bug: 142483439
Test: verified by script MemLeak_LastCmd.sh (attached in Bugnizer)
Change-Id: I8bb9f7c9f7d19268663e2830d1a90d27bd5f99bd
Signed-off-by: Robin Hsu <robinhsu@google.com>
2019-11-12 18:52:29 +08:00
Treehugger Robot d9381651ee Merge "Delay initial accept() until server initialized" 2019-11-12 03:45:51 +00:00
Daniel Colascione d7052824d4 Merge "Support socket activation of adb server" 2019-11-12 02:27:02 +00:00
Treehugger Robot a8f3081663 Merge "libcutils: remove unused socket_set_receive_timeout()." 2019-11-11 17:03:37 +00:00
Haibo Huang 01a3f13452 Merge "Fix build with new googletest" 2019-11-10 04:08:34 +00:00
Haibo Huang cf8a5b0e0e Fix build with new googletest
The new googletest requires prefix to be non-empty.

Exempt-From-Owner-Approval: fix test
Change-Id: Ic039cb657b455919e429a3ec2107893b1734e8a1
2019-11-10 04:08:25 +00:00
Elliott Hughes d91984a890 libcutils: remove unused socket_set_receive_timeout().
Test: treehugger
Change-Id: I834762fd83bdaa3b714c7531439bf9115a82e342
2019-11-08 15:21:39 -08:00
Treehugger Robot eb8cccf772 Merge "Replace -Weverything with -Wextra" 2019-11-08 22:24:28 +00:00
Elliott Hughes ef6d913027 Merge "fastdeploy: fix tests." 2019-11-08 21:11:45 +00:00
Colin Cross b1ea33b64c Replace -Weverything with -Wextra
-Weverything is not recommended, use -Wextra.

Bug: 143713277
Test: mma
Change-Id: Ic242983ce984ae87d4b6937af8c106abe8e38364
2019-11-08 13:09:00 -08:00
Tom Cherry c9f5353ad3 Move init and ueventd scripts from / to /system/etc
There is no reason for these scripts to continue to exist in /, when
they are better suited for /system/etc.  There are problems keeping
them at / as well, particularly that they cannot be updated with
overlayfs.

Bug: 131087886
Bug: 140313207
Test: build/boot
Merged-In: I043d9a02ba588ca37ceba2c4e28ed631792b2586
Change-Id: I043d9a02ba588ca37ceba2c4e28ed631792b2586
2019-11-08 10:15:49 -08:00
Treehugger Robot 0bc3f6b124 Merge "configs for jailed procs to dump code coverage data" 2019-11-08 17:51:16 +00:00
Nikita Ioffe 838f5ccf9b Merge "userspace reboot: don't re-install keyring when remounting userdata" 2019-11-08 17:38:00 +00:00
Suren Baghdasaryan 8106c8e09f Merge changes from topic "native process registration"
* changes:
  init: Add support for native service registration with lmkd
  lmkd: Support process types when registering a process
  lmkd: Add library function to unregister a process
  lmkd: Prepare lmkd to support connection from init process
  lmkd: Restrict process record modifications to the client that created it
2019-11-08 17:25:10 +00:00
Treehugger Robot be49555bca Merge "Do not run init CTS test on secondary ABI" 2019-11-08 16:29:44 +00:00
Treehugger Robot 16366e36d5 Merge "ziparchive: add a corpus for the fuzzer." 2019-11-08 16:22:41 +00:00
Ray Essick 36e6f6d128 configs for jailed procs to dump code coverage data
list system calls used for dumping code coverage information; empty on
non code coverage builds. Mini-jail configurations can include this file
instead of trying to manage the list themselves.

Bug: 139313557
Test: arm32/arm64/x86 media svcs w/native coverage on, kill -37 to dump stats.
Change-Id: I7323a9739803756a76f54e4a98e995522cab71ef
2019-11-08 08:20:29 -08:00
Nikita Ioffe 63898aa2b2 userspace reboot: don't re-install keyring when remounting userdata
From the implementation of FscryptInstallKeyring it looks like it will
install a new keyring on each call.

Another approach would be change FscryptInstallKeyring to first call
request_key[0] (http://man7.org/linux/man-pages/man2/request_key.2.html),
and don't add keyring in case request_key succeeded, but it looks like
that libkeyutils doesn't provide such functionality.

Since I was there, I've also added checks that we are not trying to
remount userdata on FDE devices.

Test: adb reboot userspace
Bug: 135984674
Change-Id: I2e063d7d87a3c2c26810e913a33e3a5c0364332b
2019-11-08 16:11:04 +00:00
Elliott Hughes 74f0fc6b18 fastdeploy: fix tests.
Actually log results of adb commands, so we can see why this fails.

Fix the asan-detected use of a value from a reused part of the stack.

Test: atest FastDeployTest on Linux (with an asan adb)
Change-Id: I4d2bbae62a301e16065d604a2c9918077489cafb
2019-11-08 15:39:50 +00:00
Daniel Colascione 4ad4a11aa8 Delay initial accept() until server initialized
When the adb client starts the adb server, it waits until the server
reports that it's fully-initialized (via reply-fd) before executing
its adb client operation. This wait prevent that adb client from
talking to the server while it's initializing and becoming confused.
But if a *different* adb client connects to the server while it's
initializing, *that* client can temporarily observe unexpected state
while the server initializes itself. For example, such a client can
observe a device that's alive and connected as being offline while the
server connects to it.

The new socket activation support makes this race more apparent, since
in the socket activation configuration, there's no initial adb client
waiting for the server's all-clear indication and so even the first
client observes the partially-initialized server state.

This CL prevents the server accepting *any* client connection until
the server has fully initialized itself, preventing all clients, not
just the initial client, from observing a
partially-initialized server.

Test: test_adb.py; test_adb gtest binary
Test: [with socket activation] adb kill-server; adb devices
Change-Id: I5d399ee62436eee63340b6b8b0f64131ad17ac65
2019-11-07 20:58:28 -08:00
Daniel Colascione 4456b5fc15 Support socket activation of adb server
Socket activation allows adb to be run as a system daemon that starts
only as needed and supports race-free transparent restarts of the adb
server after a client issues an "adb kill-server" command.

Test: see SOCKET-ACTIVATION.txt
Change-Id: Ieabf08710ce4365e5513102f3aa578560aa7355e
2019-11-07 20:28:06 -08:00
Treehugger Robot 7e5fb6b322 Merge "migrate *.libraries.txt from Make to Soong" 2019-11-08 04:04:14 +00:00
Tom Cherry a4eeeadcd3 Do not run init CTS test on secondary ABI
Init unit tests refer to libraries that do not exist for the
secondary ABI, and we'd rather test the libraries on the device than
statically link them, so only test the primary ABI.

Init will only run on the primary ABI in any case, and doesn't have
much arch specific code in it.

Bug: 143560509
Test: build
Change-Id: I3c1883b3b55e5a06391d2885242f38c74eab621d
2019-11-07 16:06:38 -08:00
Treehugger Robot 71ed80a229 Merge "Add require_root for libcutils tests" 2019-11-07 23:34:24 +00:00
Elliott Hughes 9e63ba787d ziparchive: add a corpus for the fuzzer.
Reuse the existing test data.

Test: ran fuzzer on host, saw a lot more log spam
Change-Id: If57e4b8708832d7296b118e6926d41951d4a3ca9
2019-11-07 14:24:04 -08:00