Commit graph

57184 commits

Author SHA1 Message Date
Tom Cherry
6923de1267 Merge "logd: disable flaky logd.timeout test" 2020-04-29 20:10:13 +00:00
Tom Cherry
09eae5024e Merge "liblog: clean up log_id.h includes" 2020-04-29 18:43:15 +00:00
Jooyung Han
597559a6fc Merge "stats: Set min_sdk_version" 2020-04-29 18:14:10 +00:00
Tom Cherry
25a4d708e2 logd: disable flaky logd.timeout test
This test is repeatedly seen to be flaky.  Disable it until we can run
tests against a dedicated logd instance.

Bug: 155146087
Test: logd-unit-tests
Change-Id: I0cd953955f613e40d17df73f70543d7d2f0925b6
2020-04-29 10:16:13 -07:00
Martin Stjernholm
9e1cabdfc7 Merge "Revert "bionic_libc_platform_headers is only available when buil..."" 2020-04-29 12:27:37 +00:00
Martin Stjernholm
87bac1a411 Revert "bionic_libc_platform_headers is only available when buil..."
Reason for revert: Breaks rvc-d1-dev-plus-aosp: http://ab/6443190
Reverted Changes:
Ide447b89a:bionic_libc_platform_headers is only available whe...
Ia93cd3ec8:bionic_libc_platform_headers is only available whe...
Icdc495588:Make bionic_platform_headers available only for Bi...
Idfd7c87dc:bionic_libc_platform_headers is only available whe...

Bug: 152255951
Bug: 155269399
Change-Id: I4e6beba5565e604fde3a51cdce5cc4041caffa4e
2020-04-29 12:18:54 +00:00
Martin Stjernholm
6b4faa57cc Merge "bionic_libc_platform_headers is only available when building with Bionic." 2020-04-29 10:30:23 +00:00
Treehugger Robot
2a586be0c7 Merge "Add vts_processgroup_validate_test to vts suite" 2020-04-29 00:33:31 +00:00
Tom Cherry
d5188d8258 Merge "init: fix restarting of subcontext" 2020-04-28 23:23:30 +00:00
David Anderson
b954b13613 Merge "libfiemap: Ignore userdata requirements in fiemap_writer_test when running a DSU." 2020-04-28 22:09:25 +00:00
Tom Cherry
da399f3a47 Merge "liblog: fix header copyrights" 2020-04-28 22:09:24 +00:00
Tom Cherry
3e86e250bb Merge "liblog: remove Rwlocks for logd_socket and pmsg_fd" 2020-04-28 21:10:29 +00:00
Tom Cherry
e3e77d382f init: fix restarting of subcontext
When the subcontext code was redone to allow only one subcontext
(vendor_init), the code for restarting it and for terminating it
during shutdown was not updated, resulting in it not working.

Bug: 155203339
Test: kill subcontext init and notice it restart
Test: subcontext init stops during shutdown
Change-Id: Ib77f59d1e7be0ffcfd3f31c8450dc022c20bb322
2020-04-28 14:03:25 -07:00
Treehugger Robot
f61377979e Merge "Fix cutils/ashmem.h copyright header." 2020-04-28 20:55:49 +00:00
Tom Cherry
dd1d42664f liblog: clean up log_id.h includes
This header is not needed in many of the places it is included.  It
contains functions that are duplicated from the <android/log.h>
header.

Test: build
Change-Id: I6ba41d596bcc956cfed13f1d3b21e023591bce0f
2020-04-28 12:34:45 -07:00
Treehugger Robot
3124175854 Merge "Moves some shared_libs to static_libs for vts_libsnapshot_test." 2020-04-28 18:49:52 +00:00
Dan Shi
63a07aafcf Add vts_processgroup_validate_test to vts suite
Bug: 154727600
Test: atest vts_processgroup_validate_test
Change-Id: I53bd4f9fd097878deaa77159feb2d48f66c464d1
Merged-In: I53bd4f9fd097878deaa77159feb2d48f66c464d1
2020-04-28 09:58:14 -07:00
Tom Cherry
b629ed9679 liblog: fix header copyrights
There is no reason to dual license this.

Test: builds
Change-Id: I93e6f75758edc32dbeeb55354cf0b1b327561716
2020-04-28 09:52:33 -07:00
Elliott Hughes
f35feb5389 Fix cutils/ashmem.h copyright header.
The *kernel* header is "GPL-2.0 OR Apache-2.0", but the userspace
libcutils is just Apache-2.0 like all our code.

Test: builds
Change-Id: I25eef8eed16550f4010285479b21b502a2d1fc07
2020-04-28 09:28:29 -07:00
Treehugger Robot
fdabad8d53 Merge "Add fuzz test for libsnapshot" 2020-04-28 08:28:53 +00:00
David Anderson
dde0c28089 Merge "liblp: Remove alignment_offset handling." 2020-04-28 04:30:23 +00:00
Tom Cherry
7acfba274c liblog: remove Rwlocks for logd_socket and pmsg_fd
These historically used atomics to manage their lifetime.  They were
unfortunately unsafe and later replace with a RwLock.  A lock is
also problematic as it is too heavy weight for the typical use case
and implies that logging is neither async nor fork safe.

This change returns us to using atomics with two key changes:
1) compare_exchange_strong() is used instead of atomic_exchange().
   The latter has a race condition where a separate thread could have
   read the atomic value into a register, while the thread performing
   the atomic_exchange closes that FD.  The new code only changes the
   FD in the atomic if it is uninitialized.
2) Using the fact that DGRAM sockets can have connect() called on them
   multiple times, it uses a single logd_socket for the duration of
   the program.

These sockets are thread/async/fork safely created and accessed.

The one caveat is __android_log_close(), which is intended only to be
used by zygote when it is single threaded and is therefore not thread
safe.  It will close this socket and reset the underlying variable,
such that the next log message will go through the above
initialization.

Bug: 65062446
Test: logging works, logging unit tests
Test: new unit test
Change-Id: Ia4dbf7479dbe50683d124558ab2f83bff53b8f5f
2020-04-27 18:24:38 -07:00
Jooyung Han
8c2056f747 Merge "libbase/liblog: set min_sdk_version" 2020-04-27 23:00:58 +00:00
Daniel Norman
2f8eb83f52 Moves some shared_libs to static_libs for vts_libsnapshot_test.
These shared_libs are missing from /system/lib/ on 64-bit devices.

Test: Build, install, and run 32bit vts_libsnapshot_test.
Bug: 154115505
Change-Id: Iaf2014748546a055d35e4fe0e24969eef13db7fa
2020-04-27 15:39:35 -07:00
David Anderson
cc2bf6b9d3 libfiemap: Ignore userdata requirements in fiemap_writer_test when running a DSU.
The test is guaranteed to fail because userdata is itself a fiemap-backed device.

Bug: 154447105
Test: fiemap_writer_test on DSU
Change-Id: Ied35da0eb7aba3daca7ed430f006bf1e90e21dca
2020-04-27 21:46:53 +00:00
Treehugger Robot
b0765fd679 Merge "fs_mgr: overlayfs: replace adb reboot -R with adb remount -R" 2020-04-27 21:19:29 +00:00
Yifan Hong
1b0893ea5e Add fuzz test for libsnapshot
Bug: 154633114
Test: source fuzz.sh && run_snapshot_fuzz_all -runs=100000

Change-Id: I5cd9e3f088ca283d3a49959c38aa74a483931f2c
2020-04-27 12:37:40 -07:00
Martin Stjernholm
03082e6952 bionic_libc_platform_headers is only available when building with Bionic.
Test: m checkbuild
Test: atest libunwindstack_unit_test
Test: lunch fvp-userdebug && mmm system/core/libunwindstack
Bug: 152255951
Change-Id: Idfd7c87dc65db350730fec3ceef8c6bc64acf60b
2020-04-27 19:53:49 +01:00
Tom Cherry
91fd50c78f Merge "base: reimagine line splitting in logger.cpp" 2020-04-27 16:03:46 +00:00
Mark Salyzyn
93c1233f12 fs_mgr: overlayfs: replace adb reboot -R with adb remount -R
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Test: none
Change-Id: Ie718e264b41763d904e59db74d4e7c9d4b8787f3
2020-04-27 07:41:17 -07:00
Jooyung Han
60985953bd Merge "Add min_sdk_version:R to updatable apexes" 2020-04-25 04:41:43 +00:00
Treehugger Robot
d694a67865 Merge changes I25df8eec,I493ff192
* changes:
  result.h - fix bugprone-suspicious-semicolon warning
  expected.h - fix bugprone-forwarding-reference-overload warnings
2020-04-24 20:43:33 +00:00
Maciej Żenczykowski
57d2fa4e52 result.h - fix bugprone-suspicious-semicolon warning
Fixes:
  system/core/base/include/android-base/result.h:
  133:94: warning: potentially unintended semicolon [bugprone-suspicious-semicolon]

Bernie says:
  it probably means that there's a parser bug with "if constexpr"

  maybe, at static analysis pass, the "if constexpr" was evaluated to false,
  and the compiler removed the "then" block from the AST...
  ... and then it thought you had written it that way :-)
  https://reviews.llvm.org/D46027

Test: builds
Bug: 153035880
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I25df8eeca4ec06b3180c1cd21b554fc583c5581a
2020-04-24 11:28:06 -07:00
Maciej Żenczykowski
dc12124aba expected.h - fix bugprone-forwarding-reference-overload warnings
Fixes:
  system/core/base/include/android-base/expected.h:
  186:13: warning: constructor accepting a forwarding reference can hide the copy and move constructors [bugprone-forwarding-reference-overload]
  195:22: warning: constructor accepting a forwarding reference can hide the copy and move constructors [bugprone-forwarding-reference-overload]
  611:13: warning: constructor accepting a forwarding reference can hide the copy and move constructors [bugprone-forwarding-reference-overload]

To quote Tom Cherry:
  I'm a bit confused at what's happening there.
  I think it's a bug in the linter itself.
  The general solution to that problem is a heavy dose of std::enable_if<>
  to hide that constructor when the 'U' parameter is the same class,
  but those constructors do have the necessarily std::enable_if<> lines.

  I think the problem is that the linter doesn't check that the macro
  _ENABLE_IF() expands into std::enable_if<>.  Let me try explicitly
  putting the std::enable_if<> instead of the macro and check if it
  goes away.

  I expanded the macro but the linter doesn't still doesn't accept
  the format of `std::enable_if_t<(condition_here)>* = nullptr`.
  It does accept `typename Enable = std::enable_if_t<(condition_here), void>`,
  which is the syntax used on their example here:
    https://clang.llvm.org/extra/clang-tidy/checks/bugprone-forwarding-reference-overload.html.

  That latter syntax doesn't work for us.
  See the Notes section on
    https://en.cppreference.com/w/cpp/types/enable_if
  as a reference for why what we're doing is correct.

Test: builds
Bug: 153035880
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I493ff19208cc104f5f176a36ec23fbcb914388f7
2020-04-24 11:28:06 -07:00
Treehugger Robot
e0edc7ec32 Merge "llkd: Print thread group before panic the kernel" 2020-04-24 14:04:03 +00:00
Joshua Duong
3eea62432d Merge "[adb] Disable _adb._tcp. service auto-connect by default." 2020-04-24 05:38:22 +00:00
Woody Lin
e5a09d8da5 llkd: Print thread group before panic the kernel
Debugging information for addressing the reason why the process stops as
a zombie, can be found by observing the call trace and running status of
threads in thread group of the zombie process.

Bug: 154667692
Change-Id: Icd7fa2161e88b08fd5ce0d5dc3a3790ed4ac02d1
2020-04-24 02:55:00 +00:00
Ytai Ben-tsvi
07ccf08af2 Merge "Control audio HAL services in start/stop" 2020-04-24 02:40:10 +00:00
Treehugger Robot
abc40c7c5d Merge "Using ABB for install-multi." 2020-04-24 01:15:49 +00:00
Joshua Duong
2eedc2303b [adb] Disable _adb._tcp. service auto-connect by default.
Added ADB_MDNS_AUTO_CONNECT envionment variable to control which
services to allow auto-connect. By default, only _adb-tls-connect
services can auto-connect, since these services only auto-connect once
paired. _adb services will try to auto-connect to every service found.

Bug: 152636135

Test: ADB_TRACE=1 adb server nodaemon | grep whitelist
Test: ADB_TRACE=1 ADB_MDNS_AUTO_CONNECT=adb adb server nodaemon | grep whitelist
Test: ADB_TRACE=1 ADB_MDNS_AUTO_CONNECT=adb,adb-tls-connect adb server nodaemon | grep whitelist
Test: ADB_TRACE=1 ADB_MDNS_AUTO_CONNECT=adb-tls-connect adb server nodaemon | grep whitelist
Test: ADB_TRACE=1 ADB_MDNS_AUTO_CONNECT=0 adb server nodaemon | grep whitelist
Test: ADB_TRACE=1 ADB_MDNS_AUTO_CONNECT=1 adb server nodaemon | grep whitelist

Change-Id: Ie562ea24fea3d6d96e67b376a0523b09e2778eb7
2020-04-23 16:55:52 -07:00
Treehugger Robot
2722a3bef9 Merge "expected.h - fix bugprone-branch-clone warning" 2020-04-23 23:48:09 +00:00
Tom Cherry
36d31c530d base: reimagine line splitting in logger.cpp
Previously, we would split messages by line and call the logger
function for each line.  We would hold a lock during this, to ensure
that multiple threads would not interleave their messages.

There are a few problems with this approach:
1) Using a lock is not efficient and is not fork safe
2) With APEX, there is one lock per instance of libbase, so we must
   move the lock to a location where all instances can access it, or
   perform the line splitting in a way that does not require the lock.

To solve these issues, we reimagine line splitting.
1) We move the lock out of the LogMessage::~LogMessage() and make it
   the logger's responsibility to split lines, giving the logger the
   option to lock or not.
2) We do not need any locks at all for StderrLogger.
   Instead, we generate a single string that contains all of the lines
   with their appropriate log header.  A single write() call is used
   to output this at once.
3) Logd handles log messages with newlines correctly, however it only
   accepts up to a maximum size of log message.  Therefore we
   separate the incoming log message into chunks, delimited by new
   lines, up to that maximum size, and send each of those to logd.
   Note that this is the strategy used in
   android.util.Log.printlns().
   This should solve a majority of use cases, since the maximum size
   that logd accepts is nearly 4K, while remaining lock free.
   If interleaving messages absolutely must be avoided, a lock can
   still be used given 1) above.

Bug: 65062446
Bug: 153824050
Test: logging, particularly multi-line stack traces, show correctly
Test: existing and new unit tests
Change-Id: Id0cb5669bee7f912da1e17f7010f0ee4c93be1e3
2020-04-23 16:38:11 -07:00
Alex Buynytskyy
a59e9b4e70 Using ABB for install-multi.
ABB uses single shared CMD for all operations which improves
reliability.

Bug: b/153486595
Test: atest adb_test adbd_test fastdeploy_test
Change-Id: I1e3da63882c980811ed2e9f5556732b24a041ce5
2020-04-23 16:30:49 -07:00
Treehugger Robot
e1b7d47c29 Merge "Add AOSP preupload hook." 2020-04-23 22:53:08 +00:00
Josh Gao
a675727a81 Merge changes I5fd3b25d,I6c039b32,I014d7ad2
* changes:
  adb: allow filtering by file in coverage/show.sh.
  adbd: don't use libc++_static.
  adb: split transport_local.cpp into client/daemon.
2020-04-23 21:53:08 +00:00
Jaegeuk Kim
928bdbf5ec Merge "logcatd: unset pinning log files" 2020-04-23 20:53:25 +00:00
Jaegeuk Kim
2e5b7c425f logcatd: unset pinning log files
commit 5327d931ac ("logcatd: fallocate and fadvise to logcat files")
introduced pinning log files in order to avoid f2fs fragmentation.

But, logcatd does not guarantee to write data within fallocated 2MB space.
So, we can see some bytes written beyond 2MB boundary which results in
pinning small chunks across the filesystem. This makes F2FS GC have to unset
the pinning blocks via GC loop. If this happens during checkpoint=disable
at booting time, we can see long delay to mount /data accordingly.

Bug: 136483670
Bug: 137180754
Bug: 149418646
Fixes: 5327d931ac ("logcatd: fallocate and fadvise to logcat files")
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: I986221d6d1da9b8e46e63d1be98ddf0ce4cb099f
2020-04-23 20:52:11 +00:00
Maciej Żenczykowski
4fc9b99329 expected.h - fix bugprone-branch-clone warning
Fixes:
  system/core/base/include/android-base/expected.h:606:39: warning: repeated branch in conditional chain [bugprone-branch-clone]
    if (x.has_value() != y.has_value()) {
                                        ^
  system/core/base/include/android-base/expected.h:608:4: note: end of the original
    } else if (!x.has_value()) {
     ^
  system/core/base/include/android-base/expected.h:610:10: note: clone 1 starts here
    } else {
           ^

Test: builds
Bug: 153035880
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie67a8bb1bf622319adea15466c42077e0e9b1a18
2020-04-23 13:44:33 -07:00
Ytai Ben-Tsvi
7d6af00aca Control audio HAL services in start/stop
Some system services (e.g. SoundTriggerMiddleware) assume that
whenever they start, the audio HAL is in its default (reset) state.
init.rc scripts tie the lifetimes of the audio HAL and system
processes, but when using stop/start this is not the case, and this
may cause spurious crashes in this case.

stop/start is apparently being relied on in some test infrastructure,
so this change is needed to avoid causing problems for those systems
or false detection of problems, which are not actually present in
production.

Bug: 154029444
Test: Manually verify that the audio HAL is stopped on
      'adb shell stop', restarted on 'adb shell start' and that the
      system boots correctly after.
Change-Id: I39878b978b47a169c4fe446c43d7347809d15e06
Merged-In: I39878b978b47a169c4fe446c43d7347809d15e06
2020-04-23 12:01:46 -07:00
Elliott Hughes
dc6c706003 Add AOSP preupload hook.
Test: repo upload in internal master
Change-Id: I98d7e9e51ca2f2a03ea1223f6749007e5b3f9b9f
2020-04-23 11:02:00 -07:00