Commit graph

6054 commits

Author SHA1 Message Date
Dmitriy Ivanov
9b82136b98 Add ANDROID_DLEXT_FORCE_LOAD flag
This flag allows to force loading of the library
  in the case when for some reason multiple ELF files
  share the same filename (because the already-loaded
  library has been removed and overwritten, for example).

Change-Id: I798d44409ee13d63eaa75d685e99c4d028d2b0c1
2015-04-03 10:50:48 -07:00
Dan Albert
d6bf3d5e19 Don't export new/delete from libc shared libraries.
This used to be handled by -fvisibility=hidden on libc_cxa, but that
was broken by the resolution of https://llvm.org/PR22419 (introduced
to Android in today's clang update).

Now we just use a version script that prevents these from being
re-exported from our shared libraries.

Change-Id: Ib290e1d0d7426e09ad17a91178162fff6dbdcfa9
2015-04-01 16:31:57 -07:00
Mark Salyzyn
8f41142cd6 Merge "stubs missing include for string.h" 2015-04-01 00:55:19 +00:00
Elliott Hughes
72035734af Merge "Make ThreadLocalBuffer a class rather than a macro." 2015-04-01 00:51:57 +00:00
Mark Salyzyn
56b2768176 stubs missing include for string.h
stubs.cpp gets string.h inherited from private/android_filesystem_config.h
it should not rely on this in the future. The intent is to move fs_config
function into libcutils and thus deprecate any need for string.h in this
include file.

Change-Id: I946ec1979ef5bbb34fbcb4a99bf2cd79280bb2a3
2015-03-31 16:58:35 -07:00
Christopher Ferris
e01d32f802 Upgrade kernel headers to 3.18.10.
Change-Id: Iff1f1c830780585990856a5114b559c61282dcd6
2015-03-31 14:57:48 -07:00
Elliott Hughes
6170693e28 Make ThreadLocalBuffer a class rather than a macro.
Bug: 19995392
Change-Id: I497c512648fbe66257da3fb3bcd5c9911f983705
2015-03-31 10:56:58 -07:00
Yabin Cui
ef11500301 Revert "Revert "add guard pages to the internal signal stacks""
This reverts commit a3125fd139.
And Fix the prctl() problem that cause system crash.

Change-Id: Icc8d12d848cfba881a7984ca2827fd81be41f9fd
2015-03-30 20:51:39 -07:00
Elliott Hughes
a3125fd139 Revert "add guard pages to the internal signal stacks"
This reverts commit 595752f623.

Change-Id: Iefa66e9049ca0424e53cd5fc320d161b93556dcb
2015-03-31 02:42:39 +00:00
Daniel Micay
595752f623 add guard pages to the internal signal stacks
Signal handlers tend to be lean, but can still overflow the (tiny)
stack.

Change-Id: Ia21c6453d92a9f8d1536ad01ff26a1a84c05f8fb
2015-03-30 17:13:20 -04:00
Dmitriy Ivanov
402d199450 Fix libstdc++.so hash-style.
Bug: 19059885
Bug: 19958712
Change-Id: I167457a54cc688d64912a50f5fb75e4e2f3e3937
2015-03-27 15:27:07 -07:00
Yabin Cui
8f3eb5a4e5 Merge "Revert "Cause Fatal error when invalid pthread_id is detected."" 2015-03-26 18:14:23 +00:00
Yabin Cui
220b99bdc1 Revert "Cause Fatal error when invalid pthread_id is detected."
Some code like in https://buganizer.corp.google.com/u/0/issues/19942911 need to change first.

This reverts commit 03324780aa.

Change-Id: I13ff1e5b3d0672bae9cde234ffba32fbbf33d338
2015-03-26 18:13:07 +00:00
Dmitriy Ivanov
f2d153f836 Merge "Initial implementation of __cxa_thread_atexit_impl" 2015-03-26 17:50:23 +00:00
Yabin Cui
377243b78c Remove PTHREAD_RECURSIVE_MUTEX_INITIALIZER and PTHREAD_ERRORCHECK_MUTEX_INITIALIZER.
These macros are also not used in glibc. And we should use
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
and PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP instead.

Change-Id: I35195e2f499712dcde9305bbb93622d0f7ca874b
2015-03-25 21:02:36 -07:00
Dmitriy Ivanov
df79c330d8 Initial implementation of __cxa_thread_atexit_impl
This is initial implementations; does not yet handle
  dlclose - undefined behavior, needs linker support to
  handle it right.

Bug: 19800080
Bug: 16696563
Change-Id: I7a3e21ed7f7ec01e62ea1b7cb2ab253590ea0686
2015-03-25 18:07:59 -07:00
Yabin Cui
17393b06ba Hide internal of pthread_mutex_t.
Bug: 19249079
Change-Id: Iffb79c8d861b698d474f212dc80c638fc2cf1620
2015-03-25 17:54:17 -07:00
Yabin Cui
fa3dcecc0f Merge "Fix in error handling in pthread_create.cpp." 2015-03-26 00:26:59 +00:00
Yabin Cui
799cb35f45 Fix in error handling in pthread_create.cpp.
It is due to a previous change "Let g_thread_list_lock only protect g_thread_list".
We need to add the newly created thread to thread_list even if
__init_thread fails, so the thread can exit successfully.

Change-Id: I0332df11acfdd181350bcc092b12d90d679057a4
2015-03-25 16:18:21 -07:00
Yabin Cui
03324780aa Cause Fatal error when invalid pthread_id is detected.
This is a patch testing whether we can use abort() instead of
returning ESRCH for invalid pthread ids. It is an intermediate
step to remove g_thread_list/g_thread_list_lock.

Bug: 19636317
Change-Id: Idd8e4a346c7ce91e1be0c2ebcb78ce51c0d0a31d
2015-03-25 15:30:39 -07:00
Yabin Cui
0c3b632bd6 Merge "Add O_APPEND flag for __libc_write_stderr." 2015-03-25 20:17:34 +00:00
Yabin Cui
28e69f7508 Add O_APPEND flag for __libc_write_stderr.
For DeathTests, we are testing the output of stderr to check if it is the
death we are expecting. To collect the output, Gtest redirects stderr to
a temporary file. But in __libc_write_stderr in libc_logging.cpp, we are
writing to stderr without a O_APPEND flag, so a new message will overwrite
a previous message.
The above situation makes almost all the DeathTests fail on host. Because
the expected message are always overwritten in host DeathTests. So I add
O_APPEND flag in __libc_write_stderr, which makes all host DeathTests pass.

Change-Id: Ic2f6044fdb181eebe132a6f170b57db43c5c3289
2015-03-25 13:01:23 -07:00
Christopher Ferris
24958514b9 Use ALIAS_SYMBOL for assembler aliasing.
Change-Id: I8d04d2da0a1ac440cc9044fc819c9a8eda5ff17d
2015-03-25 09:12:00 -07:00
Christopher Ferris
fa5faa0ce6 Make gensyscalls.py use the ALIAS_SYMBOL macro.
Change-Id: Ib94c0abb6fc85126ecc5ed3f1962b2b8b90b9952
2015-03-24 21:08:26 -07:00
Yabin Cui
93d44ff2a6 Merge "Let g_thread_list_lock only protect g_thread_list." 2015-03-24 02:39:51 +00:00
Yabin Cui
673b15e4ee Let g_thread_list_lock only protect g_thread_list.
As glibc/netbsd don't protect access to thread struct members by a global
lock, we don't want to do it either. This change reduces the
responsibility of g_thread_list_lock to only protect g_thread_list.

Bug: 19636317
Change-Id: I897890710653dac165d8fa4452c7ecf74abdbf2b
2015-03-23 19:03:49 -07:00
Dmitriy Ivanov
32b039e46e Merge "RTLD_LAZY is not supported, use RTLD_NOW instead." 2015-03-24 00:48:58 +00:00
Yabin Cui
f8246ac65f Merge "Add test for pthread types alignment check." 2015-03-23 23:18:27 +00:00
Dmitriy Ivanov
84c10c2e79 RTLD_LAZY is not supported, use RTLD_NOW instead.
Change-Id: Ia08ed6416aef686435224b50b3e58955d09f04e2
2015-03-23 14:58:45 -07:00
Yabin Cui
b584572213 Add test for pthread types alignment check.
Bug: 19249079
Change-Id: I83c4f0d11ec5d82a346ae0057d02a92bb1d519e8
2015-03-20 17:42:09 -07:00
Yabin Cui
a2db50d5d7 Fix alignment error for pthread_internal_t/pthread stack.
aligned attribute can only control compiler's behavior, but we
are manually allocating pthread_internal_t. So we need to make
sure of alignment manually.

Change-Id: Iea4c46eadf10dfd15dc955c5f41cf6063cfd8536
2015-03-20 14:41:52 -07:00
Yabin Cui
bbb0432a33 Return EINVAL when calling pthread_detach for joined thread.
Change-Id: I717015132187e087e0ad485284a13c8801e25e77
2015-03-19 16:48:19 -07:00
Yabin Cui
aec2bb5ec6 Fix two errors in pthread_detach.cpp.
The errors are introduced in "Make pthread join_state not protected by g_thread_list_lock".

Bug: 19636317
Change-Id: I58ae9711da94bfbac809abfd81311eeb70301a4b
2015-03-19 23:35:23 +00:00
Yabin Cui
6943f2968c Merge "Make __get_thread inlined." 2015-03-19 02:50:20 +00:00
Yabin Cui
2f836d4989 Make __get_thread inlined.
Bug: 19825434

Change-Id: Ifb672a45a5776b83625a25654ed0d6f7fc368ae3
2015-03-18 19:35:34 -07:00
Elliott Hughes
fa495d51b0 Hide statfs/fstatfs' ST_VALID flag from userspace.
Spotted while debugging the strace 4.10 upgrade.

Change-Id: I1af1be9c9440151f55f74a835e1df71529b0e4fe
2015-03-18 15:46:48 -07:00
Elliott Hughes
ab12dc70f3 Merge "Fix _PATH_DEFPATH to correspond to the actual default path." 2015-03-18 01:15:04 +00:00
Elliott Hughes
1101962447 Fix _PATH_DEFPATH to correspond to the actual default path.
This is currently set in init.rc, but I plan on making init
set PATH to _PATH_DEFPATH and removing the line from init.rc...

Bug: 19564110
Change-Id: Ifa7226a3a5a90d141a788d7d6b1ae86245674218
2015-03-17 17:34:14 -07:00
Daniel Micay
ee7649c5ac set errno to ENOENT in getauxval per glibc 2.19
Bionic's getauxval(...) implementation returns zero when entries are
missing. Zero can be a valid value, so there is no unambiguous way of
detecting an error. Since glibc 2.19, errno is set to ENOENT when an
entry is missing to make it possible to detect this. Bionic should match
this behavior as code in the Linux ecosystem will start relying on it to
check for the presence of newly added entries.

Change-Id: Ic1efe29bc45fc87489274c96c4d2193f3a7b8854
Signed-off-by: Daniel Micay <danielmicay@gmail.com>
2015-03-17 19:50:55 -04:00
Yabin Cui
ecbfb25c50 Fix build: pthread_mutex/pthread_detach.
Change-Id: I9c7b6297d3bf3ab8004d05d44cc4c95159315c9e
2015-03-17 11:37:51 -07:00
Yabin Cui
94babaee1b Merge "Make pthread join_state not protected by g_thread_list_lock." 2015-03-17 18:12:59 +00:00
Yabin Cui
5490bebd7c Merge "Remove duplication in pthread_mutex.cpp." 2015-03-17 18:12:32 +00:00
Dmitriy Ivanov
b5cd3c7a75 Fix build: align pthread_cond_t to sizeof(long)
Change-Id: Ieaee6d09089b161ec516ba22cafaee1ecb4342da
2015-03-16 17:06:59 -07:00
Christopher Ferris
eb8b122d67 Add alignment to opaque types.
If there is no alignment forced, then the compiler might put these
structures at any alignment.

Change-Id: I6416db72433504e0ec1178bfae6f5b18b6e363fb
2015-03-16 16:28:54 -07:00
Yabin Cui
9e6c7bc618 Fix atomic_load on const variable in pthread_cond_t.
Change-Id: I60f55a53294a09332a3fbec669ed793359d1bdf5
2015-03-16 14:26:53 -07:00
Yabin Cui
d3e2a207ff Merge "Hide content of pthread_cond_t in pthread_cond_internal_t." 2015-03-16 20:58:02 +00:00
Yabin Cui
32651b8e8e Hide content of pthread_cond_t in pthread_cond_internal_t.
Bug: 19249079
Change-Id: I6f55af30bcd6211ce71630c6cacbef0e1663dcee
2015-03-16 11:09:52 -07:00
Christopher Ferris
83c0028e03 Merge "For libm, use a macro for aliasing symbols." 2015-03-14 17:44:32 +00:00
Christopher Ferris
995b813e91 For libm, use a macro for aliasing symbols.
Change-Id: Ibd42ebc387c2bf3eba9aa96091770915b4b34184
2015-03-13 23:57:15 -07:00
Yabin Cui
2fabea47ac Hide content of pthread_rwlock_t in pthread_rwlock_internal_t.
Bug: 19249079
Change-Id: Ifbe634c716b6793bef897ec5134b55eb44c6b8d5
2015-03-13 19:35:05 -07:00