Commit Graph

42416 Commits

Author SHA1 Message Date
Hans Boehm b9d0753d2b Revert "Prepare to fail in RefBase destructor if count is untouched"
This reverts commit 9d3146af22.

Reason for revert: It appears that weak symbols don't work as expected on MacOS, breaking the MacOS aapt build.

Change-Id: Ica0955106485a7bf2e2c3f09ff7910e230eb4139
2018-08-07 05:35:12 +00:00
Josh Gao 297d9bf8ea adb: actually enable fdsan.
adb was using a custom unique_fd closer that didn't have an
implementation for fdsan, which meant that none of our FDs were
actually tracked. Guard this behind ifdefs so that we only use this
on Windows, and delete our implementation of Pipe in favor of the one
in libbase while we're at it. libbase's implementation always sets
O_CLOEXEC, so fix up the instance of Pipe that doesn't expect that.

Test: mma
Test: adb start-server
Test: debuggerd `pidof adbd`
Change-Id: Ic29d641a2f93fb42384b00c51775048c8bcbe152
2018-08-06 18:50:10 -07:00
Josh Gao 9d100f1043 adb: move AdbCloser to its rightful place.
Test: mma
Change-Id: Ie74c49e8abf72f594a35d04b2b0d99b96f58f8d0
2018-08-06 18:50:10 -07:00
Josh Gao ce841d91fb libdebuggerd: extract and print the fdsan table.
This commit only prints the raw value of the owner tag, pretty-printing
will come in a follow-up commit.

Test: debuggerd `pidof adbd`
Test: static_crasher fdsan_file + manual inspection of tombstone
Change-Id: Idb7375a12e410d5b51e6fcb6885d4beb20bccd0e
2018-08-06 18:50:10 -07:00
Josh Gao 9da1f51c10 crash_dump: pass the address of the fdsan table.
Pass the address of the fdsan table down to crash_dump so that we can
dump the fdsan table along with the open file descriptor list.

Test: debuggerd_test
Test: manually ran an old static_crasher
Change-Id: Icbac5487109f2db1e1061c4d46de11b016b299e3
2018-08-06 18:50:10 -07:00
Treehugger Robot 4f878cf6cb Merge "fs_mgr: Do not mount empty partitions." 2018-08-07 00:52:34 +00:00
Treehugger Robot a70e2b2ed7 Merge "liblp: Allow flashing to readonly logical partitions." 2018-08-07 00:28:48 +00:00
Xin Li fb973d34ac Merge Android Pie into master
Bug: 112104996
Change-Id: Ib0e5b2801a931b469b753806b1fbe2fabb0c1de5
2018-08-06 17:26:31 -07:00
Treehugger Robot c4630ef445 Merge "Allow existance of partition to be checked before flashall or update" 2018-08-07 00:20:46 +00:00
Treehugger Robot c30a75a007 Merge "Add fastbootd." 2018-08-07 00:08:18 +00:00
David Anderson 6868cb9f5e fs_mgr: Do not mount empty partitions.
If a logical partition is resized to 0 bytes, it will have no extents.
This is not allowed by device-mapper, but is useful for effectively
compacting partitions with "fastboot flashall". If all logical
partitions are resized to 0, then resized to their intended size, then
we will allocate extents more efficiently.

However, if a partition is left with a zero size (either intentionally
or not), this should not throw the device into a reboot loop due to
CreateLogicalPartitions failing. Instead we skip partitions with no
extents.

Bug: 78793464
Test: with fastbootd:
        fastboot create-partition example 4096
        fastboot resize-partition example 0
      device reboots successfully

Change-Id: I572efa949176c8c3c493ef00438d8badd4d7cf4f
2018-08-06 15:59:38 -07:00
David Anderson 4d71d85805 liblp: Allow flashing to readonly logical partitions.
By default, logical partitions with the readonly flag are created with a
readonly device. This change allows callers of CreateLogicalPartition
to create writable devices so they can still be flashed.

Bug: 78793464
Test: fastboot flash product_services works with fastbootd
Change-Id: Ia8d2761a3067e3b62815acbf0b6fb7f033072ba2
2018-08-06 15:47:26 -07:00
Tao Bao 19e545c12d Merge "adb: `adbd` uses shared libraries."
am: 0e947189c5

Change-Id: If6dd1b01b0ae7b71c8911045ef0570f0c226e5d9
2018-08-06 15:34:51 -07:00
Tao Bao 0e947189c5 Merge "adb: `adbd` uses shared libraries." 2018-08-06 21:55:28 +00:00
Tao Bao eca59ae895 adb: `adbd` uses shared libraries.
This CL builds the former `libadbd` as a shared library, and moves
`adbd` to using shared libraries.

We can't switch `libadbd` from static to shared library directly, due to
the circular dependency between `libadbd` and `adbd`. In particular,
daemon_service_to_fd() can't be compiled into `libadbd`, as it needs to
be overridden by recovery/minadbd.

This CL creates a static library `libadbd_core` as the common base,
which contains everything from the former `libadbd`. Both of the two
shared library targets `libadbd` and `libadbd_services` depend on
`libadbd_core`.

The `adbd` on device (under both of normal boot and recovery) now
depends on `libadbd.so` and `libadbd_services.so`. recovery/minadbd will
depend on `libadbd.so` and `libminadbd_services.so` in future (after
fully converting recovery to Soong).

Bug: 78793464
Test: `m dist`
Test: Run adbd_test on marlin.
Test: Build and flash marlin on device. Check basic adbd functionalities
      (`adb shell` and `adb sync`) under normal boot and recovery.
Test: `adb sideload` on marlin.
Change-Id: Iacbd4db524ef94abd175cd1d27688f4faf3db024
2018-08-06 11:40:47 -07:00
Hridya Valsaraju f1f0a9c8a5 Allow existance of partition to be checked before flashall or update
Bug: 112108453
Test: fastboot flashall with super.img and product-services.img in $OUT,
fastboot update with super.img and product-services.img in image.zip.

Change-Id: I5718b5e60c546c55af74292895b3f7fe169e4f02
2018-08-06 11:05:37 -07:00
Hans Boehm b708511f78 Merge "Prepare to fail in RefBase destructor if count is untouched"
am: f502182ac6

Change-Id: I91ff7140a9a72c910ef01a2e13f277fa36c82b50
2018-08-06 11:01:28 -07:00
Tom Cherry 31438489c0 split first stage init into a separate executable
In the future, systems with dm-linear will require a ramdisk to set up
the mount for system.  In this world, first stage init will be a part
of this ramdisk and handle setting up dm-linear, mounting the
necessary partitions, then pivoting to the system image, which will
become the root partition.

This also enables previous devices without system-as-root, to be
unified with system-as-root devices for all aspects of boot after the
pivot_root.

Bug: 79758715
Test: boot hikey
Test: boot sailfish, boot sailfish into recovery
Change-Id: Iefa88a3ec5994e7989aa9f26f2de0351ffa5468b
2018-08-06 10:36:43 -07:00
Hans Boehm f502182ac6 Merge "Prepare to fail in RefBase destructor if count is untouched" 2018-08-06 16:53:12 +00:00
Idries Hamadi ed409eaec2 Integrate adb with fastdeploy
Test: lunch sdk-eng && make sdk -j44
Test: lunch aosp_walleye-eng && cd system/core/adb && mm
Test: adb install -r -f --force-agent --local-agent ~/example_apks/example.apk
Test: adb install -r -f --no-streaming --force-agent --local-agent ~/example_apks/example.apk

Change-Id: Ia1c2160f87ea584656f8fdd67e314a260d39d607
2018-08-06 13:57:47 +01:00
Christopher Ferris 5aa46568b3 Merge "Be permissive about badly formed elf files."
am: c7815d675a

Change-Id: Ie62a0bd4f1fb50a2a02a0129a5006485a51ae734
2018-08-04 10:33:46 -07:00
Christopher Ferris c7815d675a Merge "Be permissive about badly formed elf files." 2018-08-04 17:28:35 +00:00
Hans Boehm 9d3146af22 Prepare to fail in RefBase destructor if count is untouched
Move towards crashing if a normally configured RefBase object is
destroyed without ever incrementing the reference count. We've been
threatening to do this for a long time. The previously last known
violation had been fixed.

This also fixes stack trace printing from RefBase, which had previously
been broken, and which we found necessary to track down further
violations of this rule.

Unfortunately, we found several more violations with the aid of
that fix. After existing CLs are submitted, there are
still some failures, but they are no longer numerous. Thus this CL
doesn't actually crash in the event of a violation, but does log a
verbose stack trace if it encounters one.

Bugs have been filed against the remaining known RefBase client offenders.
We plan to enable crashing on usage violations once those are fixed.

The fix for the stack trace printing breakage unfortunately requires
the use of weak symbols in order to avoid a circular build dependency.
We expect to eventually replace this with execinfo.h functionality.

Some random reformatting, driven by consistency with current formatting
requirements.

Add missing include to BacktraceMap.h.

Bug: 79112958
Bug: 30292291
Test: Boot AOSP, Master
Change-Id: I8151c54560c3b6f75ffc4c48229f0388a2066958
2018-08-03 17:56:47 -07:00
Tom Cherry 5744e4d7d2 Merge "Split init's source files init first stage and second stage"
am: e0f6dc46d8

Change-Id: Iec525d3fb0e09550895d67709ed958f8337d9e34
2018-08-03 16:00:05 -07:00
Calin Juravle d856c9c2c5 Merge "Accept DexMetadata files (.dm) for install-multiple"
am: d560f39fd7

Change-Id: Ib41e955f4e9d20b10ddd517507142346b273b683
2018-08-03 15:59:18 -07:00
David Anderson 8660f5a85c Merge "liblp: Try to merge extents during partition resizes."
am: b0c9318493

Change-Id: Ib124843c47f710665e1d9134eae11edb7575863e
2018-08-03 15:58:35 -07:00
Christopher Ferris 497d0dd5e5 Merge "Fix incorrect left shifts."
am: d2b5a53ef8

Change-Id: Ica7dcb8d4606aeeeae71667400ddb833a03cd808
2018-08-03 15:57:57 -07:00
David Anderson 727c80765d Merge "liblp: Add more logging for logical partition operations."
am: 805bc5d757

Change-Id: If08681fc946f0bd21854459c7efd5986e81a7823
2018-08-03 15:57:21 -07:00
Tom Cherry e0f6dc46d8 Merge "Split init's source files init first stage and second stage" 2018-08-03 22:44:31 +00:00
Christopher Ferris 5acf069a7a Be permissive about badly formed elf files.
Here is the allowable issues with an elf file that will not result in an error:
- The program headers/section headers offset points to unreadable memory.
- Allow missing program header and/or section headers.
- Allow a symbol table section header to point to invalid symbol table values.

There is no real reason to require the elf file be perfect. Everything in
the code has sane defaults, so any missing information won't cause any
problems.

This gets rid of the warning that occurs any time an elf is loaded
from memory. In memory elf files never contain all of the section headers,
and do not contain the symbol table data.

Update tests to test these new cases.

Test: Builds and unit tests all pass.
Change-Id: Iaefe2cd6b6c965a01ed425a112d6afae339f3b78
2018-08-03 22:02:05 +00:00
Tom Cherry 44aceed016 Split init's source files init first stage and second stage
This is a baseline for splitting init first and second stage into
their own executables.

Bug: 79758715
Test: sailfish boots
Change-Id: I549ad4502893b3a5e4c2a9886f66850f6d31b619
2018-08-03 13:40:17 -07:00
Treehugger Robot d560f39fd7 Merge "Accept DexMetadata files (.dm) for install-multiple" 2018-08-03 20:14:28 +00:00
Treehugger Robot b0c9318493 Merge "liblp: Try to merge extents during partition resizes." 2018-08-03 20:02:41 +00:00
Christopher Ferris d2b5a53ef8 Merge "Fix incorrect left shifts." 2018-08-03 19:58:06 +00:00
Treehugger Robot 805bc5d757 Merge "liblp: Add more logging for logical partition operations." 2018-08-03 19:52:47 +00:00
Tom Cherry 3676564019 Merge "Move watchdogd out of init"
am: 132615b803

Change-Id: Icfc2511dfa3b905e25d6b8187557871960c0f9b1
2018-08-03 12:37:22 -07:00
Tom Cherry 132615b803 Merge "Move watchdogd out of init" 2018-08-03 19:28:14 +00:00
Calin Juravle f03eebdd59 Accept DexMetadata files (.dm) for install-multiple
Allow .dm files (DexMetadata) to be passed to adb install-multiple.

Do not rename the input files based on their indices as the naming matters
for associating an .dm file to an .apk file.

Test: adb install-multiple -p com.android.cts.classloadersplitapp base.apk
     split.apk split.dm

Bug: 30934496
Change-Id: I2ac39e00d64eae938124250033f79e02f3c3f9c0
(cherry picked from commit aa7753871e)
2018-08-03 11:21:06 -07:00
David Anderson 1aab3909f7 liblp: Try to merge extents during partition resizes.
When adding extents to partitions, if the previous extent and new extent
are contiguous, merge them together to avoid allocating unnecessary
device-mapper targets.

Bug: 79173901
Test: liblp_test gtest
Change-Id: I80087df9aea8141c5e16f8d4cdb3dd7da02aee8c
2018-08-03 11:02:25 -07:00
David Anderson b9f734c936 liblp: Add more logging for logical partition operations.
This logs when partition tables update, when partitions resize, and when
partitions are unmapped from device mapper.

Bug: N/A
Test: N/A
Change-Id: I1125332c79fccc3ebc556b3b48856901e2503c47
2018-08-03 10:59:43 -07:00
Suren Baghdasaryan 5d95ac61d7 [automerger skipped] Merge "Enable lmkd kill tracing everywhere"
am: e961bbcadc  -s ours

Change-Id: I8551e637d4aec87c75ff6079040d0cde1b8f248c
2018-08-03 10:58:06 -07:00
Suren Baghdasaryan e961bbcadc Merge "Enable lmkd kill tracing everywhere" 2018-08-03 17:49:29 +00:00
Hridya Valsaraju 71fb82a271 Add sideload, fastboot as reboot targets in init
Rebooting to these targets requires writing bootloader
messages and thus root. Moving them into init means that
adb, reboot don't need root to use these targets.

Test: try rebooting to these targets
Bug: 78793464
Change-Id: Ia002d1e3b1cb0c0616f60435fb9af4dce162cf84
2018-08-03 10:03:41 -07:00
Suren Baghdasaryan 9461708ec9 Merge "lmkd: Disable memory.stat usage when per-application memcgs are not used"
am: 615745cead

Change-Id: I57f3142ed217d4f1b3edb526087076fc588354d7
2018-08-03 09:14:09 -07:00
Daniel Colascione cd9ba8cbad Enable lmkd kill tracing everywhere
Test: asdf
Exempt-From-Owner-Approval: vacation
Merged-In: If6af7df74d303466aac4a69cdfe558e9748f72b9
Change-Id: If6af7df74d303466aac4a69cdfe558e9748f72b9
2018-08-03 16:08:01 +00:00
Treehugger Robot 615745cead Merge "lmkd: Disable memory.stat usage when per-application memcgs are not used" 2018-08-03 16:07:24 +00:00
Suren Baghdasaryan ce13cb52fe lmkd: Disable memory.stat usage when per-application memcgs are not used
Per-application memory.stat files are not available when per-application
memcgs are not used (per_app_memcg=false). Disable its usage based on
ro.config.per_app_memcg property.

minchan:
* correct indentation of memory_stat_parse
* move per_app_memcg check into memory_stat_parse inside
* change low_ram_device to per_app_memcg

Bug: 110384555
Test: manual test to see lkmd log message with memory hogger
Merged-In: Ib6dd7586d3ef1c64cb04d16e2d2b21fa9c8e6a3a
Change-Id: Ib6dd7586d3ef1c64cb04d16e2d2b21fa9c8e6a3a
Signed-off-by: Minchan Kim <minchan@google.com>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-08-03 16:06:54 +00:00
Elliott Hughes 71797610f0 Merge "Remove dead gglFastDivx."
am: a02ca9e7ae

Change-Id: I2f836242c432b3695f768b184b87cef1a1f8ea1e
2018-08-03 07:33:41 -07:00
Elliott Hughes a02ca9e7ae Merge "Remove dead gglFastDivx." 2018-08-03 14:24:22 +00:00
Christopher Ferris 2786608743 Fix incorrect left shifts.
Bug: 112142060

Test: New unit tests pass.
Change-Id: I0c47b22582f0bf75ab503364a337c7de4de3ec43
2018-08-02 18:01:02 -07:00