Commit graph

34483 commits

Author SHA1 Message Date
Treehugger Robot
61cb88add2 Merge "init: Allow clean system shutdown upon SIGTERM" 2017-09-07 19:59:29 +00:00
Luis Hector Chavez
9f97f47940 init: Allow clean system shutdown upon SIGTERM
This allows Android to cleanly shutdown when running in a PID namespace
in a way that does not rely on adbd running. This is useful to allow
Android to be running in a container and its lifetime managed by an
OCI-compliant tool.

Bug: 65415372
Test: `kill -TERM 1` as root is correctly dropped.
Test: `kill -TERM 1` from the init PID namespace causes init to cleanly shutdown.
Change-Id: Ia66ebdb436221919081bc4723337c0c7f1e53b09
2017-09-07 10:47:04 -07:00
Christopher Ferris
18149b6764 Merge "Add a method to share the process memory object." 2017-09-07 00:01:10 +00:00
Tom Cherry
2827106d7d Merge "Log pid for writes to sys.powerctl" 2017-09-06 16:58:23 +00:00
Treehugger Robot
9c8781f479 Merge "Mark libgrallocusage as vendor_available" 2017-09-06 15:52:22 +00:00
Treehugger Robot
45eeea2dcd Merge "Don't rely on transitively included headers" 2017-09-06 15:51:46 +00:00
Treehugger Robot
0c89aaec1f Merge "Suppress false-positive static analyzer warnings" 2017-09-06 05:04:29 +00:00
Jiyong Park
bab16584ce Don't rely on transitively included headers
One must explicitly include what it need.
time.h for clock_gettime

Bug: 37629934
Test: build
Change-Id: I992eac637f373b204aa161b0b26f5563e952c27e
2017-09-06 13:04:57 +09:00
Ting-Yuan Huang
249bd05038 Suppress false-positive static analyzer warnings
by hinting the analyzer with assertions.

Test: built without seeing warnings.
Change-Id: I0d43d4ceafd7f68be89cad6c930c85ee7b6d5165
2017-09-05 16:46:40 -07:00
Jiyong Park
e2bd601fd2 Mark libgrallocusage as vendor_available
libgrallocusage is used by libui which will be vendor_available: true.

Test: BOARD_VNDK_VERSION=current m libgrallocusage is successful
Change-Id: I476768d8b103033f3b8e5b09f53f4ac422ae377c
Merged-In: I476768d8b103033f3b8e5b09f53f4ac422ae377c
2017-09-05 14:49:53 -07:00
Christopher Ferris
5f118519fd Add a method to share the process memory object.
New function to create the process memory object. This allows for
a future where different remote process memory objects could be created
depending on the way remote memory can be created. Even different local
memory objects that access memory without doing any checks.

It also allows MemoryRange objects to share one single process memory object
and could help if the process memory object caches data.

Small changes to MapInfo::CreateMemory to when some errors are detected.
- Always check if the map is a device map, instead of only if the name
  is not empty.
- Check if a memory map is readable before creating the memory from process
  memory.

Bug: 23762183

Test: Ran unit tests, unwound on device using the new code.
Change-Id: I12a93c2dc19639689a528ec41c67bfac74d431b3
2017-09-05 14:30:22 -07:00
Tom Cherry
a84e14da1e Log pid for writes to sys.powerctl
Unless a process logs that it is requesting a device to reboot, there
are no logs to show which process triggered a reboot.  This change
introduces such a log in property service such that system initiated
reboots can be clearly blamed back to a calling process.

Bug: 64214361
Test: reboot and check kernel log for reboot string
Change-Id: I18de33d2a0933d20bdb581025b78020c88c5c6eb
2017-09-05 12:47:08 -07:00
Treehugger Robot
6139592321 Merge "Add vndk tag for libunwindstack which must be a vndk-sp" 2017-09-05 18:19:30 +00:00
Treehugger Robot
f899548cdb Merge "Add odm sepolicy support to selinux.cpp" 2017-09-04 04:45:33 +00:00
Treehugger Robot
d97a1710b8 Merge "init: add option to read file fully on readahead" 2017-09-02 02:53:53 +00:00
Wei Wang
02628f3b23 init: add option to read file fully on readahead
Bug: 62413151
Test: boottime, dumpcache
Change-Id: I1a7b69f0619428e4db31c5a7639c5d895c89ecdb
2017-09-01 15:15:51 -07:00
Treehugger Robot
2b8a95a2a7 Merge "libdebuggerd: cleanup." 2017-09-01 19:45:31 +00:00
kaichieh
eef4cd7d08 Add odm sepolicy support to selinux.cpp
init: support loading odm sepolicy

Currently init merges two sepolicy cil files:
    - /system/etc/selinux/plat_sepolicy.cil
    - /vendor/etc/selinux/nonplat_sepolicy.cil

This change replaces nonplat_sepolicy.cil with the following two files:
    - /vendor/etc/selinux/declaration/nonplat_declaration.cil
    - /vendor/etc/selinux/vender_sepolicy.cil

And support merging another default (but optional):
    - /odm/etc/selinux/odm_sepolicy.cil.

Bug: 64240127
Test: boot sailfish normally without odm.cil
Test: boot another device having odm.cil
Change-Id: I0b7f8c656c73ddb0fd46f2af3c625d7c81566f2f
2017-09-01 18:13:29 +08:00
Justin Yun
73bd4f05bf Add vndk tag for libunwindstack which must be a vndk-sp
As a VNDK-SP module, Android.bp must have 'vndk' tag as well as
'vendor_available: true'.

The 'vndk' tag for VNDK-SP module is formated as below:
vndk: {
    enabled: true,
    support_system_process: true,
},

VNDK-SP modules will be installed both in system/lib(64) as normal and
in system/lib(64)/vndk-sp as a vendor variant.

Bug: 64395154
Bug: 63866913
Test: build with BOARD_VNDK_VERSION=current
Merged-In: Idb4757988d1799ffcd3341343fcc4dac34bf7ef3
Change-Id: Idb4757988d1799ffcd3341343fcc4dac34bf7ef3
(cherry picked from commit 14d540a156)
2017-09-01 13:40:23 +09:00
Treehugger Robot
9638729a9d Merge "Revert "adbd: lessen security constraints when the device is unlocked"" 2017-08-31 08:21:08 +00:00
Bowgo Tsai
0603ec4294 Revert "adbd: lessen security constraints when the device is unlocked"
This reverts commit f1d3dbc32f.

With the following changes to move /sbin/adbd to /system/bin/adbd,
we don't need this workaround anymore.

  https://android-review.googlesource.com/#/q/topic:move-adbd-to-system+(status:open+OR+status:merged)

Bug: 63313955
Bug: 63381692
Bug: 64822208
Test: 'adb root' works in VTS for a non-A/B device (userdebug GSI + user boot.img)

Change-Id: Ic1249d6abd7d6e6e7380a661df16d25447853a48
2017-08-31 14:30:51 +08:00
Treehugger Robot
3d6f85167e Merge "Move adbd from root to system" 2017-08-31 06:22:16 +00:00
Christopher Ferris
537c68c8ed Merge "Add proper support for embedded elf files." 2017-08-31 02:17:41 +00:00
Christopher Ferris
3f805ac3f8 Add proper support for embedded elf files.
- Add a method to get the max size of an elf file by reading the
  section header offset + size. This will properly map an elf
  file embedded into an apk, instead of just mapping in what is done
  by the dynamic linker. It does assume that the section headers are
  at the end of the elf file.
- Add new tests for the above functionality.
- Update the unwind_symbols tool to take an address for finding a
  function instead of dumping the entire symbol table.

Bug: 23762183

Test: Unit tests pass, unwind through the camera process and verify
Test: the GoogleCamera.apk shows some function names.
Change-Id: I00c021680fe1d43b60d652bf91bbf6667d9617be
2017-08-30 15:50:11 -07:00
Tom Cherry
e1f9a58c86 Merge "use a single file for storing persistent properties" 2017-08-30 19:30:18 +00:00
Treehugger Robot
815f74a759 Merge "base: hopefully fix the mac build." 2017-08-30 08:03:32 +00:00
Josh Gao
4221e2cc03 base: hopefully fix the mac build.
Test: none
Change-Id: Idd4f353a158a0c096d16ecf87e239c50aba79cf7
2017-08-29 21:28:32 -07:00
Treehugger Robot
cb4e164562 Merge "sdcard: mute false compiler alarm" 2017-08-30 02:31:54 +00:00
Tom Cherry
16fad42007 use a single file for storing persistent properties
We have seen that storing persistent properties in separate files
causes increased boot latency compared to if they were stored in a
single contiguous file.

This change creates a simple format for a contiguously stored property
file, and adds the support for arbitrary characters in the names of
persistent properties, which previously had been restricted.  It has a
mechanism for converting older devices to the new format as well.

Bug: 64392887
Test: boot bullhead with new properties
Test: boot bullhead and verify old properties are converted to the new
      property file
Test: corrupt property file and ensure that it gets recovered from memory
Test: new unit tests
Change-Id: I60d8201d655ce5c97b33faae81d5ca8dbbb21a14
2017-08-29 17:45:06 -07:00
Ting-Yuan Huang
1991ae9459 sdcard: mute false compiler alarm
Clang static analyzer worries that strcpy to a field may overwrites
other fields.  Use snprintf() instead.

Test: built without seeing the warning.

Change-Id: I75d8edf1353b5d052fd14a954362bd0632c258fa
2017-08-29 17:21:13 -07:00
Josh Gao
c3706668c6 libdebuggerd: cleanup.
Move libdebuggerd headers into their own directory for namespacing,
move some includes to the top of their implementing files, delete some
dead code.

Test: mma, treehugger
Change-Id: Ie4c44e32e2ab3bc678092899d257fd4ed634aa34
2017-08-29 15:18:46 -07:00
Treehugger Robot
287e8348de Merge "base: add Pipe and Socketpair wrappers." 2017-08-29 21:26:39 +00:00
Tom Cherry
451ff37052 Merge "Globally allow up to 32K FDs open per process" 2017-08-29 21:01:23 +00:00
Christopher Ferris
4614a7ae1b Merge "Update the tests." 2017-08-29 17:30:41 +00:00
Treehugger Robot
aaa90cfe06 Merge "adb: Use kernel aio for functionfs." 2017-08-29 03:28:26 +00:00
Christopher Ferris
458cc66b07 Update the tests.
- Change all load_base to load_bias in the test files.
- Add the test files to the backtrace_test.
- Add a function to get the path to the test libraries.
- Change aarch64 to arm64 for offline test code.
- Modify the offline tests so that they can be easily updated when
  unwinding on any arch for any other arch is possible.
- Add tests of CreateNew for remote debugging.

Test: Ran unit tests on host and angler.
Change-Id: Id6c5afe73aeb2ac22463dd81f061799fcb1c178b
2017-08-28 18:08:52 -07:00
Treehugger Robot
9f38e19b88 Merge "adb: improve CHECKs." 2017-08-28 23:35:44 +00:00
Josh Gao
fdf832dfd3 base: add Pipe and Socketpair wrappers.
Also, switch debuggerd_handler over to using android::base::unique_fd.

Test: treehugger
Change-Id: I97b2ce22f1795ce1c4370f95d00d769846cc54b8
2017-08-28 14:51:07 -07:00
Tom Cherry
30bf4b7500 Merge "init: fix signal handling and LOG(FATAL) in child processes" 2017-08-28 21:45:38 +00:00
Josh Gao
e46720938d adb: improve CHECKs.
Use CHECK_LT(foo, 1234) instead of CHECK(foo < 1234) so that failing
checks have the values emitted.

Bug: http://b/65063965
Test: adb server nodaemon
Change-Id: I094287f7c4d2d177ea216568d06e9e425a28dd96
2017-08-28 14:43:24 -07:00
Treehugger Robot
32d2eae8b9 Merge "adbd: don't spin if file sync read fails." 2017-08-28 21:06:48 +00:00
Tom Cherry
cb5fccc83c Globally allow up to 32K FDs open per process
We've seen crashes due to processes exceeding the current soft limit
for open FDs of 1024, mainly due to increases in using FDs for shared
memory and gralloc memory objects.

There is not a compelling reason to keep this limit artificially low,
so we raise it to 32K.  This matches my desktop linux limit, so it is
with precedent.

Bug: 64894637
Test: open 32K FDs in a process without failure then fail after 32K
Change-Id: Ibecfc486e9c61f273a432a108893137d2d13a530
2017-08-28 13:08:24 -07:00
Treehugger Robot
459aa1cac6 Merge "init: support setting rlimits per service" 2017-08-28 19:27:08 +00:00
Josh Gao
1d6c01b53d adbd: don't spin if file sync read fails.
Bug: http://b/64508974
Test: mma
Change-Id: Ifba6a9dea3138b6d2a62c91cc0532f63986c048a
2017-08-28 11:21:31 -07:00
Tom Cherry
9bde0dc769 Merge "init: log all failures of Service::Start()" 2017-08-28 17:22:11 +00:00
Tom Cherry
7ac013de7e init: support setting rlimits per service
Add a new service option, `rlimit` that allows a given rlimit to be
set for a specific service instead of globally.

Use the same parsing, now allowing text such as 'cpu' or 'rtprio'
instead of relying on the enum value for the `setrlimit` builtin
command as well.

Bug: 63882119
Bug: 64894637

Test: boot bullhead, run a test app that attempts to set its rtprio to
      95, see that the priority set fails normally but passes when
      `rlimit rtprio 99 99` is used as its service option.
      See that this fails when `rlimit rtprio 50 50` is used as well.
Test: new unit tests

Change-Id: I4a13ca20e8529937d8b4bc11718ffaaf77523a52
2017-08-28 10:19:50 -07:00
Christopher Ferris
1f6a807bac Merge "Add missing include for readv." 2017-08-26 15:12:14 +00:00
Christopher Ferris
5d6a0325ef Add missing include for readv.
Test: Builds.
Change-Id: Ia8511dcec6f49d3f6016a4dac88ccf343495349b
2017-08-25 17:33:38 -07:00
Treehugger Robot
75a40988c0 Merge "libunwindstack: make machine type a property of Regs." 2017-08-26 00:02:46 +00:00
Treehugger Robot
54a28300b7 Merge "Clarify SELinux service error message" 2017-08-25 23:10:06 +00:00