Commit graph

58937 commits

Author SHA1 Message Date
Treehugger Robot
b745a960f8 Merge "Return bytes written in CowWriter" 2020-09-03 22:01:25 +00:00
Elliott Hughes
a2f248724c Merge "ashmem: ensure ashmem fds are CLOEXEC." 2020-09-03 21:06:03 +00:00
Kelvin Zhang
8e75a38edd Return bytes written in CowWriter
delta_generator in update_engine needs to know number of bytes written
to estimate cow image sizes. This change modifies CowWriter::Finalize to
return relevant information.

Test: unnitest
Change-Id: I7cf6b9124b90f089a7c5f3850c38200f82da18e6
2020-09-03 15:59:17 -04:00
Elliott Hughes
790ef05793 ashmem: ensure ashmem fds are CLOEXEC.
Fix the memfd_create(2) path and add the missing unit test.

Bug: https://issuetracker.google.com/165667331
Test: treehugger
Change-Id: Ibb5c1d0f9d7caba1df04d1f03e82e55026d9f86a
2020-09-03 10:54:20 -07:00
Treehugger Robot
480335dfd6 Merge "Create directories under /data/local/tests at boot" 2020-09-03 02:26:10 +00:00
Kelvin Zhang
0b26cbb6b1 Merge "Enable libsnapshot_cow in recovery builds" 2020-09-03 00:11:43 +00:00
Kelvin Zhang
f6219e2d56 Enable libsnapshot_cow in recovery builds
update_engine is enabled in recovery mode, needs to link with
libsnapshot_cow

Test: mm -j
Change-Id: Ia4823c866b16f47cd03dda1779701e957a77aed6
2020-09-02 20:08:46 -04:00
David Anderson
29e7b2af30 Merge "liblp: fix host lpdump cannot work issue" 2020-09-02 17:36:00 +00:00
Tom Cherry
6233b23918 Merge "logcat: fix tests broken from new formatting" 2020-09-01 23:23:38 +00:00
Christopher Ferris
6a06520258 Merge "Do not create a map with start == end." 2020-09-01 23:10:55 +00:00
Tom Cherry
500c25cb61 logcat: fix tests broken from new formatting
1) `logcat -g` now contains 'readable', so fix sscanf() appropriately
2) Remove tests that the security buffer isn't returned as an error,
since it's not important to hide this buffer from the logging front
end, and more importantly: the expected failures no longer happen.
3) Update invalid_buffer for the new error format.

Test: logcat-unit-tests
Change-Id: I1a607815bdc7b1135e9a0e97f8b7334f2d259e31
2020-09-01 21:33:34 +00:00
Christopher Ferris
c9b6e084a3 Do not create a map with start == end.
This is not possible in the real world, so prevent this particular case
to avoid leaking memory and any other issues.

Bug: 165619316

Test: Verified the fuzzer test case that caused a leak no longer leaks.
Change-Id: I352b3bd21a4931432e015af89c256ddbcdaa1070
2020-09-01 12:36:26 -07:00
Colin Cross
7201ef820f Create directories under /data/local/tests at boot
Create directories under /data/local/tests at boot for atest to use
to execute tests on the device.

Bug: 138450837
Test: atest binderVendorDoubleLoadTest memunreachable_unit_test memunreachable_binder_test
Change-Id: Ic8e5031ad8701a063be14b6db760feb78f3eb412
2020-09-01 11:17:37 -07:00
Treehugger Robot
af13a8b744 Merge changes I3a2191b0,Ide1056b5
* changes:
  libfastboot uses usb_linux.cpp for all Linux targets
  Don't enable version lib for libadb_sysdeps
2020-08-31 23:39:45 +00:00
Christopher Ferris
f60d4f9a04 Merge "libunwindstack: expose static version of BuildFrameFromPcOnly." 2020-08-29 00:38:03 +00:00
Josh Gao
0d0f32369f libunwindstack: expose static version of BuildFrameFromPcOnly.
Bug: http://b/165206592
Test: unit tests and treehugger
Change-Id: Ic357ee6160281c5986570de5536b3247b231bc6f
2020-08-28 15:36:54 -07:00
Christopher Ferris
86f19217fb Merge "Fix bugs in BuildFrameFromPcOnly." 2020-08-28 17:37:08 +00:00
Jiyong Park
fd890289e2 libfastboot uses usb_linux.cpp for all Linux targets
The build system has added the new target named 'linux_cross' which is
the cross-compiled (i.e. arm on x86) host target. libfastboot is now
configured to use usb_linux.cpp not only for linux_glibc (which is the
native host target using glibc), but for all Linux-based host targets
including linux_glibc, linux_bionic, and the new linux_cross.

Note that the device target 'android' is also included in the 'linux'
target. But that doesn't cause a problem because libfastboot is a host
library which is not enabled for the device target.

Bug: 159685774
Test: HOST_CROSS_OS=linux_cross m
out/soong/host/linux_cross-arm64/bin/fastboot

Change-Id: I3a2191b0878a26914cb0282ecf41a45296827c04
2020-08-28 13:30:35 +09:00
Jiyong Park
4c57596b81 Don't enable version lib for libadb_sysdeps
When use_version_lib is set to true, but build::GetBuildNumber() isn't
used, the library can't be processed by symbol_inject. For example,

$ m out/soong/.intermediates/system/core/adb/libadb_sysdeps/android/arm64_armv8-a_shared/versioned/libadb_sysdeps.so

FAILED:
out/soong/.intermediates/system/core/adb/libadb_sysdeps/android_arm64_armv8-a_shared/versioned/libadb_sysdeps.so
out/soong/host/linux-x86/bin/symbol_inject -i
out/soong/.intermediates/system/core/adb/libadb_sysdeps/android_arm64_armv8-a_shared/unstripped/libadb_sysdeps.so
-o
out/soong/.intermediates/system/core/adb/libadb_sysdeps/android_arm64_armv8-a_shared/versioned/libadb_sysdeps.so
-s soong_build_number -from 'SOONG BUILD NUMBER PLACEHOLDER' -v $(cat
out/soong/build_number.txt)
symbol not found
17:09:10 ninja failed with: exit status 1

This is because the visibility of the symbol `soong_build_number` in
libbuildversion.a is hidden via the -fvisibility=hidden flag for the
library. In addition, -Wl,--gc-sections strips the hidden symbol when
it is not referenced.

This fortunately hasn't caused a problem because, for the device target,
the output of symbol_inject was used only for dist outputs.
libadb_sysdeps wasn't registered as dists. So
versioned/libadb_sysprops.so never had a chance to be built. For the
host target, in the other hand, the output of symbol_inject is used
always, but --gc-sections is not used for host targets. So the symbol
wasn't stripped and therefore symbol_inject could always find the
symbol.

This however is expected to cause a problem when the support for
LinuxCross is added. It is one of the host targets, therefore
symbol_inject is always used. However, unlike other host targets,
--gc-sections is turned on because it inherits most of the flags from
Android/ARM64.

To avoid the problem, we might want to disable --gc-sections for the
target. But regardless of the decision, having a build rule that always
fails is not desirable - even though the build rule is essentially never
triggered. Therefore, we choose to not use version lib for
libadb_sysdeps because GetBuildNumber() is not used in the lib.

Bug: 159685774
Test: m \
out/soong/.intermediates/system/core/adb/libadb_sysdeps/android/\
arm64_armv8-a_shared/versioned/libadb_sysdeps.so

Change-Id: Ide1056b5b55e409ab809e302a697d10d759c92ce
2020-08-28 13:30:34 +09:00
Christopher Ferris
06996a8196 Fix bugs in BuildFrameFromPcOnly.
There are a few bugs in this routine, so fix them and add unit tests
to cover the cases.

Test: Unit tests pass.
Change-Id: I9bcb9b9fbe33d56a17a613ae3aa88036bd1d0ef1
2020-08-27 19:52:54 -07:00
Christopher Ferris
bb81b77895 Merge "Fix nullptr dereference." 2020-08-27 20:58:09 +00:00
Christopher Ferris
afbed690f0 Fix nullptr dereference.
A previous cl missed adding a return in the new path which could result
in a crash if the map info is null. Add the return back.

Added a new test to catch this case.

Bug: 166188440

Test: Unit tests pass. Verified the new test crashes on the old code.
Change-Id: I9420b47dae0f880493c0e6a60d97bb3468ff2906
2020-08-27 12:00:43 -07:00
Treehugger Robot
e27781db4c Merge "libsnapshot: Fix uninitialized variables" 2020-08-27 18:26:53 +00:00
Greg Kaiser
8ad3957d76 libsnapshot: Fix uninitialized variables
We fix two separate instances of classes not initializing members
in their constructors.

Test: TreeHugger
Change-Id: If1b7a7625572c9b005f9b8331b282ed11ceb6e97
2020-08-27 08:09:14 -07:00
Gavin Corkery
c0d11aa73a Merge "Store userspace reboot info in /metadata" 2020-08-26 21:47:19 +00:00
Treehugger Robot
58c10b7730 Merge "libsnapshot: Off-line tool for converting OTA payloads to COWs." 2020-08-26 19:59:31 +00:00
David Anderson
ad35dcc5b8 libsnapshot: Off-line tool for converting OTA payloads to COWs.
The A/B version of this tool takes in a payload.bin file (from an OTA
package), and converts it into COWs in the new format. It uses the
CowWriter API to do this. This tool can be used to precisely see the
size of a COW relative to an OTA. Since there is one COW per partition,
it also takes an output folder:

    make_cow_from_ab_ota payload.bin ./ota-cows/

If the payload is incremental, a source target-files package is needed.
It must be the exact package used to build the OTA, otherwise, the
conversion is likely to fail. Example:

    make_cow_from_ab_ota -source_tf target-files-XYZ.zip \
                         payload.bin ./ota-cows/

Bug: 162274240
Test: manual tests
Change-Id: I8cb1554e71384625c8073f1c351a976b5ae00a36
2020-08-26 11:39:01 -07:00
Ankit Goyal
77ea69e9a7 Merge "Revert "libsnapshot: Off-line tool for converting OTA payloads t..."" 2020-08-26 07:24:08 +00:00
Ankit Goyal
4dd34114de Revert "libsnapshot: Off-line tool for converting OTA payloads t..."
Revert submission 1405248-vab-offline-cow

Reason for revert: Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=git_master-without-vendor&target=sdk_mac&lkgb=6790614&lkbb=6791107&fkbb=6791107, bug 166383275
Reverted Changes:
If8a1bbf99:Expose extent_ranges for libsnapshot to use in res...
I22c86546f:libsnapshot: Off-line tool for converting OTA payl...

Change-Id: I7f85fb24a350c610d0837886716c22c2742ab144
2020-08-26 07:01:26 +00:00
Treehugger Robot
35d0ddbc8e Merge "Assume UNSUPPORTED if the battery capacity level sysfs node does not exist." 2020-08-26 00:01:03 +00:00
Treehugger Robot
909219ccc2 Merge "Fix API for C compatibility" am: 6f3e974ab5
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1408797

Change-Id: I0aaa7ab7ceb9e0397fdd18b4802d8239e39ad174
2020-08-24 20:27:10 +00:00
Treehugger Robot
6f3e974ab5 Merge "Fix API for C compatibility" 2020-08-24 19:49:37 +00:00
Christopher Ferris
7efed535c8 Merge "libunwindstack: don't save pseudoregisters while evaluating Dwarf" am: e5c9bbd453
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1403667

Change-Id: I8b25673da5b71fd3f40f34acaa6a78cae2bbe14f
2020-08-24 18:27:55 +00:00
Christopher Ferris
e5c9bbd453 Merge "libunwindstack: don't save pseudoregisters while evaluating Dwarf" 2020-08-24 17:40:56 +00:00
Greg Kaiser
b473061c5a Fix API for C compatibility
In https://android-review.googlesource.com/c/platform/system/core/+/1224544
when we introduced a default argument to androidSetThreadPriority(),
we broke C compatibility with this API, and with the header file
in general.

We fix this up by instead introducing a new method that takes
three arguments.  This gets this header file compiling for C again,
and keeps this particular API C compatible.

Any C++ callers of the three argument version of
androidSetThreadPriority() will need to switch to using
androidSetThreadPriorityAndPolicy().  Although since this was
a recent change, we believe there is only one such user, which
we are fixing at the same time.

Test: TreeHugger
Bug: 165009705
Merged-In: Iab0b7e6c91a8e32a17ba1b186fd0c2fe96b601e4
Change-Id: Iab0b7e6c91a8e32a17ba1b186fd0c2fe96b601e4
2020-08-24 17:29:25 +00:00
David Anderson
6eab53e0e7 Merge "libsnapshot: Off-line tool for converting OTA payloads to COWs." am: 5b940dc7f9
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1405248

Change-Id: I8416a633114ab35102d7a1a626598dfe28091fa8
2020-08-21 23:15:46 +00:00
David Anderson
5b940dc7f9 Merge "libsnapshot: Off-line tool for converting OTA payloads to COWs." 2020-08-21 23:05:36 +00:00
Treehugger Robot
56a0602e4a Merge "Allow shell to write to /sdcard/Android/data and /sdcard/Android/obb." am: 0297fef2f9
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1404487

Change-Id: I1d0223b551f1444e7259459982cfcdc034004904
2020-08-21 22:57:39 +00:00
Treehugger Robot
0297fef2f9 Merge "Allow shell to write to /sdcard/Android/data and /sdcard/Android/obb." 2020-08-21 22:25:37 +00:00
Elliott Hughes
d40cb2ae55 Merge "Fix logd's implicit dependency on libsysutils." am: ad0614b855
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1407074

Change-Id: I94e78d01b18030942b5c3c84cdf06646afb93fd5
2020-08-21 20:52:52 +00:00
Elliott Hughes
ad0614b855 Merge "Fix logd's implicit dependency on libsysutils." 2020-08-21 20:31:07 +00:00
Elliott Hughes
6998894440 Merge "libcrypto_utils: switch to C++." am: 73bfaa2745
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1407076

Change-Id: Ibc774502d31d1d0e725e6dc5aaa72e96a6a85373
2020-08-21 19:38:22 +00:00
Elliott Hughes
73bfaa2745 Merge "libcrypto_utils: switch to C++." 2020-08-21 19:23:15 +00:00
Marco Ballesio
ff0a789f8f Merge changes from topic "cgroup v2 freezer" am: 8b0b53a913
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1407073

Change-Id: I1a092f58c8ec513cc29cdda6a07c0d7cc10426ee
2020-08-21 18:51:27 +00:00
Marco Ballesio
8b0b53a913 Merge changes from topic "cgroup v2 freezer"
* changes:
  init.rc: remove initializations to cg2_bpf path
  libprocessgroup: json prototype for cgroups v2
  libprocessgroup: switch freezer to cgroup v2
  freezer: allow dynamic changes to freezer.state
2020-08-21 18:41:11 +00:00
Elliott Hughes
91784040db libcrypto_utils: switch to C++.
brillo is long gone, so no one should care about being C any more, and
this will let future janitorial work take advantage of RAII.

Test: treehugger
Change-Id: I06acd01e8b30247bed6e971ab3e8660d3e599cce
2020-08-21 10:34:56 -07:00
Gavin Corkery
8c92256df5 Store userspace reboot info in /metadata
Store pertinent information about userspace reboot events in the case
of failure. This information is any services which failed to stop
cleanly, the output of the default fstab and /proc/mounts, and
a list of mounts which failed to unmount. This information is only
stored as necessary (i.e. mount information will not be stored if
everything unmounted, even if some services failed to stop).

Added new /metadata/userspacereboot directory to persist this
information. Information older than 3 days will be deleted.

Test: adb reboot userspace with sigterm/sigkill timeouts set to
      very low values
Test: Manual test of storing all other information
Bug: 151820675
Change-Id: I6cfbfae92a7fc6f6c984475cad2c50c559924866
2020-08-21 17:32:34 +01:00
Marco Ballesio
fdc03350f4 init.rc: remove initializations to cg2_bpf path
https://r.android.com/c/1324649/5 moves the cgroup folder to its sysfs
path. Directory access rights are defined by kernel code and sepolicy,
so remove the initialization lines from init.rc.

Test: manually booted the device and verified access rights for
/sys/fs/cgroup
Bug: 154548692

Change-Id: I67284dc651ed529cae69e413b66c6e1292a2d970
2020-08-21 09:18:58 -07:00
Treehugger Robot
9dc6804d96 Merge "libcrypto_utils: Use accessors to manipulate RSA keys." am: cdfef7fe9e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1405369

Change-Id: I2bd01de4f23ce1fd29b20587fd793fac13a34788
2020-08-21 16:02:42 +00:00
Treehugger Robot
cdfef7fe9e Merge "libcrypto_utils: Use accessors to manipulate RSA keys." 2020-08-21 15:49:09 +00:00