Commit graph

19210 commits

Author SHA1 Message Date
Christopher Ferris
d4c884330c Fix use of uninitialized memory.
When creating an UnwindMapLocal fails in the Build() function call,
the destructor for UnwindMap is called. Unfortunately, the map_cursor_
member variable has not been initialized, so the call to destroy it
winds up operating on garbage data.

Part of this is a result of a bad class hierarchy, so this refactors
the classes slightly, and properly initializes the map_cursor_ member
variable in the base class.

Bug: 26931578
Change-Id: I885596bf65e4ef63559cee2c56cd41576d5ecc1b
2016-02-05 15:22:34 -08:00
David Pursell
c742a7f174 fastboot: add Socket timeout detection.
UDP fastboot will require re-transmission in the case of datagrams
getting lost. This CL adds Socket functionality to easily distinguish
between a normal timeout and a socket failure.

I also found some Windows docs that indicate sockets may become
invalid after a call to recv() times out. This has never occurred in
my testing, but to be safe this switches the timeout implementation
to use select() instead of SO_RCVTIMEO.

Bug: http://b/26154914
Change-Id: Id7b598f8aea5df1a3676d24702b489042d5f9e3a
2016-02-05 13:22:06 -08:00
Elliott Hughes
718625010d Merge "init: fix writepid wrong pid written in file(s)" 2016-02-05 18:41:52 +00:00
Elliott Hughes
ead369bdf0 Merge "Fix libbase's logging dependency." 2016-02-05 18:25:43 +00:00
Mark Salyzyn
76f99770d1 Merge "libcutils: abort for invalid fd" 2016-02-05 18:05:24 +00:00
Mark Salyzyn
20a6f0ff3b Merge "init-debug.rc: add runtime mmc max speed property actors" 2016-02-05 15:21:35 +00:00
Anestis Bechtsoudis
b702b46f68 init: fix writepid wrong pid written in file(s)
When child (pid==0) executes fork branch 'pid_str'
will always be 0 writting wrong value to file(s).
Fix by utilizing getpid() to obtain correct pid.

Tracker link provides some insight on why use cases
aren't broken.

Bug: https://code.google.com/p/android/issues/detail?id=200392

Change-Id: I29989365a8bac94502c090918fa30e5cc88eb1ea
Signed-off-by: Anestis Bechtsoudis <anestis@census-labs.com>
2016-02-05 16:49:28 +02:00
Christopher Ferris
14c06e0769 Merge "Newer kernels added SEGV_BNDERR." 2016-02-05 02:08:27 +00:00
Chih-hung Hsieh
cfd44ee74f Merge "Suppress false positive memory leak warnings." 2016-02-05 01:21:14 +00:00
Chih-Hung Hsieh
f7e7bd4c3b Suppress false positive memory leak warnings.
Clang static analyzer does not know the transfer of
object ownership to hashmapPut. Use a fake global
pointer variable to trick the analyzer.

BUG: 26955438
Change-Id: Id3ac595fff14e48d28a1147461cd836914857086
2016-02-04 16:38:04 -08:00
Alex Deymo
205cdb8868 Merge "metricsd: Create a brillo::MessageLoop." 2016-02-04 23:38:54 +00:00
Jorge Lucangeli Obes
42a53e0c2a Merge "Unit tests: Compile only on 'eng' builds." 2016-02-04 22:24:46 +00:00
Jorge Lucangeli Obes
1e7592c9d5 Unit tests: Compile only on 'eng' builds.
metrics_collector_tests, metricsd_tests.

Bug: 26967770
Change-Id: I6d7e8fb6d3d98ab747d922bfeef05aa344b2179c
2016-02-04 14:17:46 -08:00
Christopher Ferris
5d56e28537 Newer kernels added SEGV_BNDERR.
Bug: 23789423
Change-Id: I6fdce75715edfce179df8c0e6a7205f26341ebd0
2016-02-04 14:07:23 -08:00
Jorge Lucangeli Obes
a7d277796f Merge "crash_reporter_tests: Compile only on 'eng' builds." 2016-02-04 22:00:25 +00:00
Alex Deymo
f1bf9e5fc9 metricsd: Create a brillo::MessageLoop.
brillo::BinderWatcher now requires a brillo::MessageLoop, so this patch
creates a brillo::BaseMessageLoop and passes it when creating the
brillo::BinderWatcher.

Bug: 26356682
TEST=Deployed metricsd to edison-eng.

Change-Id: I6a9e592623faf231205ae44e479bec2b873b8898
2016-02-04 13:56:38 -08:00
Jorge Lucangeli Obes
512d677a5e crash_reporter_tests: Compile only on 'eng' builds.
Bug: 26967770
Change-Id: I2bebd3da5f0d845edec24279c160d9cc62577210
2016-02-04 13:56:25 -08:00
Mark Salyzyn
9dead6deec Merge "logcat: build cleanup" 2016-02-04 21:40:16 +00:00
Mark Salyzyn
7864e36751 init-debug.rc: add runtime mmc max speed property actors
persist.mmc.max_read_speed  - KB/s speed cap
persist.mmc.max_write_speed - KB/s speed cap
persist.mmc.cache_size      - MB of high-speed on-device write cache

device default directly to associated /sys/block/mmcblk0/ attributes,
not delivered on "user" builds.

Bug: 26976972
Change-Id: Ic82b9614489b6406ce830d127c85affc9095e256
2016-02-04 13:10:19 -08:00
Mark Salyzyn
5b89b49fc9 logcat: build cleanup
LOCAL_MODULE_TAGS debug encompasses eng

Bug: 26976972
Change-Id: I44b30f2ebb0173b203bf975f01dfead737b4e5bf
2016-02-04 13:10:19 -08:00
Mark Salyzyn
11aebd8c9a Merge "logcatd.rc: only deliver on eng and userdebug" 2016-02-04 20:33:20 +00:00
Mark Salyzyn
6de62e52c7 logcatd.rc: only deliver on eng and userdebug
Change-Id: I694d33a041e40fe181d3c2f1c8604765ba29e709
2016-02-04 11:11:52 -08:00
Elliott Hughes
5cf0dcd5b2 Fix libbase's logging dependency.
Get liblog directly, rather than transitively through libcutils.

Change-Id: Ia08ac6f04ac68c39807989d869709bae0a051578
2016-02-04 08:24:55 -08:00
Josh Gao
aae1eb2c4f Merge "adb: don't append a slash to a path that already ends with one." 2016-02-04 00:36:32 +00:00
Elliott Hughes
1617dd4fe9 Merge "adb: win32: fix start-server to properly display UTF-8 on the console" 2016-02-04 00:26:36 +00:00
Spencer Low
53a0a99fe8 adb: win32: fix start-server to properly display UTF-8 on the console
fwrite() is a macro that maps to adb_fwrite(), which can write UTF-8 to
the console. Use it to write the output that comes from the subprocess
adb server.

To do this, dup the stdout/stderr file descriptor and make a duplicate
FILE* stream, in binary mode (since we're reading raw bytes from the
subprocess), and unbuffered.

Change-Id: I480761bae0bd576dc9e03fa4d31266f4e49635ed
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2016-02-03 16:24:37 -08:00
Josh Gao
323899b6d3 adb: don't append a slash to a path that already ends with one.
Bug: http://b/26964908
Change-Id: I1fbd752fd97f5414a306b46f7bfce3373362f8b3
2016-02-03 16:24:13 -08:00
Elliott Hughes
ba3014c914 Merge "Add support for USB_HVDCP chargers" 2016-02-04 00:08:33 +00:00
Josh Gao
7aa7a81eb1 Merge "adb: report subprocess creation errors to the client." 2016-02-03 23:53:26 +00:00
Josh Gao
4323507a7e adb: report subprocess creation errors to the client.
Bug: http://b/26589627
Change-Id: I38e7a33ea8274f0eb47dc0ed87fcbca08a0ab22a
2016-02-03 15:52:07 -08:00
Josh Gao
2d2185ee09 Merge "adb: fix mistaken uses of SendFail in file_sync_service.cpp." 2016-02-03 23:51:44 +00:00
Josh Gao
6ad06b9ea9 adb: fix mistaken uses of SendFail in file_sync_service.cpp.
SendFail and SendSyncFail are similarly named, and have the same
prototype. Use `#pragma GCC poison` to prevent use of SendFail in
file_sync_service.cpp, and fix the places where it was used
accidentally.

Change-Id: I6b9a7e565b76dfab10f8ae38f889d046ad80a403
2016-02-03 23:50:32 +00:00
Mark Salyzyn
9c551a1bec Merge "libcutils: ashmem print error message for invalid fd" 2016-02-03 23:30:29 +00:00
Mark Salyzyn
1a84f47794 Merge "libcutils: ashmem check fd validity" 2016-02-03 23:30:06 +00:00
Elliott Hughes
80e88a1274 Merge "Fix the version number in the fastboot documentation." 2016-02-03 23:10:46 +00:00
Mark Salyzyn
53c0ca6520 libcutils: abort for invalid fd
If ashmem accessors are being called with a file descriptor that
belongs to anything other than ashmem, we need to stop it right
now so that they can fix the caller.

Bug: 26871259
Change-Id: Icf9aafc3631a80b9af6fe0fea03599d61e285d21
2016-02-03 15:09:20 -08:00
Mark Salyzyn
e37111d751 libcutils: ashmem print error message for invalid fd
NB: We decided to not sniff for the constant saved __ashmem_rdev in
the early error path; requiring either the use of atomic operations,
or acquiring a lock to do it correctly. The heroics are not worth it.

Bug: 26871259
Change-Id: I46249838850ae32063eb5b7d08c731c5bb0fbf6b
2016-02-03 15:06:45 -08:00
Elliott Hughes
d505cd8db2 Fix the version number in the fastboot documentation.
Bug: https://code.google.com/p/android/issues/detail?id=65414
Change-Id: Ia52101f7c8d59e79583fd9658e001648ff545c66
2016-02-03 14:30:01 -08:00
David Pursell
80dc9d8584 Merge "fastboot: add TCP protocol." 2016-02-03 21:59:31 +00:00
David Pursell
2ec418a4c9 fastboot: add TCP protocol.
This CL implements a TCP protocol for use with fastboot. Protocol
description is given in fastboot_protocol.txt, some examples of
expected behavior can also be found in tcp_test.cpp.

Usage is:
  fastboot -s tcp:<hostname>[:port] <command>

Bug: http://b/26558551
Change-Id: If53a514a534489c617db32c4fea8819949121282
2016-02-03 13:57:45 -08:00
Colin Cross
a2dd73424f Merge "liblog: remove strdup from logging calls" 2016-02-03 21:48:37 +00:00
Mark Salyzyn
1186f3a5ad libcutils: ashmem check fd validity
- collect st_rdev on open, or when required, for /dev/ashmem.
- check in all cases if fd is a character device and matches rdev.
- requires that we have open, read and write access to /dev/ashmem
  to check, assumption being that if we can not, then we have no
  right playing with the associated misdirected file descriptor.

NB: ashmem libcutil library entry points can no longer be called in
    signal context.

Bug: 26871259
Change-Id: I9a17e33317a9be795131473a51c16f761b5f7407
2016-02-03 13:05:22 -08:00
Steve Fung
da1a9a277d Merge "crash_reporter: Fix paths for kernel panic collection" 2016-02-03 20:30:58 +00:00
David Pursell
e54ea1c12d Merge "fastboot: fix SocketMock send failures." 2016-02-03 18:54:27 +00:00
David Pursell
2c094f7983 fastboot: fix SocketMock send failures.
Fixes SocketMock::ExpectSendFailure() to allow unit testing of errors
during send, and adds tests for ExpectSendFailure() and
AddReceiveFailure().

Also adds missing tests to make sure ReceiveAll() continues to read
until failure or all bytes have been read.

Bug: http://b/26157893
Change-Id: I67e7d6de8e8ec4a3b62a6b7d7217f7530862edf7
2016-02-03 10:43:01 -08:00
David Pursell
f6f800ef3c Merge "libcutils/fastboot: improve multi-buffer write." 2016-02-03 18:03:00 +00:00
David Pursell
b34e4a06ee libcutils/fastboot: improve multi-buffer write.
Fixes libcutils multi-buffer write interface to be more friendly and
hooks into it from the fastboot Socket class.

Bug: http://b/26558551
Change-Id: Ibb3a8428fc379755602de52722c1260f9e345bc0
2016-02-03 10:01:38 -08:00
Mark Salyzyn
989daeaf5b Merge "init.rc: too many start logd" 2016-02-03 15:24:32 +00:00
Johan Redestig
3282861b68 Add support for USB_HVDCP chargers
and print a warning message containing the type
when the battery monitor fails to recognize a power supply.

Change-Id: I02ebd89736f7444f8bf7f28550afeec82d57e107
2016-02-03 13:45:54 +01:00
Steve Fung
2bedc74553 crash_reporter: Fix paths for kernel panic collection
Fix the paths to the pstore mount and run data within
the kernel collector.

BUG=26774830

Change-Id: I68be0a28201cb73c3420166b2f4da77a1e586ca2
2016-02-02 16:14:52 -08:00