Commit Graph

52434 Commits

Author SHA1 Message Date
Treehugger Robot ea378530d6 Merge "<android-base/endian.h>: fix interoperability issue" 2019-09-19 00:17:22 +00:00
Treehugger Robot 948e4fa316 Merge "adb: fix adb remount -R" 2019-09-18 18:48:58 +00:00
Mark Salyzyn 6f908cefe7 adb: fix adb remount -R
A regression from commit 8c2198c809
("adb: use shell for remount to forward return codes.") where the
optional argv[1] got missed for the remount command.  This change
hands off _all_ the arguments if to a shell and activates some of
the extra features in the remount command.

$ adb remount --help
remount [-h] [-R] [-T fstab_file] [partition]...
	-h --help	this help
	-R --reboot	disable verity & reboot to facilitate remount
	-T --fstab	custom fstab file location
	partition	specific partition(s) (empty does all)

Remount specified partition(s) read-write, by name or mount point.
-R notwithstanding, verity must be disabled on partition(s).
$

SideEffects: adb remount [-h] [-R] [-T fstab_file] [partition]...
Test: adb-remount-test.sh
Bug: 138577868
Bug: 139283818
Bug: 139226412
Change-Id: I8223d4000ab20857e9b634e4d4a326eed530d7be
2019-09-18 09:40:50 -07:00
Tom Cherry b0321c1de1 Merge "fastboot: don't use sparse_file_import_auto() in load_buf_fd()" 2019-09-18 14:44:42 +00:00
Bowgo Tsai 41d8a576ec <android-base/endian.h>: fix interoperability issue
<winsock2.h> has defined htonl(), ntohl(), htons() and ntohs() with
different return type that cannot be replaced by those macro definitions
in <android-base/endian.h>.

Includes <winsock2.h> first to prevent them from being replaced.
Then defines the macro later so we don't need to call into DLL
when using those functions.

Bug: 139639521
Test: m libbase_test && wine out/host/windows-x86/nativetest64/libbase_test/libbase_test64.exe
Test: m checkbuild
Change-Id: I672f23a31c6800df10e04d36695d446bca4c91e9
2019-09-18 13:06:45 +08:00
Treehugger Robot 7922a44637 Merge "Using the correct feature name for abb_exec." 2019-09-18 02:51:28 +00:00
Christopher Ferris 5da9906af0 Merge "Allow getrlimit/ugetrlimit syscalls in tests." 2019-09-18 00:59:20 +00:00
David Anderson 0e70ce26b8 Merge "init: Make sure /dev/block/by-name/userdata is created in snapshot mode." 2019-09-18 00:35:55 +00:00
Yifan Hong 7509fca99a Merge changes from topic "libsnapshot_api_update_engine"
* changes:
  libsnapshot: CreateUpdateSnapshot accepts DeltaArchiveManifest
  libsnapshot: Add snapshot metadata updater.
2019-09-17 23:52:19 +00:00
Christopher Ferris ab60668ef4 Allow getrlimit/ugetrlimit syscalls in tests.
The fdsan code uses getrlimit/ugetrlimit so need to allow that when
running the debuggerd unit tests.

Bug: 141045754

Test: Ran the offending tests hundreds of times without failure.
Change-Id: Iece94f03e7895d61ca8a8f3ab17dce7e54ddf9cd
2019-09-17 15:31:47 -07:00
Tom Cherry fbb9535aae fastboot: don't use sparse_file_import_auto() in load_buf_fd()
load_buf_fd() attempts to find the size of the file that it is about
to load by first calling sparse_file_import_auto() then using
sparse_file_len() upon success or falling back to the file size on the
filesystem on failure.

This is problematic however as sparse_file_import_auto() creates a
sparse_file out of the normal file, but does not resparse it, so an
assertion fails during the sparse_file_len() call.

This is fixed by using sparse_file_import() instead.  This will fail
in the case that the file is not sparse and the call to
sparse_file_len() will be properly skipped.

Bug: 140538105
Test: flash blueline factory image with assertions enabled in
      libsparse/sparse.cpp

Change-Id: I0283be33563a3301ce5b09bde41105a20f91086c
2019-09-17 13:43:56 -07:00
Elliott Hughes f3a5ab8b1d Merge "Remove the global seccomp option." 2019-09-17 20:21:09 +00:00
David Anderson 1cfcee0e4d init: Make sure /dev/block/by-name/userdata is created in snapshot mode.
When userdata is used to store COW devices, we need to ensure we've
generated uevents for it.

This patch also refactors FirstStageMount to pass required devices
through arguments rather than a member variable.

Bug: 140761481
Test: manual test
Change-Id: Ie5e1c9699f084da5467a758eea41c7907fecc5ca
2019-09-17 13:19:22 -07:00
Yifan Hong 184bb8a77f libsnapshot: CreateUpdateSnapshot accepts DeltaArchiveManifest
DeltaArchiveManifest includes full update package metadata.
Now, CreateUpdateSnapshot reads the source
metadata, updates it, and write to target metadata slot as well.

Test: libsnapshot_test
Bug: 140868231

Change-Id: Ia885b336145d02111ecff1aad421cb9b1efd18c2
2019-09-17 12:55:23 -07:00
Yifan Hong d22459dff3 libsnapshot: Add snapshot metadata updater.
This class knows how to update super metadata for virtual A/B devices.

Test: libsnapshot_test
Bug: 138816109

Change-Id: I9e375c76814e0dcbb47fc2ea9e4903ba69ccf7f8
2019-09-17 12:55:23 -07:00
Treehugger Robot e5e9ee41d9 Merge "Add surenb@ to libprocessgroup OWNERS" 2019-09-17 18:18:52 +00:00
Christopher Ferris 1d1da49127 Merge "Fix LocalUpdatableMaps" 2019-09-17 16:32:06 +00:00
Treehugger Robot cda0a308eb Merge "Allocate UID for fs-verity ownership in keystore" 2019-09-17 16:08:48 +00:00
Tom Cherry 73f5b65ed4 Add surenb@ to libprocessgroup OWNERS
Test: n/a

Change-Id: Ia671384e4202f618d0ae08bc33f0ca8bbd9e53c1
2019-09-17 08:50:04 -07:00
Paul Crowley 21b00b31d4 Merge "Create /data/per_boot" 2019-09-17 05:40:05 +00:00
David Srbecky f1932fd107 Fix LocalUpdatableMaps
Avoid accessing nullptr of already deleted entry.

Add new unit tests that pass with the fix and fail without.

Test: fixes unwinding in ART gcstress tests
Test: All unit tests pass.
Change-Id: Ideb00e2adc899904dd6aeb5dad3fb6fad150322d
2019-09-16 18:28:38 -07:00
Yifan Hong 116d2ff503 Merge "liblp: convert more functions to use string_view (#4)" 2019-09-16 21:56:09 +00:00
Yifan Hong c2ff970b17 liblp: convert more functions to use string_view (#4)
Test: builds
Change-Id: Iad041762beb9eeab8b2174ab48a50677754248b5
2019-09-16 14:50:40 -07:00
Treehugger Robot 32017407fd Merge "ion-unit-tests: Add heap id verification test." 2019-09-16 18:29:22 +00:00
Alex Buynytskyy 7ea92d8232 Using the correct feature name for abb_exec.
Test: atest adb_test
Test: atest fastdeploy_test

Change-Id: Ib917ed8293d0f51339cade032c768a4058ba578e
2019-09-16 10:36:52 -07:00
Jaegeuk Kim cf4845b153 Merge "logcatd: fallocate and fadvise to logcat files" 2019-09-16 16:30:05 +00:00
Treehugger Robot 17438477cb Merge "libsnapshot: Fix typo in nullptr check" 2019-09-16 04:52:31 +00:00
Treehugger Robot d3268a71b8 Merge "boringssl_self_test: Enable optimization." 2019-09-16 04:29:32 +00:00
Paul Crowley 570d20d2ac Create /data/per_boot
Bug: 140882488
Test: Booted twice, checked logs to ensure encryption
    is different each time, adb created files in directory.
Change-Id: I44f746acd1040f7baa9123d4824ba39b194f287b
2019-09-13 15:50:23 -07:00
Tom Cherry a550e7f412 Merge "init: add reboot_on_failure service option" 2019-09-13 19:26:49 +00:00
Yifan Hong 101588127c Merge "Move digital_stroage.h to its own library" 2019-09-13 17:25:30 +00:00
Tobias Thierer 530d8f1d48 Merge "Set LOCAL_INJECT_BSSL_HASH for init_first_stage" 2019-09-13 16:56:06 +00:00
Tobias Thierer f0f9438d5b boringssl_self_test: Enable optimization.
libcrypto performs a self test when it is loaded, unless
a marker file /dev/boringssl/selftest/[hash] exists which
indicates that the self test has already successfully
completed since the last time the device was booted.

Before this CL topic, libcrypto attempted to create the
marker file when the self test successfully completed.
On Android, dedicated boringssl_self_test{32,64} binaries
are run early during boot and are the only binaries
(apart from init and vendor_int) that have permission to
create these files.

Another CL in this topic stops the boringssl self test
creating a marker file unless the environment variable
BORINGSSL_SELF_TEST_CREATE_FLAG is set to a nonempty value.
This CL sets that value to "true" when running the dedicated
self test binaries, but not for other binaries. This has
the effect that other binaries that run the self test
early during boot (before the dedicated self test binaries
have created the marker files) and which run the self test
will no longer attempt to create the marker file, which
SELinux would have denied anyway.

Bug: 137267623
Test: Treehugger

Change-Id: I99317df1a8c3496d33ae83f9ec346782b2286ac9
2019-09-13 16:51:57 +01:00
Tom Cherry 60971e6ce2 init: add reboot_on_failure service option
This replaces the recently added `exec_reboot_on_failure` builtin, since
it'll be cleaner to extend service definitions than extending `exec`.
This is in line with what we decided when adding `exec_start` instead
of extending `exec` to add parameters for priority.

Test: `exec_start` a service with a reboot_on_failure option and watch
      the system reboot appropriately when the service is not found and when
      the service terminates with a non-zero exit code.

Change-Id: I332bf9839fa94840d159a810c4a6ba2522189d0b
2019-09-13 16:48:35 +01:00
Greg Kaiser 99ab97836b libsnapshot: Fix typo in nullptr check
We already know 'existing_extent' is non-null (or else we would
have crashed on the previous line).  We fix this to check
'existing_linear_extent' against nullptr.

Test: TreeHugger
Change-Id: I03338bca87d1c2bd0cbea0e1ec31244ba9570a40
2019-09-13 06:58:03 -07:00
Treehugger Robot 6f735df0d1 Merge "init.rc: Move /system/bin/boringssl_self_test{32,64} call to early-init." 2019-09-13 08:22:29 +00:00
Colin Cross 58505923e5 Set LOCAL_INJECT_BSSL_HASH for init_first_stage
init_first_stage is built in Make and statically links libcrypto,
so it needs to set LOCAL_INJECT_BSSL_HASH to make the FIPS self
test pass.

Bug: 137267623
Test: m checkbuild
Change-Id: Icd8ec07b731228a162db9a13d7304bf1d73127aa
2019-09-13 03:31:42 +01:00
Tobias Thierer bda0554bb2 init.rc: Move /system/bin/boringssl_self_test{32,64} call to early-init.
This should ensure that the self tests run before any other binaries
that load libcrypto and which would otherwise run into SELinux denials
trying to create the marker file /dev/boringssl/selftest/[hash]

The invocation of the self test binaries from the Conscrypt apex
requires the apex to be mounted so it remains at a later point in
the boot process.

Bug: 137267623
Test: Treehugger
Change-Id: I34266d6e9d2f394fffa8a2c7725479b5770d119c
2019-09-13 03:31:42 +01:00
Tom Cherry 385aeb2dda Merge "ueventd: allow using external firmware handlers" 2019-09-12 22:52:37 +00:00
Yifan Hong f6fccc466a Move digital_stroage.h to its own library
...so that it can be used by other tests.

Also, clean up the code before exposing it.

Test: libsnapshot_test
Test: liblp_test

Change-Id: I627326f696ea55b7113ff26b313f7dd04e341dc1
2019-09-12 15:50:51 -07:00
Yifan Hong bd122aa9c2 Merge changes from topic "libsnapshot_api_update_engine"
* changes:
  libsnapshot: tests for public APIs.
  fastbootd: skip COW group
  libsnapshot: no overlayfs during virtual a/b ota.
  libsnapshot: Also use empty space in super for COW
  libsnapshot: APIs for all partitions
  fs_mgr: CreateDmTable takes CreateLogicalPartitionParams
2019-09-12 22:36:08 +00:00
Treehugger Robot fd010252c2 Merge "adb: fix old host transport selection." 2019-09-12 19:58:20 +00:00
Tom Cherry dcb3d15611 ueventd: allow using external firmware handlers
Userspace may want to load a different firmware than the one that the
kernel requests in some cases, therefore this change adds the ability
to ueventd to run an external handler that will determine the name of
the file that should actually be loaded.

Bug: 138352500
Test: unit tests
Change-Id: Ic5da37268fd78109f83ae52d1b903bf7322a5ee5
2019-09-12 12:57:22 -07:00
Josh Gao 727b07b260 adb: fix old host transport selection.
We regressed handling of the old host transport selection syntax, which
broke users that reimplement adb themselves (e.g. Studio via ddmlib).

Bug: https://issuetracker.google.com/140369526
Test: adb raw "host-serial:822X0028S:forward:tcp:42929;localabstract:/com.example.ndktest-0/platform-1568299082100.sock"
Test: ./test_device.py
Change-Id: Iaaec8fde952316fe9bf2a6f6c6c4a3bc9f74bf72
2019-09-13 00:26:37 +08:00
Treehugger Robot 4cbecc9584 Merge "Remove -D_FILE_OFFSET_BITS=64 on host builds" 2019-09-12 15:14:36 +00:00
Yifan Hong 26d7d95391 libsnapshot: tests for public APIs.
Test: libsnapshot_test

Change-Id: I411ae32e77914845ed4037d7e67620598f8218cf
2019-09-11 18:32:57 -07:00
Yifan Hong 0e13bbade3 fastbootd: skip COW group
Skip importing COW group because they are dynamically
created by OTA clients and will never show up in built
images.
Test: flash

Change-Id: I44e7693cfb4c15e64455b56212a02f9abde88d61
2019-09-11 18:32:57 -07:00
Yifan Hong 65d94596f2 libsnapshot: no overlayfs during virtual a/b ota.
With overlayfs enabled, the scratch partition takes up
super partition, causing retrofit devices to create COW
images.
Test: OTA on retrofit device, no COW images created.

Change-Id: I35a1a2d02c8acf9efc33965c7e015f960bf45296
2019-09-11 18:32:57 -07:00
Yifan Hong 20a23bb41c libsnapshot: Also use empty space in super for COW
The super partition usually has some empty space even after
the target partitions are created, especially for retrofit
Virtual A/B devices. Use that empty space for COW before taking
up userdata space.

- PartitionCowCreator computes free regions in super partition metadata
  and use that space until it is used up. It returns a pair of numbers
  (cow_partition_size, cow_file_size) and let SnapshotManager to create
  the partition / images with proper sizes.
  - A region is considered free iff it is used by NEITHER target NOR
    source partitions
  - The list is in PartitionCowCreator's return value so that
    SnapshotManager can use it as a guide when creating partitions.
  - These partitions are created under the group named "cow".
    - Avoid mapping COW partitions directly during init first stage
      mount. Init only maps them when they are needed by the top-level
      device.
- CreateCowImage no longer zero-fills the first 4 bytes of the image.
  (See below)
- CreateUpdatePartitions: after creating the snapshot, also maps the COW
  devices (via MapCowDevices()) and zero-fills the first 4 bytes of the
  top-level COW device.
- Add a new SnapshotManager::MapCowDevices() function, which maps both
  the COW partition (in super) and the COW image (through
  IImageManager) (if necessary). Then, create a dm-linear target that
  concatenates them (if necessary).
- Add a new SnapshotManager::UnmapCowDevices() functions that does the
  reverse MapCowDevices().
- DeleteSnapshot also unmaps the top-level COW device and COW partition
  before unmapping the COW images (before deleting them).

Test: libsnapshot_test

Change-Id: I0098b7e842ab48b0b4dd2a59142098b098d23d34
2019-09-11 18:32:57 -07:00
Yifan Hong c69029f2a8 libsnapshot: APIs for all partitions
Add CreateCowForUpdate / MapSnapshotDevicesForUpdate
that update_engine and init can call them directly.

Bug: 134536978
Test: libsnapshot_test

Change-Id: If53c48855931db27454fd2893745915c77fd37f8
2019-09-11 18:32:57 -07:00