Commit graph

57337 commits

Author SHA1 Message Date
Yifan Hong
d2a8418acf Merge "Handle zero snapshot size appropriately." 2020-05-01 22:54:14 +00:00
Sim Sun
a7a194beb4 Fix dangling pointer issue in LocalUpdatbleMaps
Libunwindstack would remove duplicated items and update the `prev_map`
during reparsing `/proc/self/maps`. But we leave `prev_real_map`
pointing toward a MapInfo that will be deleted soon. It will cause a
dangling pointer issue.

Add new tests to cover this dangling pointer issue.

Bug: 155511785

Test: libunwindstack_test
Change-Id: I62e1b97bcb73f07e9349671f0b758f5ec9de16c0
2020-05-01 22:20:01 +00:00
Yifan Hong
83c690c7a6 Handle zero snapshot size appropriately.
This won't happen in practice because device size is never
zero. Hypothetically, if it is, PartitionCowCreator still
suggests that a CoW size of 8192 bytes needs to be created. In
reality, it is not necessary.

Test: libsnapshot_fuzzer
Bug: 155484992
Change-Id: I6c69f54820522d50c699384eec90c474ca3a9402
2020-05-01 18:46:44 +00:00
Yifan Hong
c43f513c91 Enable automatic libsnapshot fuzzer runs
Test: none
Bug: 154633114
Change-Id: I226d88b74bd1ea6b3cb912609d7bdf10aa8208fd
2020-05-01 11:00:48 -07:00
Yifan Hong
4d5bfabfeb Also log corpus when aborted through libbase.
If a CHECK or LOG(FATAL) is hit, also attempt to log the current
corpus.

Test: pass
Bug: 154633114
Change-Id: Id0f376021011924f5d64eb5b591b5ebab6dc7dbc
2020-05-01 11:00:48 -07:00
David Anderson
b827d1db0c Merge "remount: Improve messaging when a reboot is needed." 2020-05-01 17:44:18 +00:00
Nikita Ioffe
e874875570 Merge "Reject services that are both critical and oneshot" 2020-05-01 16:07:09 +00:00
Nikita Ioffe
dfcf2e8a4a Merge "Add reason why userspace reboot shutdown sequence failed" 2020-05-01 16:06:55 +00:00
Luca Stefani
9a3d868d3e Remove unneeded optimize_for lite
* It's already specified in the java_library definition

Test: m deployagent_lib, no warnings
Change-Id: I58fa9af71b8f817da55cfc040fbcbd80fd6425cf
2020-05-01 16:11:22 +02:00
Nikita Ioffe
51c251c74b Reject services that are both critical and oneshot
Test: atest CtsInitTestCases
Test: builds
Test: device boots
Bug: 155275196
Merged-In: I1bb9099371bd1a3f339396ef343c49b054fcef66
Change-Id: I1bb9099371bd1a3f339396ef343c49b054fcef66
(cherry picked from commit 6a3c94b3aa)
2020-05-01 15:10:25 +01:00
Nikita Ioffe
39d4553fee Add reason why userspace reboot shutdown sequence failed
Test: atest CtsUserspaceRebootHostSideTestCases
Bug: 154772075
Merged-In: I7e4674c474189b0185c020e3e066aea5678d7428
Change-Id: I7e4674c474189b0185c020e3e066aea5678d7428
(cherry picked from commit a4e83ad3d7)
2020-05-01 13:27:14 +01:00
Alessio Balsini
ce036fd7ba fiemap_image_test: libcrypto_utils as static lib
libcrypto_utils is not available as 32 bit library in 64 bit devices.
Import the library as static.

Bug: 148878078
Test: nativetest/fiemap_image_test
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: I2b8cd69d06607f4216e4e2220dd8561e6eff323c
2020-05-01 12:18:39 +01:00
Treehugger Robot
8bb2b3f2ad Merge "task_profiles.json: add a new task profile used by camera HAL" 2020-05-01 07:51:57 +00:00
Treehugger Robot
ee024b01de Merge "snapshot_test: Fix overflow in statvfs arithmetics" 2020-05-01 07:44:38 +00:00
Yifan Hong
0d4a47b0c7 libsnapshot_fuzzer: Fuzz MapUpdateSnapshot.
Test: run it
Bug: 154633114
Change-Id: I15ea0fb28df5b0f6d32096aab808549c3855c289
2020-04-30 23:06:42 -07:00
Yifan Hong
db0e62b87a libsnapshot_fuzzer: construct valid super partition metadata.
This should hopefully achieve more coverage.

Test: pass
Bug: 154633114
Change-Id: Ice575f2d8c3e22b80465c133d055e7c4368ebdfa
2020-04-30 23:06:42 -07:00
Yifan Hong
74d1fb4571 libsnapshot_fuzzer: Fuzz CreateUpdateSnapshots
Test: run it
Bug: 154633114
Change-Id: I56ed2953e85714d23a9273224a28eb8e8e47a54d
2020-04-30 23:05:36 -07:00
Yifan Hong
c0df932a43 libsnapshot_fuzzer: add additional tests for more APIs
Test: run it
Bug: 154633114
Change-Id: I956cb74bfd46750137dfa73e9e040dd9d1782ce7
2020-04-30 23:05:36 -07:00
Yifan Hong
90a9393ea0 libsnapshot_fuzzer: use protobuf
Use protobuf because it already has all the fuzzing implemenetations.
Delete fuzz_utils.

Pros:
- Fuzzing protobuf is faster; it is easy to achieve 4K exec/s
- It is more guided; protobufs are fuzzed using mutators, and mutators
  should have better knowledge of the structure of the fuzz data
- No more hand-written parsing code of the fuzz data. That code in
  fuzz_utils.h is deleted.
- Corpus data can be reused even after adding new fields in the protobuf
- Corpus data is human-readable and easily manually written (it is
  the text format of the protobuf)

Cons:
- The "actions" are "declared" in protobuf definition and "defined" in
  C++, so there's more boilerplate to write. Adding a new "Action"
  requires changes in both.

Test: run libsnapshot_fuzzer
Bug: 154633114
Change-Id: Idc2a6b2c087e370e4cfef53142a244b9b275389e
2020-04-30 23:05:36 -07:00
Yifan Hong
5eb2d6fa27 libsnapshot_fuzzer: map super image
... instead of operating on the image file directly.
Test: run it
Bug: 154633114

Change-Id: Id04c0d15d0d52483647716f8bfb0b8ee1a2876d9
2020-04-30 23:05:36 -07:00
Suren Baghdasaryan
8c604e8615 task_profiles.json: add a new task profile used by camera HAL
Add new CameraServicePerformance task profile used by camera HAL.

Bug: 155419956
Test: confirm profile applies correctly
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I21cf942eca279a5ad4c1ff75c735560954f4ebc1
2020-05-01 01:05:42 +00:00
Suren Baghdasaryan
13c6574139 Merge "init: Add task_profiles init command" 2020-05-01 00:59:21 +00:00
Tom Cherry
c941236374 Merge changes I5b3ca4f0,I610bed59
* changes:
  liblog: mark tests as require_root: true
  liblog: require root for multi_connect_dgram_socket test
2020-04-30 23:38:31 +00:00
Suren Baghdasaryan
c9c0bbac53 init: Add task_profiles init command
Introduce new command to allow setting task profiles from inside .rc
script. This is to replace usage of writepid when a service is trying
to join a cgroup. Usage example from a .rc file:

service surfaceflinger /system/bin/surfaceflinger
    task_profiles HighPerformance

Bug: 155419956
Test: change .rc file and confirm task profile is applied
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I0add9c3b363a7cb1ea89778780896cae1c8a303c
2020-04-30 22:24:21 +00:00
Tom Cherry
20d4d23f8c liblog: mark tests as require_root: true
Some tests require root to be run, so we require_root to run all of
them.

Test: tests pass as root
Change-Id: I5b3ca4f08e41f16e81c5d5995043ab55d379a882
2020-04-30 14:39:10 -07:00
Tom Cherry
710825ce47 liblog: require root for multi_connect_dgram_socket test
Bug: 65062446
Test: multi_connect_dgram_socket is skipped for non-root
Test: multi_connect_dgram_socket passes for root
Change-Id: I610bed5987580e0c5a01952efc2e32e7d8cdf9b4
2020-04-30 14:28:13 -07:00
Alessio Balsini
75672f8be5 snapshot_test: Fix overflow in statvfs arithmetics
Operations on (unsigned long) f_bsize and f_bfree are correctly handled
on 64 bit architectures, but when switching to 32 bit, the
multiplication between the two could result in an overflow, causing the
test to crash.
Fix by using a uint64_t operand, hinting the compiler to handle the
whole multiplication with 64 bit operands.

Bug: 154355449
Bug: 148889015
Test: vts_libsnapshot_test (32 bit)
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: Ief5c03ff7954c4a3e8597ef6e7df467f59428877
2020-04-30 21:02:26 +01:00
Tom Cherry
1a342a12f3 Merge "logd: refactor mLast setting into a GetOldest function" 2020-04-30 19:53:17 +00:00
Tom Cherry
385c2c93c2 logd: refactor mLast setting into a GetOldest function
This code was duplicated throughout LogBuffer.cpp, so refactor it into
a single location and clean up some comments along the way.

This may fix a subtle bug: if `logcat -c` is used from a
non-privileged UID, the current code may set mLast to the oldest seen
log message *from that UID* and not not the oldest log message for
that log id.  That may prevent pruning from the start of that log,
resulting in old log entries that are impossible to delete.

Bug: 144382260
Test: logging works, and above scenario is not seen
Change-Id: I1749293ce6ea1697dd8a9258cfd7eab29dbeac6e
2020-04-30 10:06:07 -07:00
Martin Stjernholm
2e3af867d9 Merge "Reland "bionic_libc_platform_headers is only available when building with Bionic"." 2020-04-30 14:11:50 +00:00
David Anderson
45253ae5c6 remount: Improve messaging when a reboot is needed.
Bug: 149665201
Test: adb remount
Change-Id: I990ce80f14795669d4bbf05789910c5b15ee53cf
2020-04-29 22:04:58 -07:00
Treehugger Robot
a5fa1ae859 Merge "rootdir: init.rc: mount tracefs" 2020-04-30 02:33:59 +00:00
Peter Collingbourne
584292811a Merge "Switch to new kernel ptrace interface for reading tags." 2020-04-30 00:55:45 +00:00
Elliott Hughes
7cae3345d3 Merge "Avoid zero-initializing our most-used buffers." 2020-04-29 23:45:41 +00:00
Bob Badour
a34edf59e3 Merge "Add METADATA to system/core: Apache2+BSD=NOTICE" 2020-04-29 23:07:09 +00:00
Elliott Hughes
8c253d4d42 Avoid zero-initializing our most-used buffers.
The StringPrintf one is heavily used and brings the overhead versus
fmtlib down to 1.5x rather than 2x. I don't have a convenient benchmark
for the other two.

Test: libbase tests & benchmarks
Bug: http://b/155324241
Change-Id: I9e704a360846d5520c53f668e7c315b0c0ea55f8
2020-04-29 14:10:12 -07:00
Tom Cherry
7609e44fd1 Merge "init: add even more debugging information for reboot" 2020-04-29 21:08:01 +00:00
Bob Badour
0fc5ac062b Add METADATA to system/core: Apache2+BSD=NOTICE
Remaining GPL is old and deprecated or optional.

Bug: 68860345
Bug: 69058154
Bug: 151953481

Test: no code changes

Change-Id: Ib75bd2fbcf3c96f62a03559c335d31352f06c641
2020-04-29 13:16:41 -07:00
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
Kyle Lin
9d19a05422 rootdir: init.rc: mount tracefs
Bug: 153849221
Test: build and try to capture the trace by perfetto and systrace
Change-Id: Ie8a13e12038bd66afcd264079a2c5f25daaa20ee
2020-04-30 02:15:42 +08:00
Jooyung Han
597559a6fc Merge "stats: Set min_sdk_version" 2020-04-29 18:14:10 +00:00
Martin Stjernholm
4a27a81e4e Reland "bionic_libc_platform_headers is only available when building with Bionic".
Relanding unchanged - the build problem was due to a split topic.

Test: m checkbuild
Test: atest libunwindstack_unit_test
Test: lunch fvp-userdebug && mmm system/core/libunwindstack
Bug: 152255951
Change-Id: Ifd1ced65b840ef216630906eec1ec31233e0c5f1
2020-04-29 18:16:46 +01: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
Orion Hodson
e123b3ca5a Add libnativehelper.so to public libraries
Bug: 150252746
Bug: 151443957
Test: m & boot
Change-Id: If595a8af164cddb7d9471aa54607f878b3b4ed8c
2020-04-29 17:48:40 +01:00
Peter Collingbourne
118c5ee6e6 Switch to new kernel ptrace interface for reading tags.
Bug: 135772972
Change-Id: I506429d7bff79f83828e1f0d5c0ea0468ee1580b
2020-04-29 09:33:53 -07:00
Tom Cherry
1c84135144 init: add even more debugging information for reboot
There are devices stuck waiting for vendor_init to finish a command,
without giving much more information.  Instead of setting aside the
last run command, it's more valuable to store and dump the last 30
logs seen.

Bug: 155203339
Test: these logs appear during hung reboots
Test: normal reboots have no difference.
Change-Id: I99cae248eb81eaf34ef66b910fa653a9fa135f68
2020-04-29 09:01:53 -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