Commit Graph

42773 Commits

Author SHA1 Message Date
Christopher Ferris 1f34c0e7a4 Fix handling of globals for new linker.
The new linker base map is read-only, but the global handling code
for jit and dex information assumed the base map was a read-execute
one. Relax that requirement to search read-only maps.

Adjust the unit tests for this case.

Bug: 117293117
Test: Passes unit tests.
Test: Passes art cfi tests with and without llvm linker.
Change-Id: I31a765d51847d0b8d778ace9cbaa29f42073f4d9
2018-10-08 19:47:33 -07:00
Treehugger Robot 380d3192cc Merge "llkd: Do not check ueventd by default for stack" 2018-10-08 18:46:26 +00:00
Treehugger Robot e4046c7886 Merge "Allow erase, set_active and download commands only on unlocked devices." 2018-10-08 18:38:59 +00:00
Josh Gao f3186de123 Merge changes Ia4244757,Ibcdf69d9
* changes:
  adbd: clean up jdwp service a bit.
  Revert "Revert "adb: detect some spin loops and abort.""
2018-10-08 17:45:23 +00:00
Mark Salyzyn 2cfc8d9b78 llkd: Do not check ueventd by default for stack
ueventd is now blocked by sepolicy, so skip checking it to
prevent an avc warning.

Test: manual
Bug: 33808187
Change-Id: I7b7a53604b83ee18a47db38d7a8260ab4226d531
2018-10-08 10:32:51 -07:00
Hridya Valsaraju d1e623160c Allow erase, set_active and download commands only on unlocked devices.
Bug: 117276890
Bug: 117277405
Bug: 117278071
Test: make

Change-Id: Ic5e3a3ce9e2199578c2788b3b14aac7a8860a270
2018-10-08 10:27:48 -07:00
Treehugger Robot 4aa42b46c9 Merge "Allow Conformance tests to verify userspace fastboot." 2018-10-08 16:34:26 +00:00
Mark Salyzyn b127c35adc Merge changes Ie03f3895,Id4d9ee61
* changes:
  fs_mgr: add fs_mgr_access() as no-errno access(,F_OK) wrapper
  fs_mgr: candidate list check mount_point
2018-10-08 14:26:45 +00:00
Mark Salyzyn 6cc230f587 Merge changes I49c9f064,I946e8564
* changes:
  llkd: Add cma_alloc stack symbol checking
  llkd: Add __get_user_page stack symbol checking
2018-10-08 14:22:18 +00:00
Treehugger Robot e06850afdb Merge "Support fastboot variable battery-soc-ok" 2018-10-07 17:53:45 +00:00
Treehugger Robot 6b39f9d475 Merge "Use only signed/unsigned numbers with ParseInt/ParseUint respectively" 2018-10-07 17:34:10 +00:00
Josh Gao 15dcc62c72 adbd: clean up jdwp service a bit.
Change-Id: Ia42447576b047dfa9ddc0b73b87adc8114e3f20f
Test: ./test_device.py
2018-10-05 17:23:44 -07:00
Josh Gao 39c1f4bca5 Revert "Revert "adb: detect some spin loops and abort.""
This reverts commit 04b9ca8c31.

The original incarnation of this patch was falsely triggering when our
poll would block with no activity happening for an extended amount of
time. When the poll returned, we would immediately flag that as a spin
loop. Solve this by tracking the last time we looped, to detect this.

While we're at it, switch from CLOCK_MONOTONIC to CLOCK_BOOTTIME, for
the same reason.

Change-Id: Ibcdf69d93f7b6012142cafd72066f39494c1f84b
Test: ./test_device.py
2018-10-05 17:23:44 -07:00
Hridya Valsaraju a534a5a973 Support fastboot variable battery-soc-ok
Bug: 79480454
Test: fastboot getvar battery-soc-ok

Change-Id: Icfd70a71f1598e437316d4b8f895fd851516febb
Merged-In: Icfd70a71f1598e437316d4b8f895fd851516febb
(cherry picked from commit 9a1203b7ac)
2018-10-05 16:16:49 -07:00
Hridya Valsaraju bdc1429454 Allow Conformance tests to verify userspace fastboot.
Bug: 117220134
Test: ./fuzzy_fastboot --gtest_filter=Conformance.*

Change-Id: Iab04fdff71e7e90a56d53d24cf14e94c81131009
2018-10-05 15:56:12 -07:00
Mark Salyzyn aace48642f fs_mgr: add fs_mgr_access() as no-errno access(,F_OK) wrapper
Simplification of code paths.

Test: compile
Bug: 74595769
Bug: 63736262
Change-Id: Ie03f3895bc4b520fc23854ab662d99497c31bc66
2018-10-05 15:23:53 -07:00
Mark Salyzyn ea928bbc1f fs_mgr: candidate list check mount_point
if we specify mount_point /vendor, candidate list should not add
/system as a candidate.  eg: adb disable-verity /vendor.

Test: manual
Bug: 109821005
Change-Id: Id4d9ee617262cf1b68a790c9c43476d0f907353a
2018-10-05 15:23:53 -07:00
Tom Cherry e0bc5a9aa2 Use only signed/unsigned numbers with ParseInt/ParseUint respectively
Test: build
Change-Id: I4d950d4aa8d24c90d1fc9b1cbea0f324aeed56a3
2018-10-05 14:30:39 -07:00
Tom Cherry 64990d5b45 Merge "init: move InitKernelLogging() to first stage init" 2018-10-05 20:41:23 +00:00
Chih-hung Hsieh 3356ca3040 Merge "Add noexcept to move constructors and assignment operators." 2018-10-05 20:05:12 +00:00
Tom Cherry 48e83e629f init: move InitKernelLogging() to first stage init
The kernel opens /dev/console and uses that fd for stdin/stdout/stderr
if there is a serial console enabled and no initramfs, otherwise it
does not provide any fds for stdin/stdout/stderr.  InitKernelLogging()
is used to close these existing fds if they exist and replace them
with /dev/null.

Currently, InitKernelLogging() is only called in second stage init,
which means that processes exec'ed from first stage init will inherit
the kernel provided fds if any are provided.

In the case that they are provided, the exec of second stage init
causes an SELinux denial as it does not have access to /dev/console.
In the case that they are not provided, exec of any further process is
potentially dangerous as the first fd's opened by that process will
take the stdin/stdout/stderr fileno's, which can cause issues if
printf(), etc is then used by that process.

Lastly, simply moving InitKernelLogging() to first stage init is not
enough, since first stage init still runs in kernel context and future
child processes will not have permissions to access kernel context
resources.  Therefore, it must be done for a second time in second
stage init.

Bug: 117281017
Test: no audits when booting marlin.
Change-Id: If27edab5c32b27765e24c32fbed506ef625889de
2018-10-05 10:36:38 -07:00
Chih-Hung Hsieh 747eb149d0 Add noexcept to move constructors and assignment operators.
Bug: 116614593
Test: build with WITH_TIDY=1
Change-Id: I5a7461386946ca623ab509609092aa0ac8418b80
2018-10-05 16:43:47 +00:00
Tom Cherry 5f2a21d244 Merge "init: allow customizable restart and timeout periods for services" 2018-10-05 16:15:23 +00:00
Tom Cherry 73f535e33b init: allow customizable restart and timeout periods for services
Allow services to specify a custom restart period via the
restart_period service option.  This will allow services to be run
periodically, such as a service that needs to run every hour.

Allow services to specify a timeout period via the timeout_period
service option.  This will allow services to be killed after the
timeout expires if they are still running.  This can be combined with
restart_period for creating period services.

Test: test app restarts every minute
Change-Id: Iad017820f9a602f9826104fb8cafc91bfb4b28d6
2018-10-04 19:52:37 -07:00
Treehugger Robot 69b83f0af0 Merge changes If3664d44,Iab038f3e
* changes:
  fs_mgr: split out fs_mgr_overlayfs_setup_dir()
  fs_mgr: Add fs_mgr_overlayfs_required_devices()
2018-10-05 00:23:15 +00:00
Christopher Ferris d3a7ddcf8d Merge "Implement support for linker rosegment option." 2018-10-04 22:38:26 +00:00
Mark Salyzyn 780db02f7d fs_mgr: split out fs_mgr_overlayfs_setup_dir()
In preparation for adding a list of possible backing storage.

Test: compile
Bug: 109821005
Change-Id: If3664d44c232db32f79b1355799ec239cfe7633a
2018-10-04 15:15:11 -07:00
Mark Salyzyn e511e3a3b1 fs_mgr: Add fs_mgr_overlayfs_required_devices()
Added fs_mgr_overlayfs_required_devices() as hint to init to make sure
the device gets created before fs_mgr_overlayfs_mount_all().

Test: manual
Bug: 109821005
Change-Id: Iab038f3e0252a357b082bb08db3679512b9badec
2018-10-04 15:15:02 -07:00
Treehugger Robot 29553d2d52 Merge "Restore lost .dm support of adb install-multiple" 2018-10-04 21:22:29 +00:00
Treehugger Robot b20b2f96f9 Merge "Add an API to release stats logger resources." 2018-10-04 21:03:05 +00:00
Treehugger Robot ed673c967d Merge "Add a function to allow statslog failure." 2018-10-04 21:02:47 +00:00
Treehugger Robot 02678f32be Merge "Don't hardcode the super partition name." 2018-10-04 19:29:34 +00:00
David Anderson ba132f1901 Merge "liblp: Remove the guid field from LpMetadataPartition." 2018-10-04 18:20:47 +00:00
Victor Hsieh 8e27656a9a Restore lost .dm support of adb install-multiple
Apparently some changes are lost in
https://android-review.googlesource.com/c/platform/system/core/+/600457.

Test: adb install-multiple foo.apk foo.dm
Bug: 117092647
Change-Id: I87a6e1509de809624254c77073d922617f222ed2
2018-10-04 10:46:56 -07:00
Treehugger Robot a3303fd21b Merge "fs_mgr: split out fs_mgr_overlayfs_teardown_one()" 2018-10-04 14:32:43 +00:00
Martijn Coenen c3b40a5793 Merge "Add /apex tmpfs mount and mount it." 2018-10-04 07:08:54 +00:00
Christopher Ferris 9d5712c123 Implement support for linker rosegment option.
The rosegment linker option results in two maps containing the elf data
existing. One is an execute map where the code lives, and the other is the
read-only segment which contains the elf header information. If the file
backing a shared library in memory is not readable, then the new code
will attempt to find the read-only map that has the same name as the
current execute segment, and that is at offest zero in the file.

Add new unit tests for this functionality.

Add the missing MapInfoCreateMemoryTest.cpp to the list of tests.

Bug: 109657296

Test: Pass new unit tests.
Test: All unit libbacktrace/libunwindstack tests pass with rosegment enabled.
Change-Id: If8f69e4a067d77b3f2a7c31e2e5cd989a0702a8c
2018-10-03 20:48:45 -07:00
Mark Salyzyn 336f759959 fs_mgr: split out fs_mgr_overlayfs_teardown_one()
In preparation for adding a list of possible backing storage.

Test: compile
Bug: 109821005
Change-Id: Id64d3630a646de714831a3c746204440324c206e
2018-10-03 15:10:22 -07:00
David Anderson e5f2f06b00 liblp: Remove the guid field from LpMetadataPartition.
Bug: 117229984
Test: liblp_test gtest
Change-Id: Ie42b3a8005b1cf711303966a2a117c255f0fb08c
2018-10-03 14:48:42 -07:00
Treehugger Robot 29e9833e39 Merge "fs_mgr/init: use unique_ptr + CLO_EXEC for setmntent()/fopen()" 2018-10-03 21:22:50 +00:00
Christopher Ferris 15a5c9c44f Merge "Load libbacktrace_test.so explicitly." 2018-10-03 21:09:25 +00:00
Treehugger Robot d7f2c56089 Merge "liblp: Add support for updateable partition groups." 2018-10-03 20:33:45 +00:00
Tom Cherry f274e78eeb fs_mgr/init: use unique_ptr + CLO_EXEC for setmntent()/fopen()
We ran into an issue with an fd leaking due to missing both CLO_EXEC
and fclose() in related code, so let's make sure we're safe here too.

Test: boot
Change-Id: Ief893c936859815c78fa6d7e06cb88ad34aadbac
2018-10-03 13:19:04 -07:00
Treehugger Robot fe0e345ef0 Merge changes from topic "ext4 checkpointing"
* changes:
  make checkpointing work on ext4
  Adding bow dm-target
2018-10-03 20:15:48 +00:00
Treehugger Robot 8bd7d5238f Merge "init: IsDmLinearEnabled() replace with check if logical partitions present in fstab" 2018-10-03 20:03:26 +00:00
Christopher Ferris 50d81acdc9 Load libbacktrace_test.so explicitly.
This guarantees that the shared library is loaded separately. It allows
this test to be run without depending on the shared library being
somewhere in the system path since the library is now treated as a file
to be dlopen'd.

This also fixes some bugs in the deleted shared library test code. The
previous test was passing when it was really failing. This new test
no longer passes incorrectly. Specifically, the original testlib library
only had a debug_frame on 32 bit host, which is not mapped into memory.
Adding the exceptions option causes a full eh_frame to be generated.

Due to the new dlopen code, also, switching to the new isolated test runner.

Also, changing the memory leak checker to use mallinfo since the new
unwinder allocates everything using the normal allocator. The use
of the isolated runner causes the PSS checker to fail because processes
come and go which changes the PSS distribution to the process doing
the PSS check.

Bug: 109876814

Test: All unit tests pass.
Change-Id: I1b77a783979a8beaae0c0b12823267f363e07977
2018-10-03 12:42:38 -07:00
David Anderson 5246b6c183 liblp: Add support for updateable partition groups.
This patch introduces a new "groups" table in the super partition
metadata. Each entry denotes a named partition group with a maximum
size. All partitions now belong to a group, and the total size of
partitions in a group must not exceed its maximum size. This is enforced
by MetadataBuilder.

There is also a "default" group with no size restriction. This is used
for one-off partitions that aren't restricted by updates, for example,
the scratch partition for overlayfs, or partitions created through
fastbootd.

Bug: 116817738
Test: liblp gtest
Change-Id: I7049ffd35d326e41e25d01b1748cb53a584783a7
2018-10-03 12:14:14 -07:00
Treehugger Robot cf207d082a Merge "fs_mgr: __mount better detail for ENOENT" 2018-10-03 18:41:40 +00:00
Yao Chen 602d292cb1 Add an API to release stats logger resources.
Test: tested with ag/5112579
Change-Id: I271b7574beab1baa9886d31bc1cf25c40c2fae23
Merged-In: I271b7574beab1baa9886d31bc1cf25c40c2fae23
(cherry picked from commit 5b63e2704a)
2018-10-03 10:43:21 -07:00
Yao Chen 6301054b38 Add a function to allow statslog failure.
+ Record all types of failures which lead to log loss
+ Only record eventual failure after the retries to get a accurate log loss count.

Bug: 80538532
Test: manually tested

Change-Id: I23a55e62e140bf22ae5aa9e6c40539d51149cd66
Merged-In: I23a55e62e140bf22ae5aa9e6c40539d51149cd66
(cherry picked from commit ad3a40bf76)
2018-10-03 10:42:34 -07:00