Commit Graph

21946 Commits

Author SHA1 Message Date
Christopher Ferris a7431cfa57 Merge "Fix problem with wait_for_gdb." into nyc-dev 2016-05-05 17:46:28 +00:00
Felipe Leme 162414474e Merge "Display warning about bugreport delay." into nyc-dev
am: f99193b7aa

* commit 'f99193b7aa8eedb0f5be448c6df6d2688c1bfb2e':
  Display warning about bugreport delay.

Change-Id: I3203a50143c7fff4f5ffe98625ebd0fd357fb0f7
2016-05-05 03:04:50 +00:00
TreeHugger Robot f99193b7aa Merge "Display warning about bugreport delay." into nyc-dev 2016-05-05 03:01:29 +00:00
Christopher Ferris 9818bd2bbe Fix problem with wait_for_gdb.
When someone enables wait_for_gdb, activity manager will kill the
stopped process before a developer can attach to the process. To
allow debugging in this case, change the code to only contact the
activity manager right before continuing the process that is
crashing.

Also, modify the conditions under which to do a gdb attach. The previous
code did a partial attach if perform_dump failed. The new version simply
allows an attach regardless of whether perform_dump passes or fails.

Bug: 28409358
Change-Id: I4fe8d390c212d47e007cbe6543c2d114c3c7aeff
2016-05-04 17:42:30 -07:00
Felipe Leme 42e45c7068 Display warning about bugreport delay.
BUG: 28569299
Change-Id: Ide6109fd24737cbaf6296ef7326127e85d6420cb
2016-05-04 16:20:25 -07:00
Dimitry Ivanov 0d505c0645 Merge "nativeloader: Add CloseNativeLibrary() method" into nyc-dev
am: acd3c71784

* commit 'acd3c71784d4207b478f411413f109281a83ef36':
  nativeloader: Add CloseNativeLibrary() method

Change-Id: I109d4fd3b688720c5260a2b40641e25122085a5f
2016-05-04 22:31:29 +00:00
Dimitry Ivanov acd3c71784 Merge "nativeloader: Add CloseNativeLibrary() method" into nyc-dev 2016-05-04 22:22:07 +00:00
Nick Kralevich f6ff9638b2 init/builtins.cpp: Switch to finit_module
am: f2049163a4

* commit 'f2049163a4ce602dffaa41a747ee5675a0d82752':
  init/builtins.cpp: Switch to finit_module

Change-Id: I2c29111f0b5e369bd4a6034fea93a93dde1848e8
2016-05-04 16:02:27 +00:00
Nick Kralevich f2049163a4 init/builtins.cpp: Switch to finit_module
Switch insmod from using init_module to finit_module. From
"man finit_module":

  The finit_module() system call is like init_module(), but reads the
  module to be loaded from the file descriptor fd. It is useful when the
  authenticity of a kernel module can be determined from its location in
  the file system; in cases where that is possible, the overhead of
  using cryptographically signed modules to determine the authenticity
  of a module can be avoided.

finit_module is preferred over init_module because it allows LSMs, such
as SELinux, to perform a permission check on kernel module loads based on
the file from which the module is loaded. This functionality is not yet
implemented in the Linux kernel, but is on the SEAndroid TODO list.
See https://bitbucket.org/seandroid/wiki/wiki/ToDo

Bug: 27824855

(cherry picked from commit 124a9c97e9)

Change-Id: I5e87de1a7b8c3d8849bf757c71b08e81c378b021
2016-05-04 07:01:46 -07:00
Matthew Bouyack 654174e2af Merge "If we fail to format a blank partition, try recovery" into nyc-dev
am: 6846d22629

* commit '6846d22629e7bf9d53006d4f40c9c5f81b2b45f0':
  If we fail to format a blank partition, try recovery

Change-Id: Ic56fccb65c171d4f21527bc78a7b4eb76edcb348
2016-05-03 23:22:58 +00:00
Matthew Bouyack 6846d22629 Merge "If we fail to format a blank partition, try recovery" into nyc-dev 2016-05-03 23:18:16 +00:00
Elliott Hughes 204d3a564d DO NOT MERGE ANYWHERE Remove the USB vendor id whitelist from fastboot. am: a463d24633 -s ours am: 1baf911bd5 -s ours
am: c04a11c9e3  -s ours

* commit 'c04a11c9e3bc1a314f05561648a0db6da767d03d':
  DO NOT MERGE ANYWHERE Remove the USB vendor id whitelist from fastboot.

Change-Id: Id39182b1ebd96cf51d987e47c1fedfd3f0fa45c3
2016-05-03 22:59:27 +00:00
Elliott Hughes c04a11c9e3 DO NOT MERGE ANYWHERE Remove the USB vendor id whitelist from fastboot. am: a463d24633 -s ours
am: 1baf911bd5  -s ours

* commit '1baf911bd5a8df58e0bf66a8741829f34625d44f':
  DO NOT MERGE ANYWHERE Remove the USB vendor id whitelist from fastboot.

Change-Id: Ic1ea13b7a393e5bbb3e8e1376b9470987ecdc925
2016-05-03 22:57:06 +00:00
Elliott Hughes 1baf911bd5 DO NOT MERGE ANYWHERE Remove the USB vendor id whitelist from fastboot.
am: a463d24633  -s ours

* commit 'a463d246339f405981bd690209429ef5acf0f01d':
  DO NOT MERGE ANYWHERE Remove the USB vendor id whitelist from fastboot.

Change-Id: Id9504ed93bedf0f981fc7817d07aee5b74fac8db
2016-05-03 22:54:31 +00:00
Dimitry Ivanov 09a516bf16 nativeloader: Add CloseNativeLibrary() method
This method is called by art on UnloadNativeLibraries()

Bug: http://b/28406866
Change-Id: Ibccff93c83d6ccd3d0a1c0294a64b09281b4e05e
2016-05-03 14:55:25 -07:00
Felipe Leme 594aa58894 Automatically add a .zip to adb bugreport file when missing.
am: 644a36c209

* commit '644a36c20942029ece43ea9fbeb6163d4b706c56':
  Automatically add a .zip to adb bugreport file when missing.

Change-Id: I5de2340cfbbedfd89db1706008165567a8a4158d
2016-05-03 21:33:41 +00:00
Felipe Leme 644a36c209 Automatically add a .zip to adb bugreport file when missing.
BUG: 27653204
Change-Id: Ib322f1f9eeedd8e78c9a51a845a20c462442a0fe
2016-05-03 10:21:22 -07:00
Elliott Hughes a463d24633 DO NOT MERGE ANYWHERE Remove the USB vendor id whitelist from fastboot.
(Backported from AOSP commit: e1746fda6a)

Change-Id: I661a0538776d4ba74fcee37e2964d987eb861342
2016-05-03 10:14:02 -07:00
Matthew Bouyack 9c59cbcf37 If we fail to format a blank partition, try recovery
Bug: 28303663

Change-Id: Iab802997dcd2a4416417228c92362518c7f1a82f
2016-05-03 10:01:03 -07:00
Dimitry Ivanov e723651840 Merge "nativeloader: Add Reset capabilities" into nyc-dev
am: 3174bda7ac

* commit '3174bda7ac07465400a4b38b272ebe5126212ba6':
  nativeloader: Add Reset capabilities

Change-Id: Ibf410033e22a681f47d9adccec5713fa995b577b
2016-05-02 21:39:09 +00:00
Dimitry Ivanov 3174bda7ac Merge "nativeloader: Add Reset capabilities" into nyc-dev 2016-05-02 21:20:00 +00:00
Dimitry Ivanov be4ca3afc0 nativeloader: Add Reset capabilities
In the case when VM is restarted all weak references
from the old VM become invalid. In such event NativeLoader
needs to clear the list of classloaders from old VM.

Bug: http://b/28453840
Bug: http://b/28449304
Change-Id: I2268c1e21cf940c57ddc5f0312f56b71aa702134
2016-05-02 10:43:16 -07:00
sergeyv b00141d2fc Merge "atrace: read package names from multiple sysprops" into nyc-dev
am: d7dfadbd4c

* commit 'd7dfadbd4c66a8b6f1f8e0be805c211b83e88c16':
  atrace: read package names from multiple sysprops

Change-Id: Ie61e20a3ad5d9bdcda801814e1da87d664e873e1
2016-04-30 00:07:46 +00:00
Sergei Vasilinetc d7dfadbd4c Merge "atrace: read package names from multiple sysprops" into nyc-dev 2016-04-30 00:02:23 +00:00
sergeyv c19588cfc8 atrace: read package names from multiple sysprops
bug: 28200530
Change-Id: I4597a84f4fb16098b0e57684cde5e57c1f41eed5
2016-04-29 10:56:41 -07:00
Mark Salyzyn 79923c91e3 Merge "liblog: O_CLOEXEC flag on opens" into nyc-dev
am: 787b4b8ed2

* commit '787b4b8ed24073d292702622eaa3fb535fd3abba':
  liblog: O_CLOEXEC flag on opens

Change-Id: Ibdcded9c9b0c389cf26ea985a237315997d79d9e
2016-04-29 16:20:00 +00:00
Mark Salyzyn 787b4b8ed2 Merge "liblog: O_CLOEXEC flag on opens" into nyc-dev 2016-04-29 16:15:02 +00:00
Mark Salyzyn f077cf3df0 liblog: logcat -g readable size wrong
am: 358cf8a919

* commit '358cf8a91961eeb1e553664df3bc6b40933ab868':
  liblog: logcat -g readable size wrong

Change-Id: I6129ea776980b4bb09e6cb122b24c675488ad957
2016-04-29 15:14:34 +00:00
Mark Salyzyn 2b409c9bc7 liblog: O_CLOEXEC flag on opens
(cherry pick from commit 78786da116)

Bug: 28455828
Change-Id: Ic00101a6192aab7271cb0c3461e249a77d7f29ed
2016-04-29 08:08:39 -07:00
Mark Salyzyn 358cf8a919 liblog: logcat -g readable size wrong
(cherry pick from commit ccfb244b36)

Bug: 28451229
Change-Id: I4bbc2bed933d69416c23cc7af617be3fb55d0b62
2016-04-29 07:45:29 -07:00
Colin Cross 9a99578573 Silently ignore duplicate heap entries
am: cecd64012d

* commit 'cecd64012db013331ff1071254ab543dcdf327bd':
  Silently ignore duplicate heap entries

Change-Id: I67edc2bdedbd28bf4b11a071e132ae213d143bc1
2016-04-29 00:15:22 +00:00
Colin Cross f3a81cadae Handle segfaults while walking native heap
am: ba5d9ff6d9

* commit 'ba5d9ff6d9674a0f1e985b49f53863045aff558d':
  Handle segfaults while walking native heap

Change-Id: I8a63ed20a9d8fbd3611e542b7584f3bdd2a95dae
2016-04-29 00:15:20 +00:00
Colin Cross cecd64012d Silently ignore duplicate heap entries
Vendor blobs on ryu mprotect heap pages, causing a single chunk mapping
to appear as multiple mappings.  The heap iterator has to expand the
requested range to cover the beginning of the chunk to find the chunk
metadata, which will lead to duplicate identical allocations being
reported from iterating over each of the split mappings.  Silently
ignore identical allocations, and only warn on non-identical allocations
that overlap.

Bug: 28269332
Change-Id: Ied2ab9270f65d00a887c7ce1a93fbf0617d69be0
2016-04-28 16:20:40 -07:00
Colin Cross ba5d9ff6d9 Handle segfaults while walking native heap
Vendor blobs on ryu mprotect heap pages, causing segfaults when dumping
unreachable memory.  Handle segfaults within HeapWalker by mapping a
zero page over any unreadable pages.  HeapWalker runs in the forked
process, so the mapping will not affect the original process.

Bug: 28269332
Change-Id: I16245af722123f2ad467cbc6f245a70666c55544
2016-04-28 16:20:40 -07:00
Yabin Cui 69e97e4bee adb: close ep0 on disconnection.
adbd on device kicks the usb connection when usb IO fails. But to notify
adb on host to reconnect it, adbd needs to close ep0 to reset the usb
connection. Otherwise, adb on host cann't connect the device unless the
usb cable is reconnected or adb host server is restarted.

This can be tested by using `adb reconnect device` command.

Bug: 25935458

Change-Id: I80979d6029e60b9cfd218f7b9b5201810238ec07
2016-04-28 16:01:10 -07:00
Mihai Serban f375bf38aa ueventd: relabel block devices nodes when processing subsequent add events
am: 721c9ce

* commit '721c9ce4a55c13716f263dc7a9cbda92b349b4b7':
  ueventd: relabel block devices nodes when processing subsequent add events

Change-Id: I148427f531764e1baa4b19faa14274c0bd03851e
2016-04-28 16:36:39 +00:00
Mihai Serban 721c9ce4a5 ueventd: relabel block devices nodes when processing subsequent add events
There is a race in ueventd's coldboot procedure that permits creation
of device block nodes before platform devices are registered. This happens
when the kernel sends events for adding block devices during ueventd's
coldboot /sys walk.
In this case the device node links used to compute the SELinux context
are not known and the node is created under the generic context:
u:object_r:block_device:s0.
A second add event for block device nodes is triggered after the platform
devices are handled by ueventd and the SELinux context is correctly computed
but the mknod call fails because the node already exists. This patch handles
this error case and updates the node's security context.

The race is introduced by the uevent sent from the sdcard device probe
function. The issue appears when this uevent is triggered during ueventd's
coldboot procedure but before the /sys/devices recursive walk reached the
corresponding sdcard platform device path.
The backtrace looks something like:
1. ueventd_main()
2. device_init()
3. coldboot("/sys/devices");
4. do_coldboot()
5. handle_device_fd()
6. handle_device_event()
6.1 handle_block_device_event()
6.2 handle_platform_device_event()

Because handle_device_fd() reads all events from the netlink socket it may
handle the add events for the sdcard partition nodes send occasionally by the
kernel during coldboot /sys walk procedure.
If handle_device_event() continues with handle_block_device_event()
before handle_platform_device_event() registers the sdcard platform device then
handle_block_device_event() will create device nodes without knowing all block
device symlinks (get_block_device_symlinks()):
1. handle_device(path=/dev/block/mmcblk0p3, links = NULL)
2. make_device(path=/dev/block/mmcblk0p3, links = NULL)
3. selabel_lookup_best_match(path=/dev/block/mmcblk0p3, links = NULL)
  returns the default context (u:object_r:block_device:s0) for
  /dev/block/mmcblk0p3 instead of more specific context like:
  u:object_r:boot_block_device:s0
4. setfscreatecon(u:object_r:block_device:s0)
5. mknod(/dev/block/mmcblk0p3)

So the node is create with the wrong context. Afterwards the coldboot /sys walk
continues and make_device() will be called with correct path and links.
But even if the secontext is computed correctly this time it will not be
applied to the device node because mknod() fails.
I see this issue randomly appearing (one time in 10 reboots) on a Minnoboard
Turbot with external sdcard as the boot device.

BUG=28388946

Signed-off-by: Mihai Serban <mihai.serban@intel.com>

(cherry picked from commit 24a3cbfa73)

Change-Id: I2d217f1c8d48553eb4a37457dbf27fff54051cf9
2016-04-28 06:27:39 -07:00
Dimitry Ivanov e43503c2a8 native_loader: Use ANDROID_ROOT environment variable
am: 0b5651e

* commit '0b5651e1588c2fee6a587314993a166a77068974':
  native_loader: Use ANDROID_ROOT environment variable

Change-Id: I384d0c5b24da515719ad936421331a89e9dc5cf8
2016-04-27 23:52:43 +00:00
Dimitry Ivanov 2c3cdae297 Enable namespaces for all target sdk versions
am: 5539db0

* commit '5539db0b4f915bf15de742d1378904a553dc80dc':
  Enable namespaces for all target sdk versions

Change-Id: I29fda91a146b15f3356f9d50638b09a573c43e3a
2016-04-27 23:52:43 +00:00
Dimitry Ivanov 0b5651e158 native_loader: Use ANDROID_ROOT environment variable
Replace "/system" with ANDROID_ROOT environment variable.

Bug: http://b/28320913
Bug: http://b/28082914
Change-Id: Ib039722cb059bae1635b45f6af20ef0180e83ba9
(cherry picked from commit 7e8cee8fb2)
2016-04-27 13:43:33 -07:00
Dimitry Ivanov 5539db0b4f Enable namespaces for all target sdk versions
We previously relied on the fact that target sdk version 0
implies system_server, which is not true, target sdk version
may be set to 0 for other apps and it means 1 - the earliest
version of android. This change enables namespaces for
apps targeting all sdk version and for system_server.

Bug: http://b/27702070
Change-Id: I16fbdeb6868c7035aec71132c80c150c08ea2cc3
(cherry picked from commit 213676b880)
2016-04-27 11:44:42 -07:00
Yabin Cui d7f60557b0 Merge "adb: fix adb usb operations on device." into nyc-dev
am: f92838c

* commit 'f92838ca1d5e315943022b7225a6c97c6c1283f4':
  adb: fix adb usb operations on device.

Change-Id: I9db3169f3e8af6db6e28dc9186ba21831179f7ae
2016-04-27 03:43:10 +00:00
Yabin Cui f92838ca1d Merge "adb: fix adb usb operations on device." into nyc-dev 2016-04-27 03:05:40 +00:00
Yabin Cui 54d50bee55 Merge "adb: use a custom thread to poll for usb devices on mac." into nyc-dev
am: f7c31b9

* commit 'f7c31b9552da778ebea5ac3c2bd3c5260b5e7705':
  adb: use a custom thread to poll for usb devices on mac.

Change-Id: I73c0321758f027e7dec32980e37a22dde6662f3a
2016-04-27 00:51:22 +00:00
Yabin Cui 9b53e4c42c adb: fix adb usb operations on device.
Problem: For devices using /dev/usb-ffs/adb, Run
`while true; do adb reconnect device; sleep 1; done`. And the
device soon becomes offline. The adbd log shows that calling
adb_read(h->bulk_out) in usb_ffs_read() gets EOVERFLOW error.

Reason: When kicking a transport using usb-ffs, /dev/usb-ffs/adb/ep0
is not closed, and the device will not notify a usb connection reset
to host. So the host will continue to send unfinished packets even
if a new transport is started on device. The unfinished packets may
not have the same size as what is expected on device, so adbd on
device gets EOVERFLOW error. At the worst case, adbd has to create new
transports for each unfinished packet.

Fixes:
The direct fix is to make the usb connection reset when kicking transports,
as in https://android-review.googlesource.com/#/c/211267/1. And I think
we can make following improvements beside that.
1. Close a file that is used in other threads isn't safe. Because the file
descriptor may be reused to open other files, and other threads may operate
on the wrong file. So use dup2(dummy_fd) to replace close() in kick function,
and really close the file descriptor after the read/write threads exit.

2. Open new usb connection after usb_close() instead of after
usb_kick(). After usb_kick(), the transport may still exist and
reader/writer for the transport may be still running. But after
usb_close(), the previous transport is guaranteed to be destroyed.

Bug: 25935458
Change-Id: I1eff99662d1bf1cba66af7e7142f4c0c4d82c01b
(cherry picked from commit 005bf1e05b)
2016-04-26 17:43:14 -07:00
Yabin Cui f7c31b9552 Merge "adb: use a custom thread to poll for usb devices on mac." into nyc-dev 2016-04-27 00:38:58 +00:00
Yabin Cui 71bddf842d adb: use a custom thread to poll for usb devices on mac.
On mac, if the adb server kicks a transport on some error, mac usb driver
will not report a new usb device. So instead of relying on mac usb driver
to report new usb devices, this CL uses a loop to search for usb devices
not exist before. Note that this is also the behavior on windows and linux
host.
`adb reconnect` can be used to verity this CL.

Bug: 25935458
Change-Id: I890e0eb1fae173f2e7a0c962ededa294d821e015
(cherry picked from commit 48d4c0c42a)
2016-04-26 17:00:49 -07:00
Yabin Cui 4d7a96cf10 Merge "Fix kick_transport test." into nyc-dev
am: 550ad20d

* commit '550ad20d64e3a4cc508fac172c62f16b0d201acd':
  Fix kick_transport test.

Change-Id: I178d5aa37fb77906b5487df2a7aa80cb01ee9f90
2016-04-26 23:29:14 +00:00
Yabin Cui 550ad20d64 Merge "Fix kick_transport test." into nyc-dev 2016-04-26 23:18:20 +00:00
Daniel Rosenberg 0013ab2639 Add support for FUSE_CANONICAL_PATH
am: 2abee9e

* commit '2abee9e063d1549fb006853b27f378c7d22192af':
  Add support for FUSE_CANONICAL_PATH

Change-Id: I9268c06c43debd48b10342020f994ac0a989bdd7
2016-04-26 23:01:59 +00:00