Commit graph

27182 commits

Author SHA1 Message Date
Treehugger Robot
eca92a5a6f Merge "adb: replacing fs_mgr_read_fstab() with fs_mgr_read_fstab_default()" 2017-03-11 03:48:49 +00:00
Josh Gao
bc8433d582 Merge changes I7d394c66,I737d66e8
* changes:
  crash_dump: improve logging for when a process dies prematurely.
  debuggerd_handler: restore errno.
2017-03-11 01:45:28 +00:00
Bowgo Tsai
66ee277353 adb: replacing fs_mgr_read_fstab() with fs_mgr_read_fstab_default()
The original default /fstab.{ro.hardware} might be moved to
/vendor/etc/. or /odm/etc/. Use the new API to get the default
fstab instead of using the hard-coded /fstab.{ro.hardware}.

Bug: 35811655
Test: boot marlin with /vendor/etc/fstab.marlin, then run 'adb remount'
Change-Id: I927209ce3c5bea45c01ed631a7c4c320fe728c00
2017-03-11 09:37:56 +08:00
Treehugger Robot
75b66a6f2a Merge "init.rc: enable ledtrig-transient support for vibrator" 2017-03-11 01:23:18 +00:00
Treehugger Robot
2d03e64b95 Merge "Build split file_contexts on TREBLE builds" 2017-03-10 23:54:18 +00:00
Josh Gao
428daafc5b crash_dump: improve logging for when a process dies prematurely.
If a process that's getting dumped dies before crash_dump starts (e.g.
because seccomp immediately kills it after it execs crash_dump),
improve the error message to not just say "target died before we could
attach".

Bug: http://b/36077710
Test: inserted an exit in the handler, inspected output
Change-Id: I7d394c66d60d328b096b15654b3648e1ed711728
2017-03-10 14:52:34 -08:00
Christopher Ferris
9a22ae5f57 Merge "Add a 2 width option of clang format." 2017-03-10 22:46:29 +00:00
Josh Gao
ec91809dae debuggerd_handler: restore errno.
Bug: http://b/31448909
Test: mma
Change-Id: I737d66e8bed5fb31c2558f68608d3df460fa73c9
2017-03-10 14:44:54 -08:00
Treehugger Robot
e7195be772 Merge "ASAN: Separate SANITIZE_LITE from asan.options" 2017-03-10 21:03:56 +00:00
Christopher Ferris
a78d9a293c Add a 2 width option of clang format.
Make the default the 4 tab space version.

Add a link to the 2 space version for libbacktrace.

The only other difference between the 4 space and 2 space tab version
is that the 2 space tab version allows short functions on a single line.
This is for things like constructors, short destructors, or accessor
functions. I believe this is closer to the Google C++ style guide.

Bug: 36046320

Test: NA
Change-Id: Ida08db18902eeb101f42869dd5590182529d54ef
2017-03-10 13:01:39 -08:00
Treehugger Robot
e02eba8fd2 Merge "adb: properly erase destroyed jdwp_trackers." 2017-03-10 20:54:51 +00:00
Josh Gao
6def9bd67c adb: properly erase destroyed jdwp_trackers.
std::remove_if moves to-be-removed elements to the end of the vector
and returns an iterator that must be .erased.

Bug: http://b/35772578
Test: mma
Change-Id: Idfe8520e176204ac5ce000c30704873a3ffe6c9c
2017-03-10 11:24:37 -08:00
Andreas Gampe
21bb2e0388 ASAN: Separate SANITIZE_LITE from asan.options
Add SANITIZE_LITE_SERVICES to drive usage of asan.options for a
large set of native services.

Test: m SANITIZE_TARGET=address SANITIZE_LITE=true
Test: m SANITIZE_TARGET=address SANITIZE_LITE=true SANITIZE_LITE_SERVICES=true
Change-Id: I84458dcc1b193b762daeb3004cf6c49e2fd8fae2
2017-03-10 10:48:00 -08:00
Christopher Ferris
10ab87f646 Restore errno in signal handlers.
There was a problem where errno could be set in a signal handler
and cause bugs if other system calls were interrupted.

There isn't strong evidence this is causing any issues, but add this
proactively.

Bug: 31448909

Test: Ran the backtrace unit tests, backtraces few random processes,
Test: forced the ANR path for some zygote based processes.
Test: Ran the art ThreadStress test a few times.
Change-Id: I5abc9e330a5e86cea7015e2362f66044c6bc37d0
2017-03-10 10:13:48 -08:00
Treehugger Robot
ce7ee088ff Merge changes I7c1c0f3d,I670cb0b7,Id426d5c5
* changes:
  liblog: replace "frontend" with "transport"
  liblog: stay away from C++ keyword private
  liblog: specify clang format
2017-03-10 15:15:22 +00:00
NIEJuhu
5c31ffe9cd fs_mgr: fix errno setted by mount_with_alternatives
mount_with_alternatives should set errno to match the 1st mount failure.

Bug: N/A
Test: run `fs_mgr -a <fake_fstab>` and check dmesg log
Change-Id: If4148d327f75c659b843e95f85568ea49c5d0180
Signed-off-by: NIEJuhu <niejuhu@xiaomi.com>
2017-03-10 08:36:11 +00:00
Treehugger Robot
ac13718d0a Merge changes from topic 'fstab_relocation'
* changes:
  init: replacing fs_mgr_read_fstab() with fs_mgr_read_fstab_default()
  fs_mgr: support reading fstab file from /odm or /vendor partition
  fs_mgr: add fs_mgr_read_fstab_with_dt() API
2017-03-10 02:07:34 +00:00
Treehugger Robot
f4f95496ce Merge changes from topic 'adb-mdnsd'
* changes:
  Make ADB over mDNS work on Windows
  Enable mDNS on Darwin
  Don't include mDNS support on platforms other than Linux
  Add mDNS device discovery for adb client
  adb: Set a hostname for mDNS
  Make ADBD announce its presence over mDNS
2017-03-10 01:09:42 +00:00
Treehugger Robot
f58280e7dc Merge "init.rc: make sure netd start after post-fs-data" 2017-03-09 23:29:24 +00:00
Josh Gao
48a31877f0 Merge changes from topic 'debuggerd_fallback'
* changes:
  libdebuggerd: add compatibility shim.
  debuggerd_handler: implement missing fallback functionality.
2017-03-09 22:03:31 +00:00
Wei Wang
bae9ba3402 init.rc: make sure netd start after post-fs-data
Current init doesn't order the triggeres it scaned, and there is no
guarantee that general event trigger exec first and then event+property
triggers.

This CL will make sure netd started after post-fs-data trigger is done.

Bug: 35110957
Test: marlin boots
Change-Id: I7bb55af4e00f336682388abfa8a06eac2136b7d4
2017-03-09 13:53:39 -08:00
Treehugger Robot
df2ad0b4ab Merge "Remove hard-coded policy version from secilc step" 2017-03-09 21:03:44 +00:00
Josh Gao
9eb4eb1811 libdebuggerd: add compatibility shim.
Avoid breaking internal code when AOSP automerges to internal.

This will be reverted after fixing up the uses on the other end.

Bug: http://b/35858739
Test: treehugger
Change-Id: If1ee03d8d7c218d3ad9f451cfe9a9077753dda02
2017-03-09 12:13:16 -08:00
Josh Gao
e1aa0ca58a debuggerd_handler: implement missing fallback functionality.
Allow the fallback implementation to dump traces and create tombstones
in seccomped processes.

Bug: http://b/35858739
Test: debuggerd -b `pidof media.codec`; killall -ABRT media.codec
Change-Id: I381b283de39a66d8900f1c320d32497d6f2b4ec4
2017-03-09 11:26:05 -08:00
Alex Klyubin
a71dfec4c2 Remove hard-coded policy version from secilc step
This change makes init's SELinux policy compilation step target the
highest SELinux policy language version supported by the kernel.
Prior to this change the version was simply hard-coded in init.

P. S. clang-format (part of presubmit for this change) is being
counter-productive trying to format the section with secilc
parameters. The resulting layout is harder to read. This commit thus
disables clang-format for this section of code and formats the code
for improved readability.

Test: Remove precompiled policy, device boots up, no new denials.
      Added log statement to print out the policy version passed
      into secilc -- it printed 30, as expected.
Bug: 31363362

Change-Id: I151017b5211712861bafb662525e794a44026dd2
2017-03-09 11:11:23 -08:00
David Lin
27b2c1e678 init.rc: enable ledtrig-transient support for vibrator
This change makes the init process to always attempts to enable
transient trigger for vibrator. This allows the exported properties to
change the ownership later at the on boot stage.

Test: device vibrates with the driver supports ledtrig-transient

Change-Id: If5eb7b7feaefe803f2ead634fbe4fc7b48da84ea
Signed-off-by: David Lin <dtwlin@google.com>
2017-03-09 18:42:33 +00:00
Mark Salyzyn
81321a7980 liblog: replace "frontend" with "transport"
We still do not have any users of the 'frontend' interface, let's
right a wrong and rename it to 'transport' as it makes more sense.
Renames android_log_set_frontend, android_log_get_frontend and
include/log/log_frontend.h.

SideEffects: None
Test: gTest liblog-unit-tests
Bug: 27405083
Change-Id: I7c1c0f3dfdc7cf047285403e306edbd16ad1324d
2017-03-09 09:36:34 -08:00
Mark Salyzyn
04bbc8ea45 liblog: stay away from C++ keyword private
Replace with void* private with priv in context structure.

SideEffects: None
Test: gTest liblog-unit-tests
Bug: 27405083
Change-Id: I670cb0b7fb2f3085ea13b4ac836d84239a3c8572
2017-03-09 09:36:34 -08:00
Mark Salyzyn
2ed51d708e liblog: specify clang format
Switch coding style to match

SideEffects: None
Test: compile
Bug: 27405083
Change-Id: Id426d5c5e3b18f2ceec22b31bbc9781aabf6bcca
2017-03-09 09:36:19 -08:00
Bowgo Tsai
c9a1842d31 init: replacing fs_mgr_read_fstab() with fs_mgr_read_fstab_default()
The original default /fstab.{ro.hardware} might be moved to
/vendor/etc/. or /odm/etc/. Use the new API to get the default
fstab instead of using the hard-coded /fstab.{ro.hardware}.

Bug: 35811655
Test: boot marlin with /vendor/etc/fstab.marlin

Change-Id: I8a9c70eda7f68b174ec355910d0fa1eb18a46e21
2017-03-09 23:26:31 +08:00
Bowgo Tsai
46c6dc1a6f fs_mgr: support reading fstab file from /odm or /vendor partition
fstab contains device- and soc- specific content that should reside in
/odm or /vendor partition. This change searches the fstab.${ro.hardware}
file from /odm/etc, /vendor/etc and /, then use the first one found.

Bug: 35811655
Test: boot sailfish
Change-Id: I82f89b41a849faedb64072a7cfc52d7424e1aaa1
2017-03-09 22:35:54 +08:00
Bowgo Tsai
47d342739a fs_mgr: add fs_mgr_read_fstab_with_dt() API
With the early mount support in init, fstab entries of verified partitions
(e.g., /system, /vendor) will be moved into device tree in kernel image.

Those early mount fstab entries will be removed from the fstab file to
prevent duplicated and/or inconsistent settings.

This change adds a new function: fs_mgr_read_fstab_with_dt(), to return
the combined results from both places. It also removes
fs_mgr_read_fstab_file() from the public APIs and makes it as an
internal function.

Bug: 35811655
Test: early mount /vendor with dm-verity on sailfish

Change-Id: I2fba3614685bf9f852a789cda6f53013e2164e60
2017-03-09 21:15:08 +08:00
Treehugger Robot
c1b3c8ef26 Merge "adb: append the libwinpthread COPYING to adb's NOTICE." 2017-03-09 07:43:56 +00:00
Treehugger Robot
4bf2bc078f Merge "init.rc: start netd and zygote early for file based encryption devices" 2017-03-09 06:12:33 +00:00
Treehugger Robot
59aea45254 Merge "Add a PREUPLOAD.cfg file to run git-clang-format on every commit" 2017-03-09 05:30:19 +00:00
Josh Gao
d3bf1a8d7e adb: append the libwinpthread COPYING to adb's NOTICE.
We statically link libwinpthread into Windows binaries, but soong
currently can't specify notice files for toolchain_libraries. Add
libwinpthread's COPYING info directly to adb's as a hack.

Bug: http://b/36073965
Test: `make PRODUCT-sdk-win_sdk` + manual inspection of NOTICE.txt
Change-Id: I58d6be0ecf5626b67308f7e94128a2cd44dab161
2017-03-08 21:27:59 -08:00
Jeff Vander Stoep
0cbbb8381e Build split file_contexts on TREBLE builds
Build file_contexts.bin on legacy builds.
Test: Marlin and Bullhead build and boot with no new denials.
Test: Marlin and Bullhead recovery boots with no new denials.
Test: Bullhead boots with file_contexts.bin in /
Test: Marlin boot with /system/etc/selinux/plat_file_contexts and
      /vendor/etc/selinux/nonplat_file_contexts.
Bug: 36002414

Change-Id: I66f138fc3ad808df0480e0467cee03fd40177f31
2017-03-08 15:28:06 -08:00
Treehugger Robot
dda9cbb350 Merge "Use precompiled sepolicy when available" 2017-03-08 23:09:08 +00:00
Wei Wang
7f32aa4d04 init.rc: start netd and zygote early for file based encryption devices
Bug: 35110957
Test: marlin boots
Change-Id: Ibe4c413e41fcf25a68b50d99ee66d9b70706a6a1
2017-03-08 14:48:53 -08:00
Treehugger Robot
4e5e797d26 Merge "init.rc: add a new zygote-start trigger" 2017-03-08 22:18:11 +00:00
Wei Wang
a2058036ed init.rc: add a new zygote-start trigger
Bug: 35110957
Test: marlin boots
Change-Id: I12b41588371486e79938df2f7a2152cda18530d1
2017-03-08 12:39:41 -08:00
Alex Klyubin
2d19aeb13a Use precompiled sepolicy when available
NOTE: This change affects only devices which use SELinux kernel policy
split over system and vendor directories/partitions.

Prior to this change, init compiled sepolicy from *.cil files on every
boot, thus slowing boot down by about 400 ms. This change enables init
to skip the step compilation and thus avoid spending the 400 ms. The
skipping occurs only if the device's vendor partition includes an
acceptable precompiled policy file. If no acceptable policy is found,
the compilation step takes place same as before.

Because such devices support updating system and vendor partitions
independently of each other, the vendor partition's precompiled policy
is only used if it was compiled against the system partition's policy.
The exact mechanism is that both partitions include a file containing
the SHA-256 digest of the system partition's policy
(plat_sepolicy.cil) and the precompiled policy is considered usable
only if the two digests are identical.

Test: Device with monolithic policy boots up just fine
Test: Device with split policy and with matching precompiled policy
      boots up just fine and getprop ro.boottime.init.selinux returns
      a number below 100 ms. No "Compiling SELinux policy" message in
      dmesg.
Test: Device with split policy and with non-matching precompiled
      policy boots up just fine and getpropr ro.boottime.init.selinux
      returns a number above 400 ms. There is a "Compiling SELinux
      policy" message in dmesg. The non-matching policy was obtained
      by adding an allow rule to system/sepolicy, building a new
      system image using make systemimage and then flashing it onto
      the device.
Bug: 31363362
Change-Id: Ic2e81a83051689b5cd5ef1299ba6aaa1b1df1bdc
2017-03-08 12:25:25 -08:00
Badhri Jagan Sridharan
eab4c62e22 Merge "adb: Do not signal gaget stack unless descriptors are written" 2017-03-08 19:33:10 +00:00
Treehugger Robot
e88882e16e Merge "init.rc: remove duplicated chown entry for timed_output" 2017-03-08 18:39:49 +00:00
Mark Salyzyn
6471b85143 Merge "liblog: add LOGGER_STDERR frontend" 2017-03-08 17:03:44 +00:00
Mark Salyzyn
4d99c986d9 liblog: add LOGGER_STDERR frontend
Standalone, this logger provides no end-to-end capability.  Only
provides a writer, no reader transport.  All output goes, logcat-like,
into the stderr stream.  Output can be adjusted with environment
variables ANDROID_PRINTF_LOG and ANDROID_LOG_TAGS.

liblog_*.__android_log_bswrite_and_print___max print fails if a string
member is truncated with "Binary log entry conversion failed" and -1.
We expose the truncated content in the tests and in LOGGER_STDERR.

The purpose of this transport selection is for command-line tools,
providing a means to shunt the logs to be mixed in with the tool's
error stream.

Test: gTest liblog-unit-tests
Bug: 27405083
Change-Id: If344b6e3e67df2dc86ce317cfad8af8e857727b7
2017-03-08 07:17:31 -08:00
Treehugger Robot
e1bfafd241 Merge "liblogcat: free up log_device_t structures" 2017-03-08 15:11:28 +00:00
Bowgo Tsai
1aeb8d2107 Add a PREUPLOAD.cfg file to run git-clang-format on every commit
The style file .clang-format is copied from adb/.clang-format.
Each sub folders still can have different style by adding their own
.clang-format because git-clang-format uses the style file located
in one of the parent directories of the *source file*.

Also see the following link for previous discussions:

  https://android-review.googlesource.com/#/c/340106

Bug: 36046320
Test: repo upload, checks pre-submit fails when the uploading commit
      doesn't meet the style

Change-Id: I94369af197da1ccce581bbd861c8737f6a197429
2017-03-08 16:51:26 +08:00
David Lin
489450abe3 init.rc: remove duplicated chown entry for timed_output
Test: build

Change-Id: Ib15be4188cdce270a15bd90304be0704d9e54cbf
Signed-off-by: David Lin <dtwlin@google.com>
2017-03-07 21:31:42 -08:00
Badhri Jagan Sridharan
43fd1a4ea7 adb: Do not signal gaget stack unless descriptors are written
While recovering from endpoint errors, the gadget stack was being
signalled even when desriptors were NOT being rewritten. Avoid this
as this might cause enumeration loops.

Bug: 36036550
Change-Id: Iff2b2fc8cded001ef3c77dc170dce3b96848970c
2017-03-07 19:20:54 -08:00