Commit graph

4883 commits

Author SHA1 Message Date
Colin Cross
f4250508d5 am 3225f498: Merge "bionic: add __system_property_foreach"
* commit '3225f4984837c4d9e6e9495d2154f2d9987cf457':
  bionic: add __system_property_foreach
2013-06-19 10:27:23 -07:00
Colin Cross
3225f49848 Merge "bionic: add __system_property_foreach" 2013-06-19 17:26:17 +00:00
Nick Kralevich
3cd4cac2ce Fix FORTIFY_SOURCE unittests.
The compiler is too damn smart.

Change-Id: Ibef3ef41ec99f8cd9c06f1dbca535819f9a08197
2013-06-19 10:25:44 -07:00
Sergey Melnikov
dc5d3426d8 stdint.h header is not fully compatible with C99(ISO9899:1999)
stdint.h provides macros with incorrect type:
  * UINT8_C
  * UINT16_C
  * UINT8_MAX
  * UINT16_MAX

Signed-off-by: Sergey Melnikov <sergey.melnikov@intel.com>
Change-Id: I2d130c782d4485bf6c9e9f068de0bdaa4ba7303f
2013-06-19 12:33:31 +04:00
Greg Hackmann
c6ff844d75 bionic: add __system_property_foreach
find_nth() will be inefficient on a trie.  Since find_nth() is only used
internally and only for enumerating properties, we can add a foreach()
function to do this directly.

Signed-off-by: Greg Hackmann <ghackmann@google.com>

(cherry picked from commit 577418403d)

Change-Id: Iaca97d1182ce2c28863ba85241cbb5cf6185eb2f
2013-06-18 19:24:29 -07:00
Elliott Hughes
13e23302c9 am c656d732: Merge "Always use v1 for MIPS TLS access."
* commit 'c656d732c7712b0f73d9c560ccf3cb5ae47d219d':
  Always use v1 for MIPS TLS access.
2013-06-18 13:57:57 -07:00
Elliott Hughes
c656d732c7 Merge "Always use v1 for MIPS TLS access." 2013-06-18 20:56:25 +00:00
Nick Kralevich
d98d35c538 am 0846109c: Merge "libc: Rename fortify error functions."
* commit '0846109c96d54a28e413893b0cd4b4acb3aa87fc':
  libc: Rename fortify error functions.
2013-06-18 13:27:18 -07:00
Nick Kralevich
3bf6279034 am dd0880fe: Merge "libc: add limited FORTIFY_SOURCE support for clang"
* commit 'dd0880fec3bb8c998680e78aff9e2ddc2bcf6d7a':
  libc: add limited FORTIFY_SOURCE support for clang
2013-06-18 13:27:17 -07:00
Elliott Hughes
45ef218bde am 6807af77: Merge "Make LD_PRELOAD failures just warnings."
* commit '6807af773f862750efb6860e00402580a5f463f3':
  Make LD_PRELOAD failures just warnings.
2013-06-18 13:27:16 -07:00
Elliott Hughes
a33dc57c7c Always use v1 for MIPS TLS access.
Change-Id: Ic2850b90185cfbc5b0eff804c8b74a1c553c0852
2013-06-18 13:26:22 -07:00
Nick Kralevich
0846109c96 Merge "libc: Rename fortify error functions." 2013-06-18 20:24:04 +00:00
Colin Cross
e421bd71c3 am 02002443: Merge "bionic: fix deleting property arrays in property benchmark"
* commit '02002443d4b17de78418d51fc303b4c976ad071a':
  bionic: fix deleting property arrays in property benchmark
2013-06-18 13:23:51 -07:00
Nick Kralevich
dd0880fec3 Merge "libc: add limited FORTIFY_SOURCE support for clang" 2013-06-18 20:23:49 +00:00
Elliott Hughes
6807af773f Merge "Make LD_PRELOAD failures just warnings." 2013-06-18 20:23:07 +00:00
Colin Cross
02002443d4 Merge "bionic: fix deleting property arrays in property benchmark" 2013-06-18 20:22:25 +00:00
Nick Kralevich
ba6c021a53 am e2fb05b4: Merge "libc: Introduce __errordecl()"
* commit 'e2fb05b45b9af7b9af8df0ea15bfec63d331d882':
  libc: Introduce __errordecl()
2013-06-18 13:17:35 -07:00
Nick Kralevich
e2fb05b45b Merge "libc: Introduce __errordecl()" 2013-06-18 20:15:33 +00:00
Elliott Hughes
7e5a8cc523 Make LD_PRELOAD failures just warnings.
This matches glibc and makes life easier for developers who want to
sometimes preload a library from init (which has no conditionals); they
can simply move/remove the library to disable.

Change-Id: I579b8633f958235af6e46bb53b378b9e363afb1f
2013-06-18 13:15:00 -07:00
Colin Cross
7d06813d93 bionic: fix deleting property arrays in property benchmark
Use delete[] to delete arrays allocated with new []

Change-Id: Icc2a6b23df09049c008f7f1f50ed93a277174308
2013-06-18 13:08:28 -07:00
Nick Kralevich
a641c18f0c libc: Rename fortify error functions.
__umask_error -> __umask_invalid_mode
__creat_error -> __creat_missing_mode
__too_many_args_error -> __creat_too_many_args

Change-Id: I4036f344a3a93628e70f2e948ad73cfed3a967ea
2013-06-18 13:07:18 -07:00
Colin Cross
1a38e06383 am 0005b354: Merge "bionic: change properties benchmarks to read a single property"
* commit '0005b3544be345e697592b4dc199ebaa37048559':
  bionic: change properties benchmarks to read a single property
2013-06-18 13:04:10 -07:00
Colin Cross
0005b3544b Merge "bionic: change properties benchmarks to read a single property" 2013-06-18 20:01:05 +00:00
Colin Cross
7d90cfa6b5 bionic: change properties benchmarks to read a single property
The properties benchmarks were reading n properties from a property
area with n properties in it, which was making it hard to compare
the time between runs of different sizes.  Change the benchmark
to read a random property per iteration so the numbers between
runs are comparable.

Change-Id: Ib1648ce0948d9038fce76d209608427376cfb8da
2013-06-18 12:55:52 -07:00
Nick Kralevich
16d1af167f libc: add limited FORTIFY_SOURCE support for clang
In 829c089f83, we disabled all
FORTIFY_SOURCE support when compiling under clang. At the time,
we didn't have proper test cases, and couldn't easily create targeted
clang tests.

This change re-enables FORTIFY_SOURCE support under clang for a
limited set of functions, where we have explicit unittests available.
The functions are:

* memcpy
* memmove
* strcpy
* strncpy
* strcat
* strncat
* memset
* strlen (with modifications)
* strchr (with modifications)
* strrchr (with modifications)

It may be possible, in the future, to enable other functions. However,
I need to write unittests first.

For strlen, strchr, and strrchr, clang unconditionally calls the
fortified version of the relevant function. If it doesn't know the
size of the buffer it's dealing with, it passes in ((size_t) -1),
which is the largest possible size_t.

I added two new clang specific unittest files, primarily copied
from fortify?_test.cpp.

I've also rebuild the entire system with these changes, and didn't
observe any obvious problems.

Change-Id: If12a15089bb0ffe93824b485290d05b14355fcaa
2013-06-18 12:14:20 -07:00
Nick Kralevich
b24c0637d0 libc: Introduce __errordecl()
Define __errordecl and replace __attribute__((__error__("foo")))
with __errordecl. Make sure __errordecl is a no-op on clang, as it
generates a compile time warning.

Change-Id: Ifa1a2d3afd6881de9d479fc2adac6737871a2949
2013-06-18 12:13:52 -07:00
Colin Cross
f6e6e5e727 am 977a3313: Merge changes Iac00ce10,I192d3825
* commit '977a33137d2be0093f474055f839cf665b82b588':
  bionic: add tests for properties
  bionic: move system property writing from init to bionic
2013-06-17 18:21:37 -07:00
Colin Cross
977a33137d Merge changes Iac00ce10,I192d3825
* changes:
  bionic: add tests for properties
  bionic: move system property writing from init to bionic
2013-06-18 01:11:58 +00:00
Colin Cross
b27e200ad6 bionic: add tests for properties
(cherry picked from commit 37d9f75dde)

Change-Id: Iac00ce10a4272032a1cbdbc4204277d6876e3365
2013-06-17 16:58:47 -07:00
Colin Cross
5cf32de7a0 bionic: move system property writing from init to bionic
Move the implementation of writing to the system property area
from init to bionic, next to the reader implementation.  This
will allow full property testing to be added to bionic tests.

Add new accessor and waiting functions to hide the implementation
from watchprops and various bionic users.

Also hide some of the implementation details of the property area
from init by moving them into _system_properties.h, and other details
from everybody by moving them into system_properties.h.

(cherry picked from commit dc1038b790)

Change-Id: I192d3825ee276c5047bc751039fe6cfe226a7cca
2013-06-17 16:58:43 -07:00
Elliott Hughes
d2dbf16358 am 5995bf88: Merge "don\'t hardcode register r0/v1 when reading the TLS"
* commit '5995bf880e2a7fac249382f0a929b7271c843122':
  don't hardcode register r0/v1 when reading the TLS
2013-06-17 14:53:12 -07:00
Elliott Hughes
5995bf880e Merge "don't hardcode register r0/v1 when reading the TLS" 2013-06-17 21:51:50 +00:00
Mathias Agopian
b6e340080a don't hardcode register r0/v1 when reading the TLS
this leads to much improved code when calling __get_tls()

Change-Id: I21d870fb33c33a921ca55c4e100772e0f7a8d1e4
2013-06-17 14:50:30 -07:00
Elliott Hughes
afd4e2999c am 657d0da7: Merge "Slight script cleanup; make gensyscalls work from any directory."
* commit '657d0da7513e01b0eb104c8a8a522c28fdbc807d':
  Slight script cleanup; make gensyscalls work from any directory.
2013-06-17 11:18:58 -07:00
Elliott Hughes
657d0da751 Merge "Slight script cleanup; make gensyscalls work from any directory." 2013-06-17 18:16:36 +00:00
Elliott Hughes
18bc975bfe Slight script cleanup; make gensyscalls work from any directory.
Also remove a ton of dead code.

Change-Id: I1315623695a004f643b155f121cbafe24b715b8a
2013-06-17 10:39:33 -07:00
Elliott Hughes
c1e4183c7a am 560e9f7e: Merge "Ensure that <stdint.h> defines SIZE_MAX and friends."
* commit '560e9f7e7a39e02aca96709043ca06f562f75d58':
  Ensure that <stdint.h> defines SIZE_MAX and friends.
2013-06-13 16:21:55 -07:00
Elliott Hughes
560e9f7e7a Merge "Ensure that <stdint.h> defines SIZE_MAX and friends." 2013-06-13 23:19:09 +00:00
Elliott Hughes
7c89506e3a Ensure that <stdint.h> defines SIZE_MAX and friends.
We were missing SIG_ATOMIC_MAX, SIG_ATOMIC_MIN, SIZE_MAX,
WCHAR_MAX, WCHAR_MIN, WINT_MAX, and WINT_MIN.

Change-Id: I2535f36bc220fbaea009b483599b7af811c4cb5c
2013-06-13 16:02:53 -07:00
Elliott Hughes
af975b076f am c843a3e7: Merge "Fix the qsort copyright notice (fixed upstream this afternoon)."
* commit 'c843a3e7b215bca5e896e1d56c2fa6332770ea83':
  Fix the qsort copyright notice (fixed upstream this afternoon).
2013-06-12 17:46:57 -07:00
Elliott Hughes
c843a3e7b2 Merge "Fix the qsort copyright notice (fixed upstream this afternoon)." 2013-06-13 00:44:05 +00:00
Elliott Hughes
4eeec44e29 Fix the qsort copyright notice (fixed upstream this afternoon).
Change-Id: I786feb42719bceaa7da91565e350c1333b0d301f
2013-06-12 17:42:43 -07:00
Elliott Hughes
ddbf561e5e am c843d766: Merge "Handles spurious wake-ups in pthread_join()"
* commit 'c843d7667ada205ecbaf773531067076ed4ad271':
  Handles spurious wake-ups in pthread_join()
2013-06-12 17:34:17 -07:00
Elliott Hughes
c843d7667a Merge "Handles spurious wake-ups in pthread_join()" 2013-06-13 00:31:50 +00:00
Elliott Hughes
7ae23868b4 am 92e841d0: Merge "Take upstream libm changes."
* commit '92e841d0aa8d118882a74e3c3fc4b6a6062dcc09':
  Take upstream libm changes.
2013-06-12 17:30:59 -07:00
msg555
0f020d18b1 Handles spurious wake-ups in pthread_join()
Removed 'join_count' from pthread_internal_t and switched to using the flag
PTHREAD_ATTR_FLAG_JOINED to indicate if a thread is being joined. Combined with
a switch to a while loop in pthread_join, this fixes spurious wake-ups but
prevents a thread from being joined multiple times. This is fine for
two reasons:

1) The pthread_join specification allows for undefined behavior when multiple
   threads try to join a single thread.

2) There is no thread safe way to allow multiple threads to join a single
   thread with the pthread interface.  The second thread calling pthread_join
   could be pre-empted until the thread is destroyed and its handle reused for
   a different thread.  Therefore multi-join is always an error.

Bug: https://code.google.com/p/android/issues/detail?id=52255
Change-Id: I8b6784d47620ffdcdbfb14524e7402e21d46c5f7
2013-06-12 17:30:58 -07:00
Elliott Hughes
92e841d0aa Merge "Take upstream libm changes." 2013-06-13 00:29:21 +00:00
Elliott Hughes
78419467a2 Take upstream libm changes.
Mostly workarounds for GCC and Clang bugs.

Change-Id: I4ef428a42d4ac6d622659053711a8cc416925727
2013-06-12 16:37:58 -07:00
Elliott Hughes
5065eef801 am 6a44d227: Merge "Take some fixed upstream copyright headers and regenerate NOTICE."
* commit '6a44d2271f372d0c65b05a5d3377bd00ce92824e':
  Take some fixed upstream copyright headers and regenerate NOTICE.
2013-06-12 16:16:09 -07:00
Elliott Hughes
6a44d2271f Merge "Take some fixed upstream copyright headers and regenerate NOTICE." 2013-06-12 23:13:34 +00:00