Commit graph

42923 commits

Author SHA1 Message Date
Elliott Hughes
d2aaede610 adb: don't use <error.h>.
This should fix the bloody Mac build, which doesn't have <error.h>. Since
we weren't entirely happy with error(3) anyway, switch to the toybox
style of error_exit and perror_exit, which are slightly briefer and quite
a bit more intention-revealing.

Bug: N/A
Test: builds
Change-Id: Ic8e411906c363af51657da5ce947b25a0b6bb1f3
2018-10-22 17:04:32 -07:00
Elliott Hughes
f2b170573f Merge "adb: rationalize fatal/error logging." 2018-10-22 19:44:11 +00:00
Treehugger Robot
abdf6f2938 Merge "logcat: include 'kernel' and 'security' buffers in logcat --help" 2018-10-22 19:33:15 +00:00
Tom Cherry
d2c7613fc0 logcat: include 'kernel' and 'security' buffers in logcat --help
Bug: 115798272
Test: documentation looks right
Change-Id: I35dcc51e6779e7382843d4d92fb6182ddf0e0202
2018-10-22 11:16:07 -07:00
Treehugger Robot
5336d40ed4 Merge "logd: clear timeout if no start time is given" 2018-10-20 00:03:08 +00:00
Elliott Hughes
4679a39610 adb: rationalize fatal/error logging.
Let's use LOG(FATAL)/PLOG(FATAL) for actual fatal stuff.

Add a Windows error(3) and move folks who didn't really mean "abort"
fatal over to it. Also get rid of syntax_error which wasn't adding a
lot of value, and most of the places it was adding "usage: " didn't seem
entirely appropriate anyway.

In particular, we seemed to have confused fastdeploy.cpp into aborting
in most user error cases, and none of the reviewers noticed. Clearly
we'd all lost track of far too many options.

(I've also cleaned up a few random instances of fprintf(3) + exit(2).)

Bug: N/A
Test: manual
Change-Id: I3e8440848a24e30d928de9eded505916bc324786
2018-10-19 14:04:24 -07:00
Tom Cherry
e2d30d14d0 logd: clear timeout if no start time is given
This code was accidentally deleted in the refactoring of
4f22786cc9 cause the
logd.timeout_no_start test to start failing.

Bug: 117942520
Test: logd unit tests
Change-Id: Id7994230a89d7f8c2cb1f36a8ca1175a6b398de0
2018-10-19 13:51:35 -07:00
Tom Cherry
5083be5d72 Merge "init: Add some ASAN helpers" 2018-10-19 20:41:24 +00:00
Treehugger Robot
4ef4b57512 Merge "fs_mgr: fs_mgr_overlayfs_teardown_one use .<hidden>" 2018-10-19 20:10:17 +00:00
Tom Cherry
e0042419f8 init: Add some ASAN helpers
Init is special.

It starts early and does not pick up the Android ASAN options provided
on the environment.  Therefore we pull in /system/asan.options in
explicitly if it exists.  We provide sane defaults that will allow the
system to boot otherwise.

Logging is complicated because it needs to go to the kernel log.
So use sanitizer functions to install log functions.

Bug: 117879229
Test: m && m SANITIZE_TARGET=address
Test: init boots with ASAN enabled
Change-Id: I72c033a1f86ba5d6b2e4f943e7a3acd0d399c8bf
2018-10-19 11:18:58 -07:00
Mark Salyzyn
9b44e80948 fs_mgr: fs_mgr_overlayfs_teardown_one use .<hidden>
Switch to using a leading . to reference a teardown directory, and
if the top directory (/mnt/scratch/overlay) report ENOTEMPTY then
check if there is any non-hidden content, and if not then consider
removing the scratch partition.

Although not currently a problem, use basename of mount point in
fs_mgr_overlayfs_teardown_one when referencing the overlay directory
tree to match the setup behavior.  Would have become a problem if
we started dealing with sub-mount points (eg: /vendor/firmware_mnt).

Test: manual
Bug: 109821105
Change-Id: I05dafe29c9e376e8423aedc8783fe674a657b3ee
2018-10-19 16:49:16 +00:00
Tom Cherry
7a08c896dd Merge changes Iea270320,Ib9063185
* changes:
  init: allow properties to be used for the keycodes option
  init: use rvalues references for callees of ParseLineSection()
2018-10-19 15:43:43 +00:00
Treehugger Robot
1230ddc94b Merge "liblp: Always align the first usable sector." 2018-10-19 05:29:17 +00:00
Treehugger Robot
62833808b0 Merge "Add O_CLOEXEC" 2018-10-19 02:52:52 +00:00
Howard Ro
18a936b3ad Merge "Revert "Make native metrics logger write to statsd socket"" 2018-10-19 02:12:15 +00:00
David Anderson
6f4722e98e Merge "liblp: Reserve the first logical block of the super partition." 2018-10-19 02:04:08 +00:00
Howard Ro
44874e5b0e Revert "Make native metrics logger write to statsd socket"
This reverts commit 34bc567a93.

Reason for revert: build failure

Change-Id: I67e0270051a82db7f524ed219316f02f2766d6e1
2018-10-19 01:41:07 +00:00
Nick Kralevich
2991949001 Add O_CLOEXEC
Prevent an FD from accidentally leaking across an exec() boundary.

Test: code compiles.
Change-Id: I90ca6e332802700403f401db016cc6c0c72b0ea3
2018-10-18 16:09:40 -07:00
Treehugger Robot
30fa1b7864 Merge "fs_mgr: fs_mgr_overlayfs_teardown_one failure to teardown scratch" 2018-10-18 21:23:43 +00:00
Treehugger Robot
321a60f156 Merge changes Ic8d22016,I3e15296e,Ie275e22c
* changes:
  adb: improve benchmark script a bit.
  adb: extract helper for dumping a packet header.
  adbd: turn on -Wthread-safety.
2018-10-18 20:25:53 +00:00
Treehugger Robot
d301f1bce4 Merge "Make native metrics logger write to statsd socket" 2018-10-18 20:05:58 +00:00
Treehugger Robot
224263da96 Merge "fs_mgr: fs_mgr_overlayfs_mount_scratch try alternate" 2018-10-18 19:21:41 +00:00
Howard Ro
34bc567a93 Make native metrics logger write to statsd socket
Bug: 110537511
Test: compiles without failures and verified the correct metric
Change-Id: Ie8019a20a2112ed6cbbc0999d68592efb8f0f538
2018-10-18 10:39:40 -07:00
Tom Cherry
e72274ac2b Merge "Start logd and service managers during the 'init' trigger" 2018-10-18 17:09:12 +00:00
Treehugger Robot
d2dfb33942 Merge "fs_mgr: fs_mgr_rm_all error propagation inconsequential EPERM" 2018-10-18 14:28:46 +00:00
Treehugger Robot
0a6c743179 Merge "fs_mgr: string literal cleanup" 2018-10-18 14:28:43 +00:00
Treehugger Robot
b59b20caac Merge "fastboot: use constants.h values" 2018-10-18 14:27:33 +00:00
Mark Salyzyn
8e7e9cb395 fastboot: use constants.h values
Cleanup to utilize all the manifest values in constants.h.

If the cli command _and_ the protocol name match, use a common
source of convenient truth.  This should set a pattern for future
additional commands.  When the command and the protocol differ,
we want to introduce resistance as it results in confusion and
maintenance issues.

Test: compile
Change-Id: Idad413c63cbbfcb6e851856105a5d5a9ef53ef29
2018-10-18 14:26:27 +00:00
Christopher Ferris
7cffd15110 Merge "Fix which maps to search for globals." 2018-10-18 01:54:47 +00:00
David Anderson
87391664e3 liblp: Always align the first usable sector.
Align the first usable sector to the logical block size, if no other
alignment was specified. This fixes a bunch of warnings during certain
gtests (ones with unaligned metadata sizes). The warnings were coming
from MetadataBuilder::GrowPartition() which expects the first sector
to always be block-aligned.

Bug: 116802789
Test: liblp_test gtest
Change-Id: I8dcf502aa4c2ba0674c5b4dcb77a274f300ff0a3
2018-10-17 23:17:24 +00:00
David Anderson
692049259c liblp: Reserve the first logical block of the super partition.
Traditionally the first 512 bytes of a partition can be interpreted as
an MBR. To prevent any compatibility issues, we explicitly zero the
first 4096 bytes of the super partition (one logical block, on most
systems).

Bug: 116802789
Test: liblp_test gtest
      device with super partition flashes and boots

Change-Id: I29688ca75dbb52442f1464e8ab35893678a4f79e
2018-10-17 16:15:41 -07:00
Christopher Ferris
56d0e07d70 Fix which maps to search for globals.
If multiple threads are unwinding at the same time, new maps that contain
the global variables for dex files and jit information are created. This
leads to threads creating more new maps that then get searched, then
more maps, then more searching until virtual address space exhaustion.

Fix this so that we only search maps that have a corresponding rw map that
could contain the global memory.

Small refactor to combine the code to search for global variables into
one class that both classes inherit from.

Modify unit tests for the new pattern checking.

Bug: 117761427

Test: Ran unit tests for libunwindstack/libbacktrace/simpleperf.
Test: Ran art 004-ThreadStress that used to fail.
Change-Id: I837ca6b9d0383100079de090bc7d019598e0cdfe
2018-10-17 14:23:10 -07:00
Tom Cherry
f18b748b91 Start logd and service managers during the 'init' trigger
Now that we mount partitions early, services can be started before the
'fs' trigger.  We therefore start the service managers as early as
possible to ensure their transports are online, without device
specific rc files needing to handle that.  We also start logd even
one step earlier to ensure that we capture all possible logd.

Bug: 89689596
Test: logging works for early services, include the servicemanagers
Change-Id: I75dbfcd26eb6fa77f002de10afd00f085c93aa07
2018-10-17 14:21:37 -07:00
Josh Gao
f2eaefe368 Merge "test_adb.py: silence ResourceWarning." 2018-10-17 21:10:45 +00:00
Tom Cherry
791668462a init: allow properties to be used for the keycodes option
Bug: 117828597
Test: bugreport launches with a test property set to appropriate keys
Test: bugreport doesn't launch with the test property unset
Test: no errors seen in build or boot in either of the above cases
Change-Id: Iea27032080a0a7863932b1c1b573857ac66b56b5
2018-10-17 11:30:53 -07:00
Tom Cherry
018a438ff0 init: use rvalues references for callees of ParseLineSection()
ParseLineSection() provides 'args' as an rvalue reference, so its
callers can and should use it as such.  This saves some copying
overhead and cleans up the code a bit.

Test: boot
Change-Id: Ib906318583dc81de9ea585f5f09fdff35403be1b
2018-10-17 11:30:53 -07:00
Treehugger Robot
4bc53d20af Merge "liblp: Add partitions to the correct group when writing LpMetadata." 2018-10-17 01:54:09 +00:00
Elliott Hughes
86c56953b3 Merge ""utils/Errors.h": include <stdint.h> for int32_t." 2018-10-17 00:53:40 +00:00
Treehugger Robot
03ea74aa91 Merge "Adding /odm/usr -> /vendor/odm/usr symlink" 2018-10-17 00:20:07 +00:00
Treehugger Robot
30793ac5fa Merge "liblp: Remove last_logical_sector from LpMetadataGeometry." 2018-10-16 23:41:42 +00:00
David Anderson
875434618f liblp: Add partitions to the correct group when writing LpMetadata.
The group_indices variable was intended to facilitate this, but I forgot
to actually use it.

Bug: 116817738
Test: lpmake, lpdump super_empty.img
Change-Id: Ia0da50b56b6c09e277324ec9d7aea6ce48fdc10a
2018-10-16 15:30:05 -07:00
Tom Cherry
89bf115a70 Merge "init: separate init packaging for mainline" 2018-10-16 20:29:47 +00:00
Elliott Hughes
9fbebc5d55 "utils/Errors.h": include <stdint.h> for int32_t.
No need for a Unix/Windows difference here.

Bug: N/A
Test: builds
Change-Id: If7b27f939f9c13ef336d2015608f2a24db8cc96d
2018-10-16 13:17:15 -07:00
Treehugger Robot
618be4c225 Merge "lmkd: increase the soft limit for keyboard" 2018-10-16 20:12:27 +00:00
Srinivas Paladugu
3eb20bc954 lmkd: increase the soft limit for keyboard
lmkd sets the soft limit parameters for Go devices.
The limit for apps in the perceptible group is set to 16M.
However this limit is not sufficient for the keyboard app to
prevent pages from being re-claimed quickly. The mem usage of
the keyboard app is around 55M most cases with some occasional
spikes to 70-80M. Increasing the limit to 64M improves the warm
startup latency for keyboard. It is still lower than the limits
set for foreground and visible apps.

Test: Go device (1G)
Bug: 117517805
Merged-In: Id50e49327cfd76126e41ef6503971845f29196af
Change-Id: Id50e49327cfd76126e41ef6503971845f29196af
2018-10-16 18:58:01 +00:00
Treehugger Robot
da915b4af3 Merge "Rename vbmeta_mainline to vbmeta_system." 2018-10-16 18:34:18 +00:00
Mark Salyzyn
e97469bd14 fs_mgr: fs_mgr_overlayfs_teardown_one failure to teardown scratch
If fs_mgr_overlayfs_teardown_one can not access the top directory,
then we should teardown the scratch volume.

Test: manual
Bug: 109821105
Change-Id: Ic86e10f1af1be354242fc004a95cac92d77619a6
2018-10-16 11:14:36 -07:00
Mark Salyzyn
6b313de3e3 fs_mgr: fs_mgr_overlayfs_mount_scratch try alternate
Harden fs_mgr_overlayfs_mount_scratch to try alternate filesystem
mount type just in case (f2fs <-> ext4).

Cleanup remove any unnecessary string literals.

Test: manual
Bug: 109821105
Change-Id: I36ea974ffeeae392553fff779939dc76a12ab96e
2018-10-16 11:14:24 -07:00
Mark Salyzyn
3a445df4fc fs_mgr: fs_mgr_rm_all error propagation inconsequential EPERM
If in fs_mgr_rm_all opendir on a subdirectory fails because of EPERM,
but a subsequent rmdir succeeds then there was no reason to report
the EPERM as an overall failure error code.

Test: manual
Bug: 117605276
Change-Id: I79fbf8567af1667094595e59ca2b536450f34b94
2018-10-16 11:14:15 -07:00
Mark Salyzyn
9b9bd39b7a fs_mgr: string literal cleanup
Cleanup remove any unnecessary string literals.

Test: compile
Bug: 109821105
Change-Id: Id22629201b8d874afb6b8f9157fa474fdfcf3f43
2018-10-16 11:14:06 -07:00