Commit graph

58650 commits

Author SHA1 Message Date
Tom Cherry
0df0fcbb9d Merge "logd: add a test that logd ignores SIGPIPE" 2020-08-12 17:18:57 +00:00
Treehugger Robot
546cf270ab Merge "Add failure logs in __ashmem_open_locked()" 2020-08-11 23:04:28 +00:00
Tom Cherry
cadeec102c Merge "Revert "liblog: use a blocking socket for sending messages to logd"" 2020-08-11 22:17:41 +00:00
Tom Cherry
b1eb731197 Revert "liblog: use a blocking socket for sending messages to logd"
This reverts commit 4af349b072.

Reason for revert: post submit test logs too much fails after this
Bug: 163611679

Change-Id: If9939f3c9864dad67536d0c5481f662b9d07c58e
2020-08-11 22:15:09 +00:00
Treehugger Robot
d81e1d3483 Merge "liblog: remove android_lookupEventTag" 2020-08-11 19:05:35 +00:00
Yifan Hong
333149339b Merge changes from topic "charger_soong"
* changes:
  charger: Add tests for loading animation resources
  charger: Move built-in resources to /system
  charger: Load default resources from /system
2020-08-11 18:51:31 +00:00
Tom Cherry
175366df44 liblog: remove android_lookupEventTag
This function has been marked deprecated for quite some time, has no
users, and isn't in liblog.map.txt.

Test: build
Change-Id: Ic3bf47c780b18a5d4f1e997b9265be76049fb824
2020-08-11 09:20:18 -07:00
Elliott Hughes
7298ba0992 Merge "libsparse: Fix overflow of merged sparse chunk length" 2020-08-11 15:19:01 +00:00
Tom Cherry
d731184c38 Merge "liblog: use a blocking socket for sending messages to logd" 2020-08-11 15:13:02 +00:00
Hyeongseok Kim
e8d02c50d7 libsparse: Fix overflow of merged sparse chunk length
Merging sparse chunk can make sparse map block bigger than 4GiB,
that can't be covered by unsigned integer type. Fix this by
changing unsigned int to uint64_t type.

Test: sparse build
Bug: 162808120
Change-Id: Id4d3f88f9d531c25c3937c99b2c81efb915605ee
Signed-off-by: Hyeongseok Kim <hyeongseok@gmail.com>
Cc: hyeongseok.kim <hyeongseok.kim@lge.com>
2020-08-11 08:34:28 +09:00
Tom Cherry
4af349b072 liblog: use a blocking socket for sending messages to logd
liblog uses a non-blocking socket for sending messages to logd as a
performance/reliability trade-off, favoring not blocking processes
when they log over reliably tracking all logs.

This change asserts that the above is the wrong trade-off: that log
relability is more important than slight delays when logging. Further
points to consider:

1) The new logd implementation without chatty has lower latency and
less variance in its ::Log() function.
2) liblog also writes to /dev/pmsg0 and this call is already blocking.
3) Logging is already expensive and excess spam must be eliminated
regardless.

Bug: 151654749
Bug: 155922578
Bug: 160314220
Test: No messages are dropped by this socket
Change-Id: I163b7d51aa73a10978850f1868cb9fc4bf9ead1b
2020-08-10 15:56:15 -07:00
Eric Biggers
9b6922b5df Merge "fs_mgr: use __ANDROID_API_Q__ instead of pre_gki_level" 2020-08-10 22:35:21 +00:00
Tom Cherry
c486371741 Merge "logd: document the decision to use compression instead of chatty" 2020-08-10 21:47:39 +00:00
Hridya Valsaraju
9a147033f8 Add failure logs in __ashmem_open_locked()
Bug: 160984921
Test: build, boot
Change-Id: I754c961289828463af6de905d8b057b4350f5f07
2020-08-10 14:14:13 -07:00
Tom Cherry
edc1ba6a1d logd: document the decision to use compression instead of chatty
Open README.compression.md in a markdown viewer for details.

Test: vscode and gitiles render this correctly
Change-Id: Iaa0093dc565b5c6bb016c9e97248375f0906d0c8
2020-08-10 11:53:51 -07:00
Eric Biggers
75ebdd9c7c fs_mgr: use __ANDROID_API_Q__ instead of pre_gki_level
The name "pre_gki_level" is causing some confusion because not all
devices launching with Android R are subject to the GKI requirement.
(See b/161563110#comment11.)  E.g., devices that use a 4.14-based kernel
are exempt from GKI.  However, the encryption requirements still apply.

Just use __ANDROID_API_Q__ directly instead.

No change in behavior.

Change-Id: I4242745ccc9f88e084a1adfab5796daa9bc59b6e
2020-08-10 11:43:52 -07:00
Elliott Hughes
2cfea97ba3 Merge "Add second batch of fuzzers for libutils" 2020-08-10 15:40:44 +00:00
Treehugger Robot
52c8422ea1 Merge "Add uptimeNanos to SystemClock" 2020-08-08 01:04:09 +00:00
Yifan Hong
c2bed97e10 charger: Add tests for loading animation resources
Bug: 143907179
Test: run it

Change-Id: I1b1dfe4947210932c674657689e396ae909013c2
2020-08-07 17:07:09 -07:00
Yifan Hong
5109c8ce04 charger: Move built-in resources to /system
Convert rules to build charger resources to Soong
assuming BOARD_CHARGER_NO_UI is not set. As of now,
no devices in the source tree sets this variable. Also,
these images should be installed to the system image
regardless of this variable.

This change moves battery_fail and battery_scale to
/system/etc/res/images/charger.

Test: build and inspect system/etc/res/images/charger
Fixes: 143907179
Change-Id: Idccf5631371c7520cbfcfa6e92d1e88d0f3f95e7
2020-08-07 17:07:09 -07:00
Yifan Hong
abda7153fe charger: Load default resources from /system
When charger resources are missing from /product, before this change,
images are loaded from /res/images/charger. After this change, charger
first checks if the resource exists at that location, and if not, use
resource under /system/etc/res/images/charger.

On devices that uses resources from /product, this change has no effect.
On devices that uses resources from /res,
- if an old image is mounted at /, charger continues to load resources
  from /res.
- if a new image is mounted at /, that is, battery_fail and
  battery_scale may not exist under /res, charger loads them from /system.
  There are no font files installed by modules defined here, so any
  device-specific font files stay at /res.

Also create virtual function wrappers over minui APIs to be mocked
later.

See next change on moving battery_scale and battery_fail images to
/system.

Test: build and inspect system/etc/res/images/charger
Bug: 143907179
Change-Id: I4895b9602274fa4a1ebb4d7d3b842622b81b7b51
2020-08-07 17:07:09 -07:00
Jooyung Han
ccab04e5b5 Merge "Fix the order for boot scripts scanning" 2020-08-07 23:21:55 +00:00
Dylan Katz
7168f2726e Add second batch of fuzzers for libutils
This adds fuzzers for:
- CallStack
- Looper
- LruCache
- Printer
- ProcessCallStack
- PropertyMap
- RWLock
- RefBase
- StopWatch.
Test: Ran each fuzzer for 10 minutes. Rough coverage est. (likely far below actual value): 10.97%

Signed-off-by: Dylan Katz <dylan.katz@leviathansecurity.com>
Change-Id: I2f9f35c18b13338c282fb7f9c3ea4099ecb2c56f
2020-08-07 15:36:39 -07:00
Suprabh Shukla
a55ef96ea7 Add uptimeNanos to SystemClock
Test: system/core/libutils/SystemClock_test.cpp

Bug: 162791194
Change-Id: I0e3ea2004146eb7442c89bb35a9f3a2171d9c4b8
2020-08-07 14:36:07 -07:00
Yifan Hong
0198ce0ca7 Merge "Fix allowlist for unreliable pinning." 2020-08-07 17:57:13 +00:00
Yifan Hong
75d5e98401 Merge "libsnapshot_test: skip global setup on non-VAB devices." 2020-08-07 17:57:00 +00:00
Treehugger Robot
2666aaba84 Merge "logd: consolidate command handling and fix an error check" 2020-08-07 17:41:14 +00:00
Tom Cherry
9b77d73744 logd: add a test that logd ignores SIGPIPE
Now that libsysutils sockets do not ignore SIGPIPE, logd itself must
ignore it and we therefore add a test that it is ignored properly.

Test: this test passes
Test: this test fails if logd doesn't ignore SIGPIPE
Change-Id: I65474967f40291a7abd11cfd279c8cde2d2bca14
2020-08-07 10:27:37 -07:00
Tom Cherry
94b299ab43 logd: consolidate command handling and fix an error check
Consolidate command handling for commands that take a buffer ID as
their first argument.  Further use ParseUint instead of atoi(), since
atoi("bad string") returns `0` is the same as LOG_ID_MAIN.

Test: these commands are handled property
Test: `echo -n 'getLogSize ignoreme!\0' | nc -U /dev/socket/logd`
      returns an error
Change-Id: I3e84a6157e16f4c110681da453e1ae1a920da7c4
2020-08-07 09:48:16 -07:00
Treehugger Robot
4b3229b216 Merge "Delete fiemap_image_test_presubmit" 2020-08-07 02:23:13 +00:00
Jooyung Han
f7c2585f6d Fix the order for boot scripts scanning
To support "override" services, we need to scan partitions from least
speicific to most specific.

Bug: 163021585
Test: m
Change-Id: I26a6de4f7fb571c60038e803137a4b1c237792fd
2020-08-07 10:44:14 +09:00
Yifan Hong
17ed9c4fb6 Merge changes from topic "healthd_test"
* changes:
  Add libhealthd_charger_test to presubmit.
  Convert healthd_test to Soong
  Fix AnimationParser remove_prefix test
2020-08-07 00:38:50 +00:00
Yifan Hong
f0cb5a04f3 Delete fiemap_image_test_presubmit
No tests are skipped in presubmit now.

Test: presubmit
Fixes: 148874852

Change-Id: Ic0ce7489ff4a92ab90986dd76f836c262f5aa3fc
2020-08-06 17:38:02 -07:00
Yifan Hong
a7c00a0943 libsnapshot_test: skip global setup on non-VAB devices.
On non-VAB devices, fake super image creation may fail because it
may not support f2fs file pinning.

Also changes global setup to a testing::Environment object because it is
the recommended way in gtest's guide. SnapshotTestEnvironement::TearDown
is automatically executed before RUN_ALL_TEST returns.

Test: vts_libsnapshot_test
Test: make IsVirtualAbEnabled() return false, then all tests are
skipped.

Bug: 162557082
Change-Id: I1382f9a4ddec146fa2d8cfb21ac66ca22a2e110f
2020-08-06 17:21:50 -07:00
Yifan Hong
900fdf47ce Fix allowlist for unreliable pinning.
When checking IsUnreliablePinningAllowed, the existing code calls
IsTestDir on a value starts with "/data", but IsTestDir expects
metadata_dir_. Fix it.

Also, make subdir checks more robust and add test cases for IsSubdir.

Fixes: 162557082
Test: vts_libsnapshot_test
Test: fiemap_image_test

Change-Id: I495cfae3da11d1e0800b8abf520df10dd9a29dce
2020-08-06 15:02:56 -07:00
Tom Cherry
ca0a46aefa Merge "Query log size properties only within logd" 2020-08-06 22:00:29 +00:00
Tom Cherry
39dc221026 Query log size properties only within logd
liblog exposed __android_logger_get_buffer_size() which queries log
size properties, but that should not be a generic library function.
Logd should be the only process that queries these properties and
other processes should query the actual used log sizes from logd via
the android_logger_get_log_*_size() functions.

Also, always use 1MB for log buffer tests, instead of just on host and
various other clean up related to improper types.

Test: log buffers are correctly sized
Merged-In: I9b7c86bf58e569618737afe9097cf1c4d4e61d95
Change-Id: I9b7c86bf58e569618737afe9097cf1c4d4e61d95
2020-08-06 20:32:45 +00:00
Treehugger Robot
b96cc0bfd2 Merge "Add the rough toybox version numbers to the docs." 2020-08-06 18:30:15 +00:00
Treehugger Robot
30e542983a Merge "cts: Skip CtsInitTestCases over a native bridge." 2020-08-06 17:31:56 +00:00
Elliott Hughes
60dfa184a7 Add the rough toybox version numbers to the docs.
Bug: https://github.com/landley/toybox/issues/230
Test: treehugger
Change-Id: I007cb2fd5fc4b2258394e7472c12df4acb25ebcc
2020-08-06 10:15:25 -07:00
Christopher Ferris
c625ea6137 Merge "Add new caps from kernel 5.8." 2020-08-06 16:31:03 +00:00
Kazuhiro Inaba
c293c58660 cts: Skip CtsInitTestCases over a native bridge.
The set of linked binaries was making it difficult to run
the test over a native bridge. Since init won't usually
run over a native bridge, the test can be skipped.

Bug: 161081809, 142324733, 162288553
Test: Arm build of CtsInitTestCases skips rammus-arc-r Chromebook.
Change-Id: Icdd8b03111d0f3fd6658ee6d9a97fca27181db45
(cherry picked from commit 9cecf8422a)
2020-08-07 01:11:29 +09:00
Yifan Hong
186b4d9ddd Add libhealthd_charger_test to presubmit.
Test: atest --test_mapping
Change-Id: Idae68e575f66b53c8b587405856b4a1c532ecadc
2020-08-05 20:00:09 -07:00
Yifan Hong
12d15750fe Convert healthd_test to Soong
This makefile is not included before, so it was never built. Also do
the following changes to make sure it works:

- Remove non-existing libhealthd_internal dep
- Add necessary libhealthd_charger dep because it tests AnimationParser
- Since it tests AnimationParser, change its name to
libhealthd_charger_test

Test: run it

Change-Id: If7f91de4b910024f27d09a25ca801e67b98221db
2020-08-05 20:00:09 -07:00
Yifan Hong
2a06ae8299 Fix AnimationParser remove_prefix test
The test fails because TEST_STRING, a char[], is silently
converted to a std::string, passed to remove_prefix, then
the string is destroyed, but a pointer to the string is
returned.

Fix it by changing the signature of remove_prefix to use
std::string_view to be more robust in handling raw char*.

Test: run it
Change-Id: I553c066907f09cf330c8b7a4659db5a1fee82cac
2020-08-05 20:00:09 -07:00
Tom Cherry
539f5e3880 Merge changes I2dd4ec10,I8b9688a9
* changes:
  logcat: replace write() calls with WriteFully()
  Add android_logger_get_log_consumed_size() and report it in logcat
2020-08-05 23:27:03 +00:00
Eric Biggers
64d1a3d60e Merge "fs_mgr: Revert "Try to recover corrupted ext4 /data with backup superblock"" 2020-08-05 22:28:53 +00:00
Tom Cherry
3e970d430f logcat: replace write() calls with WriteFully()
There is a possibility of data loss if an interrupt occurs in the
middle of these write() calls.

Test: logcat -g/-S/-B work correctly
Change-Id: I2dd4ec10771714fc49b61538d3028983516e106c
2020-08-05 14:01:11 -07:00
Tom Cherry
06e111a148 Add android_logger_get_log_consumed_size() and report it in logcat
There is an existing API, android_logger_get_log_readable_size() which
historically reported the consumed amount of data for the chatty log
buffer, since consumed and readable are synonymous with that buffer
type.

With log compression, readable and consumed are not synonymous, since
the readable log size is the uncompressed log size whereas the
consumed log size is the compressed log size.

This change adds android_logger_get_log_consumed_size() which returns
the consumed log size and makes android_logger_get_log_readable_size()
return the readable log size.  Note that these values are identical if
compression is not used.

It adds both statistics to logcat:

    main: ring buffer is 1 MiB (429 KiB consumed, 817 KiB readable)
    radio: ring buffer is 1 MiB (339 KiB consumed, 715 KiB readable)
    ...

Test: logcat prints the right values with compression and chatty
Change-Id: I8b9688a987736204e2e6026e8635fbd1a5e68bb7
2020-08-05 13:43:31 -07:00
Tom Cherry
368c70daba Merge "liblog: add a timeout for logd command socket operations" 2020-08-05 19:18:07 +00:00