Commit graph

30033 commits

Author SHA1 Message Date
Christopher Ferris
32ac9bfd09 Merge "Add missing test files to compile." 2017-07-07 21:26:30 +00:00
Christopher Ferris
9744fb2b54 Add missing test files to compile.
Bug: 23762183

Test: Ran unit tests.
Change-Id: I8ac43517231d88c68c288800d8ed286daa57bce1
2017-07-07 12:25:23 -07:00
Christopher Ferris
2d07f72961 Merge "Init .gnu_debugdata in GetElf()." 2017-07-07 18:56:56 +00:00
Treehugger Robot
f444650d0d Merge "bootstat.cpp: update help message for --record_boot_complete" 2017-07-07 17:27:05 +00:00
Yongqin Liu
78b2b94d1d bootstat.cpp: update help message for --record_boot_complete
add description about --record_boot_complete in the help

Test: manually with HiKey

Change-Id: I521d6f5b9d98113c006fc6ab146b6c353ce2390c
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2017-07-07 15:27:10 +00:00
Treehugger Robot
a6bee4a29e Merge "Add test config for memunreachable_test" 2017-07-07 04:11:22 +00:00
Treehugger Robot
48d610ab18 Merge "Remove reference to deleted gzip module" 2017-07-07 01:34:40 +00:00
Colin Cross
b9e74ba400 Add test config for memunreachable_test
Test: none
Change-Id: Ieb297a2fcece6365a074cd470b3ca56e2baea926
2017-07-07 01:07:05 +00:00
Treehugger Robot
508e0b8b34 Merge "Move libnativebridge headers into the module." 2017-07-06 23:36:34 +00:00
Treehugger Robot
ae590fe723 Merge "System/core: Remove include/ziparchive" 2017-07-06 22:42:39 +00:00
Colin Cross
73c2ef4b87 Remove reference to deleted gzip module
The gzip module was removed and replaced with an implementation in
toybox.  Remove the required modules reference.

Bug: 63400769
Change-Id: I032d7ddc59105b3c6fb87084983266655772756a
Test: m -j checkbuild
2017-07-06 22:33:22 +00:00
Steven Moreland
b2b88e35ea Move libnativebridge headers into the module.
Test: links
Change-Id: I2e19d1ba7845b4b3d3fee934fcb1c90151fd7192
2017-07-06 11:23:16 -07:00
Treehugger Robot
c31963b5c2 Merge "Libziparchive: Export headers in defaults" 2017-07-06 06:51:29 +00:00
Andreas Gampe
d201b292fd System/core: Remove include/ziparchive
Remove the now unnecessary link.

Partially reverts commit cdf7ff8e20.

Bug: 37342627
Test: m
Change-Id: Ia44df234923c798618d7dc79d8f9f9432fbfada9
2017-07-05 22:03:44 -07:00
Andreas Gampe
a10a7e7114 Libziparchive: Export headers in defaults
libziparchive-host needs to include the headers correctly, too.

Bug: 37342627
Test: mmma system/core/libziparchive
Change-Id: I88a6d38ff9e494273040f9b913c71bccdda117ad
2017-07-05 22:03:44 -07:00
Treehugger Robot
6a9d56775f Merge "init: add info logs in first stage mount if we have to poll" 2017-07-06 04:46:05 +00:00
Treehugger Robot
4ca2a30368 Merge "fs_mgr: Adding logs when failing to wait for a device file" 2017-07-06 04:19:00 +00:00
Tom Cherry
0f4fb5497a Merge "ueventd: don't double fork firmware handlers" 2017-07-06 02:02:33 +00:00
Jinguang Dong
9d344969b0 fs_mgr: Adding logs when failing to wait for a device file
During mount operations, fs_mgr_wait_for_file() is invoked to
ensure the device file exists before starting to mount it. Adding
logs when the wait fails and also skip mounting as it won't be
successful. Also merge fs_mgr_test_access() and wait_for_file()
as fs_mgr_wait_for_file().

Test: Boot device and manually trigger the timeout issue
Test: Check and confirm whether timeout log info is inside ksmg.

Change-Id: Ide6d7fdca41e03e169e4400f91b7dea327985aaf
2017-07-06 09:51:02 +08:00
Treehugger Robot
b3915d113d Merge "add "shutdown critical" to service" 2017-07-06 00:40:55 +00:00
Treehugger Robot
cd0c2d8962 Merge "fs_mgr: allow no verity metadata when the device is unlocked." 2017-07-06 00:29:47 +00:00
Treehugger Robot
69542edfbe Merge "Backtrace: Add libziparchive dependency" 2017-07-05 23:55:43 +00:00
Treehugger Robot
c1bc4241f8 Merge "init: Support custom shutdown actions" 2017-07-05 23:49:41 +00:00
Tom Cherry
0f296e06d6 ueventd: don't double fork firmware handlers
ueventd may be asked to handle firmware during the time critical
coldboot process.  If we double fork to avoid needing to reap the
firmware handler, then we may add significant delay to this process,
as the first child may not get scheduled quickly enough for waitpid()
to complete without delay.

Bug: 63081260
Test: boot bullhead and sailfish, check that firmwares are loaded,
      no zombie ueventd processes remain, and no new errors are shown
Change-Id: I2bac3b1fbc3a58557a00326e491c104656db27ae
2017-07-05 16:41:11 -07:00
Tom Cherry
f3ae82f57f Merge "ueventd: remove character device symlinks (/dev/usb/*)" 2017-07-05 22:41:55 +00:00
Tom Cherry
a51c40ce35 Merge "init: reap zombies only after kill(-pid, ...)" 2017-07-05 22:39:51 +00:00
Keun-young Park
cccb34fce8 add "shutdown critical" to service
- "shutdown critical" prevents killing the service during
  shutdown. And the service will be started if not running.
- Without it, services will be killed by SIGTERM / SIGKILL during shutdown.
- Even services with "shutdown critical" will be killed if shutdown
  times out.
- Removes ueventd and vold from hard coded list. Each service's rc will
  be updated to add "shutdown critical". watchdogd is still kept in the list.

bug: 37626581
Test: reboot and check last kmsg

Change-Id: Ie8cc699d1efbc59b9a2561bdd40fec64aed5a4bb
2017-07-05 14:55:22 -07:00
Wei Wang
eeab491efd init: Support custom shutdown actions
We have been seeing panics and errors during shutdown sequence in
some vendor's platform, and it is required to disable error handling
during shutdown.

This CL separates the shutdown request to execute another "shutdown"
trigger at the beginning of shutdown stage. And vendor can use this
trigger to add custom commands needed for shutting down gracefully.

Bug: 38203024
Bug: 62084631
Test: device reboot/shutdown
Change-Id: I3fac4ed59f06667d86e477ee55ed391cf113717f
2017-07-05 14:49:57 -07:00
Treehugger Robot
6333cd0938 Merge "fs_mgr: report errno string for __mount errors" 2017-07-05 21:41:51 +00:00
Tom Cherry
322e176f6a init: add info logs in first stage mount if we have to poll
It's not a error case if we do not find a device that we're attempting
to regenerate uevents for during first stage mount, but it is likely
to increase boot time, so we log a message to attribute this delay.

Bug: 63327193
Test: Boot bullhead, sailfish

Change-Id: I97c2e5aefd218bbdd87717ff3c375381f725de08
2017-07-05 14:05:03 -07:00
Bowgo Tsai
d1fe3bdbd6 fs_mgr: allow no verity metadata when the device is unlocked.
To boot with generic system.img for project Treble, we should allow no verity
metadata when the device is unlocked. The previous fix checks system property
"ro.boot.flash.locked" but it's unavailable during first stage mount.
This CL checks "androidboot.verifiedbootstate" in kernel command line instead.

Bug: 63268209
Test: boot sailfish without metadata on /vendor

Change-Id: Ifd1dbeb2a2f09cd06903ecdd59bc94b3905a3fbd
2017-07-05 17:22:35 +08:00
Andreas Gampe
8f0947c11f Backtrace: Add libziparchive dependency
Bug: 37342627
Test: m
Change-Id: I2b4155bd11b315ff49eb9a69549e1ab3678d0b28
2017-07-04 12:03:52 -07:00
Treehugger Robot
eb42bb8c8b Merge "zlib is not exposed to libziparchive headers" 2017-07-03 19:30:45 +00:00
Jiyong Park
e7cf680ccc zlib is not exposed to libziparchive headers
By forward-declaring zstream, we don't need to re-export zlib headers.

Bug: 37342627
Test: build
Test: BOARD_VNDK_VERSION=current m -j dumpstate (or any other module
using libziparchive)

Change-Id: Ia69e5d459c79878d491cfe4ca21a7cc8fed4a5d8
2017-07-03 17:44:07 +00:00
Treehugger Robot
7b44858b91 Merge "libziparchive headers are moved to local directory" 2017-07-03 08:06:40 +00:00
Treehugger Robot
aa82721894 Merge "Ran clang-format on libziparchive sources and headers" 2017-07-03 00:45:16 +00:00
Jiyong Park
cdf7ff8e20 libziparchive headers are moved to local directory
libziparchive headers are moved from the global include directory
(/system/core/include) to the local directory inside libziparchive.

Note: /system/core/include/ziparchive still exists as a symlink to
libarchive/include/ziparchive. This will be removed when there is no
header-only dependency to libziparchive.

Bug: 37342627
Test: build
Change-Id: I3631ffc2df7be8a064d64a625d10436090c3bb0f
2017-07-02 04:33:34 +00:00
Jiyong Park
cd997e6094 Ran clang-format on libziparchive sources and headers
Test: build aosp_arm
Change-Id: I469b82b68f2c457f480fb9cd9da2026672985ce3
2017-07-02 11:46:53 +09:00
Treehugger Robot
22de50d351 Merge "Remove unnecessary SELinux dependencies" 2017-07-01 16:35:17 +00:00
Nick Kralevich
33391dad15 Remove unnecessary SELinux dependencies
These are unused.

Test: code compiles.
Change-Id: Idd707dfcc8f6daac3a489c791ecc364841cf31f9
2017-07-01 07:41:48 -07:00
Christopher Ferris
570b76f04f Init .gnu_debugdata in GetElf().
- Modify the tests to share some code for the generation of the elf data.
- Move the gnu_debugdata files into a separate directory.
- Add tests for GetElf().
- Move the CreateMemory() tests and the GetElf() tests into separate files.

Bug: 23762183

Test: New unit tests pass.
Change-Id: Ie3380296bb49753c2ac8801cfa11f93d6ff7121d
2017-06-30 17:24:58 -07:00
Treehugger Robot
c10e14110a Merge "init: Read previous state of securebits before modifying" 2017-07-01 00:20:50 +00:00
Luis Hector Chavez
f5965519d1 init: Read previous state of securebits before modifying
When Android is running in a container, some of the securebits might be
locked, which makes prctl(PR_SET_SECUREBITS) fail.

This change gets the previous state of the process' securebits and adds
the desired bits.

Bug: 62388055
Test: aosp_bullhead-eng boots
Test: If init has non-zero securebits, it can also boot
Change-Id: Ie03bf2538f9dca40955bc58314d269246f5731bd
2017-06-30 14:42:46 -07:00
Tom Cherry
8d13d808a5 init: reap zombies only after kill(-pid, ...)
When init gets SIGCHLD, it uses waitpid() to get the pid of an exited
process.  It then calls kill(-pid, ...) to ensure that all processes
in the process group started by that process are killed as well.

There is a bug here however as waitpid() reaps the pid when it
returns, meaning that the call to kill(-pid, ...) may fail with ESRCH
as there are no remaining references to that pid.  Or worse, if the
pid is reused, the wrong processes may get the signal.

This fixes the bug by using waitid() with WNOWAIT to get the pid of an
exited process, which does not reap the pid.  It then uses waitpid()
with the returned pid to do the reap only after the above kill(-pid,
...) and other operations have completed.

Bug: 38164998
Test: kill surfaceflinger and see that processes exit and are reaped
      appropriately
Test: `adb reboot` and observe that the extraneous kill() failed
      messages do not appear

Change-Id: Ic0213e1c97e0141e6c13129dc2abbfed86de138b
2017-06-30 13:52:48 -07:00
Treehugger Robot
c997cd64dc Merge "logd + liblogd to Android.bp" 2017-06-30 19:32:41 +00:00
Treehugger Robot
67897d47ce Merge changes Ie89f709b,Ibf543a7d,I1d8092a1
* changes:
  Fix out of bound read in libziparchive
  Check filename memory bound when parsing ziparchive
  Fix out of bound access in libziparchive
2017-06-30 15:38:13 +00:00
Tianjie Xu
0fda1cf633 Fix out of bound read in libziparchive
We should check the boundary of central directory before checking its
signature. Swap the order of these two checks.

Bug: 36392138
Test: libziparchive doesn't read the signature after boundary check fails.
Merged-In: Ie89f709bb2d1ccb647116fb7ccb1e23c943e5ab8
Change-Id: Ie89f709bb2d1ccb647116fb7ccb1e23c943e5ab8
(cherry picked from commit 74464a1361)
2017-06-30 17:19:56 +09:00
Tianjie Xu
9e020e2d11 Check filename memory bound when parsing ziparchive
Add a check to ensure the filename boundary doesn't exceed the mapped
memory region. Also add the corresponding unit test.

Bug: 28802225
Test: New unit test passes.
Merged-In: Ibf543a7da3d7898952e9eb332c84cdfc67cf5aa4
Change-Id: Ibf543a7da3d7898952e9eb332c84cdfc67cf5aa4
(cherry picked from commit bcc4431f24)
2017-06-30 17:19:28 +09:00
Tianjie Xu
fba1a36fd9 Fix out of bound access in libziparchive
The boundary check of an invalid EOCD record may succeed due to the
overflow of uint32_t. Fix the check and add a unit test.

Test: Open the crash.apk and libziparchive reports the offset error as expected.

Bug: 31251826
Merged-In: I1d8092a19b73886a671bc9d291cfc27d65e3d236
Change-Id: I1d8092a19b73886a671bc9d291cfc27d65e3d236
(cherry picked from commit ae8180c06d)
2017-06-30 17:18:31 +09:00
Treehugger Robot
7dbf1a187e Merge "Fix ScopedSignalHandler" 2017-06-30 06:44:40 +00:00