Commit graph

49858 commits

Author SHA1 Message Date
Josh Gao
af086e9a95 adbd: respond to device-to-host control transfers.
Failing to write to the endpoint results in subsequent reads on ep0 to
fail with EL2HLT, so do an empty write to fulfill the transfer.

Bug: http://b/131867920
Test: manually tested with modified auto client
Change-Id: If2eec162ca4b31a9974c7bd5802be51cee9e2708
2019-05-21 16:39:51 -07:00
TreeHugger Robot
7eeed22871 Merge "adbd: reduce queue depths." into qt-dev 2019-05-21 00:05:34 +00:00
TreeHugger Robot
5b882637e1 Merge "adbd: avoid starting multiple worker threads." into qt-dev 2019-05-21 00:04:15 +00:00
TreeHugger Robot
6031286936 Merge "adbd: read, print, and ignore USB control transfers." into qt-dev 2019-05-20 21:37:24 +00:00
Josh Gao
12807c7012 adbd: read, print, and ignore USB control transfers.
It seems like we're blowing up when receiving a control transfer that's
intended for Android Auto, because we're not expecting to get the data
for the control transfer in a subsequent read.

Bug: http://b/131867920
Test: none
Change-Id: Icfd642e6dfc02d2ccbdd60c39f89e534298c944d
2019-05-17 18:34:23 -07:00
TreeHugger Robot
982259add1 Merge "Initialize all fields of struct iocb." into qt-dev 2019-05-16 23:27:38 +00:00
Evgenii Stepanov
9da358d6d3 Initialize all fields of struct iocb.
Kernel does not accept non-zero value of iocb->aio_reserved2.

Bug: 132803232
Test: initialize malloc() memory to non-zero pattern and see what breaks

Change-Id: I65a7e89e3a2c1ba79df1dc2d011d6c76c41afb81
(cherry picked from commit fe7eca7b8f)
2019-05-16 12:55:41 -07:00
Alistair Strachan
9924f7ee2d Merge "Add asan.permitted.paths for the media namespace" into qt-dev 2019-05-16 14:45:58 +00:00
Martijn Coenen
5ff7c4b22d Merge "class_start_post_data also starts disabled services." into qt-dev 2019-05-16 07:29:35 +00:00
TreeHugger Robot
2c4803838e Merge "Allow CreateResizeDeleteLP test case to run on non-A/B devices" into qt-dev 2019-05-15 22:25:03 +00:00
Martijn Coenen
ebce675b17 class_start_post_data also starts disabled services.
This keyword was introduced to support restarting services on devices
using APEX and FDE. The current implementation is not a restart, but
rather a 'reset' followed by a 'start', because the real /data must be
mounted in-between those two actions. But we effectively want this to be
a restart, which means that we also want to start 'disabled' services
that were running at the time we called 'class_reset_post_data'.

To implement this, keep track of whether a service was running when its
class was reset at post-data, and start all those services.

Bug: 132592548
Test: manual testing on FDE Taimen
Change-Id: I1e81e2c8e0ab2782150073d74e50e4cd734af7b9
2019-05-15 22:23:41 +02:00
Hridya Valsaraju
fbaffb5deb Allow CreateResizeDeleteLP test case to run on non-A/B devices
Test: fuzzy_fastboot --gtest_filter=*Logical*
Bug: 117220134

Change-Id: Ic7c2b246b7c5646d3589f8f57eceb9ba5feeef2b
Merged-In: Ic7c2b246b7c5646d3589f8f57eceb9ba5feeef2b
(cherry picked from commit f81bd17179)
2019-05-15 09:29:34 -07:00
Jiyong Park
78e6b181ac Add asan.permitted.paths for the media namespace
Permitted paths were empty for ASAN builds with the media namespace.

Bug: 131625115
Test: no dlopen failure on libflacextractor.so in aosp_cf_x86_pasan
Change-Id: I90050fc54820ba68d64931412572f3b0954e6616
2019-05-15 12:41:01 +09:00
TreeHugger Robot
83e9f6bd68 Merge "fs_mgr: overlayfs: ReadFstabFromFile touches errno" into qt-dev 2019-05-14 00:25:22 +00:00
TreeHugger Robot
82ebfca5cd Merge "adbd: don't abort on EOF on functionfs control fd." into qt-dev 2019-05-13 22:21:59 +00:00
Josh Gao
1f7ae9d4e3 adbd: don't abort on EOF on functionfs control fd.
Also, improve the logging in the cases where we do abort.

Bug: http://b/131867920
Test: treehugger
Change-Id: If8ec9f4614ce146e6dbd21cc77587ea81658199b
(cherry picked from commit 2916e148d9)
2019-05-13 11:42:29 -07:00
Mark Salyzyn
8471f92a20 fs_mgr: overlayfs: ReadFstabFromFile touches errno
(cherry picked from commit 98a0128e44)

Regression from commit 77c28476f1
("Remove the mount points defined in skip_mount.cfg from
ReadDefaultFstab()") resulted in ReadFstabFromFile to report
errno ENOENT even upon success, preventing clear error propagation
for real failures (ReadFstabFromFile would _always_ report ENOENT).

The bad error propagation resulted in an adb remount failure.

Added immunization against future adjustments that may also
result in a similar regression in adb remount behaviors.

Test: adb-remount-test.sh
Bug: 132594161
Bug: 128961335
Change-Id: Icf5d48bbfc6d938d4b9657ca8004a6a6ddaab5a6
2019-05-13 11:03:10 -07:00
Martijn Coenen
122bf2aedf Merge "Fix bug that would prevent us from reserving right amount of space." into qt-dev 2019-05-13 06:49:30 +00:00
David Anderson
8a04457218 Merge "Add a liblp test that we can parse the device's super partition." into qt-dev 2019-05-11 00:20:02 +00:00
Michael Groover
b9c555e2cf Merge "Notify the framework when an adb key is authorized" into qt-dev 2019-05-10 22:54:55 +00:00
David Anderson
9a8b9e0163 Add a liblp test that we can parse the device's super partition.
Bug: 132112489
Test: liblp_test gtest
Change-Id: I1c0950dc30f42cd232e0616191d1365cdfc6512d
Merged-In: I1c0950dc30f42cd232e0616191d1365cdfc6512d
2019-05-10 12:16:19 -07:00
Martijn Coenen
b3462c123c Fix bug that would prevent us from reserving right amount of space.
Bug: 132403230
Test: inspect dmesg output:
[   10.762678] init: [libfs_mgr]Setting reserved block count on
/dev/block/dm-2 to 32768
[   10.782652] tune2fs: Setting reserved blocks gid to 1065\x0a
[   10.782655] tune2fs: Setting reserved blocks count to 32768\x0a

Change-Id: Id366d478bdd8a748bb1ba97d08a3b52e3cdd1efb
2019-05-10 10:39:54 +02:00
TreeHugger Robot
377a244710 Merge "crash_dump: populate uid field." into qt-dev 2019-05-10 02:51:02 +00:00
Josh Gao
b80fe7a48d crash_dump: populate uid field.
Bug: http://b/132359035
Test: manual
Change-Id: I99d8446024fc2d9395132dea45f03317976a9b62
(cherry picked from commit 5df504c5f8)
2019-05-09 16:48:01 -07:00
Maciej Zenczykowski
6a2b82e654 Merge "Make the SocketListener control pipe O_CLOEXEC." into qt-dev 2019-05-09 23:45:07 +00:00
Michael Groover
7eeda6ba03 Notify the framework when an adb key is authorized
Bug: 124076524
Test: atest AdbDebuggingManagerTest
Change-Id: If73b81ca73ba4d64763cf49c1bbe42de81fa1cb6
2019-05-09 16:05:40 -07:00
TreeHugger Robot
482ea4a611 Merge "fs_mgr_remount: fix a typo" into qt-dev 2019-05-09 14:43:18 +00:00
TreeHugger Robot
9d97b88efe Merge "Apply initial settings for blkio cgroup" into qt-dev 2019-05-09 09:40:13 +00:00
Bowgo Tsai
d244a751fd fs_mgr_remount: fix a typo
Replacing "ro.boot.vbmeta.devices_state" with
"ro.boot.vbmeta.device_state" to check if the device is locked.

Bug: 132224452
Test: tree hugger
Change-Id: If4f312730cc82ad5a5d5104a7aca8b9691cf6600
(cherry picked from commit 2badf73b99)
2019-05-09 17:20:13 +08:00
Tao Bao
c0cf2d9eec [automerger skipped] DO NOT MERGE Start update_verifier early in late-fs.
am: 79cfc7d5a8 -s ours
am skip reason: subject contains skip directive

Change-Id: If1e9e67406324b70cb09fbaf4cb60c9bbcef1ad9
2019-05-08 21:53:43 -07:00
Lorenzo Colitti
f38e182fbf Make the SocketListener control pipe O_CLOEXEC.
Children of processes that use SocketListener should not be able
to stop the SocketListener.

Test: builds, boots
Test: atest libsysutils_tests
Test: atest --test-mapping system/netd
Bug: 131268436
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I64898d9966f62004468b8e8a43b59be4a81a8cc4
Merged-In: I64898d9966f62004468b8e8a43b59be4a81a8cc4
(cherry picked from commit dae0195380)
2019-05-08 21:02:57 -07:00
Rick Yiu
c7bf1a01fd Apply initial settings for blkio cgroup
Bug: 117857342
Test: values are applied
Change-Id: Id28d9619fc2fd2287fe656b8032025184ae7f631
(cherry picked from commit a8aaf198d5)
Merged-In: Id28d9619fc2fd2287fe656b8032025184ae7f631
2019-05-09 03:14:11 +00:00
Vic Yang
b562e68503 Static link libjsoncpp in libprocessgroup
The majority of libjsoncpp use is due to libprocessgroup.  Static
linking reduces relocations required at runtime as well as compacts the
pages dirtied by relocations.  On a 32-bit system, where this matters
the most, this reduces 8KB of dirty pages per libprocessgroup load.
Overall, the dirty page reduction on 32-bit cuttlefish is ~500KB.

Bug: 132275636
Test: Boot on cuttlefish.  Calculate total amount of dirty memory used
      for libprocessgroup and libjsoncpp.
Change-Id: I1135bb45a3764f96a4a3a47c98fbcdee3913c988
2019-05-08 13:04:11 -07:00
Iris Chang
9d7d26a5cf Support booting a chained boot-debug.img
boot-debug.img is introduced to allow 'adb root' if the device is
unlocked, and it cannot be release signed. If /boot partition is chained
in AVB signing and boot-debug.img is used, avb_slot_verify() in
userspace will return AVB_SLOT_VERIFY_RESULT_ERROR_PUBLIC_KEY_REJECTED
and fs_mgr will refuse to boot. This CL treats the public key rejection
as non-fatal for chained vbmeta to continue booting, if the device is
unlocked.

Bug: 129508966
Test: can root with user load which /boot chained in AVB signing
Change-Id: Idfa8caffbb96f33702b1749afd2e2a59616ddba7
Merged-In: Idfa8caffbb96f33702b1749afd2e2a59616ddba7
(cherry picked from commit 705fd7f52c)
2019-05-08 08:04:33 +08:00
Tao Bao
79cfc7d5a8 DO NOT MERGE Start update_verifier early in late-fs.
We used to start update_verifier after mounting userdata (post-fs-data),
as part of zygote-start. This leads to issues in practice for security
updates, where an A/B device falls back into the old slot (for any
reason, which unrelates to this change) but failing to boot due to
upgraded key blob. It essentially breaks the fallback capability offered
by A/B OTA.

This CL mitigates the issue by starting update_verifier early, before
mounting userdata. This avoids the device from falling back to the old
slot with an already-upgraded key blob. update_verifier loses the
opportunity of verifying _all_ the updated blocks based on the info
that's stored in userdata.  Instead it will only trigger the minimal
read to finish the work of marking a successful boot. This is a
trade-off in P to avoid putting the device in a bad state after
fallback, which will be improved in Q by better handling the fallback
path in vold.

Bug: 131176531
Test: Flash and boot crosshatch. Check the start of update_verifier and
      it marks a successful boot.
Change-Id: I3f4c4333ff38772a9a93c9d027d497db11de1d63
2019-05-07 12:50:58 -07:00
Christopher Ferris
f40a740034 Merge "Ignore memory from elf on /memfd:" into qt-dev 2019-05-04 05:05:55 +00:00
Christopher Ferris
ebbbc1a602 Ignore memory from elf on /memfd:
In ART, some of the maps are /memfd:/jit-cache and it triggers the warning
about unreadable elf files. Do not set the elf from memory not file
flag in this case.

Bug: 131909548

Test: New unit tests pass.
Test: No warnings dumping stacks with this change done.
Change-Id: Ifba5e65da609525ded75430da173c614f6e4801e
(cherry picked from commit 98aaf4cf08)
2019-05-03 15:46:24 -07:00
Jone Chou
edf4682cae bootstat: add 3 pmic off reasons to known set
regular expression:
- "reboot,pmic_off_fault,.*" (175)
- "reboot,pmic_off_s3rst,.*" (176)
- "reboot,pmic_off_other,.*" (177)

regex is dependent on:
https://android-review.googlesource.com/947976

Test: none
Bug: 116838876
Bug: 128929506
Change-Id: I7fae9ecee536f790c8f493c3f5e5f75b03efb1d6
Signed-off-by: Jone Chou <jonechou@google.com>
2019-05-03 14:41:21 +00:00
TreeHugger Robot
664193a62e Merge "fs_mgr: overlay check shared blocks for / if /system is not" into qt-dev 2019-05-02 21:56:52 +00:00
TreeHugger Robot
c856d14ed2 Merge "bootstat: Allow regex matches for boot reasons" into qt-dev 2019-05-02 21:19:03 +00:00
Josh Gao
94fb36bf77 adbd: avoid starting multiple worker threads.
A previous patch intended to make receiving multiple FUNCTIONFS_ENABLEs
non-fatal, but failed to do so because we would try to spawn another
worker thread and hit a different assertion.

Bug: http://b/130638368
Test: echo mem | adb shell "su 0 sh -c 'cat > /sys/power/state'"
Change-Id: I53456112244d8b4f7d26df6ec6961389fca70498
(cherry picked from commit 910ce0ff08)
2019-05-02 14:13:14 -07:00
Mark Salyzyn
3379be2a77 fs_mgr: overlay check shared blocks for / if /system is not
For bringup devices that do not have right-sized partition, and if
/system is now root, check / to be sure.

Consider unshare blocks for ext4 as dead code, provide a strong
message to caller to provide all the dependencies to overlayfs.

Test: adb-remount-test.sh
Bug: 130327601
Change-Id: Iffa7c5f24d8f409e71f89fe9ece274d8c476f6fc
Merged-In: Iffa7c5f24d8f409e71f89fe9ece274d8c476f6fc
2019-05-02 19:41:53 +00:00
Mark Salyzyn
c805a48b11 bootstat: Allow regex matches for boot reasons
If the matching string contains a [, \ or *, then it is also checked
with a regex match.  Exact match is always tried firsts.  If we do
not find an exact string match, switch to iterate through the entire
list for regex strings to find a match.

This allows us to scale with details without consuming a large
number of enums, permitting details that we do not necessarily want
resolution on to propagate to TRON.  The hierarchical nature of the
boot reason <reason>,<subreason>,<detail>... can cause scenarios
where the <detail> does not matter to TRON, but does matter to
bugreport collection.

Add a bootstat --boot_reason_enum function to expose and test the
kBootReasonMap matchihg algorithm.

Add a kBootReasonMap test that exhaustively tests all built-in
entries, and an example of one regex entry.  New regex entries added
to bootstat.cpp will need a series of exact match examples added into
filter_kBootReasonMap() function.

Test: boot_reason_test.sh kBootReasonMap (or all tests)
Bug: 116838876
Bug: 128929506
Change-Id: I3f7b5de22f99195b7ce99672a212174365960b3f
Merged-In: I3f7b5de22f99195b7ce99672a212174365960b3f
2019-05-01 18:17:04 +00:00
Mark Salyzyn
51eb0bb447 fs_mgr: overlayfs: suppress mkfs output
After this change, all the noise from mkfs is suppressed:

$ adb remount
[libfs_mgr]superblock s_max_mnt_count:65535,/dev/block/by-name/system_b
[libfs_mgr]__mount(source=/dev/block/by-name/system_b,target=/mnt/scratch,type=ext4)=-1: Invalid argument
[libfs_mgr]__mount(source=/dev/block/by-name/system_b,target=/mnt/scratch,type=f2fs)=0: Success
Using overlayfs for /system
Using overlayfs for /vendor
Using overlayfs for /product
[libfs_mgr]__mount(source=overlay,target=/system,type=overlay,upperdir=/mnt/scratch/overlay/system/upper)=0
[libfs_mgr]__mount(source=overlay,target=/vendor,type=overlay,upperdir=/mnt/scratch/overlay/vendor/upper)=0
[libfs_mgr]__mount(source=overlay,target=/product,type=overlay,upperdir=/mnt/scratch/overlay/product/upper)=0
remount succeeded

Test: manual as above
Bug: 130739326
Change-Id: I7ed8842e42b74b6a487ce6324b28baf78f1f63bf
Merged-In: I7ed8842e42b74b6a487ce6324b28baf78f1f63bf
2019-05-01 11:14:57 -07:00
Martijn Coenen
7a2d54df84 Merge "Support for stopping/starting post-data-mount class subsets." into qt-dev 2019-05-01 17:45:23 +00:00
Sandeep Patil
1040109071 Merge "procrank: do not keep process maps around" into qt-dev 2019-05-01 14:28:23 +00:00
Zimuzo Ezeozue
37e2653b33 Merge "Attempt native rollback for frequent crashes before boot completed" into qt-dev 2019-05-01 09:01:12 +00:00
Misha Wagner
59d8d4bb8a Merge "Add UID printing to tombstone headers" into qt-dev 2019-05-01 07:46:51 +00:00
Zimuzo
80cc912e7a Attempt native rollback for frequent crashes before boot completed
Before, if updatable processes crash 4 times in 4mins, a native
rollback will be attempted. This behavior does not detect
system_server early boot deadlocks because the system server requires
at least a min to detect a deadlock, and crash itself. The crashes
don't happen frequently enough for init to detect.

After, this cl, the old behavior exists and additionally, init detects
*any* 4 crashes of updatable processes before boot completed,
regardless of if they happen within 4mins or not.

Test: Manually tested by adding artificial sleep in system_server so
deadlock is triggered before boot. system_server crashes 4 times in
over 4mins and the ro.init.updatable_crashing prop is set to 1.
Bug: 129597207
Merged-In: Ie6fb5693ff4be105bcbe139c22850fb076e40260
Change-Id:  Ie6fb5693ff4be105bcbe139c22850fb076e40260
2019-05-01 00:37:28 +00:00
TreeHugger Robot
bf3baac459 Merge "Support adb rescue wipe command" into qt-dev 2019-04-30 17:50:11 +00:00