Commit Graph

54964 Commits

Author SHA1 Message Date
Tom Cherry 49a8af7dff liblog: do not check loggability of event logs before sending to logd
This code was introduced to help performance by skipping sending these
messages to logd when logd would later drop them.  However it has
multiple flaws:

1) Event logs aren't super common and non-loggable event logs are even
   less common, so it would be a trivial benefit if any.
2) This code is not particularly safe as written, which is even
   acknowledged in the comments.
3) This forces processes that write event logs to allocate a rather
   sizable amount of memory.

Therefore, it's better to simply remove this and let logd drop these
messages when it receives them.

Bug: 139705697
Test: logging works, liblog-unit-tests
Change-Id: Ide01574112e173d4922137b3d3868cf8c2c09086
2019-12-11 15:46:47 -08:00
Treehugger Robot a449a1cfd7 Merge "Revert "Revert "Support socket activation of adb server""" 2019-12-11 21:33:48 +00:00
Tom Cherry 15eda8c61e Merge "liblog: simplify fake_log_device" 2019-12-11 20:41:31 +00:00
Tom Cherry 44c3df91be Merge "Require 'exact', 'prefix', or '' for match operation in property_contexts" 2019-12-11 20:41:21 +00:00
Nikita Ioffe da776c394d Merge "userdata_checkpoint_remount: delete all devices in dm-stack under /data" 2019-12-11 18:40:21 +00:00
Tom Cherry 4b077c51f2 Require 'exact', 'prefix', or '' for match operation in property_contexts
The previous code would lazily check for 'exact' and accept any other
value as a prefix match.  This should be a tighter check allowing only
'exact', 'prefix', or an empty string for this option.

Test: build fails if an invalid string is used for the match operation
Test: build succeeds normally
Test: `getprop -Z` shows exact vs prefix is differentiated correctly
Change-Id: I21dcb193810d65f468f8960967eabfd261f71e21
2019-12-11 07:56:51 -08:00
Tom Cherry c619e49f74 liblog: simplify fake_log_device
This still fakes the long removed /dev/log devices, whereas it only
needs to print to stderr, so simplify that code.

Use std::mutex now that it is C++ to easy portability concerns.

Use the proper liblog headers for formatting information instead of
hardcoding a copy.

Test: liblog-host unit test
Change-Id: I310a6e7ad939960300eafa729cbfc535c5ced445
2019-12-11 07:20:37 -08:00
Tom Cherry 1ccaf2b8ee Merge "liblog: add a test for liblog on host" 2019-12-11 14:36:56 +00:00
Gavin Corkery d1f5a817af Merge "Store crashing process name in sysprop" 2019-12-11 11:50:59 +00:00
Daniel Colascione 3ec7be7a84 Revert "Revert "Support socket activation of adb server""
Test: actually build both device and client adb this time

This reverts commit c77904e3c5.

Change-Id: I8c2b8f24884ff36ff2460dab2500bad777100dfd
2019-12-11 08:20:20 +00:00
Treehugger Robot 9af7878ec5 Merge "Allowing the fs_mgr flag of avb_keys to be a dir" 2019-12-11 04:26:57 +00:00
Kiyoung Kim 597eca8a8c Merge "Move linker config under /linkerconfig" 2019-12-11 02:55:06 +00:00
Tom Cherry d953ba3c82 liblog: add a test for liblog on host
Test: this test
Change-Id: I60fa8b82dbc010395762eba70502b89b295e29f5
2019-12-10 15:35:19 -08:00
Gavin Corkery 5d0deb563d Store crashing process name in sysprop
As part of Watchdog-triggered rollback logging, it would
be useful to know the service which has caused
updatable_crashing to be set. Store this in a new property
sys.init.updatable_crashing_process_name.

Test: manual
Bug: 138782888
Change-Id: Iffa38b2b746abbb5d823a8d69b7b8d2456836f4e
2019-12-10 23:00:24 +00:00
Steven Moreland b033ea31ad Merge "statusToString: parenthesize strerror" 2019-12-10 20:57:10 +00:00
Steven Moreland 1e8e49cc2c statusToString: parenthesize strerror
For clarity, when printint w/o delination, noticed in b/145776393.

Test: view output of statusToString from a dumpsys change
Change-Id: I5ea9f052c223f167dd58923e2470c852907c97b8
2019-12-10 18:43:53 +00:00
Elliott Hughes 3498578c4c Merge "Be more careful about symlinking a file that actually exists on the host." 2019-12-10 17:59:15 +00:00
Matthew Maurer be9de1ab86 Merge "Add support for mocked RPMB" 2019-12-10 17:16:09 +00:00
Treehugger Robot 5642bd2384 Merge "init: clarify a comment" 2019-12-10 17:07:30 +00:00
Treehugger Robot 89bdf1f26f Merge "logcat: remove unused enum and #def" 2019-12-10 17:06:50 +00:00
Nikita Ioffe d572c80ace userdata_checkpoint_remount: delete all devices in dm-stack under /data
This enables unmounting + remounting of metadata encrypted ext4
userdata. Also added a sysprop to force unmount+remount logic even for
f2fs userdata which comes handy for testing, since we don't have
metadata encrypted ext4 devices to test on.

Test: adb shell setprop sys.init.userdata_remount.force_umount_f2fs 1
Test: adb shell /system/bin/vdc checkpoint startCheckpoint 1
Test: adb reboot userspace
Test: adb shell dumpsys activity
Bug: 135984674
Bug: 143970043
Change-Id: Icc30f5c99f4d9ee374352610ae17b5d9814f815b
2019-12-10 16:03:45 +00:00
Oli Lan 06126e1b6e Merge changes from topics "createapexdirs", "createapexrollbackdirs"
* changes:
  Create directory for snapshots of DE_sys apex data.
  Create DE_sys APEX data directories.
2019-12-10 12:54:43 +00:00
Treehugger Robot 8759cbd590 Merge "libsnapshot: add library for test helpers" 2019-12-10 10:28:42 +00:00
Tom Cherry 4b4154be30 logcat: remove unused enum and #def
Test: build
Change-Id: Ie43b4eb39c85b2a8edad4a5a73696dc97f43be68
2019-12-09 13:29:39 -08:00
Tom Cherry 687b55261c Merge "init: add missing O_CLOEXEC" 2019-12-09 17:47:21 +00:00
Tom Cherry cbeaca541c init: clarify a comment
We do not need to set up all directories from system.img for the first
stage ramdisk, only those which first stage init mounts on.

Test: n/a
Change-Id: I877c623bac0b6dd2927ebdefa20da929ff98b341
2019-12-09 07:09:32 -08:00
Tom Cherry c99d60cbc7 init: add missing O_CLOEXEC
Test: (hopefully) no more denials at boot
Change-Id: I7c20a9bbf27210e0ee5f1bbe69db36bb47c38892
2019-12-09 06:48:37 -08:00
Tom Cherry ca7fbd546c Merge "Cleanup package_string() and its users" 2019-12-09 14:35:41 +00:00
Oli Lan 4370ff58ae Create directory for snapshots of DE_sys apex data.
This creates the /data/misc/apexrollback directory which will
hold snapshots of DE_sys apex data directories (i.e. it will
hold backups of data from /data/misc/apexdata for particular
apexes).

See go/apex-data-directories for details.

Bug: 141148175
Test: Built and flashed, checked directory was created.
Change-Id: If45377a9b29cc1f52dd08ea1339829e3bb3032e9
2019-12-09 11:12:53 +00:00
Oli Lan 13e51e7f0b Create DE_sys APEX data directories.
This creates the directory /data/misc/apexdata, at the same time as other
directories under /data/misc. Then, when apexd has finished activating
APEXes, a directory is created under /data/misc/apexdata for every
APEX, with the same name as the APEX module name.

See go/apex-data-directories.

APEXes are discovered by scanning the /apex directory. It may be better
to delegate this process to a library, but it is proposed to defer that
change to a future CL.

Bug: 141148175
Test: Built and flashed, checked directories were created.
Change-Id: I639d6f490ae0b97f116ce38ff3ac348bd73aa20e
2019-12-09 11:10:42 +00:00
Kiyoung Kim 99df54be93 Move linker config under /linkerconfig
Currently linker config locates under /dev, but this makes some problem
in case of using two system partitions with chroot. To match system
image and configuration, linker config better stays under /linkerconfig

Bug: 144966380
Test: m -j passed && tested from cuttelfish
Change-Id: Iaae5af65721eee8106311c1efb4760a9db13564a
2019-12-09 19:45:11 +09:00
Bowgo Tsai acaa95dc44 Allowing the fs_mgr flag of avb_keys to be a dir
Hard coding multiple keys in the avb_keys flag isn't flexible and
causes some pains when upgrading an Android codebase.
e.g., from Android 10 to Android 11.

This CL supports specifying a directory for the avb_keys
for fs_mgr to list then use the avb keys under the directory.

Bug: 144399552
Test: config a fstab using avb_keys as a dir to boot
Test: atest libfs_avb_test
Test: atest libfs_avb_internal_test
Change-Id: Ie74845d8c8e4aa45e8a9e3b862424cec641f8090
2019-12-09 14:29:52 +08:00
Elliott Hughes 3af236c693 Be more careful about symlinking a file that actually exists on the host.
Avoids this error on later runs:

  ln: cannot create symbolic link from '/sys/kernel/debug' to 'out/target/product/walleye/root/d/debug': Permission denied

Bug: http://b/145148158
Test: touch * ; mm -j32 -k
Change-Id: I0c1c0c6e7666c0bc3373687d8c1c7bdf0847913f
2019-12-06 17:43:23 -08:00
Yifan Hong 0daaa72b0f libsnapshot: add library for test helpers
Add libsnapshot_test_helpers for update engine tests
to properly set up depended modules.

Test: update_engine_unittests
Test: libsnapshot_test
Change-Id: Idd90a74cd6fb489f6ae14f44493b2288205c4a94
2019-12-06 17:42:40 -08:00
Nikita Ioffe 1fd9c55689 Merge "libdm: add an api to unwind dm stack" 2019-12-06 23:44:11 +00:00
Josh Gao 9e6ac64871 Merge "base: steal Chromium's NoDestructor." 2019-12-06 23:03:39 +00:00
Tom Cherry d1ac612879 Merge "Make android_logger_set_prune_list() sane" 2019-12-06 22:39:58 +00:00
Nikita Ioffe 9fb63038f7 libdm: add an api to unwind dm stack
This API is an attempt to consolidate dm-stack unwinding logic
re-implemented in several different places (libfsmgr, libfstab,
libfiemap, etc.).

Test: libdm_test
Bug: 135984674
Change-Id: I9672d4c1e882824ef980667818d4c3aabcb82e1f
2019-12-06 22:10:45 +00:00
Tom Cherry 1022f0de11 Merge "init: fsync() persistent properties directory after rename()" 2019-12-06 22:01:29 +00:00
Jaegeuk Kim 7bf14bb932 Merge "rootdir: init.rc to limit discard size to 128MB" 2019-12-06 21:59:19 +00:00
Tom Cherry e17b4f62df Cleanup package_string() and its users
package_string() isn't readable in its current form and a loop is
unnecessary, so let's replace that with the direct calculations.  The
new and old functions are identical in results except an edge case
where the old function incorrectly believes it needs to round up to
'10' for the size prefix, when '9' would be ok, specifically:
10\naaaaa\n\f vs 9\naaaaa\n\f.  This is true for all powers of 10.

Clean up the calling side in logcat as well.

Test: printing log statistics and prune list works
Change-Id: Ib62ab2badab59040215b130ec9e3efbc7c95af3f
2019-12-06 13:55:08 -08:00
Josh Gao efc9a63bde base: steal Chromium's NoDestructor.
Pillage from Chromium a wrapper type that skips destruction of its
wrapped type, to avoid problems with premature destruction of
variables with static lifetime.

Test: libbase_test on host
Change-Id: I7d4541f7b59f467b232d5c4f8250dc1ea45e28fa
2019-12-06 13:23:05 -08:00
Tom Cherry 238eae1738 Merge "logcat: more error printing clean-up" 2019-12-06 19:56:55 +00:00
Tom Cherry ed860ff4bf Make android_logger_set_prune_list() sane
The current version requires callers to supply a string with 32 extra
bytes for liblog to internally prepend "setPruneList ", and to have
enough space to parse logd's return string.  That is an unacceptable
requirement on callers.

This change removes that requirement by having liblog allocate the
needed std::string in any case.

It also stops writing back the 'success' or 'Invalid' string to the
caller's buffer, since that is redundant as well.

Test: changing prune settings works.
Change-Id: Ic0f03a229f0b9a77d03adcb91288370c3bd42903
2019-12-06 11:23:58 -08:00
Tom Cherry 97437a7aae init: fsync() persistent properties directory after rename()
See the inline comment on why this is necessary.

Test: persistent properties work without errors
Change-Id: I820a193fb032a1845791a55a76390d396678f151
2019-12-06 11:16:50 -08:00
Tom Cherry 72a4e08864 logcat: more error printing clean-up
* The --help text is way too long to print after each error, so simply
  print the errors and exit.
* Report errno in a few cases where it was previously not reported
* Fix more punctuation
* Fix '?' and ':' getopt_long() return cases for long options.

Test: errors look better
Change-Id: I57058a2250e9f3c3431f104e43f0eb5ec60d8c8a
2019-12-06 10:27:07 -08:00
Tom Cherry 1dd1056f5d Merge "logcat: clean up handling of logd control commands with -f and -L" 2019-12-06 16:16:13 +00:00
Anton Hansson 38ad736944 Merge "Run the derive_sdk service" 2019-12-06 13:28:21 +00:00
Treehugger Robot 6e0a0dad52 Merge "unwindstack: fix dangling pointer in LocalUpdatableMaps." 2019-12-06 03:16:07 +00:00
Nikita Ioffe abd504611b Merge "Remove service defined in an APEX during userspace reboot" 2019-12-06 02:35:41 +00:00