Commit graph

152 commits

Author SHA1 Message Date
Nick Kralevich
567bb22650 am 4f0a7cb8: am 786e5e26: Merge "libutils: cleanups for -fsanitize=integer"
* commit '4f0a7cb8e15ce50f7da6a71c96335bd0b7394492':
  libutils: cleanups for -fsanitize=integer
2015-08-24 16:02:51 +00:00
Nick Kralevich
1f28698998 libutils: cleanups for -fsanitize=integer
* Hashing functions rely on integer overflow behavior.
Mark those functions as safe.

* abort() if a passed in size_t value is greater than
UINT32_MAX. This can occur on 64 bit builds where size_t
is larger than uint32_t.

* Special case the index lookup for an empty sorted vector.
Without the special case, size() == 0, and size()-1 underflows.

Change-Id: I343a14b589fc8f0d221c1998ae5d6f0b9e2781f8
2015-08-24 15:52:22 +00:00
Abhishek Arya
d1a6188e8c am a77a0487: am 219a006f: am fc5fdc85: am e45d96d6: am 19398a71: am d34846b7: am cd407a17: am e0dce90b: Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b
* commit 'a77a0487525df3add570605e58a7eb3a03eca6a8':
  Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b
2015-08-21 07:40:02 +00:00
Abhishek Arya
219a006f89 am fc5fdc85: am e45d96d6: am 19398a71: am d34846b7: am cd407a17: am e0dce90b: Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b
* commit 'fc5fdc85683f87c42d5ce7bcee4e2b70ef0acdd0':
  Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b
2015-08-21 07:05:07 +00:00
Abhishek Arya
fc5fdc8568 am e45d96d6: am 19398a71: am d34846b7: am cd407a17: am e0dce90b: Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b
* commit 'e45d96d6bf592f0ae20bb021ea529acc94e0cb55':
  Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b
2015-08-21 06:54:21 +00:00
Abhishek Arya
d34846b70b am cd407a17: am e0dce90b: Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b
* commit 'cd407a17fe326f3e18866ddddb1c747b06a45fc0':
  Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b
2015-08-21 06:23:50 +00:00
Abhishek Arya
cd407a17fe am e0dce90b: Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b
* commit 'e0dce90b0de2b2b7c2baae8035f810a55526effb':
  Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b
2015-08-21 06:18:47 +00:00
Abhishek Arya
e0dce90b0d Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b
Bug: 23290056
Change-Id: If6e22b0159de6635a8ca5305895b7718f15becc7
2015-08-20 21:55:55 -07:00
Sergio Giro
93f106b8d0 am e97682be: am a1a22b57: am e67b5848: am 4956c0fe: am 5b85b1d4: libutils: fix overflow in String8::allocFromUTF8
* commit 'e97682be0634fe773f70097bc518e5d034efe8f7':
  libutils: fix overflow in String8::allocFromUTF8
2015-08-20 22:58:19 +00:00
Sergio Giro
e67b584869 am 4956c0fe: am 5b85b1d4: libutils: fix overflow in String8::allocFromUTF8
* commit '4956c0fe1e582a8497aff34a41aeb8bf4748eef0':
  libutils: fix overflow in String8::allocFromUTF8
2015-08-20 22:28:53 +00:00
Sergio Giro
4956c0fe1e am 5b85b1d4: libutils: fix overflow in String8::allocFromUTF8
* commit '5b85b1d40d619c2064d321364f212ebfeb6ba185':
  libutils: fix overflow in String8::allocFromUTF8
2015-08-20 22:23:47 +00:00
Sergio Giro
5b85b1d40d libutils: fix overflow in String8::allocFromUTF8
Patch contributed in:
https://code.google.com/p/android/issues/detail?id=182908

Bug: 23290056

(cherry picked from commit 4eeacbeec0)

Change-Id: Ife1dc0791040150132bea6884f1e6c8d31972d1b
(cherry picked from commit ebabef2752)
2015-08-18 20:52:25 +00:00
Sergio Giro
c4abbcbdde am f468d1e1: am 1d44be87: Merge "libutils: fix overflow in String8::allocFromUTF8"
* commit 'f468d1e14c0bb777d557a6a86dead260e40ff8aa':
  libutils: fix overflow in String8::allocFromUTF8
2015-08-18 17:25:33 +00:00
Sergio Giro
ebabef2752 libutils: fix overflow in String8::allocFromUTF8
Patch contributed in:
https://code.google.com/p/android/issues/detail?id=182908

Bug: 23290056

(cherry picked from commit 4eeacbeec0)

Change-Id: Ife1dc0791040150132bea6884f1e6c8d31972d1b
2015-08-18 18:06:38 +01:00
Sergio Giro
1d44be87ff Merge "libutils: fix overflow in String8::allocFromUTF8" 2015-08-18 17:04:07 +00:00
Sergio Giro
4eeacbeec0 libutils: fix overflow in String8::allocFromUTF8
Patch contributed in:
https://code.google.com/p/android/issues/detail?id=182908

Bug: 23290056
Change-Id: Ide0e9a8acc4e95a9104bab3ae803aa3a40098222
2015-08-18 14:44:54 +01:00
Nick Kralevich
a0683307e7 am 77b9868a: am 6d814037: Merge "libutils: fix signed/unsigned comparison warnings"
* commit '77b9868af9313ab5b7f62d7fea709dbfb519dd2c':
  libutils: fix signed/unsigned comparison warnings
2015-08-18 04:15:23 +00:00
Nick Kralevich
3e6c451908 libutils: fix signed/unsigned comparison warnings
Change-Id: Ib283c85a404a20688c5357fa513e5d07c2f42803
2015-08-17 20:54:15 -07:00
Elliott Hughes
5ec940aed8 am fb1ecbc5: am e6e71608: Merge "Use __ANDROID__ instead of HAVE_ANDROID_OS."
* commit 'fb1ecbc55e7edeafb138eb2a60ca89ba9a7b1f0f':
  Use __ANDROID__ instead of HAVE_ANDROID_OS.
2015-07-30 16:50:27 +00:00
Elliott Hughes
e6e71608bd Merge "Use __ANDROID__ instead of HAVE_ANDROID_OS." 2015-07-30 16:34:47 +00:00
Elliott Hughes
9b828adfad Use __ANDROID__ instead of HAVE_ANDROID_OS.
Change-Id: I9967f3fd758c2a5b40be5b60ae72be7e2fb75136
2015-07-30 09:33:43 -07:00
Elliott Hughes
bb9c0a0031 am 42dbc4b1: am 44443bea: Merge "Use _WIN32 rather than HAVE_WINSOCK."
* commit '42dbc4b1859fe4de16b19e9b74324b345c5fcb9d':
  Use _WIN32 rather than HAVE_WINSOCK.
2015-07-30 15:17:38 +00:00
Elliott Hughes
adbf442a51 Use _WIN32 rather than HAVE_WINSOCK.
Change-Id: I9855b6fe72e2f2f3a8360c0993a67cb988024ee4
2015-07-29 17:45:24 -07:00
Elliott Hughes
2c1917f156 am 34c92f46: am fc2f1e61: Merge "Move libutils off AndroidConfig.h."
* commit '34c92f4652651697a7de7fa10c214afed9a6658a':
  Move libutils off AndroidConfig.h.
2015-07-30 00:16:18 +00:00
Elliott Hughes
1f8bc86a7d Move libutils off AndroidConfig.h.
Change-Id: Ia0e4a4f968c640eb44317821d2dc6b195f9f490e
2015-07-29 14:31:54 -07:00
Elliott Hughes
5b8ff09578 resolved conflicts for merge of b40ebc54 to mnc-dev-plus-aosp
Change-Id: I9da05b46da2326ae21d164b137be57a9b5220f7b
2015-06-30 15:17:14 -07:00
Elliott Hughes
6ed68cc412 Consistently use strerror in libutils.
It's easier for people to debug, and side-steps the problem that errno
values differ between architectures.

Bug: http://b/17458391
Change-Id: I1db9b2cbb653839d3936b91e37e5cff02671318a
2015-06-30 10:41:15 -07:00
Evgenii Stepanov
fc21508615 am 3c90808d: am c1c7f457: Merge "Add a space before :=."
* commit '3c90808d6d257d75d5ebd64af5d0374aa4f03cb4':
  Add a space before :=.
2015-06-13 02:25:34 +00:00
Evgenii Stepanov
6aaf740834 Add a space before :=.
Change-Id: Ib1d94648cdc163675ac7b6acf86408d5be6b5ad2
2015-06-12 14:18:33 -07:00
Jeff Brown
20432c237c Merge "Work around spurious epoll notifications." into mnc-dev 2015-05-30 00:43:10 +00:00
Jeff Brown
18a574f715 Work around spurious epoll notifications.
Sometimes it seems like we can get into a situation where we are
unable to remove an fd from the epoll set but it keeps sending us
events anyhow.  Defensively rebuild the epoll set in this case
to prevent us from spinning forever.

Bug: 21271428
Change-Id: I5607e565f2e12460d7113a1f62a70d38d334e271
2015-05-29 17:40:25 -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
John Reck
52fc3e9aa8 Move LinearAlloc to libhwui
Change-Id: I83a70959ed0dcab2237faaf1dddc02b5eb0363c9
2015-04-23 15:07:54 -07:00
Elliott Hughes
c72bd16ce8 am 8d2cd035: am 2ddb9cb1: am ed43be39: Merge "Remove LOCAL_ADDITIONAL_DEPENDENCIES in cases where it\'s not needed."
* commit '8d2cd03547c76f6c670b33d4fe6d44b646c14b45':
  Remove LOCAL_ADDITIONAL_DEPENDENCIES in cases where it's not needed.
2015-04-02 22:07:16 +00:00
Elliott Hughes
bcc2b5f44a Remove LOCAL_ADDITIONAL_DEPENDENCIES in cases where it's not needed.
Change-Id: I720b8ef1050da45a7833adef8219b6acb2cf3a38
2015-04-02 14:31:07 -07:00
Tim Kilbourn
8892ce6383 Use eventfd instead of pipe in Looper.
Bug: 19933224
Change-Id: I6611e918db960bbb0e74f8308e10bdf79510b899
2015-03-27 09:15:43 -07:00
Dan Albert
a83ba64a23 Revert "Revert "Create libbase.""
This reverts commit a7870d8816.

(cherry picked from commit c007bc3856)
2015-03-16 13:48:07 -07:00
Dan Albert
c007bc3856 Revert "Revert "Create libbase.""
This reverts commit a7870d8816.
2015-03-16 10:08:46 -07:00
Nicolas Geoffray
a6000e81dc am 90a968f0: am dd581695: Merge "Revert "Create libbase.""
* commit '90a968f0e3fb903aad41f6689c337a7e4a8d5c7b':
  Revert "Create libbase."
2015-03-16 11:25:38 +00:00
Nicolas Geoffray
a7870d8816 Revert "Create libbase."
Breaks internal master.

This reverts commit 98ff77204c.

Change-Id: I18dc6021cb43efff8aa88486c2d980dc2b8eedba
2015-03-16 11:07:29 +00:00
Dan Albert
06d60af714 am 517f65da: am a68c8148: Merge "Create libbase."
* commit '517f65daef177d06d7835300a1c23ce3409c0643':
  Create libbase.
2015-03-15 22:33:53 +00:00
Dan Albert
98ff77204c Create libbase.
Move StringPrintf and the string based file I/O from libutils to
libbase.

Change-Id: I0297a6063874b9d92100e0dd5123fddfbda932fe
2015-03-14 16:36:18 -07:00
Jeff Brown
e7d54f80cb Fix issues related to removing Looper callbacks after close.
When a file descriptor is closed before removing it from the
epoll set, it will normally be removed automatically from the
epoll set by the kernel.  However if there exists a duplicate
then the original file descriptor may remain in the set and
continue to receive events until all duplicates have been closed.

Unfortunately due to kernel limitations we need to rebuild the epoll
set from scratch because it may contain an old file handle that we are
now unable to remove since its file descriptor is no longer valid.
No such problem would have occurred if we were using the poll system
call instead, but that approach carries others disadvantages.

Bug: 19715279
Change-Id: If1ab8ebda0825755a416d513e888942a02ee3948
2015-03-12 19:44:49 -07:00
Jeff Brown
7a0310ef67 Fixed subtle bugs related to file descriptor recycling.
Added code to protect against situations that may occur when a
Looper callback has the side-effect of closing the file descriptor that
it is watching before it returns.  This code pattern is very
convenient for implementation but it does expose issues in how
the list of callbacks is maintained.  In particular, we
need to watch out for file descriptors which have been reused.

This change may resolve previously unexplained ANRs associated with
log messages such as: "Error modifying epoll events for fd 44, errno=2"

Bug: 10349083
Change-Id: I20eedf6ffbdeda382653ca0104962505194741b0
2015-03-11 15:00:36 -07:00
Jeff Brown
27e5721860 Rename Looper::isIdling() to isPolling() to resolve confusion.
The loop isn't technically idle at this time, it's just checking
whether any file descriptors have pending events.  However it's
still a good signal as to whether the loop is alive.

Bug: 19532373
Change-Id: I555c473e70ffd8a56e1b10aa60026eb674a16de9
2015-03-11 15:00:36 -07:00
Narayan Kamath
6832a7a4e0 Remove useless refCounting from FileMap.
Nobody ever called acquire() so release() was always
equivalent to delete. Just use delete instead so that
people can use unique_ptr directly (or shared_ptr if
they really want refcounts).

Change-Id: I9e3ad5e0f6a4fcc4e02e5a2ff7ef9514fe234415
2015-02-23 15:49:43 +00:00
Narayan Kamath
1158c7d5fe Merge "Remove reference to NOT_USING_KLIBC and cygwin." 2015-02-20 16:40:33 +00:00
Narayan Kamath
5955a9f5e4 Remove reference to NOT_USING_KLIBC and cygwin.
The reference to NOT_USING_KLIBC appears to be the only one
in our codebase. This change also removes some cygwin specific
retry logic - all other supported platforms in this section
of the code should support mapping at an offset.

Note that i've reversed the sense of the check, we always sysconf
since that's recommended practice.

Change-Id: Ib985fb665193d7a07a282f7092cd77c0bc508a66
2015-02-19 18:36:27 +00:00
Elliott Hughes
9d1f515ed1 Fix the WriteStringToFile overload that takes mode/owner/group.
The actual bug is == instead of !=, but the real cause was me trying to be
too clever. This patch switches to much simpler code, and -- since the
intended use of this code is security anyway -- adds logging if anything
goes wrong.

Bug: 19361774
Change-Id: If2af07d31a5002f9010b838247b691f6b28bdfb1
2015-02-17 10:25:23 -08:00
Elliott Hughes
f682b4786a Clean up reading and writing in init.
This isn't particularly useful in and of itself, but it does introduce the
first (trivial) unit test, improves the documentation (including details
about how to debug init crashes), and made me aware of how unpleasant the
existing parser is.

I also fixed a bug in passing --- unless you thought the "peboot" and "pm"
commands were features...

Bug: 19217569
Change-Id: I6ab76129a543ce3ed3dab52ef2c638009874c3de
2015-02-06 14:20:30 -08:00