Commit graph

381 commits

Author SHA1 Message Date
Steven Moreland
d3b4b2c96f libutils: export libbacktrace headers
This is used in CallStack.h.

Test: m -j libutils
Test: links
Test: trying to compile with BOARD_VNDK_VERSION := current
Bug: 33241851
Change-Id: If7258e7b38000a72fd520f725030fb0038f90167
2017-04-13 21:11:28 -07:00
Steven Moreland
b084bc3545 libutils: export system_headers
vendor + vendor_available modules built with BOARD_VNDK_VERSION :=
current aren't allowed to use global headers. Since libutils uses
system headers itself, it should export them as well.

Also added some items into windows-deprecated.h. This file is supposed
to be in sync with the libnativewindow variant until all dependencies on
it can be fixed. However, it is missing some updates. This matters when
including libsystem_headers adds system headers before libnativewindow
headers in the lookup paths.

Bug: 33241851
Test: building with BOARD_VNDK_VERSION := current produces many fewer
errors.

Change-Id: I950821f1dae3ddc110db50869247913d5b1aa638
2017-04-13 12:05:16 -07:00
Steven Moreland
91527edec8 libutils: mark as vendor_available
By setting vendor_available, the following may become true:

* a prebuilt library from this release may be used at runtime by
  in a later releasse (by vendor code compiled against this release).
  so this library shouldn't depend on runtime state that may change
  in the future.
* this library may be loaded twice into a single process (potentially
  an old version and a newer version). The symbols will be isolated
  using linker namespaces, but this may break assumptions about 1
  library in 1 process (your singletons will run twice).

Background:

This means that these modules may be built and installed twice --
once for the system partition and once for the vendor partition. The
system version will build just like today, and will be used by the
framework components on /system. The vendor version will build
against a reduced set of exports and libraries -- similar to, but
separate from, the NDK. This means that all your dependencies must
also mark vendor_available.

At runtime, /system binaries will load libraries from /system/lib*,
while /vendor binaries will load libraries from /vendor/lib*. There
are some exceptions in both directions -- bionic(libc,etc) and liblog
are always loaded from /system. And SP-HALs (OpenGL, etc) may load
/vendor code into /system processes, but the dependencies of those
libraries will load from /vendor until it reaches a library that's
always on /system. In the SP-HAL case, if both framework and vendor
libraries depend on a library of the same name, both versions will be
loaded, but they will be isolated from each other.

It's possible to compile differently -- reducing your source files,
exporting different include directories, etc. For details see:

https://android-review.googlesource.com/368372

None of this is enabled unless the device opts into the system/vendor
split with BOARD_VNDK_VERSION := current.

Bug: 36426473
Bug: 36079834
Test: m -j libutils
Test: attempt to compile with BOARD_VNDK_VERSION := current
Merged-In: I6c1279a74ef071851401e38bbdd377f13827694c
Change-Id: I6c1279a74ef071851401e38bbdd377f13827694c
2017-04-12 16:00:02 +00:00
Mathias Agopian
44cee05904 split LightRefBase out of RefBase
Bug: 36532900
Test: compiled
Change-Id: I3088e1a219e04cf924744d3a0c2d374918bb6395
2017-03-29 20:39:06 +00:00
Mark Salyzyn
02ce4262dc Merge changes I96998c4b,I161bf03b am: dd0cd8d88f am: f17500474a
am: 77a1fa9070

Change-Id: I5b296f6c1b01a8b2dc51c7ebbd44d599a3aa49c1
2017-03-27 22:42:44 +00:00
Mark Salyzyn
0484b3b575 logd: ASAN cleansing
A mixture of fixes and cleanup for LogKlog.cpp and friends.

- sscanf calls strlen.  Check if the string is missing a nul
  terminator, if it is, do not call sscanf.
- replace NULL with nullptr for stronger typechecking.
- pass by reference for simpler code.
- Use ssize_t where possible to check for negative values.
- fix FastCmp to add some validity checking since ASAN reports that
  callers are not making sure pre-conditions are met.
- add fasticmp templates for completeness.
- if the buffer is too small to contain a meaningful time, do not
  call down to log_time::strptime() because it does not limit its
  accesses to the buffer boundaries, instead stopping at a
  terminating nul or invalid match.
- move strnstr to LogUtils.h, drop size checking of needle and
  clearly report the list of needles used with android::strnstr
- replace 'sizeof(static const char[]) - 1' with strlen.

Test: gTest liblog-unit-test, logd-unit-tests & logcat-unit-tests
Bug: 30792935
Bug: 36536248
Bug: 35468874
Bug: 34949125
Bug: 34606909
Bug: 36075298
Bug: 36608728
Change-Id: I161bf03ba029050e809b31cceef03f729d318866
2017-03-27 13:32:57 -07:00
Vishwath Mohan
c94c4d269a Merge "Blacklist some vector functions for CFI." 2017-03-23 23:14:48 +00:00
Vishwath Mohan
27a7aa0f59 Blacklist some vector functions for CFI.
This CL blacklists some vector functions (construct, copy, splat,
move) that use reinterpret_cast on freshly allocated memory (where the
object doesn't exist yet). This is technically correct, but not
friendly for CFI, which enforces stricter checking to catch type
confusion errors. Blacklisting these specific functions from CFI does
not cause an appreciable coverage loss though, so this should be fine.

Bug: 36219323
Test: Builds and boots, and the reinterpret error goes away on CFI builds.
Test: All 98 libutils_tests pass
Change-Id: I4944b179116bb1e1608d92697e95e182d8c0ac9f
2017-03-23 14:37:12 -07:00
Adam Lesinski
aa1d43230c Merge "libziparchive: fix mac os breakage" am: 390f3b364c am: 7cfe1d69b0
am: cdbadafb4a

Change-Id: Ie327879eaea542911603640e36f0d867e05afd61
2017-03-23 21:12:58 +00:00
Adam Lesinski
b02d690336 libziparchive: fix mac os breakage
Add ftruncate64 to utils/Compat.h definitions for mac.

Change-Id: I82cb46927be911e867b606f4f4429a5e1b1987f7
Test: builds on mac
2017-03-23 12:02:09 -07:00
Hans Boehm
d9bcc37269 Merge "Add heuristic data race detection to sp<>" am: 04abdc6153 am: 12d6afe6f1
am: 764d347183

Change-Id: I6a27520e80c2adefe30b0d04ce7e470188d3ad99
2017-03-19 04:56:09 +00:00
Hans Boehm
7f0b2601d3 Add heuristic data race detection to sp<>
Force assignment to read the old pointer value twice, and check
that it didn't change in the interim. Previous experience with
Skia suggests that this has a high probability of correctly detecting
a data race when it occurs, instead of potentially letting the
count associated with the old pointer value get decremented twice,
and corrupting the heap.

This does increase the size of sp assignments, which seem to
commonly get inlined. For the general case, we add a third
comparison and function call.

Some code reformatting to make this consistent with modern conventions
and pass automated checks.

Test: Booted aosp build. Ran libutils tests. Looked at generated code.

Bug: 31227650

Change-Id: Id93a05c6bf10f01ee15ff1bb409611f2058f988f
2017-03-17 17:47:28 -07:00
TreeHugger Robot
6258cfee90 Merge "Formatting changes for TypeHelpers.h and Vectors.h" 2017-03-16 07:38:32 +00:00
Vishwath Mohan
fc3f57acbb Formatting changes for TypeHelpers.h and Vectors.h
This CL nukes all spurious whitespace in the two files.

Bug: 36219323
Test: Device builds and boots.
Test: All 98 libutils_tests pass
Change-Id: I8054a0f0ba5df95f5115dc06597eb9fd539da942
2017-03-15 22:48:27 -07:00
Dan Willemsen
5dfa912f03 Merge "Enable more modules on linux_bionic builds" am: 75c414d1a3 am: 5bb9220b75
am: 5e30ce0ca0

Change-Id: I8d1ba8749e9c0e6433236b42bda7da5188e5f810
2017-03-16 02:40:00 +00:00
Dan Willemsen
e0cd1e043d Enable more modules on linux_bionic builds
Bug: 31559095
Test: Enable host bionic, run soong
Change-Id: Ib4ebd909322cf464b6a40040e4b60ece7d905b6f
2017-03-15 15:44:00 -07:00
Mathias Agopian
f520b73103 Get rid of LinearTransform
It had 3 clients
- one in vendor/google_athome which was disabled
- one in a device specific folder, which will die out
- and one in frameworks/base

This reverts commit 6c942304ed.

Test: compile/run
Bug: treble cleanup

Change-Id: Ia76009d550c294198c083cf89718bc498b5c9e3e
2017-03-15 14:16:13 -07:00
Ian Pedowitz
6c942304ed Revert "get rid of LinearTransform"
This reverts commit bcd592053a.

Bug: 36206160
Test:  Fugu compiles, didn't before the revert
Change-Id: Id80fd4ce9db3fce03b049cf81f938187c7ddb8b0
2017-03-14 08:11:41 +00:00
Mathias Agopian
bcd592053a get rid of LinearTransform
it had a single client in frameworks/base

Test: compile & run
Bug: treble cleanup
Change-Id: I9a17bbffed4724f8a329c5a15d621293bb800d45
2017-03-13 12:27:35 -07:00
Steven Moreland
aa47993b23 Merge "libutils: String\d+ make std_string private" am: 76850afa52 am: 2ebb1e5404
am: 4ba3f784ef

Change-Id: I14f003992db222ef285551c6d9a8ffe71620f70d
2017-03-11 09:07:23 +00:00
Steven Moreland
2aac335128 libutils: String\d+ make std_string private
This method is still used by prebuilts, but making it private to start
the process of removing it from everywhere.

Test: pass
Bug: 35363681
Change-Id: I4d53f68d10c9abcca32023c4d930e99912afa697
2017-03-10 22:51:55 -08:00
TreeHugger Robot
decccc2e8f Merge "Remove BlobCAche from libutils" 2017-03-11 01:32:47 +00:00
Mathias Agopian
f088e4e238 Remove BlobCAche from libutils
it has moved to libEGL which was the only client.


Test: compiled & Run
Bug: vndk-stable
Change-Id: Ife18727fa1c48b1be6910058867016348b7f02c1
2017-03-10 12:27:46 -08:00
Steven Moreland
d21cfab244 Add missing includes.
Includes are transitively imported by <string> in String8.h + String16.h
but that include is being removed.

Test: pass
Change-Id: Ide5c011b40b4a4f031dd26ead08b5c8d5d299693
2017-03-10 09:05:30 -08:00
Tom Cherry
101573e3f5 Merge "Clarify that Condition::wait() can spuriously wake up" am: 514e0aa2e2 am: 675e05c48a
am: df8fc09716

Change-Id: Id99d721415d93b2d3f0539bf5a2acb1995f01000
2017-03-06 20:06:03 +00:00
Tom Cherry
514e0aa2e2 Merge "Clarify that Condition::wait() can spuriously wake up" 2017-03-06 19:26:30 +00:00
Mathias Agopian
22dbf3947f clean-up libutils includes
moved Foo.h as first include of Foo.cpp, and
removed redundant includes.

Made NativeHandle non virtual.


Test: run & compile
Bug: n/a

Change-Id: I37fa746cd42c9ba23aba181f84cb6c619386406a
2017-03-03 14:47:47 -08:00
Tom Cherry
f1147f7dde Clarify that Condition::wait() can spuriously wake up
Also, remove the clarification that Condition::signal() wakes exactly
one thread as in the presence of spurious wake ups, this clarification
does not provide a safe guarantee to developers.

Bug: 34592766
Test: Build
Change-Id: I34df02e44a70a18fe04ceda858d002ef129c1fd9
2017-03-02 12:36:45 -08:00
Colin Cross
a4ca06b3b3 Merge changes I975ba933,Ica9d211b am: a9ef4dc7a2 am: 9ece9401a4
am: f695f6e842

Change-Id: I570c55be7a7cf3ad44e32717040689a68f67ada2
2017-02-28 20:37:29 +00:00
Colin Cross
a0931ebd64 Add tests for multiton issue
Test accessing a singleton from two libraries, the second of which
depends on the first but is dlopen'd after the first is already
loaded.

Bug: 35674422
Test: out/host/linux-x86/nativetest64/libutils_tests/libutils_tests
Change-Id: I975ba933a19b941a52bdb6e9c221a6910ffb8081
2017-02-28 16:34:35 +00:00
Colin Cross
62a6b16c4b Merge "Make libutils test compile on the host" am: f5fd4888ce am: a05a666c01
am: 3bc7d607d4

Change-Id: I00ac6f6871d925c805953eff0fa0c918cee3600a
2017-02-24 21:25:24 +00:00
Colin Cross
155c983ad1 Make libutils test compile on the host
Reapply of Icd5f39ae71b57167e9b2fe7ec09c5400bcb90e78 with
RefBase_test.cpp and Looper_test.cpp removed from mac builds.

Test: out/host/linux-x86/nativetest64/libutils_tests/libutils_tests
Test: out/host/darwin-x86/nativetest64/libutils_tests/libutils_tests
Change-Id: I5979b296a8500b5697d94d64fc441363047adcea
2017-02-24 08:10:06 -08:00
Richard Uhler
2aa94cfaf9 Merge "Revert "Make libutils test compile on the host"" am: 16f4fb9c4e am: 5682e001e9
am: 0d461283ce

Change-Id: I82132fc1e9eda421ed44a65029d389fdde67d5e8
2017-02-24 11:20:20 +00:00
Richard Uhler
16f4fb9c4e Merge "Revert "Make libutils test compile on the host"" 2017-02-24 11:10:43 +00:00
Richard Uhler
26bfee52b3 Revert "Make libutils test compile on the host"
Fails mac build: "system/core/include/utils/Looper.h:25:10: fatal error: 'sys/epoll.h' file not found"

This reverts commit afa891e85e.

Change-Id: Ib558b8f5a303b55ab32a399d338d8aac0fae32b2
2017-02-24 09:36:13 +00:00
Colin Cross
23eff4621f Merge changes Icd5f39ae,I2a4e956c am: 6d795c2883 am: 92466ff6ea
am: 9cb1d219bd

Change-Id: Ic79f7efd0090a940ac1cb7be1e863c2668790bd3
2017-02-24 07:09:41 +00:00
Treehugger Robot
6d795c2883 Merge changes Icd5f39ae,I2a4e956c
* changes:
  Make libutils test compile on the host
  Fix ODR issue in StrongPointer_test.cpp
2017-02-24 06:59:11 +00:00
Colin Cross
afa891e85e Make libutils test compile on the host
Test: out/host/linux-x86/nativetest64/libutils_tests/libutils_tests
Change-Id: Icd5f39ae71b57167e9b2fe7ec09c5400bcb90e78
2017-02-23 21:25:19 -08:00
Colin Cross
fe06c63301 Fix ODR issue in StrongPointer_test.cpp
StrongPointer_test.cpp's Foo was colliding with RefBase_test.cpp's
Foo.

Test: out/host/linux-x86/nativetest64/libutils_tests/libutils_tests
      from later CL
Change-Id: I2a4e956c88a07cec72d7ce734cf06c58134a4235
2017-02-23 21:25:18 -08:00
Colin Cross
477b3fc355 Merge "Fix multiton issue" am: 78b285b367 am: 6d7751a13b
am: dafd687617

Change-Id: I7e7369361dda3df0e97169c0d06ce24c57490c7d
2017-02-24 04:12:20 +00:00
Treehugger Robot
78b285b367 Merge "Fix multiton issue" 2017-02-24 04:03:11 +00:00
Colin Cross
b0145091a7 Fix multiton issue
I385a05a3ca01258e44fe3b37ef77e4aaff547b26 broke Singleton in the
same way that 544e3e3606 had already
fixed once.  Fix it again, the next CL will add tests.

This affected cases where two libraries referenced the same singleton,
the one that was supposed to define the singleton was already loaded,
and then the second library was dlopen'd.

Bug: 35674422
Test: out/host/linux-x86/nativetest64/libutils_tests/libutils_tests
      from later CL
Change-Id: I87c64f95ed294a887e67a6c11be3072299789f01
2017-02-23 18:22:46 -08:00
Tom Cherry
917cca2f04 Merge "Make Condition use CLOCK_MONOTONIC" am: 7f932afefc am: 36ba2fbef7
am: 83f76a20a8

Change-Id: I214548f856db2826b7a4ea96a98950fee7d20a27
2017-02-23 22:09:39 +00:00
Tom Cherry
1fb04ff4e5 Make Condition use CLOCK_MONOTONIC
Changes to the REALTIME clock can cause Condition::waitRelative() to
timeout early or delayed.  This behavior is undesired and new since
https://android-review.googlesource.com/#/c/181058/ moved the
underlying pthread_cond_timedwait() implementation to use absolute
timeouts rather than relative ones.  Having Condition use
CLOCK_MONOTONIC prevents these timeout issues.

Bug: 34592766
Bug: 35678943
Test: Boot bullhead
Test: Ensure time changes do not cause Condition::waitRelative() to
timeout early or delayed

Change-Id: I3a8d7a48f9b42fe990c3c7331313b6d85aa546f9
2017-02-23 10:58:05 -08:00
Steven Moreland
870a065800 Merge "Vector.h: remove unused import <new>" am: 1a4e2dfdf5 am: c50fce7dac
am: 4fbff753ba

Change-Id: I8581d836ee94d691f7a7a6b01dd9f7f8017fe093
2017-02-17 23:51:41 +00:00
Treehugger Robot
1a4e2dfdf5 Merge "Vector.h: remove unused import <new>" 2017-02-17 23:37:06 +00:00
Steven Moreland
40c7ddfc09 Vector.h: remove unused import <new>
Test: pass
Change-Id: I9d04c909a1bc82352f1eebe36602bf095ec3ca30
2017-02-17 13:19:08 -08:00
Steven Moreland
cee1918b08 Merge "Remove unused primes.py python file." am: 325eeebc47 am: e9ce5716ce am: 72ff4d5360
am: 374ef9d1c4

Change-Id: I349611742f6ccd8e4be97b1f45b1a316e61469e8
2017-02-17 01:33:00 +00:00
Steven Moreland
16afa6a0f0 Remove unused primes.py python file.
primes.py was used to calculate primes for BasicHashTable which no
longer exists.

Change-Id: I8c6e9b7882bcb8a3832c55249be6db9421d1f771
2017-02-16 14:30:44 -08:00
Steven Moreland
5717abf233 Merge "RefBase.cpp remove unused include typeinfo" am: 141e98474e am: d253899e1e am: 1bc2c960ee
am: 878f0c6bd6

Change-Id: I8230b912145a755c7c36bd4b3f3c26784c35e19a
2017-02-16 05:35:44 +00:00