Commit graph

43528 commits

Author SHA1 Message Date
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
bc64e50bd7 Assert that ParseInt/ParseUint are only used with signed/unsigned numbers respectively
Test: build fails when the signedness is mismatched
Test: build succeeds otherwise
Change-Id: Idd6b146cc167d4607eafc81dbad6c2a79b167094
2018-10-05 14:30:39 -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
0d840e1d11 Merge "init: move InitKernelLogging() to first stage init"
am: 64990d5b45

Change-Id: Id68798cf9c0825610690a01dd2c849c45849a399
2018-10-05 13:57:17 -07:00
Tom Cherry
64990d5b45 Merge "init: move InitKernelLogging() to first stage init" 2018-10-05 20:41:23 +00:00
Chih-hung Hsieh
f3e5be5c62 Merge "Add noexcept to move constructors and assignment operators."
am: 3356ca3040

Change-Id: Ic2bee5809b66b3747b9941268df4d33e93154546
2018-10-05 13:14:32 -07: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
Idries Hamadi
269a4b422b Reverted aapt dependency to be a dependency on libandroidfw
Removed call to external aapt2 process
Replaced several layers of error handling with calls to fatal()
Changed output messages for failures to be more useful for diagnostics

Bug: 116753196
Test: mm
Test: adb install -r --fastdeploy --force-agent --local-agent ~/example_apks/example.apk
Test: adb install -r --fastdeploy --no-streaming --force-agent --local-agent ~/example_apks/example.apk

Change-Id: I6006d8aa584e789a086a31e79a41d1416e54402a
2018-10-05 17:55:05 +01: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
63bd73a5cf Merge "init: allow customizable restart and timeout periods for services"
am: 5f2a21d244

Change-Id: If6a54f0c4f673f995d6e79a9c671fb70ee18b438
2018-10-05 09:32:20 -07: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
Mark Salyzyn
10f5dee664 Merge changes If3664d44,Iab038f3e
am: 69b83f0af0

Change-Id: Ia0ca7dc5bb24fd6a6e795c338a40160b45fcf253
2018-10-04 17:35:30 -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
bca82de156 Merge "Implement support for linker rosegment option."
am: d3a7ddcf8d

Change-Id: I52f0c696e844a988ef358ca2d26759045f968606
2018-10-04 15:49:08 -07: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
Victor Hsieh
adeed2708b Merge "Restore lost .dm support of adb install-multiple"
am: 29553d2d52

Change-Id: I796a4886b10db69a8c61a02f041a501da60507d9
2018-10-04 14:39:39 -07:00
Treehugger Robot
29553d2d52 Merge "Restore lost .dm support of adb install-multiple" 2018-10-04 21:22:29 +00:00
Yao Chen
7e1df8c874 Merge "Add an API to release stats logger resources."
am: b20b2f96f9

Change-Id: I99df602094f10a026e191921f81a8d951f143eea
2018-10-04 14:19:57 -07:00
Yao Chen
cc3d37c0b7 Merge "Add a function to allow statslog failure."
am: ed673c967d

Change-Id: I60f2175ebc964457279671042d7bb9807e0d49ef
2018-10-04 14:19:11 -07: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
Josh Gao
ffc11d3cf3 adb: don't close sockets before hitting EOF.
The standard (RFC 1122 - 4.2.2.13) says that if we call close on a
socket while we have pending data, a TCP RST should be sent to the
other end to notify it that we didn't read all of its data. However,
this can result in data that we've succesfully written out to be dropped
on the other end. To avoid this, instead of immediately closing a
socket, call shutdown on it instead, and then read from the file
descriptor until we hit EOF or an error before closing.

Bug: http://b/74616284
Test: ./test_adb.py
Test: ./test_device.py
Change-Id: I36f72bd14965821dc23de82774b0806b2db24f13
2018-10-04 14:01:07 -07:00
David Anderson
401e23e020 Merge "Don't hardcode the super partition name."
am: 02678f32be

Change-Id: Ice82e64716fbb56fa94f33f4f959cc1b2f95939a
2018-10-04 12:49:16 -07:00
Treehugger Robot
02678f32be Merge "Don't hardcode the super partition name." 2018-10-04 19:29:34 +00:00
David Anderson
ceecf6836d Merge "liblp: Remove the guid field from LpMetadataPartition."
am: ba132f1901

Change-Id: Ifc25e3a4c6eef0a313ec77f6688c6085dd16f456
2018-10-04 11:57:14 -07: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
Mark Salyzyn
7eb6d41b1c Merge "fs_mgr: split out fs_mgr_overlayfs_teardown_one()"
am: a3303fd21b

Change-Id: Ic38906770c60dd47446b676f03337fe8fa954a16
2018-10-04 07:41:35 -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
289da3205f Merge "Add /apex tmpfs mount and mount it."
am: c3b40a5793

Change-Id: Ida1459a1fa77dac3728ae72715d9ebfa6c70137b
2018-10-04 00:15:57 -07: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
Tom Cherry
5d837348e5 Merge "fs_mgr/init: use unique_ptr + CLO_EXEC for setmntent()/fopen()"
am: 29e9833e39

Change-Id: Ifc6e4c335a04a9894d567a5d0e5681e86e1f3098
2018-10-03 14:37:51 -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
10ac255714 Merge "Load libbacktrace_test.so explicitly."
am: 15a5c9c44f

Change-Id: Ifeebd476022998bf5a58198e52d1f73bfa768d78
2018-10-03 14:21:27 -07:00
Christopher Ferris
15a5c9c44f Merge "Load libbacktrace_test.so explicitly." 2018-10-03 21:09:25 +00:00
David Anderson
f082a7ca45 Merge "liblp: Add support for updateable partition groups."
am: d7f2c56089

Change-Id: I8a4cc266fa4e6788a512499d5e7840149921bea8
2018-10-03 13:52:43 -07:00
Treehugger Robot
d7f2c56089 Merge "liblp: Add support for updateable partition groups." 2018-10-03 20:33:45 +00:00
Paul Lawrence
2b0fad7425 Merge changes from topic "ext4 checkpointing"
am: fe0e345ef0

Change-Id: I55efd0af0afa2911f4474da851bba006da383a0f
2018-10-03 13:31:16 -07: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
Mark Salyzyn
91fcce2b3a Merge "init: IsDmLinearEnabled() replace with check if logical partitions present in fstab"
am: 8bd7d5238f

Change-Id: I833d28cbf015fcc67b586d0983af53eb0ae95c0e
2018-10-03 13:13:53 -07: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