Commit Graph

27130 Commits

Author SHA1 Message Date
Yunlian Jiang 33f671782a fix warning: Null pointer argument in call to memory comparison function
This fixes  warning: Null pointer argument in call to
memory comparison function [clang-analyzer-cplusplus.NewDeleteLeaks]

Bug: None
Test: The warning is gone.
Change-Id: I957365184966cc1435d7e37d64f2cc6a32846ebd
2017-02-08 16:47:20 -08:00
James Hawkins 23f4e6b0a5 Merge "Revert "bootstat: Remove custom uptime parser in favor of elapsedRealtime."" 2017-02-09 00:12:54 +00:00
Mark Salyzyn 7100288532 liblog: add local_logger
- Create the local-only logger module
- Add LOGGER_LOCAL flag to android_set_log_frontend to enable
- Permit log reader for host compilation

android_set_log_frontend(LOGGER_LOCAL) will result in logs going
into application local memory.  logcat can not retrieve the data,
the user must utilize the log reading interface directly to
acquire their own logs.  Some local logger tests dropped as they
represent testing other liblog facilities.  Other local logger
tests dropped because we make the conscious decision to not
support LOG_ID_SECURITY logging.

ToDo: Some local logger tests dropped because of missing
      functionality associated with blocking reader.

Test: gTest libcutils-tests, logd-unit-tests, liblog-unit-tests,
      logcat-unit-tests, liblog-benchmarks and CtsLiblogTestCases_list
Bug: 27405083
Change-Id: Ia23b932af9e05756eaa60bab9139876b14faf72d
2017-02-08 15:07:06 -08:00
James Hawkins 0e3167e203 Revert "bootstat: Remove custom uptime parser in favor of elapsedRealtime."
This reverts commit 26f40c04c3.

This change broke the Darwin SDK target.

Test: none
Change-Id: Ia54fe2c31da8d8fa2825e023b035fb8321dcd457
2017-02-08 14:16:51 -08:00
Sandeep Patil bf298e6d0c ueventd: source ueventd configs from vendor and odm
While keeping the old /ueventd.$ro.hardware.rc configuration for devices
without early mount or vendor,odm split

b/34967636

Test: Boot angler and sailfish without regressions

Change-Id: I8d671911fd23fb1c0b5624ae209bad86137c88b7
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-02-08 13:51:02 -08:00
Mark Salyzyn 96432fc665 liblog: add __android_log_config_*_close()
Add __android_log_config_read_close() and
__android_log_config_write_close().  Fortify the list macros
to detect for list corruption, looking for entries pointing
to themselves, deleted entries in list.

Test: gTest liblog-unit-tests
Bug: 27405083
Change-Id: I33e8a0cae7e202f1989ddd7c2a96752b44c8e746
2017-02-08 13:37:44 -08:00
Mark Salyzyn cf983bcbae liblog: add android_log_logger_list management
Add list of android_log_logger_list entities as a way of
accessing the list of transport contexts from within
one of the transports.  This will enable us to iterate back
to an internal transport context which may house a last index
or signalling semaphore to propagate a wakeup on a blocking
read.

Test: gTest libcutils-tests, logd-unit-tests, liblog-unit-tests,
      logcat-unit-tests
Bug: 27405083
Change-Id: I0a5e793946c020d97ffe10192369998e4ed92a83
2017-02-08 13:37:44 -08:00
Mark Salyzyn 62d0d2d683 liblog: add logprint to host build
- cleanup of some style issues
- resolve a few minor bugs
- add -lrt for host so that clock_gettime can be issued
- enable write-only logging, logprint and event list
  handling tests for host consumption.

NB: CtsLiblogTestCases_list is only outlet for host testing of
    the interfaces, but it is not part of any automated testing

Test: gTest liblog-unit-tests, liblog-benchmarks and
      CtsLiblogTestCases_list && build mmma system/core/liblog
Bug: 27405083
Change-Id: I13db1f45f67569407587a5a909248de33809b8cf
2017-02-08 13:37:44 -08:00
Mark Salyzyn 8f2492f582 liblog: benchmark: Use local LOGGER_NULL frontend
Additional benchmarks to check the effects and performance of the
frontend changes.

Test: manual liblog-benchmarks
Bug: 27405083
Change-Id: I2a9dba81b70e9d71cdb8de1b35e8dff099ad6038
2017-02-08 13:37:44 -08:00
Mark Salyzyn 850d06e1c9 liblog: Add android_set_log_frontend
android_set_log_frontend allows one to select LOGGER_DEFAULT,
LOGGER_LOGD or LOGGER_NULL, the latter allows a runtime mechanism to
turn logging on or off.  LOGGER_DEFAULT is LOGGER_LOGD.

Test: gTest liblog-unit-tests notably liblog.android_set_log_frontend
      and liblog-benchmarks before and after.
Bug: 27405083
Change-Id: I365dbee9f7d83112da0ef8d1cace748d247773c8
2017-02-08 13:37:41 -08:00
Josh Gao c2d9b60e0a Merge changes I1a28c21c,I02faec3b,I16a2050b
am: ec5d6cb8fd

Change-Id: I77a30bdf59ae0ec156d8ab2b9ad69b050e3e9ec2
2017-02-08 19:37:12 +00:00
Josh Gao db22633766 crash_dump: collect open files before dropping caps.
am: c24cc8a9e5

Change-Id: Ic27d13c1132e8dc6f3a36757e56eff4af65c55c4
2017-02-08 19:37:11 +00:00
Josh Gao 1255609232 debuggerd_test: improve error when crasher fails to exec.
am: 7a0ee64f9d

Change-Id: I6c07c11094e67f502c7d2cd71dac0cbf78e7d422
2017-02-08 19:37:06 +00:00
Josh Gao 8c1ebc6037 debuggerd_test: fix crasher path.
am: a7d7eb6d2a

Change-Id: Ie87aa723909ea7eb9ce7fef17c9145fc8ce11b42
2017-02-08 19:37:00 +00:00
Josh Gao ec5d6cb8fd Merge changes I1a28c21c,I02faec3b,I16a2050b
* changes:
  crash_dump: collect open files before dropping caps.
  debuggerd_test: improve error when crasher fails to exec.
  debuggerd_test: fix crasher path.
2017-02-08 19:31:57 +00:00
James Hawkins cdfe67f575 Merge "bootstat: Remove custom uptime parser in favor of elapsedRealtime."
am: 914955ae9e

Change-Id: I5565b341338f75e9dbdd8405b07419219f61a940
2017-02-08 17:32:47 +00:00
Ting-Yuan Huang 68a6676c77 Merge "liblog: fix an undefined-behavor in __write_to_log_daemon()"
am: a3b6d30ba7

Change-Id: I5a50c19876333dfec5445838e6bcd3c406cdc5b2
2017-02-08 17:32:32 +00:00
Treehugger Robot 914955ae9e Merge "bootstat: Remove custom uptime parser in favor of elapsedRealtime." 2017-02-08 17:28:12 +00:00
Treehugger Robot a3b6d30ba7 Merge "liblog: fix an undefined-behavor in __write_to_log_daemon()" 2017-02-08 17:21:58 +00:00
Ting-Yuan Huang 161953f49c Merge "liblog: fix a memory leak in __android_log_pmsg_file_write()"
am: a8629e8e15

Change-Id: I9eabd9930467bd540dbc603e68c3dcca4ba452df
2017-02-08 17:20:49 +00:00
Treehugger Robot a8629e8e15 Merge "liblog: fix a memory leak in __android_log_pmsg_file_write()" 2017-02-08 16:50:09 +00:00
Ting-Yuan Huang 6efb877973 liblog: fix an undefined-behavor in __write_to_log_daemon()
The behavior of passing NULL to c-string functions is undefined.

Test: passed clang-tidy checks
Bug: none

Change-Id: Ie7bcc43cd19bc4a1c314381af3929eae0a6154b9
2017-02-07 16:42:53 -08:00
Ting-Yuan Huang 106c3e6189 liblog: fix a memory leak in __android_log_pmsg_file_write()
Free the strdup()-ed filename before returning error.

Test: passed clang-tidy checks
Bug: none
Change-Id: I555492cb4e50400db758f7c721647a8747874a01
2017-02-07 15:53:32 -08:00
James Hawkins 26f40c04c3 bootstat: Remove custom uptime parser in favor of elapsedRealtime.
Refactored init/utils/boot_clock into base/chrono_utils.

Bug: 34352037
Test: none
Change-Id: Ied0c00867336b85922369d7ff37520e3d28fc61e
2017-02-07 15:43:32 -08:00
Mark Salyzyn a8c7b6e24f Merge "liblog: logger.h fortify comments"
am: 8eb237ad57

Change-Id: Ifedfe4ab79a915c712e4e4f967e6dd5514dbd6ff
2017-02-07 23:42:31 +00:00
Mark Salyzyn 8eb237ad57 Merge "liblog: logger.h fortify comments" 2017-02-07 23:36:55 +00:00
Mark Salyzyn 7048f0b1cb liblog: logger.h fortify comments
Test: none
Bug: 27405083
Change-Id: I88ae9f33daa457454edfc5e95cb9e9e74e8cd5f0
2017-02-07 14:16:09 -08:00
Josh Gao c24cc8a9e5 crash_dump: collect open files before dropping caps.
/proc/<pid>/fd is also limited by ptrace_may_access.

Test: manual inspection of "debuggerd -b `pidof zygote`"
Change-Id: I1a28c21c0438fe8729bd8e041c6b418d6a84c586
2017-02-07 13:36:08 -08:00
Josh Gao 7a0ee64f9d debuggerd_test: improve error when crasher fails to exec.
Bug: http://b/35100742
Test: rm /system/bin/crasher && /data/nativetest/debugerd_test/debuggerd_test32
Change-Id: I02faec3b7f7ef62bb8a2ac2af730506e3d28e03e
2017-02-07 13:36:08 -08:00
Josh Gao a7d7eb6d2a debuggerd_test: fix crasher path.
https://android-review.googlesource.com/#/c/331200 moved crasher to
using soong, which changed its location from /system/xbin/crasher to
/system/bin/crasher.

Bug: http://b/35100742
Test: /data/nativetest/debuggerd_test/debuggerd_test32
Test: /data/nativetest64/debuggerd_test/debuggerd_test64
Change-Id: I16a2050b257277023773cc0c960b5ab36e0c7cd4
2017-02-07 13:13:48 -08:00
Elliott Hughes fde95b8844 Merge "Don't print 168^W143 lines of help when someone makes a typo."
am: 887b6b9a4b

Change-Id: I2fbdad1f5ec9d7b7084384a01ad34679cf74bd09
2017-02-07 20:54:09 +00:00
Elliott Hughes 887b6b9a4b Merge "Don't print 168^W143 lines of help when someone makes a typo." 2017-02-07 20:51:41 +00:00
Josh Gao 2eefb47ae3 Merge "crash_dump: read /proc/<pid>/maps before dropping capabilities."
am: 59b8e35939

Change-Id: I5ee0d4d791ae17b4f3c3eff985d8f94938dbbe19
2017-02-07 20:44:38 +00:00
Josh Gao 59b8e35939 Merge "crash_dump: read /proc/<pid>/maps before dropping capabilities." 2017-02-07 20:41:16 +00:00
Josh Gao 347164cc59 crash_dump: read /proc/<pid>/maps before dropping capabilities.
Reading /proc/<pid>/maps does a ptrace_may_access check, which will
fail if we have fewer capabilities than the target, even if we've
already ptraced it.

Bug: http://b/35070339
Test: debuggerd -b `pidof zygote`
Change-Id: I984a061022bd945a7950b88f6d579e1bd735e893
2017-02-07 12:35:51 -08:00
Evan Ralston 2c2337a293 Check against LOG_ID_MAX instead of LOG_ID_KERNEL
Logd currently checks against LOG_ID_KERNEL to determine if a given
log_id is available. While this matches with the comments in log.h to
always keep LOG_ID_KERNEL at the end it does not match with other
checks that Logd makes causing inconsistent behavior. This
inconsistency is noticable on devices with log buffers with id's
greater than LOG_ID_KERNEL and liblog reports that logd is unavailable
while logd would accept the request.

Test: compiles. no functional change

Change-Id: I0302d9e3f2657706fdf778f1e78e5604abf566e2
2017-02-07 10:46:02 -08:00
Elliott Hughes ad2927d744 Merge "Make __android_log_assert behave more like libc asserts."
am: 9df286012c

Change-Id: I20003b781eb402d4cc3420d1d2b20aeca8faf978
2017-02-07 17:04:02 +00:00
Elliott Hughes 9df286012c Merge "Make __android_log_assert behave more like libc asserts." 2017-02-07 17:01:16 +00:00
Josh Gao f18d64b2d6 Merge "debuggerd_handler: fix prctl return value check."
am: 36b8ccb9b2

Change-Id: Ic4ede60f39dc5802d51f682cd69e88534087886a
2017-02-07 06:42:20 +00:00
Josh Gao 36b8ccb9b2 Merge "debuggerd_handler: fix prctl return value check." 2017-02-07 06:37:09 +00:00
Josh Gao 54ef57d0b8 debuggerd_handler: fix prctl return value check.
Fixed this when I tested on internal, but failed to copy the fix over
when submitting to AOSP.

Bug: http://b/35070339
Test: `adb bugreport` on angler
Change-Id: Ib84d212e5f890958cd21f5c018fbc6f368138d1e
2017-02-06 21:10:48 -08:00
Elliott Hughes 2ec36b0da0 Don't print 168^W143 lines of help when someone makes a typo.
Print actual usage messages in most cases.

Add --help and --version.

Bug: http://b/28054087
Test: manual
Change-Id: I39c1cb7a84f52e0c35d24f140ec55c3a181283fb
2017-02-06 16:20:30 -08:00
Dimitry Ivanov 26e1a846ef Replace public library list with shared lib sonames
Call updated interface in order to setup anonymous and classloader
namespaces

Bug: http://b/26833548
Test: build & boot angler
Change-Id: I1fae5d9c015f2026563eb64d986c622c1b68effb
2017-02-06 14:26:56 -08:00
Dimitry Ivanov 1508020656 Merge "Log errors from loading public libraries"
am: 6b74258818

Change-Id: I3f55cdcb6c1dd194a62f6074501ebd97a7312d85
2017-02-06 21:10:43 +00:00
Dimitry Ivanov 6b74258818 Merge "Log errors from loading public libraries" 2017-02-06 21:05:02 +00:00
Evan Ralston 15a264e65c Log errors from loading public libraries
Prevent the boot from failing silently if one of the public libraries
does not exist.

Test: Add invalid element to public libraries and observe log is emited
during boot failure.

Change-Id: I0425085a1cc081068954f327f15be853a3ccd553
2017-02-06 11:05:35 -08:00
Elliott Hughes 5bae1b866d Make __android_log_assert behave more like libc asserts.
If we don't output to stderr too, not only is it annoying to shell users (who
won't see anything), it prevents us from writing better gtests that actually
make assertions about the assert message.

Bug: http://b/23675822
Test: libutils tests still pass
Change-Id: I62b3144c385cba4dde485f0b0f9b42aeaef51e9a
2017-02-06 10:54:00 -08:00
Josh Gao 124fe65738 Merge changes from topic 'debuggerd_ambient'
am: 279cb8b39a

Change-Id: I431dd9d950e8f802098835465ef7d018699f7b61
2017-02-06 18:45:38 +00:00
Josh Gao 6e121639ca debuggerd_handler: don't use clone(..., SIGCHLD, ...)
am: b3ee52e4d0

Change-Id: Ib26a3160392ef1fc3c90aad1cb6e6daaeed29cb4
2017-02-06 18:45:23 +00:00
Josh Gao 49ddc037c1 crash_dump: drop capabilities after we ptrace attach.
am: 85bcaf68d3

Change-Id: I8b057f646375743a9646a10a0e72bbe5da017eaa
2017-02-06 18:45:09 +00:00