Commit graph

43521 commits

Author SHA1 Message Date
yaochen
0db6f49cad Merge "Add a function to pass byte array to the log context." 2018-12-07 03:11:02 +00:00
Yao Chen
6bd71aef37 Add a function to pass byte array to the log context.
The existing APIs will truncate the byte array in case of '\0' in between.

Test: test_drive with atom 103
Change-Id: I104d35b330c6b52e2fdce1f5d4305dca08228f1b
2018-12-06 13:03:12 -08:00
Treehugger Robot
e813ad4b4f Merge "Add missing includes." 2018-12-06 20:22:17 +00:00
Florian Mayer
3f1f2e07ab Add missing includes.
Test: Builds.
Change-Id: Ia8b79154902503cdd774dc3b4523466123b4324c
2018-12-06 10:09:20 -08:00
Mark Salyzyn
215d1d510e Merge changes I368d3a56,Idb769991,Ia158b6ed
* changes:
  fs_mgr: overlay: use alternate for backing storage
  fs_mgr: overlay: split out fs_mgr_overlayfs_create_scratch()
  fs_mgr: overlay: split out fs_mgr_overlayfs_make_scratch()
2018-12-06 15:26:47 +00:00
Florian Mayer
a5913bdd07 Merge "Read .note.gnu.build-id." 2018-12-06 10:57:26 +00:00
Mike Yu
675a70be41 Merge "libsysutils can be linked statically" 2018-12-06 08:52:46 +00:00
Treehugger Robot
f2233fd67a Merge "Update shell documentation for the current state of master." 2018-12-06 03:49:24 +00:00
Mike Yu
c987859c70 libsysutils can be linked statically
Let libsysutils able to be statically linked by libnetd_resolv to
minimize the dependence on system ABI.

Test: m libsysutils
Change-Id: Ideb322dbc8d594a8a37d64f8140bc37090a4e238
2018-12-06 12:32:49 +09:00
Tom Cherry
05735591f8 Merge "init: disable asan" 2018-12-06 03:14:58 +00:00
Tom Cherry
50f5246352 Merge "Fix /init -> /system/bin/init symlink creation race" 2018-12-06 03:14:15 +00:00
Treehugger Robot
323ca1ea6b Merge "fs_mgr: Add fs_mgr_overlayfs_is_setup()" 2018-12-06 01:01:06 +00:00
Andreas Gampe
72050f715f Merge "Base: Explicitly set abort message on FATAL" 2018-12-06 00:14:17 +00:00
Tom Cherry
c12e205ec5 Fix /init -> /system/bin/init symlink creation race
A symlink for TARGET_ROOT_OUT as a post install command of a package
that is also installed to TARGET_ROOT_OUT.  We hijack init.rc which
satisfies this requirement for this symlink.

Bug: 120402274
Bug: 120460755
Bug: 120509320
Bug: 120554662
Test: symlink is created
Test: make bootimage && ls -la $OUT/root/init
Change-Id: I6f1ac06ef152c36d7d7db4618d49a008338da39b
2018-12-05 23:42:07 +00:00
Mark Salyzyn
f269312466 fs_mgr: overlay: use alternate for backing storage
When we have multiple physical super partitions, it is prudent to
take the alternate super physical partition in its raw entirety
rather than to construct a logical partition out of the current
super partition's limited remaining space.

SideEffect: alternate boot partitions destroyed for the sake of debug
Test: adb-remount-test.sh (including manually disabled to check
      both code paths).
Bug: 119885423
Change-Id: I368d3a5619f69de3b0d1fcad73c4b42d25d0d969
2018-12-05 14:01:59 -08:00
Mark Salyzyn
13a6605070 fs_mgr: overlay: split out fs_mgr_overlayfs_create_scratch()
Reduce some complexity in fs_mgr_overlayfs_setup_scratch()

Test: adb-remount-test.sh
Bug: 119885423
Change-Id: Idb769991f6342739c75654b1d42ab8f8633cbadf
2018-12-05 13:59:33 -08:00
Mark Salyzyn
d14eb57377 fs_mgr: overlay: split out fs_mgr_overlayfs_make_scratch()
Reduce some complexity in fs_mgr_overlayfs_setup_scratch()

Test: adb-remount-test.sh
Bug: 119885423
Change-Id: Ia158b6ed140a017fc2f5afb838482e0f8cba1222
2018-12-05 13:59:23 -08:00
Tom Cherry
f8315f073f init: disable asan
Asan requires /proc to be mounted, which means it fundamentally cannot
be used with first stage init.  Given that second stage init now
contains the logic for first stage init, asan must be disabled on all
of init until this can be resolved.

Bug: 120424438
Bug: 120561310
Test: Asan builds boot
Change-Id: I24d1a0c8ecb5eb3f77435e6e36432c7b4cb97c6a
2018-12-05 13:52:42 -08:00
Elliott Hughes
b9c064e140 Update shell documentation for the current state of master.
Test: N/A
Change-Id: I6efdd73ef44f376820f471dcfcd8005aa1e79cb0
2018-12-05 13:08:32 -08:00
Andreas Gampe
2819c0b831 Base: Explicitly set abort message on FATAL
Currently bionic only stores the first invocation of
android_set_abort_message, libbase splits the logging invocations
into discrete lines, and liblog automatically calls bionic when
fatal severity is used. This leads to only the first line of
LOG(FATAL) being stored for tombstoned.

Eagerly set the abort message directly before logging when the
severity is FATAL. This ensures the complete message will be
available.

Bug: 120506942
Test: m
Test: manual
Change-Id: I104d6960a2b1f66f21f5ada383fb4ab0f35e96a9
2018-12-05 12:59:15 -08:00
Tom Cherry
e1e71b9b98 Merge "init: allow first stage mount to read an fstab" 2018-12-05 20:32:08 +00:00
David Anderson
dbbbb17c1d Merge "fastboot: Check if super_empty.img exists before reading it." 2018-12-05 19:35:56 +00:00
Florian Mayer
da459e56f7 Read .note.gnu.build-id.
This will be used by heapprofd to allow us to correlate build ids with
memory leaks in libraries and binaries.

Test: m
Test: host libunwindstack_test
Test: run unwind_info against my phone's libc.so (32/64) and compare
      to readelf Build ID output.

Bug: 120186412

Change-Id: I3cefd6cce9a8733509bf35b7175eb0f967783477
2018-12-05 14:13:30 +00:00
David Anderson
0047580398 fastboot: Check if super_empty.img exists before reading it.
On non-DAP devices, fastboot flash <partition> will spam error messages
about not being able to read super_empty.img. We should check that
super_empty.img exists before trying to read it.

Bug: 120429424
Test: fastboot flash system on non-DAP device
Change-Id: I6c4eec19cb3ef8d24595a75e072e1d75baaa8cdd
2018-12-04 17:12:58 -08:00
Tom Cherry
5ae47e10c8 Merge "fs_mgr: use more unique_fd" 2018-12-05 00:32:36 +00:00
Alistair Strachan
5d55580fe1 Merge "Handle renamed "super" device correctly" 2018-12-05 00:06:41 +00:00
David Anderson
5cd7969177 Merge "liblp: Allocate "b" extents in the second half of super." 2018-12-04 21:53:48 +00:00
Tom Cherry
0d2621f2ac fs_mgr: use more unique_fd
Modernize a bit of code in preparation for the rest of the
modernization.  Use more unique_fd and fix a few fd leaks in the
process.

Bug: 62292478
Test: boot
Change-Id: I2a6f1abaa1b9a4e979baea36764b91157c2ed218
2018-12-04 13:25:52 -08:00
Treehugger Robot
46d19d34d1 Merge "adb: fix authentication when reconnecting." 2018-12-04 20:41:14 +00:00
Alistair Strachan
1906d5f357 Handle renamed "super" device correctly
In the non-retrofit case, the metadata source partition will be
hardcoded as "super", but such a partition may not exist or may have
been overridden by super_partition=<something>. Make this work reliably
by plumbing the resolved metadata block device through, and using it any
time a partition called "super" is requested.

This also fixes a case in the first_stage_mount code that assumed that
detected a non-A/B, non-retrofit case by assuming the metadata source
partition would be called "super".

Bug: 113175337
Test: boot test on cuttlefish
Change-Id: I8ce1defb902e257eeb7170d697b378eba31faee3
2018-12-04 11:21:34 -08:00
Mark Salyzyn
dd748aa41c fs_mgr: Add fs_mgr_overlayfs_is_setup()
Provide a means to determine if overlayfs is currently active with
fs_mgr_overlayfs_is_setup().  Search for current clues in the system
that the overrides are in play.  If /mnt/scratch/ is mounted, that
may be enough of a smoking gun because the resource itself may
interfere with operations.

Related to update_engine calling this function to reject performing
an OTA as its operations are incompatible with the overrides.

Test: adb-remount-test.sh
Bug: 120034852
Change-Id: I641163b1559c1a83fe7d0c336d04c10e9956ad3a
2018-12-04 11:06:47 -08:00
Tom Cherry
e68bf85fd6 init: allow first stage mount to read an fstab
Now that we have a first stage ramdisk (or use recovery in its place),
it's possible to place a vendor specific fstab along with first stage
init, removing the need for device tree modifications to have an
fstab.

Bug: 117933812
Test: hikey boots with only an fstab in first stage ramdisk
Test: blueline mainline boots with a disabled DT fstab and an fstab in recovery
Change-Id: I4460b88851557a75ba06ff795cd842e7dfb6da46
2018-12-04 11:06:30 -08:00
Tom Cherry
bb72b808f4 Merge "Convert fs_mgr_swapon_all() to use the new Fstab struct" 2018-12-04 18:41:56 +00:00
Treehugger Robot
a30cff7f89 Merge "fs_mgr: Change scratch margin to 3 X logical_block_size." 2018-12-04 16:30:25 +00:00
Neil Fuller
87aa446d48 Merge "Add ANDROID_RUNTIME_ROOT environment variable" 2018-12-04 12:39:16 +00:00
Treehugger Robot
239245fe79 Merge "Enable the APEX support on the device side." 2018-12-04 12:29:06 +00:00
Josh Gao
4414e4c728 adb: fix authentication when reconnecting.
If we have multiple keys available for authentication (ADB_VENDOR_KEYS
+ the one in ~/.android), we will still have keys in our list of
avilable keys after we've successfully connected. A subsequent
reconnection will start authorizing using the list of keys after the
key that actually worked, resulting in that session being unauthorized
until another reconnection happens. Clear the key list before
reconnecting to fix this. (We could do this after successfully
connecting, but we need to do this before reconnecting anyway, because
our connection could have died during authorization.)

Bug: http://b/117267347
Test: `adb connect foo; adb -s foo reconnect device` with ADB_VENDOR_KEYS
Change-Id: Ieb7dcc28e333c89ae0d75f97e89bcd1b571cb299
2018-12-04 01:08:55 -08:00
Treehugger Robot
a7f54b1592 Merge "C++17 is the default now." 2018-12-04 07:53:24 +00:00
Dan Willemsen
f56dad3fff Merge "Prevent dependency cycle due to system_shared_libs expansion" 2018-12-04 06:19:09 +00:00
David Anderson
8acb5dc1c5 liblp: Allocate "b" extents in the second half of super.
When allocating "b" partitions on a non-retrofit A/B device, prioritize
regions occuring in the second half of the super partition. To make this
effective, the region covering the midpoint sector is split into two
additional regions.

This will allow OTAs to avoid unecessary fragmentation, since each
slot's partitions will be grouped together, leaving a large chunk of
contiguous space available when the OTA deletes the target slot. Since
updates are not allowed to consume more than half of the super
partition, this should guarantee one extent per partition. Note that, if
this restriction is not in place (for example, a developer flashes a
massive "system_b"), then an additional extent will be allocated due to
the region that was split.

Bug: 120433288
Test: liblp_test gtest
Change-Id: I1797e59e14c8b0d4d0e6855a1d984e8159b21df2
2018-12-03 16:58:34 -08:00
Tom Cherry
0c7fb42949 Merge "fs_mgr: Create a C++ Fstab struct" 2018-12-04 00:10:33 +00:00
Jaewoong Jung
7174ec8fff Merge "Revert "Revert "Revert "adb: append the libwinpthread COPYING to adb's NOTICE."""" 2018-12-03 23:57:42 +00:00
Dan Willemsen
d3825898da Prevent dependency cycle due to system_shared_libs expansion
It was discovered that we were building some objects inconsistently due
to an optimization in cc_library to only build objects once and use them
for both the static and shared libraries. But static libraries didn't
get system_shared_libs set automatically, and we didn't notice that we
would have built the objects differently.

So static libraries now get the default system_shared_libs, we allow
adjusting that for static vs shared in a cc_library, and we disable the
optimization if the linked libraries are configured differently between
static and shared in a single cc_library.

This triggers dependency cycles for static libraries that libc/libdl
use, so fix those cycles here.

Test: treehugger
Change-Id: I6ec2ea45292b602d5c506560de8b8d6ae725be6f
2018-12-03 15:50:00 -08:00
Josh Gao
946f7d44c2 Merge "base: add more error-checking overloads for unique_fd." 2018-12-03 22:41:22 +00:00
Mark Salyzyn
756eebe819 fs_mgr: Change scratch margin to 3 X logical_block_size.
Found a device with a 3/4MB erase block, give a wider margin so that
flashing a single partition is unlikely to be blocked by scratch.

Add documentation to tell developers to flashall to clear scratch.

Test: adb-remount-test.sh
Bug: 109821005
Change-Id: Ic219283f4c42e457b98991bcd1752253e182eff3
2018-12-03 12:15:25 -08:00
Treehugger Robot
307337fb40 Merge changes I6a4c3d9b,Ia5cdb797,I946eb605,Ieff3f6ea
* changes:
  init: overlay: allow fs_mgr_overlayfs_required_devices to report partitions
  fastboot: call fs_mgr_overlayfs_teardown() in UpdateSuper
  fs_mgr: overlay: disable overrides in recovery or fastbootd.
  fs_mgr: overlay: umount scratch more aggressively
2018-12-03 20:14:02 +00:00
Treehugger Robot
5d595da516 Merge "fs_mgr fix flags/fs_mgr_flags mismatch" 2018-12-03 19:07:45 +00:00
Daniel Mentz
9cb7704ab4 Merge "Increase netlink uevent rcvbuf size to 16M" 2018-12-03 18:39:42 +00:00
Daniel Mentz
41aa2c3703 Increase netlink uevent rcvbuf size to 16M
Increase size of the NETLINK_KOBJECT_UEVENT socket receive buffer to
16M.  Also, use SO_RCVBUFFORCE to override any limits set by
/proc/sys/net/core/rmem_max.

We had a couple of instances, where we lost critical uevent messages due
to receive buffer overflows.

Bug: 119933843
Change-Id: I6aab183aa0194e173f9175b47c6beb0835cf6675
2018-12-03 18:39:24 +00:00
Tom Cherry
3055457a96 Convert fs_mgr_swapon_all() to use the new Fstab struct
Bug: 62292478
Test: build
Change-Id: Ifbde514bf73d3ce2f321326291daa025b6afac46
2018-12-03 09:41:01 -08:00