Commit graph

55179 commits

Author SHA1 Message Date
David Anderson
5a20de986a Merge "liblp: Export WriteToImageFile given a file descriptor." 2019-11-25 20:17:19 +00:00
Jooyung Han
5bb9d2133a Bind-mount individual flattened APEXes
There are a few directories for builtin APEXes: /system/apex,
/system_ext/apex, /product/apex, /vendor/apex.

For devices with ro.apex.updatable=false, init should bind-mount
"flattened" apexes from all of above.

Bug: 144732372
Test: OVERRIDE_TARGET_FLATTEN_APEX=true m && device boot
Change-Id: If151145e6e3d966b202300ff3a0ddb5ec9fdaa87
2019-11-25 19:53:24 +09:00
Nikita Ioffe
5110628a12 Fix logic to figure out what /data fstab entry was mounted
Now the logic is handled by following API:
GetMountedEntryForUserdata(Fstab* fstab).

Behind the scenes it does the following:
1. Reads /proc/mounts and gets block device /data is actually mounted on.
2. In case of it's a dm-device, recursively goes into it's slaves until
finds the underlying block device.
3. Optimistically assumes that corresponding block device is a symlink
and tries to read it.
4. Reads all the entries corresponding to /data from fstab.
5. For each of them, optimistically tries to readlink block_device.
6. If it matches the resolved block devices, we found our fstab entry!

Also added a test to CtsFsMgrTestCases asserting that /data was mounted
from one of entries in default fstab.

Test: on blueline & taimen, with & without checkpointing:
Test: atest CtsFsMgrTestCases
Test: adb reboot userspace

Bug: 135984674
Change-Id: Ic70daeeb18096c7b134004334cc674dacc6e36f3
2019-11-22 13:34:59 +00:00
Martijn Coenen
cc67ff5add Remove bootstrapping the passthrough mount.
This will be taken care of by vold (when necessary).

Bug: 135341433
Test: device boots, passthrough mount still works
      atest AdoptableHostTest
Change-Id: I5a144eff0e4220fa0154bfa7d62a2dec625c88bc
2019-11-22 13:13:50 +01:00
Josh Gao
4922f2aef2 Merge "Allow the adb server to bind on ::1"
am: 80a734f146

Change-Id: I11c94f09eeb36bf42d632c15b689e8c7b43e3c16
2019-11-21 14:04:25 -08:00
Josh Gao
80a734f146 Merge "Allow the adb server to bind on ::1" 2019-11-21 21:51:07 +00:00
Christopher Ferris
be141b1453 Merge "Move the dexfile support to implementation."
am: adebae2ca6

Change-Id: I7030422a81eca0735e53d46e3763f03485a2c34a
2019-11-21 11:55:13 -08:00
Christopher Ferris
adebae2ca6 Merge "Move the dexfile support to implementation." 2019-11-21 19:04:39 +00:00
Tom Cherry
3591f99b42 Merge "logd: print a message when kicking a client or skipping entries"
am: 6d4e9b1920

Change-Id: Ibb98f3146e9f05dce3dc27cea07b55bc88c17713
2019-11-21 08:38:07 -08:00
Tom Cherry
6d4e9b1920 Merge "logd: print a message when kicking a client or skipping entries" 2019-11-21 16:24:55 +00:00
Tom Cherry
36393ff546 Merge "init: fix subcontext tests running as non-root."
am: 1b0ea6c3b3

Change-Id: I3d7266c8fc8b748d325af2290e0505f6186ee3e1
2019-11-20 21:21:54 -08:00
Treehugger Robot
1b0ea6c3b3 Merge "init: fix subcontext tests running as non-root." 2019-11-21 05:15:35 +00:00
Tom Cherry
1c005f3a78 init: fix subcontext tests running as non-root.
A recently added subcontext test was failing beause it was running as
non-root, but GTEST_SKIP() didn't work as I expected it to.

In retrospect, all of these tests except for the property one, can
easily run as root, so this changes allows all of these tests to run
as root, while fixing the original issue.

Bug: 144707143
Test: root and nonroot subcontext unit tests
Change-Id: Ia835597701698f6be2101f92d6f4c9450bd3c7dd
2019-11-20 15:55:16 -08:00
Christopher Ferris
456df6929f Move the dexfile support to implementation.
No longer require that NO_LIBDEXFILE_SUPPORT be defined or not
defined when including the header files. Move all of the different
behavior to the implementation, and keep all of the classes the
exact same whether dexfiles are supported or not.

Bug: 144470551

Test: Ran libunwindstack unit tests, libbacktrace unit tests, and
Test: debuggerd unit tests.
Test: Ran host art 137-cfi tests.
Change-Id: I4a04cfbc5d4f1bf765ef154881046c85057006c8
2019-11-20 14:59:55 -08:00
Daniel Colascione
ce12543e55 Merge "Expose ParseBool from libbase"
am: e8237b3517

Change-Id: I8081a0fdb1a2b40fdb411642037f277fd9245206
2019-11-20 12:07:32 -08:00
Daniel Colascione
e8237b3517 Merge "Expose ParseBool from libbase" 2019-11-20 19:50:14 +00:00
David Anderson
2780d0abb2 liblp: Allow "flashing" files on the host.
UpdatePartitionTable expects to be run on a device, which is a
reasonable assumption. However to implement lpadd (offline modification
of super images), it's useful to be able to run these methods, and
IPartitionOpener allows us to masquerade a flie as a block device.

The only catch is that we can't query partition information on the host.
Since this logic is a protection mechanism, just surround it with
an ifdef for __ANDROID__.

Bug: 144468779
Test: lpadd
Change-Id: I3c50e5677fa1dd59f2d4216038d3d4fbfb6edcc0
2019-11-19 17:39:55 -08:00
David Anderson
4300572de3 liblp: Export WriteToImageFile given a file descriptor.
This exports an internal variant of WriteToImageFile, since lpadd needs
to call it on an open descriptor. While we're here, switch "int" to
"borrowed_fd".

Bug: 144468779
Test: m lpadd
Change-Id: I2dd35b8a872f8a72a704230d0382398b8982cb0b
2019-11-19 17:39:19 -08:00
Tom Cherry
06a0f824c0 Merge "liblog: remove the rest of the log reader transport"
am: 4023938914

Change-Id: I3564e38f14fdce5dda77f2a553d371ee6c1f25ff
2019-11-19 15:57:23 -08:00
Tom Cherry
c3e0b2725f Merge "liblog: remove memset() before recv()."
am: 332f99a7ed

Change-Id: Id07bcfd48d937ac0e71398554c1f9f984951c5a0
2019-11-19 15:56:58 -08:00
Mitch Phillips
95f7dae8c2 Merge "Add variadic logging to libdebuggerd internal."
am: 82a31b8749

Change-Id: I87e71554de11b3ff5cfc5b2a8bbb6882fa5849c2
2019-11-19 15:53:59 -08:00
Nikita Ioffe
b711442fde Merge "Make userspace_reboot.in_progress sysprop-as-api"
am: 300448a88c

Change-Id: I7bd0d19f50df889fb8ff8653a0e9f70995dee18d
2019-11-19 15:51:59 -08:00
Steven Moreland
4fedf87154 Merge "Add statusToString function."
am: 1af471dc03

Change-Id: Ib206061e7f631ca180c20999a554a089975279a7
2019-11-19 15:42:10 -08:00
Greg Kaiser
e8528b92e1 Merge "liblog: Assure shifting behavior is consistent"
am: d8c3cae95f

Change-Id: Ib99df0dc52a7fa15a2364b69b30563895c78ceb0
2019-11-19 15:41:50 -08:00
Elliott Hughes
8781248ffb Merge "Add absl-like StringReplace."
am: 43f9d5f34a

Change-Id: Ia3b13412c1eeef0e67726f77f3b0d429c5d53ef9
2019-11-19 15:41:37 -08:00
Peter Collingbourne
807b5e4927 Merge "Include PSTATE in tombstones on arm64."
am: ba5351692e

Change-Id: I9658388821fa4f3c0a12021f932be5613ef7e5e8
2019-11-19 15:41:23 -08:00
Orion Hodson
0996de5481 Merge "Add cpu-set properties to serializer test"
am: dc2f874ed3

Change-Id: Ieb6382dd30f99c77e07362e48a10d2047a78d176
2019-11-19 15:19:42 -08:00
Tom Cherry
d89ed132a0 init: always kill oneshot services' process groups.
~2007 a change was added that would allow oneshot services to
daemonize by not killing their process group.  This was a hack at the
time, and should certainly not be needed now.  I've resisted removing
the behavior however, as it hadn't caused any issues.

Recently, it was detected that the cgroups that these processes belong
to, would exist forever and therefore leak memory.  Instead of simply
removing the cgroups when empty, this provides a good opportunity to
do the right thing and fix this behavior once and for all.

The new (correct) behavior only happens for devices with vendor images
built for Android R or later.  Init will log a warning to dmesg when
it detects this difference in behavior has occurred.

Bug: 144545923
Test: boot CF/Coral and see no difference in behavior.
Test: boot CF with a service that daemonizes and see the warning.
Change-Id: I333a2e25a541ec0114ac50ab8ae7f1ea3f055447
2019-11-19 15:13:17 -08:00
Daniel Colascione
9e3cbb64ee Expose ParseBool from libbase
Also change the properties implementation to call the new API.  We use
this ParseBool API in the new SystemProperties implementation, with
which we want the libbase property API to be consistent.

Test: included
Change-Id: I89cb3eb4e1203a6bb0da41914dad720e44c00303
2019-11-19 13:31:50 -08:00
Tom Cherry
4023938914 Merge "liblog: remove the rest of the log reader transport" 2019-11-19 20:21:42 +00:00
Tom Cherry
332f99a7ed Merge "liblog: remove memset() before recv()." 2019-11-19 19:31:06 +00:00
Treehugger Robot
82a31b8749 Merge "Add variadic logging to libdebuggerd internal." 2019-11-19 19:04:55 +00:00
Tom Cherry
1a75a8cd4b liblog: remove memset() before recv().
This is unneeded, since we're already checking the length returned by
recv() and log_msg that is read for validity.

It costs ~4% of CPU with `logcat -s` and ~2% of CPU when running
simpleperf for 1 second on walleye on master.

Bug: 144311420
Test: logcat works, simpleperf doesn't show memset() costing as much.
Change-Id: I986e7e96518774034340f1b1201a2071a904e3bb
2019-11-19 10:10:37 -08:00
Mitch Phillips
aadebd8982 Add variadic logging to libdebuggerd internal.
GWP-ASan's crash information retrieval services requires a Printf()
function (declared by the system/implementing allocator). In this
instance, because _LOG is called with additional arguments (the log_t),
this function must be wrapped to conform to printf_t defined by
GWP-ASan.

We can easily wrap the variadic version.

Bug: 135634846
Test: atest debuggerd_test
Change-Id: I17209cd2b7455ce889e2f8194969f606cac329eb
2019-11-19 09:49:05 -08:00
Tom Cherry
026ddde6e4 liblog: remove the rest of the log reader transport
This is simplified down to the point there are only two branches that
need to be made, so remove the rest of the transport structs and
simply branch where needed.

Test: liblog-unit-tests
Change-Id: Ic82e7e70eb7b4e40b381a4d8066629c5b7d4f827
2019-11-19 09:41:49 -08:00
Nikita Ioffe
300448a88c Merge "Make userspace_reboot.in_progress sysprop-as-api" 2019-11-19 17:36:32 +00:00
Steven Moreland
1af471dc03 Merge "Add statusToString function." 2019-11-19 17:09:21 +00:00
Treehugger Robot
d8c3cae95f Merge "liblog: Assure shifting behavior is consistent" 2019-11-19 16:48:38 +00:00
Elliott Hughes
43f9d5f34a Merge "Add absl-like StringReplace." 2019-11-19 15:28:24 +00:00
Greg Kaiser
9829e7f894 liblog: Assure shifting behavior is consistent
Shifting a signed 32-bit value by 31 bits is implementation-
defined behavior.  So we change to an unsigned value for our
shift by 31 bits, and go ahead and change the others to
unsigned for consistency.

Test: TreeHugger
Change-Id: Ib98f9b1e468d28dafd09e86273bf76beb1ea1fa5
2019-11-19 06:53:22 -08:00
Treehugger Robot
ba5351692e Merge "Include PSTATE in tombstones on arm64." 2019-11-19 14:07:37 +00:00
Orion Hodson
dc2f874ed3 Merge "Add cpu-set properties to serializer test" 2019-11-19 07:34:13 +00:00
Peter Collingbourne
bb2f941f57 Include PSTATE in tombstones on arm64.
A thread's PSTATE can sometimes be critical for understanding a crash,
especially with MTE and other new features that store per-thread state
in PSTATE.

Bug: 135772972
Change-Id: I1bee25bffe7eea395f04b6449dc9227298cf866e
2019-11-18 17:57:37 -08:00
David Anderson
dd5ab2a053 Merge "fastbootd: Disallow certain operations during snapshot updates."
am: bf55a76fd9

Change-Id: I92be937b74381d1cf1da011797a89a8a8d5994b6
2019-11-18 17:01:54 -08:00
David Anderson
bf55a76fd9 Merge "fastbootd: Disallow certain operations during snapshot updates." 2019-11-19 00:49:44 +00:00
Elliott Hughes
908e0dfda5 Add absl-like StringReplace.
Needed for cli-test.

Test: treehugger
Change-Id: Ib1fd01ef7f3e54e5778cc548dd789b5fcfcb7bd9
2019-11-18 16:02:31 -08:00
Tom Cherry
8299d7302d Merge "liblog: simplify logd 'command' functions and struct logger"
am: 7d16aedc47

Change-Id: I1555a3d30b40cc0fc6fced4d0f20f3af5b401cb1
2019-11-18 14:06:06 -08:00
Tom Cherry
7d16aedc47 Merge "liblog: simplify logd 'command' functions and struct logger" 2019-11-18 21:47:16 +00:00
Steven Moreland
591cab8cee Add statusToString function.
For libbinder, not having these statuses printed out causes never ending
problems for developers.

Bug: 144534032
Test: libhidl_test tests this, which is on TH here
Change-Id: I02f37fb1e5b743131598ddc95ef89ebdfbdff615
2019-11-18 17:38:22 +00:00
Elliott Hughes
8c139cf850 Merge "ziptool: fix unknown long options."
am: fe983b6681

Change-Id: I9f192a6d1f3e9a5c92e898f21aa0ee0d1f125d07
2019-11-18 08:34:23 -08:00