Commit graph

1208 commits

Author SHA1 Message Date
Dmitriy Ivanov
8bdf8ab97c am e70d7a78: Merge "Fix dt_runpath test."
* commit 'e70d7a78f0bfba8b09d37c145769cb8d1d7c5fb6':
  Fix dt_runpath test.
2015-07-20 19:17:02 +00:00
Dmitriy Ivanov
3fef96f827 Fix dt_runpath test.
Bfd linker produces DT_RPATH instead of DT_RUNPATH
unless --enable-new-dtags option is specified.

Bug: http://b/22560945
Change-Id: I71bdc5137b899ab736e55c5a9574cfbba8e1983b
2015-07-20 10:47:49 -07:00
Yabin Cui
a89821abe3 am 60a11dcb: Merge "Add test for an Android kernel bug about prctl."
* commit '60a11dcb44992f610e696fc246c70731012080dd':
  Add test for an Android kernel bug about prctl.
2015-07-14 22:52:49 +00:00
Yabin Cui
91ce715af1 Add test for an Android kernel bug about prctl.
Bug: 20017123

Change-Id: I8c109a06999a8bffcc8e8298b04ee637bb67d878
2015-07-13 19:15:38 -07:00
Pirama Arumuga Nainar
fcd017148b am d1e10d7d: Merge "Use delete[] to de-allocate pointers from new[]"
* commit 'd1e10d7d168a8461d9eb47e48802ea11d8bd0640':
  Use delete[] to de-allocate pointers from new[]
2015-07-09 23:04:30 +00:00
Pirama Arumuga Nainar
d1e10d7d16 Merge "Use delete[] to de-allocate pointers from new[]" 2015-07-09 22:40:51 +00:00
Pirama Arumuga Nainar
4d44675283 Use delete[] to de-allocate pointers from new[]
Upstream clang has a new diagnostic, '-Wmismatched-new-delete' to
generate a warning (that becomes an error with -Werror) when delete is
used to deallocate pointers created with 'new[]'.  This patch fixes
'delete's that trigger this warning/error.

Change-Id: Id7b6f6c2df3e860e576de55e2f61f3d2be3a3986
2015-07-09 10:15:15 -07:00
Evgenii Stepanov
b4f5d6d894 am 33ef6c20: Merge "Respect caller DT_RUNPATH in dlopen()."
* commit '33ef6c20f2ddf19b29ed3a4e50139fa391b1a3d4':
  Respect caller DT_RUNPATH in dlopen().
2015-07-08 20:16:35 +00:00
Evgenii Stepanov
33ef6c20f2 Merge "Respect caller DT_RUNPATH in dlopen()." 2015-07-08 19:50:03 +00:00
Evgenii Stepanov
0cdef7e7f3 Respect caller DT_RUNPATH in dlopen().
When dlopen-ing a library, add the caller's DT_RUNPATH to the directory search
list. This fixes dlfcn.dt_runpath in bionic-unit-tests-glibc(32|64).

Bug: 21899363
Change-Id: Ife6a7e192939292cf4dc291b7e6b95945761cde3
2015-07-07 10:56:06 -07:00
Dmitriy Ivanov
7830dcf1b5 am 416695a7: Merge "Improve personality initialization"
* commit '416695a75c3892dd709a80ea8a640da07082594e':
  Improve personality initialization
2015-07-01 02:36:04 +00:00
Dmitriy Ivanov
c2247478d5 Improve personality initialization
1. Personality parameter should be unsigned int (not long)
2. Do not reset bits outside of PER_MASK when setting
   personality value.
3. Set personality for static executables.

Bug: http://b/21900686
Change-Id: I4c7e34079cbd59b818ce221eed325c05b9bb2303
(cherry picked from commit f643eb38c3)
2015-06-30 19:01:24 -07:00
Dmitriy Ivanov
f643eb38c3 Improve personality initialization
1. Personality parameter should be unsigned int (not long)
2. Do not reset bits outside of PER_MASK when setting
   personality value.
3. Set personality for static executables.

Bug: http://b/21900686
Change-Id: I4c7e34079cbd59b818ce221eed325c05b9bb2303
2015-06-30 18:45:59 -07:00
Dmitriy Ivanov
168ebad960 am 46d24d12: Merge "Replace NULL with nullptr"
* commit '46d24d12e167a0b5afa4ded218aa4db0a477141a':
  Replace NULL with nullptr
2015-06-29 21:34:07 +00:00
Dmitriy Ivanov
46d24d12e1 Merge "Replace NULL with nullptr" 2015-06-29 21:08:49 +00:00
Chih-Hung Hsieh
4ab0edac1a am d807b9a1: Merge "Use gcc to build and test x86_64 long double code."
* commit 'd807b9a12d3e49132b095df3d883618452033b51':
  Use gcc to build and test x86_64 long double code.
2015-06-24 00:40:16 +00:00
Chih-Hung Hsieh
d807b9a12d Merge "Use gcc to build and test x86_64 long double code." 2015-06-24 00:15:51 +00:00
Chih-Hung Hsieh
e79d06b0e8 Use gcc to build and test x86_64 long double code.
Clang/llvm x86_64 configuration of long double is still
incompatible with gcc.
https://llvm.org/bugs/show_bug.cgi?id=23897

BUG: 21899249
Change-Id: I47fd6d0ce2daa84ae0035e7885a4d90e4c3056f7
2015-06-23 23:13:39 +00:00
Dmitriy Ivanov
0a9df9a13e am af6ee5b5: Merge "Work around compiler optimization"
* commit 'af6ee5b5bc446ef5a6f2bf41bc4f2e13657978be':
  Work around compiler optimization
2015-06-23 22:17:08 +00:00
Dmitriy Ivanov
aff18fd608 Replace NULL with nullptr
Change-Id: If66d0c5ae1ea1ed371b44e067d4ae59ac54a8842
2015-06-23 13:58:22 -07:00
Dmitriy Ivanov
7d09a8cd11 Work around compiler optimization
This makes bionic-unit-test-glibc64 behave consistently
when testing dlopen from a library with dt_runpath.

Bug: http://b/21899363
Change-Id: I9d446eb6852876975874d6b7761f6f81cc4e9916
2015-06-23 13:47:23 -07:00
Dmitriy Ivanov
c29626c12a am 13cee57d: Merge "Remove libdl* tests from bionic-unit-tests-static"
* commit '13cee57dee4ebd14b57e7b5acd372228eb9c4a37':
  Remove libdl* tests from bionic-unit-tests-static
2015-06-22 19:50:49 +00:00
Dmitriy Ivanov
96ebdcdca0 Remove libdl* tests from bionic-unit-tests-static
Bug: http://b/21900592
Change-Id: I907cc15684b121ec2fbdeca49fc584bb6d2eaacc
(cherry picked from commit de4e27e231)
2015-06-22 12:24:36 -07:00
Dmitriy Ivanov
de4e27e231 Remove libdl* tests from bionic-unit-tests-static
Bug: http://b/21900592
Change-Id: I907cc15684b121ec2fbdeca49fc584bb6d2eaacc
2015-06-22 11:54:58 -07:00
Yabin Cui
1df44bd0a4 am cb060759: am 8beb0c34: am b245bc75: am 0f455612: Merge "Fix flaky test of timer_create_multiple in L." into lollipop-mr1-cts-dev
* commit 'cb0607590341ed2512a55015e66e19e7f7db3723':
  Fix flaky test of timer_create_multiple in L.
2015-06-19 20:29:49 +00:00
Yabin Cui
cb06075903 am 8beb0c34: am b245bc75: am 0f455612: Merge "Fix flaky test of timer_create_multiple in L." into lollipop-mr1-cts-dev
* commit '8beb0c34da46a5146a2de8256db8bb42febb283c':
  Fix flaky test of timer_create_multiple in L.
2015-06-19 19:06:22 +00:00
Yabin Cui
8beb0c34da am b245bc75: am 0f455612: Merge "Fix flaky test of timer_create_multiple in L." into lollipop-mr1-cts-dev
* commit 'b245bc750021ce6d220e71625fca66620cdd1f05':
  Fix flaky test of timer_create_multiple in L.
2015-06-19 18:55:51 +00:00
Yabin Cui
d1ade7ce02 Don't use TIMER_ABSTIME in time_test.
If TIMER_ABSTIME is used in timer_settime(), the timer is always fired
immediately, which is not the intent of the tests.

Change-Id: I76047dbeb2bdded272ee6d028630b53bfd7d8514
2015-06-19 00:54:34 +00:00
Yabin Cui
410c1adf5f Fix flaky test of timer_create_multiple in L.
Bug: 20677618
Change-Id: I0cb5faf77edce042b10611543180f3e2e73d3d05
2015-06-18 16:19:02 -07:00
Dan Albert
11ea08c5cb Use new sanitizer option.
Change-Id: I21b04a1f3be3b10ee557bf9e0caa5db638686364
2015-06-16 13:57:54 -07:00
Dan Albert
cce405a134 Add a sys/procfs.h.
Needed for building gdbserver out of the box.

Bug: http://b/21695943
Bug: https://code.google.com/p/android/issues/detail?id=86712
Change-Id: Ieadda2b595f08bfddfa61fcd68006b8e7c1a438d
(cherry picked from commit bf18c61798)
2015-06-15 18:39:02 -07:00
Elliott Hughes
333bdad361 Merge "Add a sys/procfs.h." 2015-06-16 01:28:48 +00:00
Dan Albert
bf18c61798 Add a sys/procfs.h.
Needed for building gdbserver out of the box.

Bug: http://b/21695943
Bug: https://code.google.com/p/android/issues/detail?id=86712
Change-Id: Ieadda2b595f08bfddfa61fcd68006b8e7c1a438d
2015-06-15 14:33:54 -07:00
Dmitriy Ivanov
ae1e75458a Merge "Make path to apk compliant with jar url format" into mnc-dev 2015-06-11 21:55:09 +00:00
Dmitriy Ivanov
402a75060d Make path to apk compliant with jar url format
Bug: http://b/21726698
Bug: http://b/8076853
Change-Id: I8c1942a98fe3119746b4dc9f60a7ff215ea7009c
(cherry picked from commit 524f1f1efe)
2015-06-11 11:01:23 -07:00
Elliott Hughes
25ac753f47 Add process_vm_readv and process_vm_writev.
Bug: http://b/21761353
Change-Id: Ic8ef3f241d62d2a4271fbc783c8af50257bac498
(cherry picked from commit be57a40d29)
2015-06-10 18:55:06 -07:00
Elliott Hughes
c910de9d5e Merge "Add process_vm_readv and process_vm_writev." 2015-06-11 01:31:17 +00:00
Elliott Hughes
be57a40d29 Add process_vm_readv and process_vm_writev.
Bug: http://b/21761353
Change-Id: Ic8ef3f241d62d2a4271fbc783c8af50257bac498
2015-06-10 17:24:20 -07:00
Dmitriy Ivanov
bd3b961186 Fix application_sdk_versions_smoke test
Bug: http://b/21364029
Change-Id: I9716d6b0ea7fae6483629a290dbe695b68526588
(cherry picked from commit 79b3877a13)
2015-06-10 17:03:12 -07:00
Dmitriy Ivanov
79b3877a13 Fix application_sdk_versions_smoke test
Bug: http://b/21364029
Change-Id: I9716d6b0ea7fae6483629a290dbe695b68526588
2015-06-10 16:55:50 -07:00
Evgenii Stepanov
6865082ca6 Support DT_RUNPATH in the linker.
Only $ORIGIN substitution is supported, but not linux-specific $LIB
or $PLATFORM.

Change-Id: I5814a016c7c91afba080230a547a863686e7c2b9
2015-06-10 16:44:22 -07:00
Christopher Ferris
60907c7f4e Allow NULL in pthread_mutex_lock/unlock.
The pthread_mutex_lock and pthread_mutex_unlock were allowed to
fail silently on L 32 bit devices when passed a NULL. We changed
this to a crash on 32 bit devices, but there are still games that make
these calls and are not likely to be updated. Therefore, once again
allow NULL to be passed in on 32 bit devices.

Bug: 19995172
(cherry picked from commit 511cfd9dc8)

Change-Id: I159a99a941cff94297ef3fffda7075f8ef1ae252
2015-06-10 10:50:43 -07:00
Christopher Ferris
511cfd9dc8 Allow NULL in pthread_mutex_lock/unlock.
The pthread_mutex_lock and pthread_mutex_unlock were allowed to
fail silently on L 32 bit devices when passed a NULL. We changed
this to a crash on 32 bit devices, but there are still games that make
these calls and are not likely to be updated. Therefore, once again
allow NULL to be passed in on 32 bit devices.

Bug: 19995172
Change-Id: If7e8860075ecd63c0064d80f64e226fad7bd3c26
2015-06-09 18:46:15 -07:00
Dmitriy Ivanov
524f1f1efe Make path to apk compliant with jar url format
Bug: http://b/21726698
Bug: http://b/8076853
Change-Id: I8c1942a98fe3119746b4dc9f60a7ff215ea7009c
2015-06-09 13:47:46 -07:00
Nick Kralevich
e1d0810cd7 Add O_PATH support for flistxattr()
A continuation of commit 2825f10b7f.

Add O_PATH compatibility support for flistxattr(). This allows
a process to list out all the extended attributes associated with
O_PATH file descriptors.

Change-Id: Ie2285ac7ad2e4eac427ddba6c2d182d41b130f75
2015-06-06 11:25:41 -07:00
Yabin Cui
ea248d9ca8 Merge "Make sys_resource test more robust." into lollipop-cts-dev
automerge: 492a0bf

* commit '492a0bf212973baa1c33d584d57e75395774447f':
  Make sys_resource test more robust.
2015-06-02 22:03:23 +00:00
Yabin Cui
e7ece90b50 Make sys_resource test more robust.
Bug: 19482626

"ulimit -c xxx" command may run before bionic-unit-tests.
Make sure sys_resource test fails gently in that case.

Change-Id: Ic3b5ed8b20acba56df8c5ef082c88e5050e761aa
(cherry picked from commit 4853f40f3f)
2015-06-02 14:40:26 -07:00
Nick Kralevich
c92f9f8069 libc: Add O_PATH support for fgetxattr / fsetxattr
Support O_PATH file descriptors when handling fgetxattr and fsetxattr.
This avoids requiring file read access to pull extended attributes.

This is needed to support O_PATH file descriptors when calling
SELinux's fgetfilecon() call. In particular, this allows the querying
and setting of SELinux file context by using something like the following
code:

  int dirfd = open("/path/to/dir", O_DIRECTORY);
  int fd = openat(dirfd, "file", O_PATH | O_NOFOLLOW);
  char *context;
  fgetfilecon(fd, &context);

This change was motivated by a comment in
https://android-review.googlesource.com/#/c/152680/1/toys/posix/ls.c

(cherrypicked from commit 2825f10b7f)

Change-Id: Ic0cdf9f9dd0e35a63b44a4c4a08400020041eddf
2015-06-02 10:08:05 -07:00
Dmitriy Ivanov
c4ebe60e1a Fix dlsym(handle_of_main_executable, ...)
According to man dlopen(3) and posix docs in the case when si is handle
  of the main executable we need to search not only in the executable and its
  dependencies but also in all libraries loaded with RTLD_GLOBAL.

  see also: http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlopen.html

Bug: http://b/21528224
Bug: http://b/17512583
Bug: https://code.google.com/p/android/issues/detail?id=173822
Change-Id: Ib2801367ba48b6f3704da89a6d9f5e6911430013
(cherry picked from commit f439b5a318)
2015-06-01 16:57:33 -07:00
Dmitriy Ivanov
ef55f96723 Merge "Fix dlsym(handle_of_main_executable, ...)" 2015-06-01 23:51:24 +00:00
Nick Kralevich
2825f10b7f libc: Add O_PATH support for fgetxattr / fsetxattr
Support O_PATH file descriptors when handling fgetxattr and fsetxattr.
This avoids requiring file read access to pull extended attributes.

This is needed to support O_PATH file descriptors when calling
SELinux's fgetfilecon() call. In particular, this allows the querying
and setting of SELinux file context by using something like the following
code:

  int dirfd = open("/path/to/dir", O_DIRECTORY);
  int fd = openat(dirfd, "file", O_PATH | O_NOFOLLOW);
  char *context;
  fgetfilecon(fd, &context);

This change was motivated by a comment in
https://android-review.googlesource.com/#/c/152680/1/toys/posix/ls.c

Change-Id: Ic0cdf9f9dd0e35a63b44a4c4a08400020041eddf
2015-06-01 15:51:56 -07:00
Dmitriy Ivanov
f439b5a318 Fix dlsym(handle_of_main_executable, ...)
According to man dlopen(3) and posix docs in the case when si is handle
  of the main executable we need to search not only in the executable and its
  dependencies but also in all libraries loaded with RTLD_GLOBAL.

  see also: http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlopen.html

Bug: http://b/21528224
Bug: http://b/17512583
Bug: https://code.google.com/p/android/issues/detail?id=173822
Change-Id: Ib2801367ba48b6f3704da89a6d9f5e6911430013
2015-06-01 14:33:43 -07:00
Dan Albert
c5e02eeb35 Cleanup ftruncate negative test.
Addresses post-submit comments from
I54692ab8105dd09db6af7a2c0894a17bdd118aa0.

Bug: http://b/21309901
Change-Id: Ie19ee8cdcc4055a65fe7dfc103156e54eafe8977
(cherry picked from commit 9d476a02e9)
2015-06-01 13:24:36 -07:00
Dan Albert
9d476a02e9 Cleanup ftruncate negative test.
Addresses post-submit comments from
I54692ab8105dd09db6af7a2c0894a17bdd118aa0.

Bug: http://b/21309901
Change-Id: Ie19ee8cdcc4055a65fe7dfc103156e54eafe8977
2015-06-01 13:22:57 -07:00
Dan Albert
5f3e19dbbe Fix error handling for negative size in ftruncate.
Bug: 21309901
Change-Id: I54692ab8105dd09db6af7a2c0894a17bdd118aa0
(cherry picked from commit c05554ec5c)
2015-06-01 11:28:13 -07:00
Dmitriy Ivanov
d8ead18145 Add functions to provide target sdk version
Bug: http://b/21364029
Change-Id: I8648d1bff6c8fd6e7cd12da7f128e048b9f2829a
(cherry picked from commit 79fd668bb4)
2015-05-27 16:20:16 -07:00
Dmitriy Ivanov
79fd668bb4 Add functions to provide target sdk version
Bug: http://b/21364029
Change-Id: I8648d1bff6c8fd6e7cd12da7f128e048b9f2829a
2015-05-27 14:31:36 -07:00
Dan Albert
ffe01a3de6 Merge "Fix error handling for negative size in ftruncate." 2015-05-21 20:41:25 +00:00
Yabin Cui
c15a935202 am fd20a8c2: resolved conflicts for merge of 473d96c0 to lmp-mr1-ub-dev
* commit 'fd20a8c2d669b3f2d63e2d33a32b90d1b7f17b82':
  Fix timer flaky test in lollipop-mr1-cts-dev.
2015-05-20 21:48:09 +00:00
Yabin Cui
b0c6f2dba2 Fix pthread_attr_getstack__main_thread failure on glibc.
Move test of bionic specific implementation into bionic ifdef.

Bug: 19805726
Change-Id: Idf369b16e7f41f060c75b0aaf34e05cf3c161aa9
2015-05-20 14:41:15 -07:00
Dan Albert
c05554ec5c Fix error handling for negative size in ftruncate.
Bug: 21309901
Change-Id: I54692ab8105dd09db6af7a2c0894a17bdd118aa0
2015-05-20 14:20:33 -07:00
Yabin Cui
fd20a8c2d6 resolved conflicts for merge of 473d96c0 to lmp-mr1-ub-dev
Change-Id: I48269218b152054d527d9257d40490b54205140f
2015-05-20 13:36:56 -07:00
Yabin Cui
2b5c2285c0 Remove pthread_detach_no_leak test.
This test has lost its purpose as we are using mmap/munmap for pthread_internal_t. And it is a flaky test.

Bug: 21205574
Bug: 20860440
Change-Id: I7cbb6bc3fd8a2ca430415beab5ee27a856ce4ea7
(cherry picked from commit 2957cc5f10)
2015-05-18 10:31:20 -07:00
Dmitriy Ivanov
ff407803db Remove -z global workaround for target x86
Change-Id: I08e75a1c7437c97e4af59316d2c14c7fa3f65e03
(cherry picked from commit 933332462d)
2015-05-15 10:30:47 -07:00
Dmitriy Ivanov
933332462d Remove -z global workaround for target x86
Change-Id: I08e75a1c7437c97e4af59316d2c14c7fa3f65e03
2015-05-14 21:28:21 -07:00
Dmitriy Ivanov
4bac6ea463 Improved dlsym tests and fixes to linker
Answers the question: what if dependent library
 was preloaded with RTLD_LOCAL flag.

 Also add test for RTLD_NEXT within local_group.

Bug: http://b/17512583
Change-Id: I79e081e68b3a8c0ed8980d4275a06515fea94ec9
(cherry picked from commit 697bd9fd38)
2015-05-12 13:49:13 -07:00
Dmitriy Ivanov
697bd9fd38 Improved dlsym tests and fixes to linker
Answers the question: what if dependent library
 was preloaded with RTLD_LOCAL flag.

 Also add test for RTLD_NEXT within local_group.

Bug: http://b/17512583
Change-Id: I79e081e68b3a8c0ed8980d4275a06515fea94ec9
2015-05-12 13:46:40 -07:00
Yabin Cui
5c0996a969 Fix timer flaky test in lollipop-mr1-cts-dev.
It is partically cherry-pick from https://android-review.googlesource.com/#/c/123410/.
And as lollipop-mr1-cts-dev still uses stlport, <stdatomic.h> is used instead of <atomic>.

Bug: 20677618
Change-Id: I952a6fd074facc4227c955fecf3ecbfbbaec4193
2015-05-08 13:12:01 -07:00
Yabin Cui
f9eeea6d65 Merge "Remove pthread_detach_no_leak test." 2015-05-08 01:36:30 +00:00
Yabin Cui
2957cc5f10 Remove pthread_detach_no_leak test.
This test has lost its purpose as we are using mmap/munmap for pthread_internal_t. And it is a flaky test.

Bug: 20860440
Change-Id: I7cbb6bc3fd8a2ca430415beab5ee27a856ce4ea7
2015-05-07 16:53:25 -07:00
Dmitriy Ivanov
a60fd09e26 Move pthread_atfork_dlclose test out of static lib
Bug: http://b/20858755
Change-Id: I0d84e8b43dc33902d75af18db6b7c8e0b619d718
(cherry picked from commit 5624a6a1e5)
2015-05-06 16:47:54 -07:00
Dmitriy Ivanov
5624a6a1e5 Move pthread_atfork_dlclose test out of static lib
Bug: http://b/20858755
Change-Id: I0d84e8b43dc33902d75af18db6b7c8e0b619d718
2015-05-06 14:15:28 -07:00
Christopher Ferris
64a8698809 Modify test to avoid race condition.
automerge: 3da136a

* commit '3da136aa47e2d1608b98abb2580f024b36f92831':
  Modify test to avoid race condition.
2015-05-04 16:45:13 +00:00
Elliott Hughes
9a2744df30 Merge "Fix POSIX timer thread naming." 2015-04-25 18:01:18 +00:00
Elliott Hughes
d1aea30b2a Fix POSIX timer thread naming.
Spencer Low points out that we never actually set a name because the constant
part of the string was longer than the kernel's maximum, and the kernel
rejects long names rather than truncate.

Shorten the fixed part of the string while still keeping it meaningful. 9999
POSIX timers should be enough for any process...

Bug: https://code.google.com/p/android/issues/detail?id=170089
Change-Id: Ic05f07584c1eac160743519091a540ebbf8d7eb1
2015-04-25 10:05:24 -07:00
Dmitriy Ivanov
2c256a0f09 Merge "Unregister pthread_atfork handlers on dlclose()" 2015-04-25 05:36:07 +00:00
Dmitriy Ivanov
e91e66f223 Use bfd linker for x86/x86_64 targets
ld.gold in current toolchain for x86_64
 does not support -z global.

Change-Id: Iea2b192f0f0aa998a02adb356fd4eec4e10a1739
2015-04-24 21:05:49 -07:00
Dmitriy Ivanov
ea295f68f1 Unregister pthread_atfork handlers on dlclose()
Bug: http://b/20339788
Change-Id: I874c87faa377645fa9e0752f4fc166d81fd9ef7e
2015-04-24 17:57:37 -07:00
Dmitriy Ivanov
6612d7a347 Enable dlsym_df_1_global test for arm/arm64
Change-Id: I1fdebced93175cb14053e2239e79f97239fc2dc2
2015-04-24 16:26:03 -07:00
Dimitry Ivanov
094f58fb2a Revert "Unregister pthread_atfork handlers on dlclose()"
The visibility control in pthread_atfork.h is incorrect.
 It breaks 64bit libc.so by hiding pthread_atfork.

 This reverts commit 6df122f852.

Change-Id: I21e4b344d500c6f6de0ccb7420b916c4e233dd34
2015-04-24 03:46:57 +00:00
Dmitriy Ivanov
6df122f852 Unregister pthread_atfork handlers on dlclose()
Change-Id: I326fdf6bb06bed12743f08980b5c69d849c015b8
2015-04-22 19:19:37 -07:00
Daniel Micay
42281880a8 add fortified readlink/readlinkat implementations
Change-Id: Ia4b1824d20cad3a072b9162047492dade8576779
2015-04-17 18:49:12 -04:00
Dmitriy Ivanov
3875744f89 Merge "Support symbol versioning" 2015-04-17 03:57:46 +00:00
Dmitriy Ivanov
2a81536144 Support symbol versioning
Bug: http://b/20139821
Change-Id: I64122a0fb0960c20b2ce614161b7ab048456b681
2015-04-16 17:57:30 -07:00
Daniel Micay
e7e1c875b0 add fortified implementations of pread/pread64
Change-Id: Iec39c3917e0bc94371bd81541619392f5abe29b9
2015-04-16 10:33:35 -04:00
Dmitriy Ivanov
a40cb0ca7f Merge "Call __cxa_thread_finalize for the main thread." 2015-04-16 08:06:03 +00:00
Yabin Cui
2587c6a2f0 Merge "Change on handling of SIGEV_THREAD timers." 2015-04-16 01:08:25 +00:00
Yabin Cui
95f1ee235a Change on handling of SIGEV_THREAD timers.
1. Don't prevent calling callback when SIGEV_THREAD timers are disarmed by timer_settime.
As in POSIX standard: The effect of disarming or resetting a timer with pending
expiration notifications is unspecified. And glibc didn't prevent in this situation, so I
think it is fine to remove the support.
2. Still prevent calling callback when SIGEV_THREAD timers are deleted by timer_delete.
As in POSIX standard: The disposition of pending signals for the deleted timer is unspecified.
However, glibc handles this (although that is not perfect). And some of our tests in
time_test.cpp depend on this feature as described in b/18039727. so I retain the support.
3. Fix some flaky test in time_test.cpp, and make "time*" test pass on bionic-unit-tests-glibcxx.

Bug: 18263854

Change-Id: I8ced184eacdbfcf433fd81b0c69c38824beb8ebc
2015-04-15 17:36:01 -07:00
Dmitriy Ivanov
163ab8ba86 Call __cxa_thread_finalize for the main thread.
Bug: http://b/20231984
Bug: http://b/16696563
Change-Id: I71cfddd0d404d1d4a593ec8d3bca9741de8cb90f
2015-04-15 16:24:21 -07:00
Dmitriy Ivanov
66aa0b61f7 Hide emutls* symbols in libc.so
Also make thread_local in test static to avoid ld.bfd
 warning for arm64.

Change-Id: I09a3f2aa9b73a4fafa3f3bbc64ddc2a128ad50ee
2015-04-15 14:23:00 -07:00
Yabin Cui
8f3f04184a Merge "Prevent using static-allocated pthread keys before creation." 2015-04-14 20:35:08 +00:00
Yabin Cui
5ddbb3f936 Prevent using static-allocated pthread keys before creation.
Bug: 19993460

Change-Id: I244dea7f5df3c8384f88aa48d635348fafc9cbaf
2015-04-14 13:32:09 -07:00
Dmitriy Ivanov
de88974120 Merge "Fix dl* tests to run-on-host" 2015-04-11 00:28:05 +00:00
Dmitriy Ivanov
ef25592f14 Fix dl* tests to run-on-host
Bug: http://b/20121152
Change-Id: I1e1f41d885c75dbb26f91565a53a15d62ef72ce6
2015-04-09 14:56:26 -07:00
Yabin Cui
9f2c2f53d3 Merge "Provide writer preference option in rwlock." 2015-04-09 17:19:44 +00:00
Yabin Cui
76615dae93 Provide writer preference option in rwlock.
Previous implementation of rwlock contains four atomic variables, which
is hard to maintain and change. So I make following changes in this CL:

1. Add pending flags in rwlock.state, so we don't need to synchronize
between different atomic variables. Using compare_and_swap operations
on rwlock.state is enough for all state change.

2. Add pending_lock to protect readers/writers waiting and wake up
operations. As waiting/wakeup is not performance critical, using a
lock is easier to maintain.

3. Add writer preference option.

4. Add unit tests for rwlock.

Bug: 19109156

Change-Id: Idcaa58d695ea401d64445610b465ac5cff23ec7c
2015-04-08 13:11:13 -07:00
Dmitriy Ivanov
1dce3ed249 Fix x86_64 build
Change-Id: Id81c059bf3ecdb9cc84d04d16ffda34baaadc5a1
2015-04-06 19:05:58 -07:00
Dmitriy Ivanov
8a1007dbab Merge "Add realpath for soinfo" 2015-04-07 00:14:57 +00:00
Dmitriy Ivanov
aae859cc3c Add realpath for soinfo
This change adds realpath to soinfo and
  extends limit on filenames from 128 to PATH_MAX.

  It also removes soinfo::name field, linker uses
  dt_soname instead.

Bug: http://b/19818481
Bug: https://code.google.com/p/android/issues/detail?id=80336
Change-Id: I9cff4cb5bda3ee2bc74e1bbded9594ea7fbe2a08
2015-04-06 21:15:43 +00:00
Elliott Hughes
67de2593b3 Merge "Add a test for getdelim(3) on a directory." 2015-04-06 19:36:13 +00:00
Elliott Hughes
694fd2d880 Add a test for getdelim(3) on a directory.
Apparently uClibc has a bug here. We don't, but let's keep it that way.

Bug: http://landley.net/notes.html#21-03-2015
Change-Id: If406df963db9bee47921d7a1c116ebcab08d96bf
2015-04-05 10:51:56 -07:00
Yabin Cui
4bd8f9637d Merge "Fix bug for recursive/errorcheck mutex on 32-bit devices." 2015-04-04 19:31:55 +00:00
Yabin Cui
f796985923 Fix bug for recursive/errorcheck mutex on 32-bit devices.
Bug: 19216648
Change-Id: I3b43b2d18d25b9bde352da1e35f9568133dec7cf
2015-04-03 19:01:17 -07:00
Dmitriy Ivanov
45c57131d2 Add libdl dependency for target libraries
Fixed x86_64 target build with gcc 4.9

Change-Id: Id3b1e9286c2bcbb8e3ac117bcef957304db7cfd3
2015-04-03 15:17:52 -07:00
Dmitriy Ivanov
aea165cb03 Merge "Add ANDROID_DLEXT_FORCE_LOAD flag" 2015-04-03 19:45:24 +00:00
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
Dmitriy Ivanov
06b6e3c51d Merge "Look into local group on dlsym with RTLD_DEFAULT" 2015-04-02 21:55:01 +00:00
Dmitriy Ivanov
76ac1acdac Look into local group on dlsym with RTLD_DEFAULT
Fix dlsym to look into local group when called with
  RTLD_DEFAULT and RTLD_NEXT.

Bug: 17512583
Change-Id: I541354e89539c712af2ea4ec751e546913027084
2015-04-02 14:12:45 -07:00
Yabin Cui
00d1101cc1 Merge "Refactor pthread_mutex to support 32-bit owner_tid on 64-bit devices." 2015-04-02 20:27:40 +00:00
Christopher Ferris
618935d267 Merge "gtest_repeat should allow negative values." 2015-04-02 19:19:38 +00:00
Christopher Ferris
119cb55d43 gtest_repeat should allow negative values.
If you pass in a negative value to gtest_repeat, it should run forever.
The new runner didn't allow this, now it does.

Change-Id: Ie0002c12e2fdad22b264adca37c165cfcfe05c7a
2015-04-02 12:16:00 -07:00
Yabin Cui
e69c24543d Refactor pthread_mutex to support 32-bit owner_tid on 64-bit devices.
Bug: 19216648
Change-Id: I765ecacc9036659c766f5d1f6600e1a65364199b
2015-04-01 21:12:22 -07:00
Elliott Hughes
0ad256c1b2 Fix ftw tests when run as non-root.
Root can create subdirectories inside non-writable directories, but
other users can't.

Change-Id: I102fe610d1bd2733aebf184b544e58612465287d
2015-04-01 12:22:40 -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
Dmitriy Ivanov
947adedebc Add test for thread_local keyword.
For gcc only for the time being.

Bug: 19800080
Bug: 16696563
Change-Id: Ifaa59a131ca2d9030554cee7ce631dcb1d081938
2015-03-27 12:05:36 -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
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
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
b584572213 Add test for pthread types alignment check.
Bug: 19249079
Change-Id: I83c4f0d11ec5d82a346ae0057d02a92bb1d519e8
2015-03-20 17:42:09 -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
Dmitriy Ivanov
52393a5633 Move open from zip tests to dlext
To avoid building them for glibc.

 Also replace snprintf with std::string

Change-Id: I12e1d2e4ab46ff5af6c05453da67842e0d838fc5
2015-03-18 22:50:01 -07:00
Dmitriy Ivanov
618f1a36f8 Implement lookup by DT_SONAME
This CL also fixes SEARCH_NAME hack and resolves
  https://code.google.com/p/android/issues/detail?id=6670
  once and for all.

Bug: https://code.google.com/p/android/issues/detail?id=6670
Change-Id: I9b8d6a672cd722f30fbfbb40cdee8d9b39cfe56e
2015-03-18 18:14:30 -07:00
Elliott Hughes
c6fbbb42e6 Merge "Hide statfs/fstatfs' ST_VALID flag from userspace." 2015-03-18 23:11:52 +00: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
Dimitry Ivanov
c0eaa73284 Merge "Support loading shared libraries from zip files" 2015-03-18 17:25:33 +00: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
5490bebd7c Merge "Remove duplication in pthread_mutex.cpp." 2015-03-17 18:12:32 +00:00
Simon Baldwin
aef719510a Support loading shared libraries from zip files
Add code to support loading shared libraries directly from within
APK files.

Extends the linker's handling of LD_LIBRARY_PATH, DT_RUNPATH, etc
to allow elements to be either directories as normal, or ZIP
format files.  For ZIP, the ZIP subdirectory string is separated
from the path to file by '!'.

For example, if DT_NEEDED is libchrome.so and Chrome.apk is the
Android ARM APK then the path element

  /system/app/Chrome.apk!lib/armeabi-v7a

would cause the linker to load lib/armeabi-v7a/libchrome.so
directly from inside Chrome.apk.  For loading to succeed,
libchrome.so must be 'stored' and not compressed in Chrome.apk,
and must be page aligned within the file.

Motivation:
  Chromium tracking issue:
  https://code.google.com/p/chromium/issues/detail?id=390618

Bug: 8076853
Change-Id: Ic49046600b1417eae3ee8f37ee98c8ac1ecc19e7
2015-03-16 17:50:50 -07:00
Dmitriy Ivanov
cb0443c0fa Remove obsolete test_isolated wrapper function
We already run all of our tests in isolated mode.

Change-Id: I8236baa302b1026a9b4a1c33a4aa65e223771bc7
2015-03-16 14:20:57 -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
Dmitriy Ivanov
b1ada3dd3f Fix typo
Change-Id: Ie6dad7d09873c88f6bbb2d45c2780e3b0c618bd6
2015-03-16 13:20:23 -07: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
Yabin Cui
64a9c4f697 Make gtest_main exit 1 when some test are failed.
This is the gtest behavior, which I think can make test status
judgement more convenient.

Change-Id: I7d3c210d1744b954a4148cd905dd5c353207fce8
2015-03-12 23:36:29 -07:00
Yabin Cui
5b8e7cd957 Remove duplication in pthread_mutex.cpp.
Also add unit tests about thread woken up by pthread_mutex_unlock.

Bug: 19216648

Change-Id: I8bde8105b00186c52a2f41d92458ae4a5eb90426
2015-03-12 21:54:41 -07:00
Yabin Cui
c6e5874a4c Loosen fchmodat AT_SYMLINK_NOFOLLOW test on symlink.
It has been reported in b2/19657449 and b2/19381040 that fchmodat
AT_SYMLINK_NOFOLLOW operation on symlink can succeed. It seems to be
controlled by kernel(version or configuration) or user configuration
whether chmod is allowed on symlinks. Unless we can disable chmod on
symlinks in bionic explicitly, we can not guarantee that the test can
pass. But it seems reasonable to allow chmod on symlink if kernel allows
to. So We prefer to loosen the test here, accepting both success and
failure when doing chmod operation on symlinks.

Bug: 19657449
Bug: 19381040
Change-Id: I780e84f0b50d0412fbac9f1c240d07e984892a28
2015-03-09 18:13:15 -07:00
Yabin Cui
24e8871faa Rename fortify_sprintf_warnings.cpp to fortify_compilation_test.cpp.
Bug: 19234260
Change-Id: Ife27ca13eeae317739eda25b40dd2a08606d6d6f
2015-03-05 00:46:18 -08:00
Yabin Cui
d9647594de Fix fortify compilation test in x86_64.
Change-Id: Ic243f6583e4f435899d01c7845dddacacbfc916e
2015-03-05 00:39:09 -08:00
Yabin Cui
94545eba37 Fix fortify compilation test on x86.
Change-Id: I9b88cbcec51b6f1dbac2780a9bf82851bd6cc87c
2015-03-04 22:35:13 -08:00
Yabin Cui
f3bd305b8f Fix fortify compilation test on mips.
Change-Id: Icff5b859ae58067bfa34430d3f5684335fe063b4
2015-03-04 21:43:14 -08:00
Yabin Cui
e1c0213be3 Merge "Switch pthread_rwlock_t to stdatomic." 2015-03-05 04:42:35 +00:00
Yabin Cui
08ee8d2030 Switch pthread_rwlock_t to stdatomic.
Bug: 19099838
Change-Id: Ie82967a60b5cec61a8bdd1e0e4a03738d01944f8
2015-03-04 18:16:20 -08:00
Yabin Cui
20f2268d61 Add fortify compile test.
Two parts of tests are added:
1. Compile time warnings for gcc checking built-in functions.
2. Compile time errors for each errordecl() in bionic.

Bug: 19234260
Change-Id: Iec6e4a8070c36815574fe9e0af9595d6143a4757
2015-03-04 13:10:38 -08:00
Christopher Ferris
cc9ca1051d Fix fread returning bad data.
Bug: 19172514
Change-Id: I05016577858a02aca7d14e75e6ec28abc925037c
2015-02-27 18:22:45 -08:00
Yabin Cui
f6237470a3 Make bionic gtest main be compatible with gtest output format for cts test.
Bug: 17589740
Change-Id: Ifab521da379a33bf0a7bf11c21386f936f0d494c
2015-02-26 19:03:54 -08:00
Yabin Cui
ea9c933f36 Make all output of child test go to parent process in gtest_main.
Change-Id: Iad460e89755051cdb99593cbf42c97d9a359f32b
2015-02-24 14:44:51 -08:00
Nick Kralevich
35778253a5 Fix "faccessat ignores flags"
The kernel system call faccessat() does not have any flags arguments,
so passing flags to the kernel is currently ignored.

Fix the kernel system call so that no flags argument is passed in.

Ensure that we don't support AT_SYMLINK_NOFOLLOW. This non-POSIX
(http://pubs.opengroup.org/onlinepubs/9699919799/functions/access.html)
flag is a glibc extension, and has non-intuitive, error prone behavior.

For example, consider the following code:

  symlink("foo.is.dangling", "foo");
  if (faccessat(AT_FDCWD, "foo", R_OK, AT_SYMLINK_NOFOLLOW) == 0) {
    int fd = openat(AT_FDCWD, "foo", O_RDONLY | O_NOFOLLOW);
  }

The faccessat() call in glibc will return true, but an attempt to
open the dangling symlink will end up failing. GLIBC documents this
as returning the access mode of the symlink itself, which will
always return true for any symlink on Linux.

Some further discussions of this are at:

  * http://lists.landley.net/pipermail/toybox-landley.net/2014-September/003617.html
  * http://permalink.gmane.org/gmane.linux.lib.musl.general/6952

AT_SYMLINK_NOFOLLOW seems broken by design. I suspect this is why this
function was never added to POSIX. (note that "access" is pretty much
broken by design too, since it introduces a race condition between
check and action). We shouldn't support this until it's clearly
documented by POSIX or we can have it produce intuitive results.

Don't support AT_EACCESS for now. Implementing it is complicated, and
pretty much useless on Android, since we don't have setuid binaries.
See http://git.musl-libc.org/cgit/musl/commit/?id=0a05eace163cee9b08571d2ff9d90f5e82d9c228
for how an implementation might look.

Bug: 18867827
Change-Id: I25b86c5020f3152ffa3ac3047f6c4152908d0e04
2015-02-24 13:40:43 -08:00
Elliott Hughes
be52e65817 Fix dup2 in the case where the two fds are equal.
dup3's behavior differs from dup2 in this case, so we need to paper
over that in the C library.

Change-Id: I313cd6f226db5e237f61866f324c5ecdd12bf762
2015-02-23 21:52:56 -08:00
Elliott Hughes
3cfb52aab2 Add GNU extensions mempcpy and wmemcpy.
Used by elfutils. On the bright side, they stopped using __mempcpy.

Bug: 18374026
Change-Id: Id29bbe6ef1c5ed5a171bb6c32182f129d8332abb
2015-02-18 22:02:56 -08:00
Christopher Ferris
3da136aa47 Modify test to avoid race condition.
There is a possible race if a timer is set to trigger at nearly the same
time as it is set. Since nobody uses the timers like this, modify the test
so this doesn't happen. The race that this can provoke has been fixed in
aosp.

Bug: 19423618
Change-Id: I21084c99da5ae46f404936d673dae6bad7c82caa
2015-02-18 17:45:50 -08:00
Christopher Ferris
54b61b7ca7 Merge "Accuracy tests for libm" 2015-02-17 21:41:41 +00:00
Elliott Hughes
fb48c68221 Merge "Fix memchr overflow." 2015-02-17 17:54:40 +00:00
Elliott Hughes
e1f9ddaf0d Regression test for NDK bug 80199.
Bionic never had this bug, but since the proposed fix is to remove the NDK's
broken code, we should add a regression test here.

Bug: https://code.google.com/p/android/issues/detail?id=80199
Change-Id: I4de21b5da9913cef990bc4d05a7e27562a71a02b
2015-02-14 14:11:50 -08:00
Elliott Hughes
41ef902379 Fix memchr overflow.
The overflow's actually in the generic C implementation of memchr.

While I'm here, let's switch our generic memrchr to the OpenBSD version too.

Bug: https://code.google.com/p/android/issues/detail?id=147048
Change-Id: I296ae06a1ee196d2c77c95a22f11ee4d658962da
2015-02-14 13:21:22 -08:00
Jingwei Zhang
56b2b2916b Accuracy tests for libm
This patch adds more tests for math functions to address coverage
issue of math functions discussed in:
https://android-review.googlesource.com/#/c/49653/
https://android-review.googlesource.com/#/c/94780/

These are data sets used in regression tests for the Intel the math library (libm). They were collected over a long period of testing various libm implementations.
The data sets contain function specific data (special and corner cases such as +/-0, maximum/minimum normalized numbers, +/-infinity, QNaN/SNaN, maximum/minimum denormal numbers, arguments that would produce close to overflow/underflow results, known hard-to-round cases, etc), implementation specific data (arguments close to table look-up values for different polynomial approximations, worst cases for range reduction algorithms) and other data with interesting bit patterns.
The reference values are computed with Maple and were converted into hexadecimal format.

Change-Id: I7177c282937369eae98f25d02134e4fc3beadde8
Signed-off-by: Jingwei Zhang <jingwei.zhang@intel.com>
Signed-off-by: Mingwei Shi <mingwei.shi@intel.com>
2015-02-14 00:56:46 +08:00
Elliott Hughes
7f925097e8 Fix our ftw tests.
SELinux denies access to some files in /sys, so we can't just trawl
through that asserting general truths. Instead, create a small known
tree.

Sadly neither ftw nor nftw takes user callback data, otherwise it would
be nice to assert that we visit all the expected nodes.

Bug: 19252748
Change-Id: Ib5309c38aaef53e6030281191a265a8d5a619044
2015-02-10 14:15:33 -08:00
Christopher Ferris
05d26211d8 Display errors instead of running infinitely.
When there is an error detected, the code runs forever and then times
out without any indication of what happened. Change it so that error
messages are printed and the test fails.

Change-Id: Id3160fc2f394984de0157356594fd8b40de66b4a
2015-02-06 18:05:58 -08:00
Yabin Cui
ead08148bd Add path separator in bionic-unit-tests program path.
Bug: 19220800
Change-Id: I4245b1270363544cd5f083fe7ea7d9b11b46cdc0
2015-02-05 10:39:37 -08:00
Yabin Cui
63826658f4 Merge "Add signal handling in bionic gtest main." 2015-02-05 04:21:03 +00:00
Yabin Cui
1d4c780a2e Add signal handling in bionic gtest main.
The two bugs are very closely related and code amount is very small,
So I think they may be fixed in one change.

Bug: 19128558
Bug: 19129994
Change-Id: I44a35398e64dfca7e9676428cb8f4026e8f6e488
2015-02-04 19:06:07 -08:00
Yabin Cui
17976019a1 Merge "Fix poll/ppoll fortify test to avoid hanging in failed fortify clang test." 2015-02-05 01:14:32 +00:00
Yabin Cui
f4fe6937aa Fix poll/ppoll fortify test to avoid hanging in failed fortify clang test.
Bug: 19220800
Change-Id: Ie75c640183c4a41a499556fefb4f824a134a5fb1
2015-02-04 12:27:06 -08:00
Yabin Cui
11829be3e1 Merge "Add test about pthread_mutex_t owner tid limit." 2015-02-03 22:28:56 +00:00
Yabin Cui
140f3678f0 Add test about pthread_mutex_t owner tid limit.
Bug: 19216648
Change-Id: I7b12955bdcad31c13bf8ec2740ff88ba15223ec0
2015-02-03 12:20:46 -08:00
Nick Kralevich
d80ec66121 Merge "Add fchmodat(AT_SYMLINK_NOFOLLOW) and fchmod O_PATH support" 2015-02-02 22:03:41 +00:00
Nick Kralevich
3cbc6c627f Add fchmodat(AT_SYMLINK_NOFOLLOW) and fchmod O_PATH support
Many libc functions have an option to not follow symbolic
links. This is useful to avoid security sensitive code
from inadvertantly following attacker supplied symlinks
and taking inappropriate action on files it shouldn't.
For example, open() has O_NOFOLLOW, chown() has
lchown(), stat() has lstat(), etc.

There is no such equivalent function for chmod(), such as lchmod().
To address this, POSIX introduced fchmodat(AT_SYMLINK_NOFOLLOW),
which is intended to provide a way to perform a chmod operation
which doesn't follow symlinks.

Currently, the Linux kernel doesn't implement AT_SYMLINK_NOFOLLOW.
In GLIBC, attempting to use the AT_SYMLINK_NOFOLLOW flag causes
fchmodat to return ENOTSUP. Details are in "man fchmodat".

Bionic currently differs from GLIBC in that AT_SYMLINK_NOFOLLOW
is silently ignored and treated as if the flag wasn't present.

This patch provides a userspace implementation of
AT_SYMLINK_NOFOLLOW for bionic. Using open(O_PATH | O_NOFOLLOW),
we can provide a way to atomically change the permissions on
files without worrying about race conditions.

As part of this change, we add support for fchmod on O_PATH
file descriptors, because it's relatively straight forward
and could be useful in the future.

The basic idea behind this implementation comes from
https://sourceware.org/bugzilla/show_bug.cgi?id=14578 , specifically
comment #10.

Change-Id: I1eba0cdb2c509d9193ceecf28f13118188a3cfa7
2015-02-02 13:17:17 -08:00
Elliott Hughes
d036e94bb3 Explicitly check that the reason fortify tests abort is fortify.
Change-Id: I95291e2febf7b497c1d9f37fd7fa9acdd21e86a4
2015-02-02 11:18:58 -08:00
Elliott Hughes
4674e3899a Fortify poll and ppoll.
And remove the test for FD_ZERO fortification, which never made much
sense anyway.

Change-Id: Id1009c5298d461fa4722189e8ecaf22f0c529536
2015-02-02 09:15:19 -08:00
Elliott Hughes
b6e3e800d2 Add the fortify tests back into the glibc tests.
Change-Id: I4426d0c7c1bfe3b0028a674f72d1c3b9d883d6af
2015-01-31 21:32:10 -08:00
Yabin Cui
11c4353cdd Add --gtest-filter as synonym for --gtest_filter in bionic gtest main.
Bug: 19130480
Change-Id: I0d3df70ee8f692581cc4b9b742c5f347259fd0d2
2015-01-28 14:28:14 -08:00
Yabin Cui
385c07a74c Merge "Fix parse of gtest_filter in bionic gtest main." 2015-01-27 22:00:35 +00:00
Yabin Cui
0bc4e9697e Fix parse of gtest_filter in bionic gtest main.
Bug: 19130330
Change-Id: Id6a60570a8aab6ae7259ff228b3801285b378f77
2015-01-27 11:22:46 -08:00
Elliott Hughes
acc06a0b74 Merge "Add a test for float registers across setjmp/logjmp." 2015-01-27 19:08:33 +00:00
Yabin Cui
4a82ede754 Rename "TIMEWARN" to "SLOW" in bionic gtest.
Bug: 19109188.
Change-Id: Idfe769ac652bf37642da24e4abb6061ca861d57e
2015-01-26 20:56:20 -08:00
Elliott Hughes
87dd503018 Add a test for float registers across setjmp/logjmp.
Change-Id: I17cc056b185755e0b91de096b5ceefee4f4e0b3a
2015-01-26 20:52:34 -08:00
Yabin Cui
0e6af17a35 Merge "Support --gtest_ouput option in bionic gtest main." 2015-01-27 01:01:05 +00:00
Yabin Cui
657b1f9bef Support --gtest_ouput option in bionic gtest main.
Bug: 19109500
Change-Id: Ib18f90ad522e66ea62dd4e02e314585d9b36e15f
2015-01-26 16:53:05 -08:00
Elliott Hughes
247cfe0382 Merge "Add <error.h>." 2015-01-26 20:38:46 +00:00
Elliott Hughes
b8a8cf0d1a Add <error.h>.
Bug: https://code.google.com/p/android/issues/detail?id=79170
Change-Id: Id91765fac45124545e2674a5b2c814707c1a448b
2015-01-26 11:57:11 -08:00
Elliott Hughes
14152b9f31 Remove obsolete BUILD_TINY_ANDROID.
Change-Id: If2fc97134340fd09ec2583b666ace2f673cbdf66
2015-01-24 19:01:58 -08:00
Elliott Hughes
e6bb5a2776 Fix optimized fread.
gcov does writes after reads on the same stream, but the bulk read optimization
was clobbering the FILE _flags, causing fwrite to fail.

Bug: 19129055
Change-Id: I9650cb7de4bb173a706b502406266ed0d2b654d7
2015-01-24 12:35:41 -08:00
Dmitriy Ivanov
31005ca4c8 Merge "Minimize calls to mprotect" 2015-01-24 00:45:25 +00:00
Dmitriy Ivanov
279a22f96e Minimize calls to mprotect
Implement refcounter based data protection guard
  to avoid unnecessary calls to mprotect when dlopen/dlclose
  is called from a constructor.

Bug: 19124318
Big: 7941716
Change-Id: Id221b84ce75443094f99756dc9950b0a1dc87222
2015-01-23 16:30:34 -08:00
Dan Albert
4ce907d2ce Allow make to set a timeout for the host tests.
Change-Id: Icc2ebf64bd1da1687bf313fe7a5640155c5795d8
2015-01-23 11:35:48 -08:00
Elliott Hughes
62284dd2cc There's no such thing as LOCAL_CXXFLAGS.
Change-Id: Iad70e6bd4cb7cec9e0ece500a540e4dadc83d92e
2015-01-22 15:36:24 -08:00
Elliott Hughes
0ed7e08cda Fix the stdio.fread_EOF test.
Another sizeof/strlen screwup caused by trying to be too clever. Use
std::string instead.

Also fix all the ASSERT_STREQ calls in this file that had the arguments
the right^Wwrong way round. If I ever see Kent Beck...

Change-Id: I47a1bdfee99cf4e7bed9b398f3158a308fbcf1e8
2015-01-22 15:28:48 -08:00
Elliott Hughes
bcb378d643 Fix fread_EOF test name.
Change-Id: I53a7f1428fd27c0b2a5c80f2e8af4845d17f5b4b
2015-01-22 14:18:35 -08:00
Elliott Hughes
8c4994bbc1 Implement __fsetlocking.
The old __isthreaded hack was never very useful on Android because all user
code runs in a VM where there are lots of threads running. But __fsetlocking
lets a caller say "I'll worry about the locking for this FILE*", which is
useful for the normal case where you don't share a FILE* between threads
so you don't need any locking.

Bug: 17154740
Bug: 18593728
Change-Id: I2a8dddc29d3edff39a3d7d793387f2253608a68d
2015-01-21 10:33:30 -08:00
Elliott Hughes
c053a42831 Merge "Optimized fread." 2015-01-21 00:11:31 +00:00
Elliott Hughes
75b99387dd Optimized fread.
This makes us competitive with glibc for fully-buffered and unbuffered reads,
except in single-threaded situations where glibc avoids locking, but since
we're never really single-threaded anyway, that isn't a priority.

Bug: 18593728
Change-Id: Ib776bfba422ccf46209581fc0dc54f3567645b8f
2015-01-20 15:59:17 -08:00
Yabin Cui
516eb53113 Remove testcase time printing in bionic-unit-tests.
Bug: 19075565
Change-Id: Icccb60657a2985e96abb1703673f0ebe2199586a
2015-01-20 14:46:03 -08:00
Yabin Cui
6104eb9fa7 Add target libbionic_gtest_main for cts test.
Bug: 17589740
Change-Id: I37f2d3fe72870b9dc867407fa1619c9a6fcd5cbb
2015-01-20 14:32:07 -08:00
Elliott Hughes
1d7b3f3ccc Merge "Improve <stdio_ext.h> testing." 2015-01-20 18:07:37 +00:00
Elliott Hughes
df8f1a42d1 Improve <stdio_ext.h> testing.
I almost fixed a non-bug. Add a test to prevent me from doing that.

Change-Id: I4a1dc13e603a7a377bdaee2e78132015087f7107
2015-01-16 16:40:55 -08:00
Yabin Cui
cfe7e75fc1 Merge "Make sys_resource test more robust." 2015-01-16 21:52:11 +00:00
Yabin Cui
4853f40f3f Make sys_resource test more robust.
"ulimit -c xxx" command may run before bionic-unit-tests.
Make sure sys_resource test fails gently in that case.

Change-Id: Ic3b5ed8b20acba56df8c5ef082c88e5050e761aa
2015-01-16 13:28:43 -08:00
Yabin Cui
19e246dda6 Fix possible leak in pthread_detach.
If pthread_detach() is called while the thread is in pthread_exit(),
it takes the risk that no one can free the pthread_internal_t.
So I add PTHREAD_ATTR_FLAG_ZOMBIE to detect this, maybe very rare, but
both glibc and netbsd libpthread have similar function.

Change-Id: Iaa15f651903b8ca07aaa7bd4de46ff14a2f93835
2015-01-15 10:45:25 -08:00
Yabin Cui
deab11acd7 Merge "Make bionic-unit-tests default run isolate mode." 2015-01-15 18:10:30 +00:00
Yabin Cui
a35cd8cdc2 Test that ip6-localhost exists in etc/hosts.
Addition change: make netdb_test pass on host.

Bug: 18791191
Change-Id: I7a9e29aa559ff6557288b47323d8a436379201a2
2015-01-13 17:30:51 -08:00
Yabin Cui
be837360c3 Make bionic-unit-tests default run isolate mode.
Fix bug of handling signal terminated tests.

Bug: 17589740
Bug: 18951146
Change-Id: I4803382b26cd5454693090202b3ba38e3dbe66e5
2015-01-08 20:34:58 -08:00
Elliott Hughes
c62a4b5a7a Fix freeaddrinfo(NULL).
Bug: https://code.google.com/p/android/issues/detail?id=13228
Change-Id: I5e3b126d90d750a93ac0b8872198e50ba047e603
2015-01-08 17:28:46 -08:00
Yabin Cui
917d390510 Make pthread stack size match real range.
Bug: 18908062
Change-Id: I7037ac8273ebe54dd19b1561c7a376819049124c
2015-01-08 14:27:24 -08:00
Dmitriy Ivanov
bfa15e464e Set linux 32bit personality for 32 bit processes
Bug: 18069809
Change-Id: Ie143d56b0f8f03510dc451649291067e1add1d2f
2015-01-07 16:32:05 -08:00
Yabin Cui
597800f1d7 Merge "better gtest runner for bionic" 2015-01-02 22:38:41 +00:00
Yabin Cui
541b0b187d Merge "Reserve enough user request stack space in pthread_create." 2015-01-02 22:37:56 +00:00
Yabin Cui
6a7aaf4675 Reserve enough user request stack space in pthread_create.
Bug: 18830897
Change-Id: I1ba4aaeaf66a7ff99c5d82ad45469011171b0a3b
2015-01-02 14:33:48 -08:00
Elliott Hughes
ba09edcb41 Merge "Fix nan output in the printf family." 2014-12-21 02:54:06 +00:00
Elliott Hughes
1b18aff9ba Fix nan output in the printf family.
Bug: https://code.google.com/p/android/issues/detail?id=82452
Change-Id: I51f226c8b033de6e81baeea5e6db3de6ed196f73
2014-12-20 18:53:08 -08:00
Yabin Cui
370a3e573d Merge "Sync with upstream for gethnamaddr.c." 2014-12-18 01:06:10 +00:00
Yabin Cui
58d33a51f3 Sync with upstream for gethnamaddr.c.
Bug: 18566967
Change-Id: I37e7410226b49eec67614e20b2c1d5e3e47817a5
2014-12-17 16:19:27 -08:00
Dmitriy Ivanov
92b9cb2c89 Merge "Add another test for weak-reference" 2014-12-16 22:01:47 +00:00
Dmitriy Ivanov
bfa88bca5c Add another test for weak-reference
This one covers undefined weak reference in .so
  referenced via JUMP_SLOT relocation.

Bug: 17526061
Change-Id: Ib8764bd30c1f686c4818ebbc6683cf42dee908b2
2014-12-16 19:46:45 +00:00
Yabin Cui
294d1e2c9e better gtest runner for bionic
1. option to run each test in a separate forked process: "--isolate".
2. warnings about slow tests: "--warnline".
3. run multiple tests at the same time: "-j N".

Bug: 17589740
Change-Id: Ife5f4cafec43aa051ad7bd9c9b2b7e2e437db0de
2014-12-13 18:53:34 -08:00
Yabin Cui
6c238f2926 Fix pthread key num calculation.
Bug: 18723085
Change-Id: Iba2c834b350e4cdba0b2d771b221560a3e5df952
2014-12-12 17:00:08 -08:00
Yabin Cui
562ae1e6e4 make stack_protector_DeathTest work for gcc4.9
Bug: 18721888
Change-Id: I5f0b5c84319f56dbc4efb88e9d828138944667ae
2014-12-11 17:24:55 -08:00
Elliott Hughes
1510a1c1ae Fix the setjmp tests for mips.
Although the LP32 mips sigset_t is large enough to represent all signals,
their jmp_buf is too small. This test succeeded on arm and x86 because the
RT signals were never in the 'expected' sigset_t, so the equality comparison
with the 'actual' sigset_t worked fine --- everyone was blind to the RT
signal. On mips the tests fail because the 'expected' sigset_t does contain
the RT signal but the 'actual' doesn't because the jmp_buf only saves and
restores the first 32 signals.

There are 32 free bits (currently used as padding) in the LP32 mips jmp_buf,
and they might choose to use those to provide better support than the other
two platforms, but I'll leave that to them. It will be easy to just remove
the #if defined(__LP64__) from this change in that case.

For mips64 it's not to late to increase the size of the jmp_buf and fix
the setjmp family, but since there are decisions to be made here for LP32,
I'll leave it all to Imagination folks...

Bug: 16918359
Change-Id: I6b723712fce0e9210dafa165d8599d950b2d3500
2014-12-10 11:48:19 -08:00
Yabin Cui
94926f8cfa Merge "support _POSIX_REALTIME_SIGNALS" 2014-12-09 20:10:19 +00:00
Yabin Cui
b033761cbf Merge "Change _POSIX_CPUTIME macro to make it compitable with glibc." 2014-12-09 17:51:37 +00:00
Yabin Cui
725756045e Change _POSIX_CPUTIME macro to make it compitable with glibc.
Change-Id: I7a8dbb74bd622693c9fef60bd779687207517b7d
2014-12-09 09:16:11 -08:00
Yabin Cui
634816055f support _POSIX_REALTIME_SIGNALS
Bug: 18489947
Change-Id: I2e834d68bc10ca5fc7ebde047b517a3074179475
2014-12-08 21:52:43 -08:00
Elliott Hughes
1c0c0ede57 Fix signal mask save/restore for x86-64.
Bug: 16918359
Change-Id: I30bf61e7d5f1c21daa3a1a21d361e98d77220bf3
2014-12-08 12:46:15 -08:00
Yabin Cui
5afae64a1b implement posix_madvise
Bug: 18472477
Change-Id: I8183de6c281acf69ed5f7f88351b056b9827b162
2014-12-04 11:01:28 -08:00
Elliott Hughes
65f0df7873 Implement <pty.h>.
Based on the package/apps/Terminal implementation. I'll switch them over
shortly. This also lets us build the toybox version of netcat.

Change-Id: Ia922a100141a67409264b43b937eeca07b21f344
2014-12-03 15:55:34 -08:00
Dmitriy Ivanov
6995c1dcb5 Merge "Extract bionic-prepare-run-on-host to inc file." 2014-12-03 00:02:13 +00:00
Dmitriy Ivanov
06b1b8ceac Extract bionic-prepare-run-on-host to inc file.
Make benchmark run-on-host depend on bionic-prepare-run-on-host.

Change-Id: I0bdbf561b2580d607a49b7c83cc273320ac55429
2014-12-02 15:15:34 -08:00
Elliott Hughes
27d276f3a6 Avoid pathological behavior in OpenBSD's fread.
(cherry picked from commit 20841a137b)

Bug: https://code.google.com/p/android/issues/detail?id=81155
Bug: 18556607
Change-Id: Ibdfebc20dce4c34ad565014523c9b074e90ea665
2014-12-02 14:54:52 -08:00
Elliott Hughes
20841a137b Avoid pathological behavior in OpenBSD's fread.
Bug: https://code.google.com/p/android/issues/detail?id=81155
Bug: 18556607
Change-Id: Idc60976b79610e2202cc42dc393dcb4ca6c42e05
2014-12-02 14:22:02 -08:00
Dmitriy Ivanov
a55126f1f6 Create /system/lib(64)? symlinks for host tests.
Replace LD_LIBRARY_PATH with default path for
  the tests run on host.

Bug: 18589961

Change-Id: Id4a84b73d25c2ca9c557fcfa19b8169daeaa016b
2014-12-02 12:11:08 -08:00
Dmitriy Ivanov
291dbf65ca Merge "Count references for groups instead of instances" 2014-12-02 19:10:04 +00:00
Dmitriy Ivanov
ab972b9adf Count references for groups instead of instances
Count references on the group level to avoid
  partially unloading function that might be
  referenced by other libraries in the local_group

  Bonus: with this change we can correctly unload recursively
  linked libraries. is_recursive check is removed.

  Also dynamic executables (not .so) with 0 DT_NEEDED libraries
  are now correctly linked.

Change-Id: Idfa83baef402840599b93a875f2881d9f020dbcd
2014-12-02 10:54:26 -08:00
Yabin Cui
e323e99ffb restore sigprocmask in setjmp/longjmp test.
Bug: 18571921
Change-Id: Ib8ca7a36abd3ccc729c20c0e32d45b1b33069f65
2014-12-02 10:35:25 -08:00
Yabin Cui
3e6ef3f902 Merge "support _POSIX_CPUTIME" 2014-12-01 17:06:02 +00:00
Yongqin Liu
9fea4090f1 bionic tests: add setjmp/_setjmp/sigsetjmp tests.
Bug: 17288973
Change-Id: I2808eee58cbddae1b16fbe19a715b72d6dbaaec3
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2014-11-26 17:31:24 -08:00
Yabin Cui
d5c652756b support _POSIX_CPUTIME
Bug: 18490039
Change-Id: I01fa83b48e1b908de1f227b6e4f98e280bcd50ee
2014-11-26 17:14:50 -08:00
Yabin Cui
eb3a5e026e Merge "flesh out sysconf(3) and the _POSIX_* constants" 2014-11-24 01:59:23 +00:00
Yabin Cui
1c19194c9d flesh out sysconf(3) and the _POSIX_* constants
Bug: 17571891
Change-Id: I81036615486bde65969ae5662587fcc88348474e
2014-11-21 19:10:52 -08:00
Dmitriy Ivanov
0864d8bc47 Rename test_forked -> test_isolated
Change-Id: Ie72627e986c159832cbd3635d8ff5b1af3d5b1eb
2014-11-20 22:53:59 -08:00
Dmitriy Ivanov
8b4b827338 Merge "Add test_forked() option" 2014-11-21 01:21:16 +00:00
Dmitriy Ivanov
00e37818a7 Add test_forked() option
Executing test via test_forked() allows us to
 avoid undesired global state changes in tests like
 atexit, dlopen(.., RTLD_NODELETE) and similar.

Change-Id: I118cdf009269ab5dd7b117c9b61dafa47de2a011
2014-11-20 17:11:06 -08:00
Elliott Hughes
770198d3f7 Merge "Make the ftw(3) tests a bit more thorough." 2014-11-20 00:09:32 +00:00
Elliott Hughes
63bd43bbdc Make the ftw(3) tests a bit more thorough.
These also test much of fts(3).

Change-Id: Ia9245d6acbbd071191563ab1b91a400044104028
2014-11-19 15:47:53 -08:00
Dmitriy Ivanov
6b48b20a1e Merge "Yet another relocation test" 2014-11-19 19:35:59 +00:00
Dmitriy Ivanov
7699d13a74 Yet another relocation test
This time we check if a -> b -> c function in 'a' relocates against
 implementation in 'c'.

Change-Id: I528180c3efd346bd447ea0237e5a8a0ac3cc031f
2014-11-19 10:39:05 -08:00
Yabin Cui
649f78df79 Merge "fix shared gid support in getpwnam/getgrnam" 2014-11-19 04:25:24 +00:00
Yabin Cui
a04c79b9d3 fix shared gid support in getpwnam/getgrnam
Bug: 18374693
Change-Id: I5353403cbbead6f6abac87bee2cf53a60dba408c
2014-11-18 19:58:04 -08:00
Dmitriy Ivanov
a2547055f2 Fix jump to unmapped memory on atexit
Split d-tor calls and soinfo_free to 2 separate steps

Bug: 18338888
Change-Id: Idbcb7242ade16fa18cba7fe30505ebd8d6023622
2014-11-18 13:16:27 -08:00
Elliott Hughes
8eda0a6d69 Merge "libc: Fix mktime returns an uncorrect time in empty TZ case" 2014-11-17 23:14:58 +00:00
Dmitriy Ivanov
ee4c8febb7 Merge "bionic/test: migrate sysconf tests from system/extras to bionic/tests" 2014-11-17 18:43:32 +00:00
Elliott Hughes
f2c882095b Merge "Add getaddrinfo(3) tests for NULL arguments." 2014-11-17 18:26:46 +00:00
Elliott Hughes
32fea147ea Add getaddrinfo(3) tests for NULL arguments.
According to https://github.com/ukanth/afwall/pull/213 some OEMs have
shipped a getaddrinfo(3) that crashes given NULL hostnames.

Change-Id: I9cea5fdd68546b7c64cf47e10e2b2b4d672b69d0
2014-11-16 12:14:04 -08:00
Dan Albert
eef1eb64bb Merge "Allow asan for glibc tests." 2014-11-15 06:47:08 +00:00
Dan Albert
01f1ff2440 Allow asan for glibc tests.
SANITIZE_HOST will break if we don't allow ASAN.

Change-Id: I0beed82b058db391f633e0ea1098f140497c65d4
2014-11-14 20:00:06 -08:00
Satoru Takeuchi
154e2026c8 libc: Fix mktime returns an uncorrect time in empty TZ case
The mktime API returned an uncorrect time when TZ is set as empty.
A timezone UTC/GMT+0 should be implied in the empty case. However
mktime keeps previous information about timezone. If mktime was called
with a timezone which has DST before, the "defaulttype" member of
"state" structure wouldn't be 0. Then it would be used next time,
even though UTC/GMT+0 doesn't have DST.

Added initialization of the "defaulttype" in the empty TZ case.

Change-Id: Ic480c63c548c05444134e0aefb30a7b380e3f40b
2014-11-14 18:13:07 -08:00
Derek Xue
bc6447673f bionic/test: migrate sysconf tests from system/extras to bionic/tests
The old test are implemented in file:
  system/extras/tests/bionic/libc/other/test_sysconf.c
This change is to migrate them to bionic/tests with the gtest format.

and since the sysconf is defined in unistd.h, will put the test under
bionic/tests/unistd_test.cpp file as unistd.syscon test

Change-Id: Ie519147c1c86a6c4cefa8c88b18bf58bdfbffbdb
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2014-11-15 09:48:36 +08:00
Yabin Cui
9d93986481 Add functions in sysinfo.h.
Bug: 17703902

Change-Id: I699d12d76a8fc483c919be730c2ac63641b71a1d
2014-11-14 16:22:48 -08:00
Yabin Cui
661423a453 Merge "Increase support of pathconf options." 2014-11-14 23:45:45 +00:00
Yabin Cui
b5e581abfe Increase support of pathconf options.
Bug: 18206366
Change-Id: Ie770e49f5af3631eb9fbd2cd5174edf004c81e00
2014-11-14 23:45:24 +00:00
Dmitriy Ivanov
9df4b13baf Fix host build for arm/arm64
Change-Id: Id92543e4080aede205b3e63099fa2baa36ba21f0
2014-11-14 12:17:06 -08:00
Dmitriy Ivanov
b3356773c6 Add test for --hash-style=sysv
With build system switched to gnu-hash we need
 a test for sysv-hashed library.

Change-Id: I34adc216fa79199aa46066cf13fcc1c1f2581f0e
2014-11-14 11:19:22 -08:00
Christopher Ferris
59b1dea882 Merge "Add missing function prototypes wcpcpy/wcpncpy." 2014-11-14 03:23:35 +00:00
Christopher Ferris
5c7d9584d9 Add missing function prototypes wcpcpy/wcpncpy.
Also add smoke tests for a few of the wchar functions.

Change-Id: Id1be522f55a6708564d444941f42097548f16497
2014-11-13 18:56:12 -08:00
Elliott Hughes
e3c4acf1e3 Fix our <mntent.h> implementation.
Used by toybox.

Change-Id: I36a5053423e5cc54ae02a68f4fe110d75134accd
2014-11-13 15:51:36 -08:00
Elliott Hughes
68d98d832b Assume glibc >= 2.15.
This catches one trivial difference between us and glibc --- the error
returned by pthread_setname_np for an invalid pthread_t.

Change-Id: If4c21e22107c6488333d11184f8005f8669096c2
2014-11-12 21:03:26 -08:00
Elliott Hughes
92a585c91a Merge "Fix glibc 2.15 build." 2014-11-13 03:37:47 +00:00
Elliott Hughes
fb50057138 Fix glibc 2.15 build.
glibc 2.15 has prlimit64, has an unsetenv that's declared nonnull,
and hasn't fixed the problems we were having trying to use the
POSIX strerror_r in C++ code.

Change-Id: I834356a385e5ae55500bd86781691b6c1c9c8300
2014-11-12 19:31:21 -08:00
Dmitriy Ivanov
ec18ce06f2 Add support for hash-style=gnu
Change-Id: I171434a587420895feac8a9b1ad2342087197568
2014-11-12 16:38:12 -08:00
Yabin Cui
e5cabca516 Merge "implement missing seekdir and telldir" 2014-11-12 20:36:26 +00:00
Elliott Hughes
bbdfa51883 Merge "gethostname.c: change to report ENAMETOOLONG error when buflen is less" 2014-11-12 20:09:59 +00:00
Elliott Hughes
83204d5708 Merge "bionic tests: migrate gethostname test to unistd_test.cpp from system/extras" 2014-11-12 20:08:57 +00:00
Yongqin Liu
2f954bab2d gethostname.c: change to report ENAMETOOLONG error when buflen is less
change to behaviour the same as glibc for the check about buflen

Change-Id: I98265a8fe441df6fed2527686f89b087364ca53d
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2014-11-12 12:07:33 -08:00
Derek Xue
d94e7f0f1d bionic tests: migrate gethostname test to unistd_test.cpp from system/extras
The old tests are implemented in file
    system/extras/tests/bionic/libc/common/test_gethostname.c
Here migrate the test to the tests/unistd_test.cpp file and
add some more checks

Change-Id: Iab1e3da873bb333d1ddefc03108d536933792db2
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2014-11-12 10:47:39 -08:00
Christopher Ferris
1468765f8a Add align/overread tests for strlcpy/strlcat.
Change-Id: I2801c7ee1847cd68ec95eba5bdffde5e52edf1e5
2014-11-10 13:58:17 -08:00
Elliott Hughes
b86a4c7f65 Add sethostname(2).
Not very useful, but helps building stuff like toybox out of the box.

Change-Id: I110e39030452bd093a84278e019c5752d293718d
2014-11-07 16:48:27 -08:00
Yabin Cui
5ca4a9e2da implement missing seekdir and telldir
Bug: 18266863
Change-Id: I189ee949d4f7ccee099f3341e349cd969d25480f
2014-11-07 10:20:32 -08:00
Elliott Hughes
b20c24456e Implement all the POSIX _l functions.
Strictly speaking, this only implements the _l variants of the functions
we actually have. We're still missing nl_langinfo_l, for example, but we
don't have nl_langinfo either.

Change-Id: Ie711c7b04e7b9100932a13f5a5d5b28847eb4c12
2014-11-06 15:52:22 -08:00
Elliott Hughes
274afe8f0e Add POSIX lcong48.
Change-Id: I821046816661d77275cb02c8c99d526bb41afb9c
2014-11-06 14:14:37 -08:00
Elliott Hughes
39ba30354a Merge "Fix our <complex.h> support." 2014-11-06 19:43:17 +00:00
Elliott Hughes
b8ee16f1dc Fix our <complex.h> support.
We build libm with -fvisibility=hidden, so we weren't exporting any
of the <complex.h> functions.

We also weren't building many of the functions anyway.

We were also missing the complex inverse trigonometric functions.

And because we didn't even have perfunctory "call each function once"
tests, we didn't notice that we weren't exporting any symbols, so this
patch adds at least that level of testing.

Change-Id: Ibcf2843f507126c51d134cc5fc8d67747e033a0d
2014-11-06 11:16:55 -08:00
Yabin Cui
9df70403d9 make all bionic death tests not dumpable
Bug: 18067305

Change-Id: Ia1ecacf47eddecc9bc58aaac779e0c218f463179
2014-11-06 11:09:03 -08:00
Yabin Cui
2311383180 Merge "check invalid file offset when loading library" 2014-11-05 19:56:01 +00:00
Elliott Hughes
c13a2044e3 Merge "Fix newlocale with a NULL locale name." 2014-11-05 02:20:55 +00:00
Elliott Hughes
7e0d0f8572 Fix newlocale with a NULL locale name.
Bug: https://code.google.com/p/android/issues/detail?id=78567
Change-Id: I272dabc12ab186b44a525c7e8ac1846e62334e85
2014-11-04 18:03:44 -08:00
Elliott Hughes
1b37ba2178 Improve math tests to allow a specific ulp bound.
At the moment our libm is only good enough for a 1 ulp bound on these tests,
but that's better than the 4 ulp bound you get from gtest by default.

I'm not really happy with the multiple structures and corresponding functions,
but at least they mean there's no duplication in the tests themselves, and it
should be easy enough for us to make further improvements in future.

Change-Id: I004e12970332e1d9531721361d6c34f908cfcecc
2014-11-04 18:00:02 -08:00
Yabin Cui
16f7f8d250 check invalid file offset when loading library
Bug: 18178121
Bug: 18078224

Change-Id: I5254433d54645db68e9b83d5095dc2bf9d8531bc
2014-11-04 14:37:15 -08:00
Dmitriy Ivanov
9d3382d97a Revert "Fix dlsym() to take into account RTLD_GLOBAL/LOCAL"
This reverts commit c85e82dde5.

Bug: 18222321
Bug: 18211780
Change-Id: I32f4048bd5ea85dc8a3dfccce8cf141b241ab692
2014-11-03 22:15:29 -08:00
Dmitriy Ivanov
69c5d108a5 Revert "Add RTLD_NODELETE flag support"
This reverts commit c87f65d2cd.

Bug: 18222321
Bug: 18211780
Change-Id: I00252e26a28a41ab9f1e2dd3b32f0f80d86297f1
2014-11-03 22:15:26 -08:00
Dmitriy Ivanov
00dce52553 Revert "Fix relocation to look for symbols in local group"
This reverts commit fd2747bb58.

Bug: 18222321
Bug: 18211780
Change-Id: I2d4ebab1e73b7277161af76b99f8249825b22d65
2014-11-03 22:15:20 -08:00
Dmitriy Ivanov
f947be2889 Revert "Fix symbol lookup order during relocation"
This reverts commit 976402cca1.

Bug: 18222321
Bug: 18211780
Change-Id: Iafdd3d843db7b1cf288be9a0232022816622c944
2014-11-03 22:15:08 -08:00
Dmitriy Ivanov
494bee796a Revert "Fix arm64 and arm builds."
This reverts commit 445111a1c9.

Bug: 18222321
Bug: 18211780
Change-Id: I4fa9e1b63ec9b528f8bfed73c2ec15046c43a2fe
2014-11-03 22:14:19 -08:00
Elliott Hughes
d18f4b2578 Ensure we initialize stdin/stdout/stderr's recursive mutexes.
(cherry-pick of 6a03abcfd23f31d1df06eb0059830e22621282bb.)

Bug: 18208568
Change-Id: I9da16ce0f9375bc363d1d02be706d73fd3b1e150
2014-11-03 13:46:41 -08:00
Dan Albert
695781b6f0 Merge "Make host tests depend on /system/etc/hosts." 2014-11-03 21:38:50 +00:00
Dan Albert
62b7279789 Make host tests depend on /system/etc/hosts.
Change-Id: I3e5ab1325d5e250a1d14b53f3a5a465d9f5de30c
2014-11-03 13:26:16 -08:00
Elliott Hughes
6a03abcfd2 Ensure we initialize stdin/stdout/stderr's recursive mutexes.
Bug: 18208568
Change-Id: I9da16ce0f9375bc363d1d02be706d73fd3b1e150
2014-11-03 12:32:17 -08:00
Dmitriy Ivanov
445111a1c9 Fix arm64 and arm builds.
Bug: 18186310

(cherry picked from commit 4e446b19d8)

Change-Id: Ibc77a9ade36dc6b9bf5a316b5ab9ae5f0a70e826
2014-10-31 19:29:04 -07:00
Dmitriy Ivanov
4e446b19d8 Fix arm64 and arm builds.
Change-Id: I2c8c41626768e792f27a2616f2cd5ae66606319d
2014-10-31 17:27:02 -07:00
Dmitriy Ivanov
976402cca1 Fix symbol lookup order during relocation
Relocate symbol against DF_1_GLOBAL shared libraries
  loaded before this shared library. This includes
  main executable, ld_preloads and other libraries
  that have DF_1_GLOBAL flag set.

Bug: 2643900
Bug: 15432753
Bug: 18186310

(cherry picked from commit d225a5e652)

Change-Id: I4e889cdf2dfbf8230b0790053d311ee6b0d0ee2d
2014-10-31 17:10:30 -07:00
Dmitriy Ivanov
fd2747bb58 Fix relocation to look for symbols in local group
The local group is a sequence of libraries in default (breadth-first)
  order. It allows RTLD_LOCALLY loaded library to correctly relocate
  symbols within its group (see test-cases).

  Local group lookup is performed after main executable and ld_preloads.

Bug: 2643900
Bug: 15432753
Bug: 18186310

(cherry picked from commit cfa97f172d)

Change-Id: I5fa8c673f929e4652c738912c7ae078d7ec286d2
2014-10-31 17:04:00 -07:00
Dmitriy Ivanov
4d0c1f673f Correct way to specify additional dependencies
Previous one was not covering all the targets

Bug: 17548097
Bug: 18186310

(cherry picked from commit 4a9e1937c5)

Change-Id: I2cd9e58893555d16cbfe291b2d1279621489d5ad
2014-10-31 17:04:00 -07:00