OSDN Git Service

android-x86/bionic.git
8 years agoMake all of ndk_cruft.cpp one big extern "C".
Elliott Hughes [Fri, 4 Dec 2015 23:57:51 +0000 (15:57 -0800)]
Make all of ndk_cruft.cpp one big extern "C".

Change-Id: Iddd9b5f36e661e443fa13d12326e72df8c0d209c

8 years agoMerge "Fix stdio static initializers to make both clang and GCC happy."
Elliott Hughes [Mon, 7 Dec 2015 19:10:32 +0000 (19:10 +0000)]
Merge "Fix stdio static initializers to make both clang and GCC happy."

8 years agoFix stdio static initializers to make both clang and GCC happy.
Elliott Hughes [Mon, 7 Dec 2015 19:07:15 +0000 (11:07 -0800)]
Fix stdio static initializers to make both clang and GCC happy.

Previously only clang was happy. GCC said:

  error: missing initializer for field 'wcio_mbstate_in' of 'struct wchar_io_data'

Change-Id: I25a11b64f4dfa22a5dd5daded152191fe2cfacaf

8 years agoMerge "Revert "Revert "Remove __sinit and __sdidinit."""
Elliott Hughes [Mon, 7 Dec 2015 18:19:07 +0000 (18:19 +0000)]
Merge "Revert "Revert "Remove __sinit and __sdidinit."""

8 years agoRevert "Revert "Remove __sinit and __sdidinit.""
Elliott Hughes [Sat, 5 Dec 2015 02:03:12 +0000 (18:03 -0800)]
Revert "Revert "Remove __sinit and __sdidinit.""

This reverts commit c8bae05f3ff9f1c736f7be70fa17d02795d748bb.

We were breaking init (ueventd) because we initialize system properties
before we initialize stdio. The new system property implementation uses
stdio to read from /property_contexts, so we end up touching stdio data
structures before they've been initialized.

This second attempt takes things further by removing the stdio initialization
function altogether. The data structures for stdin/stdout/stderr can be
statically initialized as data, and -- since we already had to give the
atexit implementation a backdoor for stdio -- we can just admit that we
need to clean up stdio, and that we always do so last.

This patch also removes the 17 statically pre-allocated file structures,
so the first fopen will now allocate a block of 10 (the usual overflow
behavior). I did this just to make my life simpler, but it's not actually
necessary to remove it if we want it back.

Change-Id: I936b2eb5e88e4ebaf5516121872b71fc88e5609c

8 years agoMerge "Allow dlopening public libs using absolute path"
Dimitry Ivanov [Sat, 5 Dec 2015 05:25:57 +0000 (05:25 +0000)]
Merge "Allow dlopening public libs using absolute path"

8 years agoAllow dlopening public libs using absolute path
Dimitry Ivanov [Sat, 5 Dec 2015 02:28:49 +0000 (18:28 -0800)]
Allow dlopening public libs using absolute path

dlopen on isolated namespaces should be able to open
public libraries using absolute path not only soname.

Bug: http://b/25853820
Change-Id: If574a67853dc51226f0f376e9e2d108316002f84

8 years agoMerge "Revert "Remove __sinit and __sdidinit.""
Elliott Hughes [Sat, 5 Dec 2015 01:53:21 +0000 (01:53 +0000)]
Merge "Revert "Remove __sinit and __sdidinit.""

8 years agoRevert "Remove __sinit and __sdidinit."
Elliott Hughes [Sat, 5 Dec 2015 01:47:20 +0000 (17:47 -0800)]
Revert "Remove __sinit and __sdidinit."

This reverts commit 4371961e00ad83fca033992c8a19c7d262fe6f84.

This broke booting; ueventd crashes with a null pointer dereference
somewhere in __sfp (but the kernel doesn't unwind, so I don't know
what was calling __sfp).

Change-Id: I65375fdfdf1d339a06558b4057b580cacd6324e2

8 years agoMerge "Do not create prop files for ctl.* properties"
Tom Cherry [Sat, 5 Dec 2015 00:21:46 +0000 (00:21 +0000)]
Merge "Do not create prop files for ctl.* properties"

8 years agoDo not create prop files for ctl.* properties
Tom Cherry [Fri, 4 Dec 2015 23:53:25 +0000 (15:53 -0800)]
Do not create prop files for ctl.* properties

Change-Id: Ia6660c68c9e0cb89938751dbc0747ee038394778

8 years agoMerge "Fix GCC build."
Elliott Hughes [Fri, 4 Dec 2015 23:54:15 +0000 (23:54 +0000)]
Merge "Fix GCC build."

8 years agoFix GCC build.
Elliott Hughes [Fri, 4 Dec 2015 23:53:25 +0000 (15:53 -0800)]
Fix GCC build.

  error: '__sdidinit' initialized and declared 'extern' [-Werror]

Change-Id: I97d9c174da6a99ca61b72572dfb4694813372a60

8 years agoMerge "Track rename from base/ to android-base/."
Elliott Hughes [Fri, 4 Dec 2015 23:30:09 +0000 (23:30 +0000)]
Merge "Track rename from base/ to android-base/."

8 years agoTrack rename from base/ to android-base/.
Elliott Hughes [Fri, 4 Dec 2015 23:27:46 +0000 (15:27 -0800)]
Track rename from base/ to android-base/.

Change-Id: I0a4592945400b1fa6892bf7c1fa8659fd711efa3

8 years agoMerge "Remove __sinit and __sdidinit."
Elliott Hughes [Fri, 4 Dec 2015 23:27:07 +0000 (23:27 +0000)]
Merge "Remove __sinit and __sdidinit."

8 years agoMerge "add checks for initialization for system properties"
Tom Cherry [Fri, 4 Dec 2015 23:06:31 +0000 (23:06 +0000)]
Merge "add checks for initialization for system properties"

8 years agoadd checks for initialization for system properties
Tom Cherry [Fri, 4 Dec 2015 19:34:42 +0000 (11:34 -0800)]
add checks for initialization for system properties

If a __system_property* function is called before
__system_properties_init() then the app will will abort.  This commit
returns either an error code or a safe return value instead.

Bug 26027140

Change-Id: I95ffd143e9563658ab67a397991e84fb4c46ab77

8 years agoMerge "Clear pthread_internal_t allocated on user provided stack."
Yabin Cui [Fri, 4 Dec 2015 00:58:05 +0000 (00:58 +0000)]
Merge "Clear pthread_internal_t allocated on user provided stack."

8 years agoClear pthread_internal_t allocated on user provided stack.
Yabin Cui [Thu, 3 Dec 2015 21:01:42 +0000 (13:01 -0800)]
Clear pthread_internal_t allocated on user provided stack.

Several parts in pthread_internal_t should be initialized
to zero, like tls, key_data and thread_local_dtors. So
just clear the whole pthread_internal_t is more convenient.

Bug: 25990348
Change-Id: Ibb6d1200ea5e6e1afbc77971f179197e8239f6ea

8 years agoMerge "Don't use StringPrintf() in gtest runner."
Yabin Cui [Fri, 4 Dec 2015 00:29:47 +0000 (00:29 +0000)]
Merge "Don't use StringPrintf() in gtest runner."

8 years agoDon't use StringPrintf() in gtest runner.
Yabin Cui [Fri, 4 Dec 2015 00:28:03 +0000 (16:28 -0800)]
Don't use StringPrintf() in gtest runner.

Change-Id: I0cd0b3cbb952c65b1c449e88ce12964b93029538

8 years agoMerge "Remove c++14'isms from system_properties"
Tom Cherry [Thu, 3 Dec 2015 23:48:54 +0000 (23:48 +0000)]
Merge "Remove c++14'isms from system_properties"

8 years agoMerge "libm: stop exporting __muldc3"
Dimitry Ivanov [Thu, 3 Dec 2015 23:44:59 +0000 (23:44 +0000)]
Merge "libm: stop exporting __muldc3"

8 years agoRemove c++14'isms from system_properties
Tom Cherry [Thu, 3 Dec 2015 23:38:52 +0000 (15:38 -0800)]
Remove c++14'isms from system_properties

Change-Id: If78e7d2770e8f8321f0d1824c3c52f93820dd325

8 years agolibm: stop exporting __muldc3
Dimitry Ivanov [Thu, 3 Dec 2015 23:25:37 +0000 (15:25 -0800)]
libm: stop exporting __muldc3

Bug: http://b/26004493
Change-Id: I991268d5e7b59bca646da25d0ad90a1cb4a9d4b9

8 years agoMerge "Separate properties by selabel"
Tom Cherry [Thu, 3 Dec 2015 22:55:32 +0000 (22:55 +0000)]
Merge "Separate properties by selabel"

8 years agoMerge "Improve unit test runner."
Yabin Cui [Thu, 3 Dec 2015 22:29:29 +0000 (22:29 +0000)]
Merge "Improve unit test runner."

8 years agoRemove __sinit and __sdidinit.
Elliott Hughes [Thu, 3 Dec 2015 21:23:03 +0000 (13:23 -0800)]
Remove __sinit and __sdidinit.

We're eagerly initializing stdio now, so this can all be simplified.

Change-Id: Icb288f8dd0ee08f02bea0d23670f75e78bed6b99

8 years agoImprove unit test runner.
Yabin Cui [Tue, 17 Nov 2015 04:39:58 +0000 (20:39 -0800)]
Improve unit test runner.

1. Read unit test's output while the test is running. Previously
we only read output when the test finishes, which has trouble
when the test outputs too many stuff.
2. Report failed unit test's exit code. It is useful when the
test doesn't fail in ASSERT_xxx, but in somewhere else.

Bug: 25392375
Change-Id: Ie90823337f7c2ee25fa489a5534801d991258f95

8 years agoMerge "Re-add putw for LP32"
Dan Willemsen [Thu, 3 Dec 2015 01:56:00 +0000 (01:56 +0000)]
Merge "Re-add putw for LP32"

8 years agoRe-add putw for LP32
Dan Willemsen [Thu, 3 Dec 2015 01:26:15 +0000 (17:26 -0800)]
Re-add putw for LP32

This was missed when switching to LOCAL_SRC_FILES_EXCLUDE

Change-Id: I6ea23c9eb31abe11e0ec4abfc2ee2f2a43c76ce2

8 years agoSeparate properties by selabel
Tom Cherry [Wed, 23 Sep 2015 23:09:47 +0000 (16:09 -0700)]
Separate properties by selabel

The purpose of this change is to add read access control to the property
space.

In the current design, a process either has access to the single
/dev/__properties__ file and therefore all properties that it contains
or it has access to no properties.  This change separates properties
into multiple property files based on their selabel, which allows
creation of sepolicies that allow read access of only specific sets of
properties to specific domains.

Bug 21852512

Change-Id: Ice265db79201ca811c6b6cf6d851703f53224f03

8 years agoMerge "Explicitly disallow default c-tor"
Dimitry Ivanov [Wed, 2 Dec 2015 18:44:20 +0000 (18:44 +0000)]
Merge "Explicitly disallow default c-tor"

8 years agoExplicitly disallow default c-tor
Dimitry Ivanov [Wed, 2 Dec 2015 00:57:19 +0000 (16:57 -0800)]
Explicitly disallow default c-tor

Change-Id: Ia52995a459443159e80383d5b396c3edd90a08ae

8 years agoMerge "Add bionic-unit-tests-gcc{32,64}, compiled with gcc."
Chih-hung Hsieh [Tue, 1 Dec 2015 00:23:32 +0000 (00:23 +0000)]
Merge "Add bionic-unit-tests-gcc{32,64}, compiled with gcc."

8 years agoMerge "Init stdio in __libc_init_common."
Yabin Cui [Mon, 30 Nov 2015 23:57:02 +0000 (23:57 +0000)]
Merge "Init stdio in __libc_init_common."

8 years agoMerge "Enable using clang to build __cxa_thread_atexit_impl."
Yabin Cui [Mon, 30 Nov 2015 23:56:41 +0000 (23:56 +0000)]
Merge "Enable using clang to build __cxa_thread_atexit_impl."

8 years agoEnable using clang to build __cxa_thread_atexit_impl.
Yabin Cui [Mon, 30 Nov 2015 22:07:58 +0000 (14:07 -0800)]
Enable using clang to build __cxa_thread_atexit_impl.

Remove previous workaround as we no longer use
__thread in __cxa_thread_atexit_impl.cpp.

Change-Id: Ic1062995db488859b341acdda0b5f6635e10d7e8

8 years agoMerge "Don't use __thread in __cxa_thread_finalize()."
Yabin Cui [Mon, 30 Nov 2015 21:59:47 +0000 (21:59 +0000)]
Merge "Don't use __thread in __cxa_thread_finalize()."

8 years agoInit stdio in __libc_init_common.
Yabin Cui [Tue, 24 Nov 2015 23:37:06 +0000 (15:37 -0800)]
Init stdio in __libc_init_common.

Previously we call __sinit() lazily. But it is likely to cause data
races like in https://android-review.googlesource.com/#/c/183237/. So
we prefer to call __sinit() explicitly at libc initialization.

Bug: 25392375

Change-Id: I181ea7a4b2e4c7350b45f2e6c86886ea023e80b8

8 years agoMerge "Fix pthread_test according to tsan report."
Yabin Cui [Mon, 30 Nov 2015 21:38:59 +0000 (21:38 +0000)]
Merge "Fix pthread_test according to tsan report."

8 years agoMerge "Consider $(use_clang) when building libc_thread_atexit_impl module"
Chih-hung Hsieh [Mon, 30 Nov 2015 18:58:59 +0000 (18:58 +0000)]
Merge "Consider $(use_clang) when building libc_thread_atexit_impl module"

8 years agoAdd bionic-unit-tests-gcc{32,64}, compiled with gcc.
Chih-Hung Hsieh [Fri, 20 Nov 2015 22:13:24 +0000 (14:13 -0800)]
Add bionic-unit-tests-gcc{32,64}, compiled with gcc.

* bionic-unit-tests{32,64} are compiled with clang/llvm.
* Skip one single test in __cxa_thread_atexit_test.cpp
  when compiled with aarch64 clang/llvm.
  Aarch64 clang/llvm generates relocation references to
  "thread_local" symbols not supported by Android linker.

BUG: 25642296
Change-Id: Ia0497b79c4b335228afeb48a26e0592217909953

8 years agoConsider $(use_clang) when building libc_thread_atexit_impl module
Nikola Veljkovic [Wed, 25 Nov 2015 18:03:12 +0000 (19:03 +0100)]
Consider $(use_clang) when building libc_thread_atexit_impl module

Change-Id: Ia369d94979f418198a2ee891385942d9bc5604d7

8 years agoDon't use __thread in __cxa_thread_finalize().
Yabin Cui [Wed, 25 Nov 2015 01:24:06 +0000 (17:24 -0800)]
Don't use __thread in __cxa_thread_finalize().

Currently we use __thread variable to store thread_local_dtors,
which makes tsan test fork_atexit.cc hang. The problem is as below:
The main thread creates a worker thread, the worker thread calls
pthread_exit() -> __cxa_thread_finalize() -> __emutls_get_address()
-> pthread_once(emutls_init) -> emutls_init().
Then the main thread calls fork(), the child process cals
exit() -> __cxa_thread_finalize() -> __emutls_get_address()
-> pthread_once(emutls_init).
So the child process is waiting for pthread_once(emutls_init)
to finish which will never occur.

It might be the test's fault because POSIX standard says if a
multi-threaded process calls fork(), the new process may only
execute async-signal-safe operations until exec functions are
called. And exit() is not async-signal-safe. But we can make
bionic more reliable by not using __thread in
__cxa_thread_finalize().

Bug: 25392375
Change-Id: Ife403dd7379dad8ddf1859c348c1c0adea07afb3

8 years agoMerge "Remove cflags and ldflags from crt defaults"
Colin Cross [Tue, 24 Nov 2015 21:33:54 +0000 (21:33 +0000)]
Merge "Remove cflags and ldflags from crt defaults"

8 years agoMerge "move arch variant structs down a level"
Colin Cross [Tue, 24 Nov 2015 20:21:20 +0000 (20:21 +0000)]
Merge "move arch variant structs down a level"

8 years agoRemove cflags and ldflags from crt defaults
Colin Cross [Mon, 23 Nov 2015 22:12:19 +0000 (14:12 -0800)]
Remove cflags and ldflags from crt defaults

After ToolchainCflags were added to soong crt no longer needs to try to
recreate the bare minimum cflags for compiling for each architecture.
Also always use GCC to match crt.mk

Change-Id: I01a833ab70d989033c84f072e3660d060189688c

8 years agoMerge "Introduce anonymous namespace"
Dimitry Ivanov [Tue, 24 Nov 2015 02:23:34 +0000 (02:23 +0000)]
Merge "Introduce anonymous namespace"

8 years agoIntroduce anonymous namespace
Dmitriy Ivanov [Mon, 23 Nov 2015 19:26:35 +0000 (11:26 -0800)]
Introduce anonymous namespace

The anonymous namespace is introduced to
handle cases when linker can not find the
caller. This usually happens when caller
code was not loaded by dynamic linker;
for example mono-generated code.

Bug: http://b/25844435
Bug: http://b/22548808
Change-Id: I9e5b1d23c1c75bc78548d68e79216a6a943a33cf

8 years agomove arch variant structs down a level
Colin Cross [Mon, 23 Nov 2015 22:12:15 +0000 (14:12 -0800)]
move arch variant structs down a level

Use blueprint's new anonymous embedded struct feature to move the arch
variant properties down a level, replacing arch.cortex_a9.srcs with
arch.arm.cortex_a9.srcs, while still supporting top-level properties
like arch.arm.srcs.

Change-Id: Ib41c80e3549440d5efdfd293a15cffa3f51a0fe4

8 years agoMerge "Change _stdio_handles_locking into _caller_handles_locking."
Yabin Cui [Mon, 23 Nov 2015 18:57:26 +0000 (18:57 +0000)]
Merge "Change _stdio_handles_locking into _caller_handles_locking."

8 years agoMerge "Handling invalid section headers"
Dimitry Ivanov [Mon, 23 Nov 2015 07:28:32 +0000 (07:28 +0000)]
Merge "Handling invalid section headers"

8 years agoHandling invalid section headers
Dmitriy Ivanov [Sat, 21 Nov 2015 01:28:12 +0000 (17:28 -0800)]
Handling invalid section headers

The linker crashes if native library has invalid section
headers. This change adds boundary checks on target offsets
and generates dlerror instead of crash.

Bug: http://b/25800330
Change-Id: Ibe282029997302b9b557637c3aad064d7d0febc5

8 years agoMerge "Use FUTEX_WAIT_BITSET to avoid converting timeouts."
Yabin Cui [Sat, 21 Nov 2015 01:50:29 +0000 (01:50 +0000)]
Merge "Use FUTEX_WAIT_BITSET to avoid converting timeouts."

8 years agoChange _stdio_handles_locking into _caller_handles_locking.
Yabin Cui [Thu, 19 Nov 2015 21:52:16 +0000 (13:52 -0800)]
Change _stdio_handles_locking into _caller_handles_locking.

It is reported by tsan that funlockfile() can unlock an unlocked mutex.
It happens when printf() is called before fopen() or other stdio stuff.
As FLOCKFILE(fp) is called before __sinit(), _stdio_handles_locking is false,
and _FLOCK(fp) will not be locked. But then cantwrite(fp) in __vfprintf()
calls__sinit(), which makes _stdio_handles_locking become true, and
FUNLOCKFILE(fp) unlocks _FLOCK(fp).

Change _stdio_handles_locking into _caller_handles_locking,
so __sinit() won't change its value. Add test due to my previous fault.

Bug: 25392375
Change-Id: I483e3c3cdb28da65e62f1fd9615bf58c5403b4dd

8 years agoMerge "Move some utility functions to linker_utils"
Dimitry Ivanov [Fri, 20 Nov 2015 21:42:18 +0000 (21:42 +0000)]
Merge "Move some utility functions to linker_utils"

8 years agoMove some utility functions to linker_utils
Dmitriy Ivanov [Fri, 20 Nov 2015 21:34:11 +0000 (13:34 -0800)]
Move some utility functions to linker_utils

Also adds unit-tests for page_start, page_offset, and safe_add

Change-Id: Ia1325b4682d367328a01599a19848e4ffcd2c0ea

8 years agoMerge "Improve error message for files with no sections"
Dimitry Ivanov [Fri, 20 Nov 2015 19:16:14 +0000 (19:16 +0000)]
Merge "Improve error message for files with no sections"

8 years agoImprove error message for files with no sections
Dmitriy Ivanov [Fri, 20 Nov 2015 18:42:02 +0000 (10:42 -0800)]
Improve error message for files with no sections

Bug: http://b/25801618
Change-Id: I4f4f368e727ff48c84781279e3d17d4ac2d1b6b0

8 years agoMerge "Disable clang for mips/mips64 libc."
Chih-hung Hsieh [Fri, 20 Nov 2015 18:27:14 +0000 (18:27 +0000)]
Merge "Disable clang for mips/mips64 libc."

8 years agoDisable clang for mips/mips64 libc.
Chih-Hung Hsieh [Fri, 20 Nov 2015 17:55:35 +0000 (09:55 -0800)]
Disable clang for mips/mips64 libc.

* Many processes, including adbd, failed to start in mips/mips64
  emulator when libc.so was compiled by clang.

BUG: 25291096
Change-Id: If3434ebdca4a3a6bf6102b120ee838a7ab66cd74

8 years agoMerge "mmap: fix calculation of is_private_anonymous variable"
Elliott Hughes [Fri, 20 Nov 2015 17:19:19 +0000 (17:19 +0000)]
Merge "mmap: fix calculation of is_private_anonymous variable"

8 years agommap: fix calculation of is_private_anonymous variable
Vitaly Vul [Thu, 24 Sep 2015 12:28:59 +0000 (14:28 +0200)]
mmap: fix calculation of is_private_anonymous variable

Currently is_private_anonymous is calculated as true if _either_
MAP_PRIVATE or MAP_ANONYMOUS is set, which is a mistake.
According to Documentation/vm/ksm.txt, "KSM only merges anonymous
(private) pages, never pagecache (file) pages". MAP_PRIVATE can
still be set on file cache pages so in order to not redundantly
set MADV_MERGEABLE on pages that are not fitted for it, both
MAP_PRIVATE and MAP_ANONYMOUS should be set.

Along with this fix, add an extra check that the mapped page is
not a stack page before setting MADV_MERGEABLE for it. Stack pages
change too quickly and always end up in KSM 'page_volatile' list.

Change-Id: If4954142852f17cc61f02985ea1cb625a7f3dec6

8 years agoMerge changes I73a39c6d,Iab2af242
Josh Gao [Fri, 20 Nov 2015 01:55:56 +0000 (01:55 +0000)]
Merge changes I73a39c6d,Iab2af242

* changes:
  Fix test build break.
  extend the PTRDIFF_MAX size check to mremap

8 years agoMerge "Fix tsan abort for lake of __libc_auxv initialization."
Yabin Cui [Fri, 20 Nov 2015 00:40:00 +0000 (00:40 +0000)]
Merge "Fix tsan abort for lake of __libc_auxv initialization."

8 years agoMerge "Update libc/Android.bp to match libc/Android.mk"
Colin Cross [Thu, 19 Nov 2015 22:48:33 +0000 (22:48 +0000)]
Merge "Update libc/Android.bp to match libc/Android.mk"

8 years agoFix tsan abort for lake of __libc_auxv initialization.
Yabin Cui [Thu, 19 Nov 2015 22:24:06 +0000 (14:24 -0800)]
Fix tsan abort for lake of __libc_auxv initialization.

If tsan is used, the following callchain can happen:
__libc_preinit() -> __libc_init_globals() ->
__libc_init_vdso() -> strcmp() -> __tsan_init()
-> sysconf(_SC_PAGE_SIZE) -> getauxval().
But __libc_auxv is initialized in __libc_init_common(),
after __libc_init_globals(). One simple way to fix
this is to initialize __libc_auxv at __libc_init_globals().

Bug: 25392375
Change-Id: I3893b1f567d5f3b7a8c881c0c1b8234b06b7751b

8 years agoUpdate libc/Android.bp to match libc/Android.mk
Colin Cross [Thu, 19 Nov 2015 21:32:49 +0000 (13:32 -0800)]
Update libc/Android.bp to match libc/Android.mk

Change-Id: I4dfadc55688213f095949c56306e5071b2ab6135

8 years agoFix test build break.
Josh Gao [Thu, 19 Nov 2015 21:44:20 +0000 (13:44 -0800)]
Fix test build break.

Change-Id: I73a39c6d4bb9baebbfb5572e9259bcd405116039

8 years agoUse FUTEX_WAIT_BITSET to avoid converting timeouts.
Yabin Cui [Thu, 5 Nov 2015 23:36:08 +0000 (15:36 -0800)]
Use FUTEX_WAIT_BITSET to avoid converting timeouts.

Add unittests for pthread APIs with timeout parameter.

Bug: 17569991

Change-Id: I6b3b9b2feae03680654cd64c3112ce7644632c87

8 years agoMerge "Add /odm/lib to shared lib search path"
Hung-ying Tyan [Thu, 19 Nov 2015 16:38:51 +0000 (16:38 +0000)]
Merge "Add /odm/lib to shared lib search path"

8 years agoextend the PTRDIFF_MAX size check to mremap
Daniel Micay [Sat, 7 Nov 2015 15:40:26 +0000 (10:40 -0500)]
extend the PTRDIFF_MAX size check to mremap

This removes another way to obtain objects larger than PTRDIFF_MAX. The
only known remaining hole is now jemalloc's merging of virtual memory
spans.

Technically this could be wrapped in an __LP64__ ifndef since it can't
occur on 64-bit due to the 1:1 split. It doesn't really matter either
way.

Change-Id: Iab2af242b775bc98a59421994d87aca0433215bd

8 years agoMerge "Do not depend on host bits to get the right size to write."
Junichi Uekawa [Thu, 19 Nov 2015 12:44:19 +0000 (12:44 +0000)]
Merge "Do not depend on host bits to get the right size to write."

8 years agoDo not depend on host bits to get the right size to write.
Junichi Uekawa [Wed, 18 Nov 2015 01:18:59 +0000 (10:18 +0900)]
Do not depend on host bits to get the right size to write.

x86_64 32-bit or 64-bit relocations do not depend on ELF bit size, they
are 32-bit or 64-bit respectively.

Known compiler that emits such code is nacl-clang which emits
R_X86_64_PC32 which should write 32 bits but ended up writing 64 bits.

Change-Id: Ibb6b484c0fea6a7e291362148e8ac749d6674529

8 years agoMerge "Implement pthread spin."
Yabin Cui [Thu, 19 Nov 2015 01:55:37 +0000 (01:55 +0000)]
Merge "Implement pthread spin."

8 years agoMerge "Avoid tsan warning about pthread_mutex_destroy."
Yabin Cui [Thu, 19 Nov 2015 01:55:25 +0000 (01:55 +0000)]
Merge "Avoid tsan warning about pthread_mutex_destroy."

8 years agoImplement pthread spin.
Yabin Cui [Wed, 18 Nov 2015 00:03:18 +0000 (16:03 -0800)]
Implement pthread spin.

In order to run tsan unit tests, we need to support pthread spin APIs.

Bug: 18623621
Bug: 25392375
Change-Id: Icbb4a74e72e467824b3715982a01600031868e29

8 years agoAdd /odm/lib to shared lib search path
Hung-ying Tyan [Thu, 12 Nov 2015 03:48:19 +0000 (11:48 +0800)]
Add /odm/lib to shared lib search path

ODM's shared libs should live in /odm/lib on the ODM partition.

BUG: 25654402
Change-Id: I3f5c26f208af87ff2817e490e51d0b4f5b8ec98e

8 years agoMerge "Ignore target sdk version for the public namespace"
Dimitry Ivanov [Wed, 18 Nov 2015 03:43:59 +0000 (03:43 +0000)]
Merge "Ignore target sdk version for the public namespace"

8 years agoIgnore target sdk version for the public namespace
Dmitriy Ivanov [Wed, 18 Nov 2015 02:36:50 +0000 (18:36 -0800)]
Ignore target sdk version for the public namespace

This fixes the bug with using the libraries loaded
prior to android_set_target_sdk_version call.

Bug: http://b/22548808
Change-Id: I3ca2d367b0fa930a437bbb65f780834803d2ef0a

8 years agoAvoid tsan warning about pthread_mutex_destroy.
Yabin Cui [Tue, 17 Nov 2015 04:19:31 +0000 (20:19 -0800)]
Avoid tsan warning about pthread_mutex_destroy.

If calling pthread_mutex_trylock from pthread_mutex_destroy, tsan
warns about an attempt to destroy a locked mutex.

Bug: 25392375
Change-Id: I5feee20e7a0d0915adad24da874ec1ccce241381

8 years agoFix pthread_test according to tsan report.
Yabin Cui [Tue, 17 Nov 2015 05:06:16 +0000 (21:06 -0800)]
Fix pthread_test according to tsan report.

1. Fix leak threads and data races related to spin_flag.
2. Increase stack size to run under tsan.

This doesn't pass all pthread tests, as some tests are used
to run intentionally in race situations.

Bug: 25392375
Change-Id: Icfba3e141e7170abd890809586e89b99adc8bd02

8 years agoMerge "Implement pthread barrier."
Yabin Cui [Tue, 17 Nov 2015 00:22:54 +0000 (00:22 +0000)]
Merge "Implement pthread barrier."

8 years agoMerge "Remove the warning about empty LD_LIBRARY_PATH"
Dimitry Ivanov [Mon, 16 Nov 2015 22:25:50 +0000 (22:25 +0000)]
Merge "Remove the warning about empty LD_LIBRARY_PATH"

8 years agoRemove the warning about empty LD_LIBRARY_PATH
Dmitriy Ivanov [Mon, 16 Nov 2015 22:23:37 +0000 (14:23 -0800)]
Remove the warning about empty LD_LIBRARY_PATH

Change-Id: I3eca11512d8055ab94dd0a6badcd83ce6440d675

8 years agoImplement pthread barrier.
Yabin Cui [Fri, 6 Nov 2015 06:06:09 +0000 (22:06 -0800)]
Implement pthread barrier.

Bug: 24341262
Change-Id: I5472549e5d7545c1c3f0bef78235f545557b9630

8 years agoMerge "Enable clang to compile more tests."
Chih-hung Hsieh [Mon, 16 Nov 2015 21:31:36 +0000 (21:31 +0000)]
Merge "Enable clang to compile more tests."

8 years agoMerge "Fix arm64 and x86 builds"
Dimitry Ivanov [Mon, 16 Nov 2015 21:23:18 +0000 (21:23 +0000)]
Merge "Fix arm64 and x86 builds"

8 years agoFix arm64 and x86 builds
Dmitriy Ivanov [Mon, 16 Nov 2015 21:17:27 +0000 (13:17 -0800)]
Fix arm64 and x86 builds

Change-Id: Ic3746b2f200f42218b6ac857c1631e873c767c17

8 years agoMerge "Introducing linker namespaces"
Dimitry Ivanov [Mon, 16 Nov 2015 20:14:37 +0000 (20:14 +0000)]
Merge "Introducing linker namespaces"

8 years agoEnable clang to compile more tests.
Chih-Hung Hsieh [Mon, 16 Nov 2015 19:13:04 +0000 (11:13 -0800)]
Enable clang to compile more tests.

* Disable optimization only in gtest.h of atexit_test.c for arm/aarch64
  to keep VTT for std::__1::basic_stringstream<char, std::__1::char_traits<char>,
  std::__1::allocator<char> > to link with g++ compiled modules.
* bionic-unit-tests source files are not affected by clang x86_64 fp128 bug
  so they can be compiled with clang.

BUG: 25643775
Change-Id: I3da2a0de61edcdca07b7fcd73a16de9da4a1f7d6

8 years agoIntroducing linker namespaces
Dmitriy Ivanov [Fri, 30 Oct 2015 00:01:24 +0000 (17:01 -0700)]
Introducing linker namespaces

Bug: http://b/22548808
Change-Id: Ia3af3c0a167f1d16447a3d83bb045d143319b1e1

8 years agoMerge "Improve libc time zone fallback behavior."
Elliott Hughes [Fri, 13 Nov 2015 18:24:41 +0000 (18:24 +0000)]
Merge "Improve libc time zone fallback behavior."

8 years agoImprove libc time zone fallback behavior.
Elliott Hughes [Fri, 13 Nov 2015 16:38:48 +0000 (08:38 -0800)]
Improve libc time zone fallback behavior.

We should fall back to GMT if neither the environment variable nor the
system property is set. This is the case if you wipe a WiFi-only device,
because we currently only take the time zone from cell networks.

Bug: http://b/24773112
Change-Id: I90d236d4d492b6562d75021bd312030b91c1e298

8 years agoMerge "Fix strftime if tm_zone is null."
Elliott Hughes [Fri, 13 Nov 2015 02:58:30 +0000 (02:58 +0000)]
Merge "Fix strftime if tm_zone is null."

8 years agoMerge "FORTIFY_SOURCE: make sure gcc unittests are compiled with gcc"
Nick Kralevich [Fri, 13 Nov 2015 01:09:44 +0000 (01:09 +0000)]
Merge "FORTIFY_SOURCE: make sure gcc unittests are compiled with gcc"

8 years agoFix strftime if tm_zone is null.
Elliott Hughes [Fri, 13 Nov 2015 00:51:31 +0000 (16:51 -0800)]
Fix strftime if tm_zone is null.

Upstream tzcode said "On platforms with tm_zone, strftime.c now assumes it
is not NULL". Which is fine for any struct tm generated by tzcode, but not
necessarily true of a struct tm constructed by arbitrary code. In particular,
Netflix on Nexus Player was failing to start because they format "%Z" with
a struct tm whose tm_zone is null (the other fields are valid, but, yeah,
that's probably not intentional).

glibc takes a null tm_zone to mean "the current time zone", so let's do that
too. (Historically Android would use the empty string, and POSIX doesn't
clarify which of this is the appropriate behavior when tm_zone is null.)

Bug: http://b/25170306
Change-Id: Idbf68bfe90d143aca7dada8607742905188b1d33

8 years agoFORTIFY_SOURCE: make sure gcc unittests are compiled with gcc
Nick Kralevich [Thu, 12 Nov 2015 23:55:13 +0000 (15:55 -0800)]
FORTIFY_SOURCE: make sure gcc unittests are compiled with gcc

The default compiler is clang. We need to explicitly indicate
that we should use gcc.

Change-Id: I37859c2e303f2a86a2565fe72eda1fda7c557a59