Commit Graph

58857 Commits

Author SHA1 Message Date
Maciej Żenczykowski c1ca9f75f9 add a new trigger for launching the bpfloader
Test: built and booted
Bug: 150040815
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Merged-In: If80758b3d7bf499d428880efa5ed555076bfc291
Change-Id: If80758b3d7bf499d428880efa5ed555076bfc291
2020-06-23 14:08:27 -07:00
David Anderson 20d78e3323 Merge "remount: Do not allow remounting during checkpoints." into rvc-dev 2020-06-19 20:04:54 +00:00
TreeHugger Robot 5062ea0564 Merge "fastboot: copy AVB footer on boot image to end of partition" into rvc-dev 2020-06-19 19:38:11 +00:00
Steve Muckle 618ca3400d fastboot: copy AVB footer on boot image to end of partition
If the flashed boot image is smaller than the block device, the AVB
footer will not be at the end of the partition. Although images are
normally created to match the partition size the GKI boot.img must work
on all devices, and the size of the boot partition will vary.

Copy the AVB footer to the end of the partition before flashing, if it
is not there already.

Bug: 159377163
Change-Id: I5a5e25fb54dc9d6a2930fda63434968808ffa1f0
Merged-In: I5a5e25fb54dc9d6a2930fda63434968808ffa1f0
2020-06-19 11:35:01 -07:00
David Anderson 9aeae82f69 remount: Do not allow remounting during checkpoints.
Bug: 157540389
Test: manual test
Change-Id: I5931a583e48ddac05f319629ae2f7f5f0f6cf032
Merged-In: I5931a583e48ddac05f319629ae2f7f5f0f6cf032
2020-06-18 23:10:10 +00:00
TreeHugger Robot 507d21905b Merge "Don't call block checkpoint functions above dm-default-key" into rvc-dev 2020-06-18 22:22:57 +00:00
Paul Lawrence 39c7961c90 Don't call block checkpoint functions above dm-default-key
Bug: 156225476
Test: Build for f2fs and ext4 device, make sure checkpoints roll back
and commit

Merged-In: I7a772ff712dec9e69df175de840d69d296c65923
Change-Id: I7a772ff712dec9e69df175de840d69d296c65923
2020-06-18 21:58:57 +00:00
TreeHugger Robot 54e693e6d7 Merge "modprobe: Use more inclusive language for modprobe and libmodprobe" into rvc-dev 2020-06-18 20:46:11 +00:00
Tim Murray 4dc1d5f3de Merge "Move zygote64 into the top-app stune group." into rvc-dev 2020-06-18 19:15:39 +00:00
Tim Murray e2318a2fce Move zygote64 into the top-app stune group.
Improve app startup performance before the new app is in the top-app
cpuset.

Test: boots, zygote64 in top-app stune group
Bug: 159201879

Change-Id: I3aad4b4b1d2f54db9e7ba86db8a655d8552bad0a
2020-06-18 10:43:01 -07:00
Mark Salyzyn 502cb7af75 modprobe: Use more inclusive language for modprobe and libmodprobe
blacklist is replaced with blocklist.

Test: none
Bug: 151950334
Merged-In: I59f9fde5900b9aee82aca1eab4a6ded3d136063b
Change-Id: I59f9fde5900b9aee82aca1eab4a6ded3d136063b
2020-06-18 09:46:37 -07:00
Narayan Kamath 17fcd95f64 Merge "Fix Deadlock Issue On AppFuseBridge" into rvc-dev 2020-06-18 10:15:55 +00:00
Tom Cherry 709d569241 liblog: fix reading pmsg
d3ecc66b9c "liblog: support extended logger_entry headers" removed
the logger_entry::msg variable and instead uses hdr_size as an offset
from logger_entry to where the message starts in parent log_msg
buffer.

In pmsg, hdr_size is not recorded and therefore uninitialized when it
was referenced, causing corruption when reading last logcat.  This
change uses sizeof(log_msg->entry) instead.

Bug: 158263230
Test: last logcat works
Merged-In: Ic01e73bf4d8ba8419cc770138565aa1210a6078b
Change-Id: Ic01e73bf4d8ba8419cc770138565aa1210a6078b
(cherry picked from commit 34d7bd98ad)
2020-06-17 13:54:58 -07:00
hyeeun.jun@samsung.com 612fc47090 Fix Deadlock Issue On AppFuseBridge
There are two locks used by AppFuseBridge.
First is it's object lock, and the second is a mutex lock in app fuse library.
There are two oppsite routines to get those locks.

  (Thread A) Got Java lock -> Try to get Native lock
  (Thread B)        Got Native lock -> Try to get Java lock

The order must be followed to obtain two locks.
If not, the dead lock will be caused.
Therefore we change the routine to get the mutex lock first, and the object lock later.

Signed-off-by: hyeeun.jun@samsung.com <hyeeun.jun@samsung.com>
Bug: https://issuetracker.google.com/issues/145707568
Bug: 157535024
Test: atest --test-mapping apex/blobstore

Change-Id: I0ab002da9a0b7ca2f518d50ab477a080cabe3788
2020-06-17 13:39:21 +01:00
Tom Cherry e28dc48de5 fsmgr: fix integer overflow in fs_mgr
As the EXT4_MAX_BLOCK_SIZE defined as 65536 which reached maxium value
of unsigned int. The superblock value maybe larger than 65536. This is
found by the Integer Overflow Sanitizer.

This patch fixed below boot error when userdata is corrupted:
init: processing action (fs) from
(/vendor/etc/init/hw/init.freescale.rc:221)
init: [libfs_mgr]Invalid ext4 superblock on '/dev/block/by-name/userdata'
init: InitFatalReboot: signal 6 init: #00 pc 00000000000af7e8  /system/bin/init
(android::init::InitFatalReboot(int)+208) init: #01 pc 00000000000afbd0  /system/bin/init
(android::init::InstallRebootSignalHandlers()::$_22::__invoke(int)+32)
init: #02 pc 00000000000006bc  [vdso:0000ffff9691b000] (__kernel_rt_sigreturn)
init: #03 pc 000000000004e070  /system/lib64/bootstrap/libc.so (abort+176)
init: #04 pc 000000000003427c  /system/lib64/libfs_mgr.so
(read_ext4_superblock(std::__1::basic_string<char, std::__1::char_
traits<char>, std::__1::allocator<char> > const&,
android::fs_mgr::FstabEntry const&, ext4_super_block*, int*)+1804)

Test: boot with corrupted ext4 superblock
Bug: 156200421

Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
Change-Id: Ib1b69bf4623f69696cb637b226ec3359fc2ed409
(cherry picked from commit cb472b92e5)
2020-06-16 23:32:39 +00:00
Yifan Hong 755eb6b606 libsnapshot_test: hardcode alignment.
SnapshotUpdateTest uses a relatively small super partition, which
requires a small alignment and 0 alignment offset to work. For the
purpose of this test, hardcode the alignment and offset.
This test isn't about testing liblp or libdm.

Fixes: 154355449
Fixes: 157437632
Bug: 158718136
Bug: 157633441
Bug: 154646936

Test: atest on devices with alignment of data partition >= 512KiB

Change-Id: I1d0474f028cc824bd4197d0228350395239b3b81
(cherry picked from commit 31739669e91c7a3afc5bee23e43bc45fb4154667)
Merged-In: I1d0474f028cc824bd4197d0228350395239b3b81
2020-06-15 14:00:12 -07:00
Randall Huang 4e864e1216 Try to recover corrupted ext4 /data with backup superblock
If the superblock of /data is corrupted, fs_mgr would skip check_fs.
But, e2fsck actually may reference backup superblock to recover
the filesystem. This fix gives fs_mgr second chance to fix corrupted
ext4 /data.

Bug: 156200421
Test: boot with corrupted ext4 superblock

Signed-off-by: Randall Huang <huangrandall@google.com>
Change-Id: Ieb89e7274d772962fe37927dcd62567dd5aa4657
(cherry picked from commit 72abd7b246)
2020-06-12 02:07:35 +00:00
TreeHugger Robot 2d51d38224 Merge "liblp: Remove tests for alignment_offset being 0." into rvc-dev 2020-06-11 19:17:55 +00:00
Ruchir Rastogi 172562dc90 Merge "Do not truncate AStatsEvent buffers" into rvc-dev 2020-06-11 17:57:06 +00:00
Ruchir Rastogi f2a5ed081a Do not truncate AStatsEvent buffers
Pushed atoms do not need to be truncated because only the bytes added to
the buffer are written to the socket. Pulled atoms do not need to be
truncated because within stats_pull_atom_callback.cpp, we only copy the
valid parts of the buffer to the StatsEventParcel object.

This improves performance by avoiding a needless call to realloc.

+ removed dead benchmarking code

Test: m libstatssocket
Test: atest libstatssocket_test
Test: atest GtsStatsdHostTestCases
Bug: 158717786
Change-Id: I6965f8832758203ca566336ba12d0acaf5f756d5
2020-06-10 20:43:53 -07:00
David Anderson a5f8e50fbb liblp: Remove tests for alignment_offset being 0.
This test doesn't exist on AOSP anymore, and the bugs around
alignment_offset have been fixed in R. There is no need for the test
anymore.

Bug: 157398966
Test: liblp_test gtest
Change-Id: I00ac7486faf8db8b18f764e61db1d545feb0312c
Merged-In: I563122282e940e07a7ece97ed1a9846ad1f3253c
2020-06-11 03:25:28 +00:00
TreeHugger Robot c39f708cb4 Merge "Fine tune blkio setting to improve boot time" into rvc-dev 2020-06-11 01:51:19 +00:00
TreeHugger Robot d9f6d499f7 Merge "Increase size limit for pulled AStatsEvent" into rvc-dev 2020-06-10 04:52:37 +00:00
Muhammad Qureshi 9b9584b1a3 Increase size limit for pulled AStatsEvent
Increase AStatsEvent max byte size to 50 KB for pulled events.
All AStatsEvent instances are treated as pulled events unless
AStatsEvent_write() is called.

- Set the default max size to 50 KB
- The starting buffer size is still ~4 KB for pushed and pulled events.
- If a write would exceed the buffer bounds, double buffer size until
write fits or 50 KB limit is exceeded in which case the overflow bit is
set to true.
- If AStatsEvent_write() is called, max size is set to ~4 KB. And if
the current payload exceeds this limit, set overflow bit to true.

- Fix error mask checking in stats_event_test.
- Set ERROR_NO_ATOM_ID when atom id is missing.
- Make sure tests don't hit ERROR_TOO_MANY_FIELDS when testing buffer
overflow.
- Rename event->size to event->numBytesWritten

Fixes: 158214941
Test: libstatssocket_test
Change-Id: Ia26aeb775f7e4f2ffe87707bab6d0119e21da10e
2020-06-09 20:12:42 -07:00
TreeHugger Robot ab7a967d1c Merge "adbd: remove ifdefs guarding root/secure." into rvc-dev 2020-06-09 21:42:05 +00:00
Tom Cherry fa94467894 Merge "Adding wait for a device file before mount" into rvc-dev 2020-06-09 21:26:50 +00:00
TreeHugger Robot 5ec1865b9c Merge "Set block size in dm-bow" into rvc-dev 2020-06-09 20:57:23 +00:00
Josh Gao b6b70c23c9 adbd: remove ifdefs guarding root/secure.
The same adbd module prebuilt will get used for both user and userdebug
builds in the post-APEX world, so we can't guard functionality with
product variable ifdefs anymore.

The code that was previously compiled out runs before we drop root, so
the increased attack surface essentially consists of an attacker having
control over system properties, and that likely implies that we're
doomed already (either they have filesystem control, or they have code
execution in init).

Bug: http://b/158156979
Test: treehugger
Change-Id: Ia70d3140189e5212beb813ff719355e30ca5fa04
(cherry picked from commit d076857c4f)
2020-06-09 13:05:47 -07:00
Will Shiu f044f2d4d4 Adding wait for a device file before mount
Adding the function, fs_mgr_wait_for_file(), to ensure the
device file exists before to mount

Bug: 158064601
Merged-In: I74a68224073932773be18a79f9334d83ea5b6947
Change-Id: I74a68224073932773be18a79f9334d83ea5b6947
(cherry picked from commit 589b7dfd83)
2020-06-09 11:10:43 -07:00
Elliott Hughes 8f4bb45a7b Stop using varargs in libkeyutils.
It's error-prone, and our specific usage of it here upsets ubsan.

Bug: https://issuetracker.google.com/158428513
Test: treehugger
Change-Id: I3a6b68865e6b4c37ac005f5f24c3d6e1de7c5bac
Merged-In: I3a6b68865e6b4c37ac005f5f24c3d6e1de7c5bac
2020-06-09 09:32:35 -07:00
Paul Lawrence 39e4a7102b Set block size in dm-bow
Fix block-level checkpointing to work correctly when used in combination with
512 byte hardware sectors and metadata encryption with dm-default-key v2.

Bug: 153512828
Test: Parameter is passed to dm-bow based on first_api_level
Change-Id: Ic0a071221559271db20b06b2f17459b5b041e02d
Merged-In: Ic0a071221559271db20b06b2f17459b5b041e02d
2020-06-09 09:20:24 -07:00
Rick Yiu 11d167b575 Fine tune blkio setting to improve boot time
Bug: 133200996
Test: boot time test
Change-Id: I5262c28596adb7e849b202b8a163c190818f271a
Merged-In: I5262c28596adb7e849b202b8a163c190818f271a
2020-06-09 04:34:40 +00:00
Josh Gao b1df146aef Merge "Move libadbd_auth, libadbd_fs to adbd_system_binaries." into rvc-dev 2020-06-08 23:05:20 +00:00
Josh Gao 0217d52d01 Move libadbd_auth, libadbd_fs to adbd_system_binaries.
The required block inside the definition of "adbd" does nothing: we get
the libraries it contains via direct dependency when building from
source, and not at all when using a prebuilt. Move them to a phony
rule that's explicitly listed in PRODUCT_PACKAGES.

Bug: http://b/157709367
Test: treehugger
Change-Id: I97c0889558482cfbe18ae91b39b6889d3fee877c
(cherry picked from commit e572f2fc44)
2020-06-08 21:24:26 +00:00
Alistair Delva afaa5fbccc Respect ro.boot.fstab_suffix in swapon_all
While mount_all and umount_all were updated to use ro.boot.fstab_suffix,
I neglected to update swapon_all. Trivially copied from umount_all.

Bug: 142424832
Change-Id: Icd706fe7a1fe16c687cd2811b0a3158d7d2e224e
2020-06-08 11:36:05 -07:00
Alistair Delva 46f25dee36 Add documentation for umount_all
The mount_all and swapon_all commands are documented, but umount_all
is not. Add some documentation.

Bug: 142424832
Change-Id: I7e4dcb4d222b787350a79c9e312062cac9eeb4d8
2020-06-08 11:29:13 -07:00
Woody Lin 39bdf397fa libsparse: Limit block size to 64 MB
Limit the block size to 64 MB before fastboot executable binary for
windows 64-bit is released.

Bug: 156057250
Change-Id: Ic4edb963a3d99f718d7630aba3f351729a84e994
2020-06-04 11:36:56 +08:00
Josh Gao a311f7866f check_ms_os_desc: fix buffer overflow.
Bug: http://b/155505587
Test: check_ms_os_desc
Change-Id: Ie99715ab62571d24460c3a1fb859d22951f30cb8
Merged-In: Ie99715ab62571d24460c3a1fb859d22951f30cb8
2020-06-03 15:32:06 -07:00
TreeHugger Robot 0917ad0467 Merge changes from topic "multi-kernel-mod-dirs" into rvc-dev
* changes:
  first_stage_init: support kernel module directories
  add libmodprobe api to query the number of modules loaded
2020-06-03 20:54:33 +00:00
Steve Muckle e35d217958 first_stage_init: support kernel module directories
Kernel modules may be located within directories in /lib/modules.
Attempt to load kernel modules from each directory that has a name starting with
the major and minor version of the currently running kernel. If a single
kernel module is successfully loaded from a directory, that directory is
treated as the correct kernel module directory for the system. No other
kernel module directories are searched and any kernel module load errors
in that directory are fatal. If the attempt to load the first kernel
module from a directory fails, or if there are no kernel modules in a
directory, then the search proceeds to the next directory.

If no kernel module is successfully loaded from any directory as above,
an attempt is made to load kernel modules from the top level at
/lib/modules/.

Bug: 157645635
Change-Id: I92eadd8617f03a645da460ccb776bc04fa541f00
Merged-In: I92eadd8617f03a645da460ccb776bc04fa541f00
2020-06-03 12:11:38 -07:00
Steve Muckle 8bafa9e28e add libmodprobe api to query the number of modules loaded
In the short term this will be used to help implement support for
multiple kernel module directories but it may be useful in other
contexts as well.

Bug: 157645635
Change-Id: I15a252b6e9394292c8f3557ed65112c935830441
Merged-In: I15a252b6e9394292c8f3557ed65112c935830441
2020-06-03 12:11:15 -07:00
Mohammad Samiul Islam 000226f1d5 Merge "Create /metadata/staged-install dir to store staged install failure reasons" into rvc-dev 2020-06-03 09:57:18 +00:00
Tej Singh 84db2e40e1 Merge "Retry pullfinish with empty payload if call fails" into rvc-dev 2020-06-01 19:14:09 +00:00
Yifan Hong ee418ecb66 Merge "libsnapshot: proto use correct index" into rvc-dev 2020-05-31 21:47:14 +00:00
Alessio Balsini 3ec696d0ce Merge "libsnapshot: Export COW image size" into rvc-dev 2020-05-31 12:20:46 +00:00
Howard Ro 413668bcf3 Merge "Libstatspull: decrease default pull timeout to 2s" into rvc-dev 2020-05-30 09:59:13 +00:00
Yifan Hong 8d996c4d3f libsnapshot: proto use correct index
Test: pass
Bug: 154016862
Change-Id: I845d2250ddb27bdbaee0d54663a2fdb45dbfbd11
2020-05-30 03:13:17 +01:00
Alessio Balsini 2898343409 libsnapshot: Export COW image size
Enable libsnapshot to export the size of the COW image, representing the
fraction of the COW device that is temporarily created in the /data
partition, computed just before initializing a merge operation.
Thise additional information can be used by other components (i.e.,
update engine) to enrich Virtual A/B metrics.

Bug: 154016862
Test: manual OTA
Signed-off-by: Alessio Balsini <balsini@google.com>
Signed-off-by: Yifan Hong <elsk@google.com>
Change-Id: I4faa0785f23884e26161e0d51268dd7a305d86bf
Merged-In: I4faa0785f23884e26161e0d51268dd7a305d86bf
(cherry picked from commit 2a1778d340)
2020-05-30 03:12:57 +01:00
Tej Singh 00ffb6c77e Libstatspull: decrease default pull timeout to 2s
Decrease the default pull timeout to 2 seconds.

Test: atest LibStatsPullTests
Test: atest libstatspull_test
Bug: 154056912
Change-Id: I8f7660de64e8c74a8c7ce7d252369c0456895e3b
2020-05-29 23:37:21 +00:00
Tej Singh c95f781901 Retry pullfinish with empty payload if call fails
If the first call for pullFinished fails, it is likely because the
transaction is too large. Currently, if this happens statsd will just
sleep until the timeout. With this change, the client will retry calling
pullFinish if the first attempt fails, but with an empty payload (and
with success = false) to cause the puller to fail fast, and so statsd
does not wait for the timeout.

Test: atest LibStatsPullTests
Bug: 157768117
Change-Id: I3af991fae47bb7c09bf8a6fc83f28556b836c6e4
2020-05-29 15:21:08 -07:00