Commit Graph

35996 Commits

Author SHA1 Message Date
George Burgess IV 584853bdb0 Merge "Silence a use-after-free warning from the analyzer"
am: 8c853c43cc

Change-Id: I053089d33c2e46da12c6e8d72252fd73bea0debf
2017-10-02 22:40:42 +00:00
Treehugger Robot 8c853c43cc Merge "Silence a use-after-free warning from the analyzer" 2017-10-02 22:32:33 +00:00
Andreas Gampe 346d7e1405 Merge "Keymaster: Move test to std::unique_ptr"
am: 81348ffa9e

Change-Id: I74b22a692e23589002eca812b88dc458bc67fad4
2017-10-02 21:22:16 +00:00
Treehugger Robot 81348ffa9e Merge "Keymaster: Move test to std::unique_ptr" 2017-10-02 21:09:17 +00:00
Mark Salyzyn 806f050f6d Merge "CtsLogdTestCases#sepolicy_rate_limiter failure"
am: 99691dfc74

Change-Id: Idbf8480ef783d70e42cc0175ca649fd56f133a5f
2017-10-02 20:41:06 +00:00
Tom Cherry 821cb5e16c Merge "init: run vendor commands in a separate SELinux context"
am: 8e09b0b953

Change-Id: I7e0272f29bd8bab029a9f9c07aa413c9172f6f5a
2017-10-02 20:40:03 +00:00
Treehugger Robot 99691dfc74 Merge "CtsLogdTestCases#sepolicy_rate_limiter failure" 2017-10-02 20:12:17 +00:00
George Burgess IV 6753bc4433 Silence a use-after-free warning from the analyzer
The analyzer is known to be very conservative in the face of atomic
operations (e.g. https://bugs.llvm.org/show_bug.cgi?id=34365); this case
is no different.

It's concerned that `delete this;` might read a different value for
`flags`, and proceed to delete `refs`. Since there are many comments
explaining why this won't happen (and it all looks sane to me), use a
NOLINT to silence this warning.

Analyzer warning:
system/core/libutils/RefBase.cpp:445:5: warning: Use of memory after it
is freed

Bug: 27101951
Test: mma. Use-after-free warning is gone.
Change-Id: Ic1623971bd1bad546fbb12a79439116c89a6762d
2017-10-02 19:50:39 +00:00
Tom Cherry 8e09b0b953 Merge "init: run vendor commands in a separate SELinux context" 2017-10-02 19:48:58 +00:00
Andreas Gampe b9d9da25ca Keymaster: Move test to std::unique_ptr
In preparation for UniquePtr removal.

Test: mmma system/core/trusty/keymaster
Change-Id: I42ca2b0d30d87e838d35a82e7ccea4e784acb2f6
2017-10-02 11:53:22 -07:00
Mark Salyzyn b825faeed7 CtsLogdTestCases#sepolicy_rate_limiter failure
Cts tests can run in appdomain, which have access to /data/backup/
which leads to zero injection of sepolicy signal to check the logd
and kernel rate limiter.  Switch to /data/drm/ as a better choice
to inject a sepolicy denial either due to dac_override or
dac_read_search because owned by the drm uid and gid, or due to
create sepolicy denial to u:object_r:drm_data_file:s0 to all but
select services.

Test: gTest
Bug: 65843095
Change-Id: I2d72b1407a930c270636a206066d2d15fdec2f77
2017-10-02 10:38:35 -07:00
Dan Willemsen a0113de2f3 Merge "Remove default libraries"
am: 8b7feee38f

Change-Id: Ic39ecabd37ffe06ba3a119410b5dcd4885fb584c
2017-09-30 23:32:45 +00:00
Treehugger Robot 8b7feee38f Merge "Remove default libraries" 2017-09-30 23:27:15 +00:00
Elliott Hughes ee4d611c46 Merge "run-as: Keep supplementary groups."
am: e80beca255

Change-Id: I971873b279dae899ae45718aa569681407e9a31f
2017-09-29 22:46:09 +00:00
Elliott Hughes e80beca255 Merge "run-as: Keep supplementary groups." 2017-09-29 22:42:10 +00:00
Mark Salyzyn 2e12030ca5 Merge "reboot: only pause indefinitely for non-shutdown operations"
am: e808f9213c

Change-Id: I8386ad08ff53f94b78bae713f614f962a92637d2
2017-09-29 21:02:36 +00:00
Treehugger Robot e808f9213c Merge "reboot: only pause indefinitely for non-shutdown operations" 2017-09-29 20:53:33 +00:00
Dan Willemsen 1e45d533b3 Remove default libraries
libdl is part of system_shared_libs now. -ldl -lpthread -lm are now defaults
for host_ldlibs on Linux and Darwin. -lrt is a default for host_ldlibs on
Linux.

Test: m host
Change-Id: I0b3c147b00a8ab6ff289b85db55b88836c905f5c
Exempt-From-Owner-Approval: build system cleanup
2017-09-29 13:17:06 -07:00
Tom Cherry cb0f9bbc85 init: run vendor commands in a separate SELinux context
One of the major aspects of treble is the compartmentalization of system
and vendor components, however init leaves a huge gap here, as vendor
init scripts run in the same context as system init scripts and thus can
access and modify the same properties, files, etc as the system can.

This change is meant to close that gap.  It forks a separate 'subcontext'
init that runs in a different SELinux context with permissions that match
what vendors should have access to.  Commands get sent over a socket to
this 'subcontext' init that then runs them in this SELinux context and
returns the result.

Note that not all commands run in the subcontext; some commands such as
those dealing with services only make sense in the context of the main
init process.

Bug: 62875318
Test: init unit tests, boot bullhead, boot sailfish

Change-Id: Idf4a4ebf98842d27b8627f901f961ab9eb412aee
2017-09-29 13:06:26 -07:00
Jorge Lucangeli Obes 8c27e19c1c run-as: Keep supplementary groups.
This broke TCP debugging because processes don't inherit the AID_INET
group.

Bug: 67058466
Test: adb shell run-as com.example.native_activity groups prints "inet".
Change-Id: Ieb461dccda8611057bb2d16334e584eb5e57c8b1
2017-09-29 15:34:23 -04:00
Josh Gao bc3d3625d5 Merge "adbd: improve thread names."
am: 39071a5177

Change-Id: Id41804332dfb81a2bcfd07d3a7180f16e7412bc0
2017-09-29 18:34:17 +00:00
Josh Gao 39071a5177 Merge "adbd: improve thread names." 2017-09-29 18:17:33 +00:00
Mark Salyzyn 7b0f41c393 reboot: only pause indefinitely for non-shutdown operations
If -p flag specified, return immediately so that scripting code
can progress.  Shutdown is unique in that if it does happen,
the device will never come back, but if it fails one can continue
diagnosis (without the need for a script to send a SIGINT to break
out of the indefinite pause on the reboot -p command).

Yes, this will break adb shell reboot -p ; adb wait-for-device as
noted in the comment, but no one should ever expect the device to
come back if a shutdown is requested.  We do not break adb reboot ;
adb wait-for-device sequence though as we retain the pause forever.

Test: manual
Bug: 63736262
Bug: 38446744
Bug: 66912053
Change-Id: I028cd873a7193a78c6b3c342eca1e08b6b296fd2
2017-09-29 16:29:52 +00:00
Bowgo Tsai b08be62fca Merge "fs_mgr_fstab: removing fs_mgr_get_entry_for_mount_point_after()"
am: 16e31801a5

Change-Id: I59b8971b02f59f16082bc48ef96203ef13788277
2017-09-29 08:38:15 +00:00
Treehugger Robot 16e31801a5 Merge "fs_mgr_fstab: removing fs_mgr_get_entry_for_mount_point_after()" 2017-09-29 06:47:27 +00:00
Bowgo Tsai d29ac08509 Merge "Removing $(PRODUCT_OUT)/root/root"
am: 8cbbacdc15

Change-Id: Ia671976f8d7d4b83478c58d566e309f36af125ab
2017-09-29 03:27:38 +00:00
Treehugger Robot 8cbbacdc15 Merge "Removing $(PRODUCT_OUT)/root/root" 2017-09-29 02:33:44 +00:00
Josh Gao bcadc77550 adbd: improve thread names.
Name each service thread specifically to improve debuggability.

Bug: http://b/65648324
Test: adb shell debuggerd -b `adb shell pidof adbd` during a sync
Change-Id: I644e25fc2f14a26eafd19f596e4e8f3c2bb79967
2017-09-28 16:45:24 -07:00
Dan Willemsen b961c07f50 Merge "Rename libz-host -> libz"
am: 612b47630f

Change-Id: If89115814856b306b7d00be89653305a1482e810
2017-09-28 22:57:38 +00:00
Dan Willemsen 612b47630f Merge "Rename libz-host -> libz" 2017-09-28 20:57:43 +00:00
Bowgo Tsai 144893e5ec Removing $(PRODUCT_OUT)/root/root
Bug: 65570851
Test: boot sailfish
Change-Id: I80c3c3de23c57343187fde207980731b5341bc1f
Merged-In: I80c3c3de23c57343187fde207980731b5341bc1f
(cherry picked from commit ededee3e40)
2017-09-28 18:10:58 +08:00
Bowgo Tsai c55f188207 fs_mgr_fstab: removing fs_mgr_get_entry_for_mount_point_after()
No fs_mgr client is using fs_mgr_get_entry_for_mount_point_after(), which
supports matching a mount point iteratively by specifying a starting entry
in the fstab. So removes it.

Also switch the public API from C/C++ to C++-only:
    fs_mgr_get_entry_for_mount_point(struct fstab* fstab, const char* path);
==> fs_mgr_get_entry_for_mount_point(struct fstab* fstab, const std::string& path);

Bug: 67024518
Test: boot sailfish, manually test fs_mgr_get_entry_for_mount_point().

Change-Id: I38e18fa6bd9485b6cd31b55474406a511df3f506
2017-09-28 15:28:59 +08:00
Dan Willemsen 5cfa006059 Rename libz-host -> libz
Test: m host
Change-Id: Ib276431d13b3e1bd243f84a80f69aafc12e71aac
2017-09-27 16:24:45 -07:00
Tom Cherry aceda86059 Merge "init: remove non-protobuf single persistent property file"
am: 61578ab50b

Change-Id: Id4b622ebde1db431d5dcb8cc3edccc6843d4c72b
2017-09-27 20:38:29 +00:00
Tom Cherry 61578ab50b Merge "init: remove non-protobuf single persistent property file" 2017-09-27 20:35:09 +00:00
Mark Salyzyn 387dbf9ab0 Merge "init: report shutdown,container for sigterm of init"
am: d2b5a2417f

Change-Id: Ifb4ab5fa166ee055838c5ad52d69e0d0c07c7e59
2017-09-27 19:40:16 +00:00
Mark Salyzyn d2b5a2417f Merge "init: report shutdown,container for sigterm of init" 2017-09-27 19:32:31 +00:00
Josh Gao d3f7956f2f Merge "adb: partially revert b5e11415."
am: ef9426d883

Change-Id: I3f7fa1577bc79b5bdcacbeacc7b5141cc9c73cb9
2017-09-27 18:45:18 +00:00
Treehugger Robot ef9426d883 Merge "adb: partially revert b5e11415." 2017-09-27 18:38:28 +00:00
Tom Cherry 9614e4d4d9 init: remove non-protobuf single persistent property file
This has moved to being serialized with libprotobuf.

Test: persistent properties work on bullhead
Test: init unit tests
Change-Id: I26ebe135e37d352f9c53612301bde703144853e7
2017-09-27 18:22:35 +00:00
Tom Cherry 531cd0f6d3 Merge "init: cleanup exit() uses"
am: 9c568d0fc0

Change-Id: I52ee55a8717f60bbf47b0cbb2a3115c63a824f84
2017-09-27 17:14:17 +00:00
Tom Cherry 9c568d0fc0 Merge "init: cleanup exit() uses" 2017-09-27 17:10:31 +00:00
Mark Salyzyn 161b8626bd init: report shutdown,container for sigterm of init
Change HandleSigtermSignal() handler to report shutdown,container. Add
the new reason to bootstat.  Remove log stutter as
HandlPowerctlMessage will also do a LOG(INFO) reporting
shutdown,container as reason.

Sending SIGTERM to init is to allow a host OS to ask an Android
Container instance to shutdown.  The temptation is to report
shutdown,sigterm but that does not accurately describe the usage
scenario.

Test: compile
Bug: 63736262
Change-Id: I3c5798921bdbef5d2689ad22a2e8103741b570b4
2017-09-27 09:10:00 -07:00
Mark Salyzyn a27a48590a Merge "init: shutdown,thermal shut off display immediately"
am: 82ee4060ed

Change-Id: I7c81548a3bbfefa8fadbe27d168708b2cb1d125a
2017-09-27 15:00:00 +00:00
Mark Salyzyn 82ee4060ed Merge "init: shutdown,thermal shut off display immediately" 2017-09-27 14:54:38 +00:00
Alexandros Frantzis b5876fe3ed Merge "libsync: Add fence info tests"
am: 6832535cd5

Change-Id: I434ca616c410cf4898b8428d2035fc17220e618d
2017-09-26 23:58:18 +00:00
Treehugger Robot 6832535cd5 Merge "libsync: Add fence info tests" 2017-09-26 23:46:32 +00:00
Tom Cherry 4a679454d7 init: cleanup exit() uses
Primarily, this fixes a bug where a forked child of property service
uses exit() instead of _exit, which has the unintended consequences of
running the global destructors of init proper, which leads to
unintended cleanup.

Secondly, this replaces the remaining calls of exit() that really
should be LOG(FATAL).

Test: boot sailfish
Change-Id: I779228e7d44a73186bc7685bb723c4b9278a0a2d
2017-09-26 16:30:03 -07:00
Bowgo Tsai dff1e3418e Merge "fs_mgr_fstab: do an exact match when searching a mount point"
am: a0dd1adab0

Change-Id: If29801d08031c83587e43f981f148f22a675dec5
2017-09-26 23:17:16 +00:00
Treehugger Robot a0dd1adab0 Merge "fs_mgr_fstab: do an exact match when searching a mount point" 2017-09-26 23:09:43 +00:00