Commit graph

14421 commits

Author SHA1 Message Date
Adam Lesinski
0ebd13f063 Merge "Prevent integer overflow when allocating native_handle_t" into mnc-dev 2015-05-19 00:30:24 +00:00
Jeff Brown
ac9131b30c Merge "Add TEMP_FAILURE_RETRY to libsuspend." into mnc-dev 2015-05-18 23:02:52 +00:00
Jeff Brown
0446e16f53 Add TEMP_FAILURE_RETRY to libsuspend.
In testing, I observed one instance of a call failing due to a signal
sent to the process.  This could happen at various times so it's better
to be safe than sorry.

Bug: 20534809
Change-Id: I42242087300d8b840a50aec34aa6b2e1507cab50
2015-05-18 15:53:56 -07:00
Michael Lentine
6078805023 Adding a build id check to blob cache.
Add a build id field to the header structure in blob cache. Add build
id support with reading and writing the cache. When the cache gets
written it writes the build id at the end of the header. When read it
checks to see if there is a match between the current version and the
version in the cache. If not, it invalidates the cache which would
typically only occur during an ota update.  Also remove blob cache
from the host build.

bug: 18262905

Change-Id: I753b1de1986703a4c1c8691b9d2bb533b2546143
2015-05-18 13:14:32 -07:00
Elliott Hughes
4652fc6f08 Revert "Switch to toybox ls."
This reverts commit 9c94aa9982.

Change-Id: Ie2479ee4a0614e285ce8d57c727200a0381904e2
(cherry picked from commit 88f0f4b2b4)
2015-05-15 23:31:08 -07:00
Elliott Hughes
7b071e53fa Switch to toybox ls.
Bug: http://b/21171466
Change-Id: I3fa09db7ca43d337cbda60f10269e7607544982b
(cherry picked from commit 9c94aa9982)
2015-05-15 18:12:16 -07:00
Christopher Ferris
f0861f9f8f Switch UniquePtr to std::unique_ptr.
Bug: 21209050
Change-Id: I91d4c44de479b37f2729382fcdf103b8c69aa668
(cherry picked from commit 6e96403b8f)
2015-05-15 17:41:20 -07:00
Chih-Hung Hsieh
2d543b7d4b Enable clang compilation.
Previous clang/llvm bug was fixed.

BUG: 18790528
Change-Id: Ib12696030d34ebc3c3ef1bca3cad0139d631417e
(cherry picked from commit 1cd02d3443)
2015-05-15 16:13:19 -07:00
Elliott Hughes
2181c722ce Fix ' escaping in adb.
You can't just use \' inside a single-quoted string.

Bug: http://b/20323053
Bug: http://b/3090932
Change-Id: I73754b097671d02dc11c35052f0534b6dd789e4f
(cherry picked from commit 84b0bf2264)
2015-05-15 14:50:47 -07:00
Adam Lesinski
07edc3b3b3 Prevent integer overflow when allocating native_handle_t
User specified values of numInts and numFds can overflow
and cause malloc to allocate less than we expect, causing
heap corruption in subsequent operations on the allocation.

Bug: 19334482
Change-Id: I43c75f536ea4c08f14ca12ca6288660fd2d1ec55
2015-05-15 13:09:39 -07:00
Elliott Hughes
651fae3cbc Reduce the coldboot timeout to 1s.
5s was already a ridiculously long time to delay booting, and some OEMs are
trying to make it even more insane:

  https://www.codeaurora.org/cgit/quic/la/platform/system/core/commit/?h=lp&id=fd23edd48272976d2fb333f377242173f92aa343

Let's at least ensure that Nexus and Android One devices don't take forever
to boot...

Bug: http://b/19899875
Change-Id: I9680c166a759360f34118e51cd0645e12b6bd5c8
(cherry picked from commit c7331d02d1)
2015-05-15 12:18:41 -07:00
Christopher Ferris
eb19e76632 Prevent crashes if a map cannot be created.
Under some conditions, /proc/<pid>/maps might return nothing. If we
try and unwind in this case, we'll crash. Check this case and fail
the unwind.

Add checks that no other functions try and use map_ without
checking for nullptr.

Add logging when an unwind fails so it's clear what happened.

Bug: 21162746
Change-Id: I56ce51dda0cfc9db20475a441f118108196aa07c
(cherry picked from commit 30c942cf10)
2015-05-15 11:32:53 -07:00
Andres Morales
c89a1774cb Merge "Move SoftGateKeeper into gatekeeperd" into mnc-dev 2015-05-14 20:06:11 +00:00
Andres Morales
33dfdc7bbc Move SoftGateKeeper into gatekeeperd
Allows for easy determination of whether there's a
hardware module in place. Permits tighter coupling of
software implementation with upper-level stack.

Bug:21090356
Change-Id: I275b57cd976c233c43c476c5869c5a4b29fbc175
2015-05-14 12:58:13 -07:00
Christopher Ferris
684fb77c82 Add tests for elf unwinding in memory.
Bug: 19517541
(cherry picked from commit 67aba6881d)

Change-Id: I914636ccd814e041475b6b2d81119cac1745a9ff
2015-05-13 13:44:47 -07:00
Dan Albert
428fad97a0 Remove libbacktrace definition of gettid.
Also simplifies the Darwin implementation of gettid, because
apparently libbacktrace had a better way of doing it.

Bug: 19517541

(cherry picked from commit 23f750b068)

Change-Id: I2f888e8ed7a2f5719973786cbcbb399a81867ee9
2015-05-13 13:44:34 -07:00
Dan Albert
cd206b3900 Fix gettid() on Windows.
Accidentally had this all hidden by an #ifndef _WIN32 when I wrote it.

Bug: 19517541

(cherry picked from commit b3a36ca5ee)

Change-Id: Ifbd5d19e506e7313700e2e29a2dae5736e049844
2015-05-13 13:43:32 -07:00
Iliyan Malchev
b33118ac76 am 2557cd21: am 8b448629: am 16092b7a: Merge "fs_mgr: allow for zramsize to be specified as percentage of total memory" into lmp-mr1-dev
* commit '2557cd21f0af31d6dafee24d649f83314d2896d4':
  fs_mgr: allow for zramsize to be specified as percentage of total memory
2015-05-13 17:07:53 +00:00
Mark Salyzyn
e97b11bc42 liblog: gtest open("/dev/pmsg0", "a")
(cherry pick from commit df0257d344)

Change-Id: I918025a8ac28204076ce4831ce277b04091619f6
2015-05-13 10:00:02 -07:00
Mark Salyzyn
654904f0f9 logd: Add TID statistics
(cherry pick from commit 17ed6797df)

Bug: 19608965
Change-Id: Ifbf0b00c48ef12b5970b9f9f217bd1dd8f587f2c
2015-05-13 09:23:01 -07:00
Mark Salyzyn
66091f11f4 logd: Cleanup
(cherry pick from commit 7718778793)

- Android Coding Standard for Constructors
- Side effects NONE

Change-Id: I2cda9dd73f3ac3ab58f394015cb810820093d47b
2015-05-13 09:22:56 -07:00
Mark Salyzyn
79c3815ca1 logcat: liblog: Add "usec" format argument
(cherry pick from commit e1f2004ecc)

- Add additional 3 digits of time precision for time output
  adding in the reporting of usec
- Remove trailing space in header file

Change-Id: Ifb560850b8e01080e126fbaeab640db71cce3eea
2015-05-13 09:22:51 -07:00
Mark Salyzyn
a1aacb71f3 logd: Add klogd
(cherry pick from commit ae4d928d81)

- Add a klogd to collect the kernel logs and place them into a
  new kernel log buffer
- Parse priority, tag and message from the kernel log messages.
- Turn off pruning for worst UID for the kernel log buffer
- Sniff for 'PM: suspend exit', 'PM: suspend enter' and
  'Suspended for' messages and correct the internal definition
  time correction against monotonic dynamically.
- Discern if we have monotonic or real time (delineation 1980) in
  audit messages.
- perform appropriate math to correct the timestamp to be real time
- filter out any external sources of kernel logging

Change-Id: I8d4c7c5ac19f1f3218079ee3a05a50e2ca55f60d
2015-05-13 09:22:45 -07:00
Mark Salyzyn
9e750a42b0 liblog: Add kernel log id
(cherry pick from commit 440e109d64)

Change-Id: I53002f05a8bdf8d67e1d761c56c8761d3b534a76
2015-05-13 09:22:41 -07:00
Narayan Kamath
241bcf05e0 Fix file descriptor leak when opening invalid archives.
Also add -Wunreachable-code to the set of compiler flags, otherwise
noreturn becomes considerably less useful.

bug: https://code.google.com/p/android/issues/detail?id=171099
Change-Id: I9a95d45633c731c7046d4e4a39844d9cebfd1718
2015-05-13 09:20:44 +00:00
Terry Heo
55431d9745 Merge "rootdir: add permission for /dev/dvb*" into mnc-dev 2015-05-13 05:46:53 +00:00
Elliott Hughes
d410a9b323 Merge changes Ie9d9a7ad,If7479bdc into mnc-dev
* changes:
  Fix insmod module size
  Enable property expansion for insmod
2015-05-13 02:45:59 +00:00
Tom Cherry
cce7e93b28 Fix insmod module size
read_file() used to append a new line character to the end of the buffer it
returns, because parse_config() isn't able to cope with input that's not
'\n'-terminated. Fix read_file() to be less insane, and push the workarounds
into the parse_config() callers.

Longer term we should rewrite parse_config().

Bug: http://b/21079470
Change-Id: Ie9d9a7adcd33b66621726aef20c4b8cc51c08be7
(cherry picked from commit eaa3b4ec6f)
2015-05-12 19:42:38 -07:00
Iliyan Malchev
2557cd21f0 am 8b448629: am 16092b7a: Merge "fs_mgr: allow for zramsize to be specified as percentage of total memory" into lmp-mr1-dev
* commit '8b4486294053ea96ac50d8c07d4fc23729ef7c52':
  fs_mgr: allow for zramsize to be specified as percentage of total memory
2015-05-12 23:55:40 +00:00
Iliyan Malchev
8b44862940 am 16092b7a: Merge "fs_mgr: allow for zramsize to be specified as percentage of total memory" into lmp-mr1-dev
* commit '16092b7a48e8426515f67206be2f0aee92fd6006':
  fs_mgr: allow for zramsize to be specified as percentage of total memory
2015-05-12 23:41:37 +00:00
Iliyan Malchev
16092b7a48 Merge "fs_mgr: allow for zramsize to be specified as percentage of total memory" into lmp-mr1-dev 2015-05-12 23:25:51 +00:00
Mark Salyzyn
ff32f3c774 logd: Add Tag statistics
(cherry pick from commit 344bff4391)

- Optional class of statistics for events Tags
- export tagToName from LogBuffer (located in main.cp to address
  https://android-review.googlesource.com/#/c/110204)
- Can not handle dropped because getTag() can not work,
  will need to be fixed if we start filtering.

Bug: 19608965
Change-Id: I7b90607ca588bf37bab71f19b1570a290e772776
2015-05-12 15:34:56 -07:00
Emmanuel Berthier
30cc3d7249 Enable property expansion for insmod
Useful for dynamic kernel module location.
This permits to use init rule like:

  insmod ${persist.modules.location}/<module_name>

Change-Id: If7479bdcb4e69ea7666f52a0075c785be025c2e9
Signed-off-by: Emmanuel Berthier <emmanuel.berthier@intel.com>
(cherry picked from commit ac41230cbc)
2015-05-12 15:01:02 -07:00
Mark Salyzyn
4fba28671b logd: pidToName deficiency
(Cherry pick from commit aa43ae2268)

any logging in zygote permanently sets the pidToName

Change-Id: I0b8fdc96fb5965a04d4dc4293c39815beef5eb8e
2015-05-12 13:06:25 -07:00
Mark Salyzyn
9bdc064720 logd: uidToName add dex2oat UID
(cherry pick from commit 023f51f360)

- When searching for uidToName from /data/system/packages.list
  one must search for the uid % AID_USER;
- If uid % AID_USER is greater than AID_SHARED_GID_START - AID_APP,
  then subract it and try again to pick up uidToName.

Change-Id: I24df42957ff7e746fffa5d39484637b1b726b9c0
2015-05-12 09:55:02 -07:00
Nick Kralevich
6de7a06afb Revert "libaudit: limit to 5 selinux denials per sec"
The shamu instabilities continued even after throttling SELinux denials
to 5/second. 5 denials per second is too low when doing device bringup,
and there have been some complaints about lost SELinux denials. See,
for example, http://comments.gmane.org/gmane.comp.security.selinux/21941

Bring the limit back up to 20/second to prevent dropping too many
denials on the floor.

This reverts commit a15db51bbf.

(cherrypick of commit 9667a66019)

Change-Id: I05e85cce0a792d05aa557fcc614c0fc019c15014
2015-05-11 15:43:25 -07:00
Elliott Hughes
a51d8b9a1c Failure to find an oem partition should not be a remount failure.
Many devices don't have an /oem partition, so find_mount should be
expected to fail, but shouldn't cause the overall remount to fail.

Also clean up all the error handling and reporting, and remove the
dead int* globals.

Bug: http://b/21024141
Change-Id: Ie31021b03c9cab8e972269d7d1ffe383cd30ee9e
(cherry picked from commit 9aa4fda4e6)
2015-05-11 13:36:13 -07:00
Andres Morales
86aeb11ed0 Merge "load ro.recovery_id property from recovery partition" into mnc-dev 2015-05-09 00:25:54 +00:00
Andres Morales
db5f5d4367 load ro.recovery_id property from recovery partition
Change-Id: I9dc1f325e353375d9c1c8ed949636e2404601076
2015-05-08 17:23:24 -07:00
Dmitriy Ivanov
5391d5f4a9 Switch liblog.so to hash-style=both
Bug: http://b/19059885
Change-Id: I7cde911f11b09c3a13553154aca6e291bb91befb
(cherry picked from commit fd8afe6f31)
2015-05-08 14:25:30 -07:00
Elliott Hughes
207ddb20ac Fix "adb remount" for devices without an oem partition.
On a device without an oem partition, we now have an /oem directory
anyway. This causes find_mount to fail, and that was returning nullptr
from a std::string-returning function. Boom!

Also clean up the bits of code I had to trace through between "adb remount"
on the host to the crash on the device as I debugged this.

The only other meaningful change is the error checking in
adb_connect_command --- adb_connect can also return -2.

Bug: http://b/20916855
Change-Id: I4c3b7858e13f3a3a8bbc7d30b3c0ee470bead587
(cherry picked from commit 5677c23e8d)
2015-05-08 10:49:31 -07:00
Benson Leung
c33e62bdc6 Merge "Be tolerant of devices that don't report serials." into mnc-dev 2015-05-08 17:37:10 +00:00
Elliott Hughes
02418b3e09 Try to include the SHA in a ddmslib-compatible way.
Bug: http://b/20918202
Change-Id: I0c1a48459372b0d28aaf9d09d82540e44b438c9c
(cherry picked from commit f3bbfa6a21)
2015-05-08 09:03:12 -07:00
Andres Morales
d34c722c59 Merge changes Iac33dbaa,I18fcd37d into mnc-dev
* changes:
  pass in correct buffer to print_id
  stop including rootdir build.prop
2015-05-08 15:00:14 +00:00
Andres Morales
e892a3f328 pass in correct buffer to print_id
hdr.id is actually larger than sha

Change-Id: Iac33dbaaf4bea9acde5ba49d8601f7ac767677d5
2015-05-08 07:55:08 -07:00
Andres Morales
507bfdfcd9 Merge "mkbootimg: make mkbootimg print image cksum to stdout" into mnc-dev 2015-05-08 13:57:47 +00:00
Dan Albert
6043e15311 Be tolerant of devices that don't report serials.
The USB spec explicitly says this is optional, so we shouldn't be
relying on it.

Bug: http://b/20883914
Change-Id: Icf38405b00275199bcf51a70c47d428ae7264f2b
2015-05-07 15:56:03 -07:00
Rom Lemarchand
e98bfaeb08 mkbootimg: use fixed-size types for image format
Change-Id: I471ef420c3944b3ffefdba9ca7122c6a7f09e5ac
2015-05-07 15:36:28 -07:00
Andres Morales
5147eacad1 stop including rootdir build.prop
merged with default.prop

Change-Id: I18fcd37ddc63e3607278d0741181d0779118132d
2015-05-07 15:18:20 -07:00
Andres Morales
7f9259f652 mkbootimg: make mkbootimg print image cksum to stdout
used by the build system as a fingerprint for the image

Change-Id: Ifaf230b881e68d921a8158ed2e8a3ee41f27a4b3
2015-05-07 15:02:23 -07:00