Compare commits

..

652 Commits

Author SHA1 Message Date
Elliott Hughes
195b85a80f Merge "Defend against -fstack-protector in libc startup." 2016-01-08 18:54:01 +00:00
Dimitry Ivanov
2afe5af77f Merge "Move __aeabi* symbols to LIBC_N version" 2016-01-08 18:50:13 +00:00
Dimitry Ivanov
6d142bcf34 Move __aeabi* symbols to LIBC_N version
We had these symbols incorrectly versioned as LIBC_PRIVATE
in M release. This change moves __aeabi* symbols from LIBC
to LIBC_N and adds __gnu_Unwind_Find_exidx to the list

Bug: https://github.com/android-ndk/ndk/issues/1
Change-Id: I0b353012adeacb00ae29ea10c63b9d1cf1cadbe7
2016-01-08 10:13:16 -08:00
Elliott Hughes
42d949ff9d Defend against -fstack-protector in libc startup.
Exactly which functions get a stack protector is up to the compiler, so
let's separate the code that sets up the environment stack protection
requires and explicitly build it with -fno-stack-protector.

Bug: http://b/26276517
Change-Id: I8719e23ead1f1e81715c32c1335da868f68369b5
2016-01-06 20:06:08 -08:00
Josh Gao
988e71b2b2 Merge "Kill BOARD_MALLOC_ALIGNMENT." 2016-01-06 22:49:30 +00:00
Josh Gao
63a42070fc Kill BOARD_MALLOC_ALIGNMENT.
Bug: http://b/26403338
Change-Id: Iba4006277fdb7c7ca60542c517634ae86c847b4f
2016-01-06 14:30:26 -08:00
Josh Gao
e1f8c66d0b Merge "Replace MALLOC_IMPL with MALLOC_SVELTE." 2016-01-06 20:08:13 +00:00
Elliott Hughes
32388ba4dc Merge "Temporary hack to avoid stack protector crashes." 2016-01-06 19:52:43 +00:00
Tom Cherry
9353089262 Merge "Revert "system_properties.cpp: special case ro.* properties"" 2016-01-06 19:16:31 +00:00
Tom Cherry
e97ce31fe7 Revert "system_properties.cpp: special case ro.* properties"
This reverts commit c5fd81ab2524a06be907d9c5234e79346bbbbd7c.

Bug: 26416032

Change-Id: Id2d6761fdf55efa28c0b08b597daaa5cd381d758
2016-01-06 19:13:54 +00:00
Elliott Hughes
2489161ce5 Temporary hack to avoid stack protector crashes.
It'll take me a while to refactor things cleanly, but if we just want
something that boots for testing...

Bug: http://b/26276517
Change-Id: I24729d3dc546e36e0eff383f0d1d05c3aa1f2e0b
2016-01-06 11:12:06 -08:00
Elliott Hughes
1464f6d8d9 Merge "Remove mktime_tz." 2016-01-06 19:02:19 +00:00
Dimitry Ivanov
4664c14fa4 Merge "Temporary move __udivdi3 back to LIBC for x86" 2016-01-06 18:37:19 +00:00
Dimitry Ivanov
bc02fb964a Temporary move __udivdi3 back to LIBC for x86
Bug: http://b/26289334
Bug: http://b/26413821
Change-Id: Ifb0eb6f16aca54cb4a9184a6394992ee57dd3408
2016-01-06 18:36:40 +00:00
Elliott Hughes
76dfa6e351 Remove mktime_tz.
Bug: http://b/15765976
Change-Id: Ifc8cd19ae621e611d66173ae927ef9a0445965c1
2016-01-06 09:15:02 -08:00
Dimitry Ivanov
74d7aa1c34 Merge "Fix gcc+arm builds" 2016-01-06 04:43:26 +00:00
Dimitry Ivanov
6f72fdede8 Fix gcc+arm builds
gcc requires unique names of symbols for .symver

Bug: http://b/26391427
Change-Id: I6392e34a45a37245fd4e53fb54243be73f443313
2016-01-05 20:41:06 -08:00
Dimitry Ivanov
52fd4ca0a0 Merge "Deprecate bzero" 2016-01-06 02:33:41 +00:00
Dimitry Ivanov
609156e266 Merge "Export public __aeabi* symbols as LIBC_PRIVATE" 2016-01-06 02:19:27 +00:00
Dimitry Ivanov
d90d067312 Export public __aeabi* symbols as LIBC_PRIVATE
But keep LIBC as default version for them

Bug: http://b/26391427
Bug: http://b/26410625
Change-Id: I819e354bbba482d1f983d9be15c23fcce10e5dd9
2016-01-05 18:18:33 -08:00
Elliott Hughes
031dfe198b Merge "Fix a broken link in a comment." 2016-01-06 01:27:09 +00:00
Elliott Hughes
7d27b68ef4 Merge "Tidy up KernelArgumentBlock::getauxval." 2016-01-06 01:24:37 +00:00
Dimitry Ivanov
6134ed8b8f Deprecate bzero
bzero is hashdefined to memset in strings.h and it
was removed from POSIX 2008.

Bug: http://b/26407170
Change-Id: Ia6d54f0e314dc7f5f3fbad0e9b00344f49f77d43
2016-01-05 17:06:45 -08:00
Nick Kralevich
ffa54cd7ba Merge "system_properties.cpp: special case ro.* properties" 2016-01-06 00:43:48 +00:00
Elliott Hughes
40c2bf6cf6 Fix a broken link in a comment.
Bug: https://code.google.com/p/android/issues/detail?id=197784
Change-Id: I2f9e5bc2dd2b8a6992c7c55bc856e4a323c7c8a8
2016-01-05 16:33:33 -08:00
Nick Kralevich
c5fd81ab25 system_properties.cpp: special case ro.* properties
Currently, reads of ro.* properties are treated differently than
writes of ro.* properties. When writing an ro.* property, we ignore
the "ro." portion of the property, and base the security decision
on the label of the remaining portion.

See e7a9e52740/init/property_service.cpp
line 120-126

For example, for writing, the label associated with
"ro.build.fingerprint" comes from the /property_contexts file
entry:

  # ro.build.fingerprint is either set in /system/build.prop, or is
  # set at runtime by system_server.
  build.fingerprint       u:object_r:fingerprint_prop:s0

However, we fail to follow this same special case when sorting
properties into files. Instead, ro.build.fingerprint is assigned
u:object_r:default_prop:s0 instead of u:object_r:fingerprint_prop:s0

Ignore the "ro." portion when sorting properties into files.
This will make reads and writes of properties use the same label.

Bug: 21852512
Change-Id: Ie88ffc6b78b31fc8ddf370ae27c218546fb25a83
2016-01-05 16:30:17 -08:00
Elliott Hughes
63fbb233cb Tidy up KernelArgumentBlock::getauxval.
Correct the comment, and remove the unused functionality. getauxval(3) does
now set errno to let you know it failed to find anything, but since none of
this function's callers care anyway it seems safer to leave errno untouched
until we actually have a demonstrated need for it.

Bug: https://code.google.com/p/android/issues/detail?id=198111
Change-Id: I232a42dc5a02c8faab94c7d69bef610408276c23
2016-01-05 16:29:33 -08:00
Dan Willemsen
507d6f2a51 Merge "libc: Update Android.bp with recent changes" 2016-01-05 23:14:43 +00:00
Dan Willemsen
9b59acc9c7 libc: Update Android.bp with recent changes
Change-Id: I54047df9db95169452bbac6d52c75161d2f3bb64
2016-01-05 14:32:54 -08:00
Dimitry Ivanov
e647db7485 Merge "Move __aeabi_ which are not in libgcc.a to LIBC" 2016-01-05 22:07:02 +00:00
Dimitry Ivanov
bb5730ecdb Move __aeabi_ which are not in libgcc.a to LIBC
The following arm symbols should be exported by libc.so:
    __aeabi_atexit; # arm
    __aeabi_memclr; # arm
    __aeabi_memclr4; # arm
    __aeabi_memclr8; # arm
    __aeabi_memcpy; # arm
    __aeabi_memcpy4; # arm
    __aeabi_memcpy8; # arm
    __aeabi_memmove; # arm
    __aeabi_memmove4; # arm
    __aeabi_memmove8; # arm
    __aeabi_memset; # arm
    __aeabi_memset4; # arm
    __aeabi_memset8; # arm

Bug: https://github.com/android-ndk/ndk/issues/1
Change-Id: I542d1ad023b8aece5dc05a28a9ca549cb51455b4
2016-01-05 13:59:20 -08:00
Josh Gao
09f4651c0e Replace MALLOC_IMPL with MALLOC_SVELTE.
Bug: http://b/26390299
Change-Id: I665f64bff4d598607e1eb7c4078819fe1d400feb
2016-01-05 11:45:45 -08:00
Elliott Hughes
c6c3b47be2 Merge "Clarify which linker we are." 2016-01-05 19:38:47 +00:00
Elliott Hughes
116b5698d4 Clarify which linker we are.
Also, we're not a debugger.

Also include LD_LIBRARY_PATH and LD_PRELOAD because they would have helped
diagnose a recent issue.

Change-Id: I7237a7236b7140ab49483c02efa705317d07bd3f
2016-01-05 11:06:50 -08:00
Dimitry Ivanov
ff164ef661 Merge "Temporary apply LIBC version to __pthread_gettid" 2016-01-05 08:22:24 +00:00
Dimitry Ivanov
0ef1d121b5 Temporary apply LIBC version to __pthread_gettid
This is workaround for http://b/26391427

Bug: http://b/26391427
Change-Id: Ibf5c611cf4c04dfa595644225e6d9503089a18da
2016-01-05 00:19:13 -08:00
Dimitry Ivanov
c1113a3fc7 Merge "Revert "Temporary apply LIBC version to __pthread_gettid"" 2016-01-05 08:04:17 +00:00
Dimitry Ivanov
c8bb96a163 Revert "Temporary apply LIBC version to __pthread_gettid"
This reverts commit eb90e91cb5872f6aac7008b0c83e103d396be196.

Change-Id: I63450087b6d3c23218b77d5eee37965f254a82d6
2016-01-05 08:03:56 +00:00
Dimitry Ivanov
56ecf28014 Merge "Temporary apply LIBC version to __pthread_gettid" 2016-01-05 07:02:15 +00:00
Dimitry Ivanov
eb90e91cb5 Temporary apply LIBC version to __pthread_gettid
This is workaround for http://b/26391427

Bug: http://b/26391427
Change-Id: I4ccc56e8b1bd2597f267df9706a33bb635abcfcb
2016-01-04 22:36:18 -08:00
Dimitry Ivanov
04673ee997 Merge changes I4fc241e6,Idca71396
* changes:
  Move __system_property* to LIBC_PRIVATE for lp64 libc
  Move ndk-cruft symbols to LIBC_PRIVATE
2016-01-04 22:52:21 +00:00
Dimitry Ivanov
ff14fb5a1f Move __system_property* to LIBC_PRIVATE for lp64 libc
Bug: http://b/26367254
Change-Id: I4fc241e69444a4b5641dfdf09576fe3ce5c1169e
2016-01-04 14:39:42 -08:00
Dimitry Ivanov
eac1d371f6 Move ndk-cruft symbols to LIBC_PRIVATE
Bug: http://b/26385283
Change-Id: Idca71396f9de4141eefc4e1851ba92ebff1ac792
2016-01-04 13:48:47 -08:00
Elliott Hughes
e13434f9da Merge "Revert "Revert "Implement getifaddrs(3)/freeifaddrs(3).""" 2016-01-04 21:03:48 +00:00
Elliott Hughes
9cddb482b4 Revert "Revert "Implement getifaddrs(3)/freeifaddrs(3).""
This reverts commit 76814a8250fd5e1502909ef5e10e4d166cc96c0e.

This differs from the original in fixing the GCC -Werror build:

  bionic/libc/bionic/ifaddrs.cpp: In function 'void __handle_netlink_response(ifaddrs**, nlmsghdr*)':
  bionic/libc/bionic/ifaddrs.cpp:113:62: error: use of old-style cast [-Werror=old-style-cast]
       ifinfomsg* ifi = reinterpret_cast<ifinfomsg*>(NLMSG_DATA(hdr));

This appears to be a GCC bug; the GCC command-line correctly uses -isystem,
and manually adding #pragma GCC system_header doesn't help. So just turn the
warning off for GCC for now. We won't need to worry about building with GCC
soon anyway.

Bug: http://b/26238832
Change-Id: I01615bd335edf11baf487b1c83a9157cd780f4a1
2016-01-04 13:00:39 -08:00
Dimitry Ivanov
2fed6aa9f0 Merge changes Ic66f6519,Ic16acea5
* changes:
  Make some of unwanted symbols LIBC_PRIVATE
  Make symbols exported via libgcc.a LIBC_PRIVATE
2016-01-04 18:55:42 +00:00
Nick Kralevich
fa8b9312d9 Merge "Add tests for /proc/self/fd and /proc/self/task/TID/fd access" 2015-12-24 04:02:47 +00:00
Nick Kralevich
bd4d45d55b Add tests for /proc/self/fd and /proc/self/task/TID/fd access
Add tests to ensure that the following kernel patches are present:

  __ptrace_may_access() should not deny sub-threads
  * https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=73af963f9f3036dffed55c3a2898598186db1045

  proc: make proc_fd_permission() thread-friendly
  * https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=96d0df79f2644fc823f26c06491e182d87a90c2a

  proc: actually make proc_fd_permission() thread-friendly
  * https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=54708d2858e79a2bdda10bf8a20c80eb96c20613

Bug: 26110743
Bug: 24912743
Bug: 26016905
Change-Id: I7eab002ddfade9e4bfe51908e190231c8dde2cc7
2015-12-23 17:42:29 -08:00
Yi Kong
b62e633ff6 Merge "Revert "Implement getifaddrs(3)/freeifaddrs(3)."" 2015-12-22 17:48:21 +00:00
Yi Kong
76814a8250 Revert "Implement getifaddrs(3)/freeifaddrs(3)."
Werror build broken. Revert while working on a fix.

This reverts commit 0945ed5cc5921243724fed4465d20881f4891a8d.

Change-Id: I67edab7a7a3b9aa673ce9d14aa95380f947838a1
2015-12-22 17:47:54 +00:00
Yi Kong
71417caa92 Merge "Implement getifaddrs(3)/freeifaddrs(3)." 2015-12-22 17:11:59 +00:00
Dimitry Ivanov
788a2bc756 Make some of unwanted symbols LIBC_PRIVATE
Bug: http://b/26274444
Change-Id: Ic66f6519a974b72779071235c1d0dd36655fd1b9
2015-12-21 23:26:53 -08:00
Dimitry Ivanov
5ce79b0af3 Make symbols exported via libgcc.a LIBC_PRIVATE
Bug: http://b/26298172
Change-Id: Ic16acea56624680d48c0b190fbe5a6142a3fca2b
2015-12-21 22:54:35 -08:00
Dimitry Ivanov
be7c7fe218 Merge "linker: implement shared namespaces" 2015-12-21 23:10:49 +00:00
Dimitry Ivanov
7331fe18d7 linker: implement shared namespaces
Shared namespaces clone the list of loaded native
libraries from the caller namespace. This allows
classloaders for bundled apps to share already loaded
libraries with default namespace.

Bug: http://b/22548808
Bug: http://b/26165097
Change-Id: I8949d45937fdb38e1f586ff0679003adac0d9dad
(cherry picked from commit e78deef364d952dd1141a2f3067a12060aaf11e6)
2015-12-19 23:38:27 -08:00
Elliott Hughes
0945ed5cc5 Implement getifaddrs(3)/freeifaddrs(3).
Time to dust off the old libcore implementation from gingerbread and add it
to bionic. Unlike the original, this actually looks at both RTM_NEWLINK and
RTM_NEWADDR.

Bug: http://b/26238832
Change-Id: I7bb4b432deb766065b66b9c9ff36ed68249aba82
2015-12-19 14:49:09 -08:00
Elliott Hughes
4afd635be1 Merge "Improve the 32-bit ABI documentation." 2015-12-19 21:47:07 +00:00
Elliott Hughes
59fc2e8557 Improve the 32-bit ABI documentation.
Change-Id: Ie5bfc8d6f7f3946100f653de0e006072e56e18d6
2015-12-19 09:36:16 -08:00
Tom Cherry
dd57119ced Merge "Reset access to system properties on reinitialization" 2015-12-17 17:54:05 +00:00
Elliott Hughes
7cb3c4af13 Merge "sem_timedwait with a null timeout doesn't mean "forever"." 2015-12-17 01:15:15 +00:00
Dimitry Ivanov
d4f86aed42 Merge "linker: add dlvsym(3)" 2015-12-17 00:40:13 +00:00
Christopher Ferris
27032a39dd Merge "Fix missing parentheses." 2015-12-17 00:30:59 +00:00
Christopher Ferris
0b13f29b2c Fix missing parentheses.
The BIONIC_ROUND_UP_POWER_OF_2 macro did not have parentheses around
the whole expression. This lead to the wrong value being computed when
used as part of a mathematical expression such as this:

  value = BIONIC_ROUND_UP_POWER_OF_2(value) - 1;

This only happens on 64 bit abis.

Change-Id: I6f8afbdaf16fe64a88fa0246d074b3534c9159c1
2015-12-16 16:11:04 -08:00
Christopher Ferris
9f20db1c94 Merge "Fix bug in dlmalloc's version of calloc." 2015-12-17 00:06:03 +00:00
Dimitry Ivanov
9cf99cbad8 linker: add dlvsym(3)
This changes implements dlvsym - dlsym for versioned symbols.

Bug: http://b/22865643
Change-Id: Ic90a60d512104261a1416c43f9100f0d88e3b46f
2015-12-16 15:24:13 -08:00
Elliott Hughes
dd586f2ebd sem_timedwait with a null timeout doesn't mean "forever".
It actually means "crash immediately". Well, it's an error. And callers are
much more likely to realize their mistake if we crash immediately rather
than return EINVAL. Historically, glibc has crashed and bionic -- before
the recent changes -- returned EINVAL, so this is a behavior change.

Change-Id: I0c2373a6703b20b8a97aacc1e66368a5885e8c51
2015-12-16 15:15:58 -08:00
Christopher Ferris
ad33ebead8 Fix bug in dlmalloc's version of calloc.
Under some circumstances, doing a calloc will make sure that the memory
returned will be zero up to the size of the requested size. However, if
there is more usable size than the requested size, that extra part
of the allocation will not be zeroed. This change fixes it so that the
entire usable memory is always zeroed.

Change-Id: I8a66d6767c074023c4ba3568bf2705e1886740fc
2015-12-16 14:48:03 -08:00
Dimitry Ivanov
d3e5301a75 Merge "Revert "Revert "Remove remaining ndk_cruft from LP64 platforms""" 2015-12-16 19:06:09 +00:00
Dimitry Ivanov
bc2e88a85d Revert "Revert "Remove remaining ndk_cruft from LP64 platforms""
This reverts commit 23af25b747b5e7b0ca513a87b32f1f6a3cb99698.

Bug: http://b/26164862
Change-Id: I201bf49530f33f8ba6a1a35b79723afb9e84c7a5
2015-12-16 19:02:04 +00:00
Elliott Hughes
4d57e669dc Merge "Add a few missing pthread tests." 2015-12-15 01:38:24 +00:00
Dimitry Ivanov
52a05f3ce7 Merge "Revert "Remove remaining ndk_cruft from LP64 platforms"" 2015-12-15 01:36:19 +00:00
Elliott Hughes
d31d4c1cc6 Add a few missing pthread tests.
This seems to be all that's tested by system/extras/tests/bionic that isn't
already better tested here.

Change-Id: Id0aa985cefd4047a6007ba9804f541069d9e92ed
2015-12-14 17:35:10 -08:00
Dimitry Ivanov
23af25b747 Revert "Remove remaining ndk_cruft from LP64 platforms"
This reverts commit b1d0a2ae7790f882d8f1ab24d7ef15e2b90c8ca2.

Change-Id: I1da06be0b78a4f2a4cad7e4a19a3ee755f55a813
2015-12-15 01:34:14 +00:00
Dimitry Ivanov
b34ae08cc6 Merge "Remove remaining ndk_cruft from LP64 platforms" 2015-12-14 23:55:55 +00:00
Dimitry Ivanov
b1d0a2ae77 Remove remaining ndk_cruft from LP64 platforms
This change removes endpwent, dlmalloc_inspect_all, dlmalloc_trim
from lp64 libc.so. It also removed necessety of having brillo
version scripts for lp64 platforms.

Bug: http://b/26164862
Change-Id: I4e9b38907bb1dc410f0eb6d2f5d5944fe713da51
2015-12-14 15:49:28 -08:00
Dimitry Ivanov
881673cb45 Merge changes Iaee1b711,Ia3dd0761
* changes:
  Generate libc version-script for brillo
  Revert "Don't verify version scripts on 32-bit Brillo"
2015-12-14 22:53:06 +00:00
Dimitry Ivanov
585e959849 Generate libc version-script for brillo
Brillo doesn't use the ndk cruft, so we need
separate set of version scripts. Added new "nobrillo"
tag to mark such symbols in *.map.txt files.

Bug: http://b/26164862
Change-Id: Iaee1b7119f75b68c2971679fc32817e6df29fd94
2015-12-14 14:23:06 -08:00
Dimitry Ivanov
a3dd076126 Revert "Don't verify version scripts on 32-bit Brillo"
This reverts commit 31951b7f0dc7ce577a21682e54362b0cf2913e11.

Bug: http://b/26164862
2015-12-14 14:19:53 -08:00
Elliott Hughes
162a8524ea Merge "Fix personality test for mips32r6" 2015-12-14 15:59:29 +00:00
Lazar Trsic
61cf963efe Fix personality test for mips32r6
When personality syscall is executed on mips64, for a 32bit process,
sys_32_personality() is called, which converts PER_LINUX32 -> PER_LINUX.
Change expected value when mips32 is a second architecture.

For more information see:
https://www.linux-mips.org/archives/linux-mips/2015-08/msg00421.html
https://www.linux-mips.org/archives/linux-mips/2015-11/msg00093.html

Change-Id: I8c9062f536ad6e513f0ac585da3568d80e5fa1b4
2015-12-14 12:29:53 +01:00
Dan Willemsen
a7ff3964ab Merge "Don't verify version scripts on 32-bit Brillo" 2015-12-12 02:29:29 +00:00
Dan Willemsen
31951b7f0d Don't verify version scripts on 32-bit Brillo
Brillo doesn't use the ndk cruft, so the same version scripts do not
apply. Until we have brillo-specific version scripts, just disable the
version script check.

Bug: 26164862
Change-Id: I682860ec1c5b36014c7a6cf24da43df553e9dc9f
2015-12-11 16:52:08 -08:00
Dimitry Ivanov
52e2db647c Merge "Remove __bionic_libgcc_unwind_symbols from version script" 2015-12-11 19:41:33 +00:00
Dimitry Ivanov
2f019872dc Remove __bionic_libgcc_unwind_symbols from version script
Bug: http://b/26004476
Change-Id: Iaa468de4cbcc94e88badc5cde0f4421c710c1f38
2015-12-11 11:30:48 -08:00
Tom Cherry
b417169d80 Reset access to system properties on reinitialization
Treat subsequent calls to __system_properties_init() as a
reinitialization of system properties and revoke access to prop files
that have been previously mapped but that the process's current context
does not have access to.  Additionally reset the no_access_ flag in
case permissions have loosened and previously unaccessible files can now
be accessed.

This is meant to work around an issue that setcon() does not revoke
mmap() mappings, so we must manually revoke them after a successful
setcon() call.

Bug 26114086

Change-Id: I4d690abb6817283ca64ac26ea4c1dad398a98fbc
2015-12-11 11:16:21 -08:00
Dimitry Ivanov
0bc3977537 Merge "Move dlsym and dladdr implementation to linker.cpp" 2015-12-11 01:26:17 +00:00
Dimitry Ivanov
4a2c5aa30c Move dlsym and dladdr implementation to linker.cpp
Bug: http://b/25716705
Bug: http://b/22865643
Change-Id: If22fc1eda219f676b5fcc06490f7901d21d1749c
2015-12-10 16:24:57 -08:00
Tom Cherry
e46ded5ce1 Merge "Do not set properties in bionic_systrace" 2015-12-10 23:05:15 +00:00
Tom Cherry
46e2eadad2 Do not set properties in bionic_systrace
Currently, if the debug.atrace.tags.enableflags property is not found,
it is set to a safe value such that a pointer to this property can be
stored for later access.  This may result in selinux denials because not
all processes write permissions for this property or permission to
connect to the property write socket at all.

Change I6d953c0c281fd72ad3eba8a479fd258023579b5b writes this property to
a safe value upon boot, which greatly decreases the cases in which this
property will not be accessible and removes the need to write it here.
This commit removes this write.

Bug 26115803

Change-Id: Ief72c5f731d3a1231b5080eb531fa0a491a8b1d1
2015-12-10 13:33:37 -08:00
Dimitry Ivanov
cb025e55f7 Merge "Revert "Add /odm/lib to shared lib search path"" 2015-12-10 20:17:02 +00:00
Dimitry Ivanov
9d8632e1a7 Merge "constexpr constructor for atfork_list_t" 2015-12-10 17:39:48 +00:00
Dimitry Ivanov
39801757c3 Merge "Add permitted_when_isolated_path to linker namespaces" 2015-12-10 04:34:38 +00:00
Elliott Hughes
6500f51c0e Merge "Fix -fstack-protector-strong for x86." 2015-12-10 02:33:34 +00:00
Dimitry Ivanov
284ae3559e Add permitted_when_isolated_path to linker namespaces
The permitted_when_isolated_path is a way to white-list
directories not present in search-path. It is ignored for
not isolated namespaces.

Bug: http://b/25853516
Bug: http://b/22548808
Change-Id: Ib1538037268eea69323ea49968a34a4a1d1938a5
2015-12-09 13:54:01 -08:00
Dimitry Ivanov
5a3ab3422d Merge "Revert "Ensure that readlink has access to /proc/self/fd"" 2015-12-09 21:50:54 +00:00
Dimitry Ivanov
db43526581 Revert "Ensure that readlink has access to /proc/self/fd"
This reverts commit 4e50d0247b9ace095e371865fad08b1a59672e3a.

Bug: http://b/24912743
Change-Id: I5d32c670f0e16aec9c74add143158e919a301673
2015-12-09 19:36:47 +00:00
Dimitry Ivanov
40728bccbc Revert "Add /odm/lib to shared lib search path"
This reverts commit f74b041cce75091b922151d4fa57e63c8a6caf4b.

Bug: 25654402
Change-Id: I77386ea3655868d7cd1a8130afbc95e70549389e
2015-12-09 19:35:02 +00:00
Dan Willemsen
df196131f3 Merge "libm: Use LOCAL_SRC_FILES_EXCLUDE_{arch}" 2015-12-08 23:41:24 +00:00
Todd Kjos
5736959094 Merge "bionic: Build Breakage" 2015-12-08 21:46:17 +00:00
Mark Salyzyn
9da687e2f4 bionic: Build Breakage
Bug: 23668800
Change-Id: Ic7cf5864d3f5881e6f7105a49ecf62b1bc4a604c
2015-12-08 13:42:41 -08:00
Elliott Hughes
6c54ddd20f Fix -fstack-protector-strong for x86.
We need to ensure %gs:20 is set up early enough for -fstack-protector-strong
on x86, and that __set_tls doesn't get stack protector checks because it's a
prerequisite for them. x86 devices/emulators won't boot without this.

Bug: http://b/26073874
Change-Id: Icf0d34294648cc0c8cb406a3617befe0d45c525a
2015-12-08 12:48:42 -08:00
Dimitry Ivanov
89a50fe1eb constexpr constructor for atfork_list_t
Bug: http://b/26026986
Change-Id: Iad95383a23f81eea776bebce641c555d26547b77
2015-12-08 11:40:51 -08:00
Mark Salyzyn
eaccfde075 Merge "Add monotonic logging for bionic" 2015-12-08 18:59:05 +00:00
Elliott Hughes
cf0c1af1dd Merge "Base bcopy on memmove rather than memcpy."
am: f0a451dcd1

* commit 'f0a451dcd10241c8f2ead2448ed922eb80f387f6':
  Base bcopy on memmove rather than memcpy.
2015-12-07 23:20:58 +00:00
Elliott Hughes
36545d2e76 Merge "Make all of ndk_cruft.cpp one big extern "C"."
am: 9dec0a775b

* commit '9dec0a775b07f58d133ae5c35713e7cf60ddcc7c':
  Make all of ndk_cruft.cpp one big extern "C".
2015-12-07 23:16:43 +00:00
Elliott Hughes
1190230f33 Merge "Fix stdio static initializers to make both clang and GCC happy."
am: 7bd33cdf15

* commit '7bd33cdf15c26c5855628eb2ac0e7d0f52189010':
  Fix stdio static initializers to make both clang and GCC happy.
2015-12-07 23:16:39 +00:00
Elliott Hughes
568ad51d80 Merge "Revert "Revert "Remove __sinit and __sdidinit."""
am: c4eef1fb5b

* commit 'c4eef1fb5ba325317e94b598c6fbf8e4c4bf83e1':
  Revert "Revert "Remove __sinit and __sdidinit.""
2015-12-07 23:14:29 +00:00
Elliott Hughes
f0a451dcd1 Merge "Base bcopy on memmove rather than memcpy." 2015-12-07 22:07:11 +00:00
Rohit Agrawal
d51a0b0f9d Base bcopy on memmove rather than memcpy.
POSIX defined bcopy to handle overlapping memory akin to memmove and
bionic appears to have always done so.

Change-Id: I2599113411e3532913270ba1c1b49e35cbc5f106
2015-12-07 13:06:14 -08:00
Elliott Hughes
9dec0a775b Merge "Make all of ndk_cruft.cpp one big extern "C"." 2015-12-07 19:14:46 +00:00
Elliott Hughes
cfd5a46b09 Make all of ndk_cruft.cpp one big extern "C".
Change-Id: Iddd9b5f36e661e443fa13d12326e72df8c0d209c
2015-12-07 11:13:23 -08:00
Elliott Hughes
7bd33cdf15 Merge "Fix stdio static initializers to make both clang and GCC happy." 2015-12-07 19:10:32 +00:00
Elliott Hughes
29ee6397a8 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
2015-12-07 11:07:15 -08:00
Elliott Hughes
c4eef1fb5b Merge "Revert "Revert "Remove __sinit and __sdidinit.""" 2015-12-07 18:19:07 +00:00
Elliott Hughes
bb46afd6c4 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
2015-12-05 07:30:59 -08:00
Dimitry Ivanov
d5ce2a93af Merge "Allow dlopening public libs using absolute path"
am: e371ae68ac

* commit 'e371ae68ac0d6d39cacf5edc893bda2f4a61e883':
  Allow dlopening public libs using absolute path
2015-12-05 05:29:52 +00:00
Dimitry Ivanov
e371ae68ac Merge "Allow dlopening public libs using absolute path" 2015-12-05 05:25:57 +00:00
Dimitry Ivanov
22840aab47 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
2015-12-04 21:21:35 -08:00
Elliott Hughes
f4e511ecf9 Merge "Revert "Remove __sinit and __sdidinit.""
am: 0d89913e74

* commit '0d89913e74981cd51532e66a2e2f138392be4de1':
  Revert "Remove __sinit and __sdidinit."
2015-12-05 01:58:40 +00:00
Elliott Hughes
0d89913e74 Merge "Revert "Remove __sinit and __sdidinit."" 2015-12-05 01:53:21 +00:00
Elliott Hughes
c8bae05f3f 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
2015-12-04 17:47:20 -08:00
Tom Cherry
071234cfd9 Merge "Do not create prop files for ctl.* properties"
am: 4ade5195f1

* commit '4ade5195f188b84ce3599c71ef058d040b141da4':
  Do not create prop files for ctl.* properties
2015-12-05 00:27:56 +00:00
Tom Cherry
4ade5195f1 Merge "Do not create prop files for ctl.* properties" 2015-12-05 00:21:46 +00:00
Elliott Hughes
70d477c913 Merge "Fix GCC build."
am: ef2ba3dbf9

* commit 'ef2ba3dbf986257ded12531fe15bf0d1d4a87d50':
  Fix GCC build.
2015-12-04 16:02:27 -08:00
Tom Cherry
21eadee6e9 Do not create prop files for ctl.* properties
Change-Id: Ia6660c68c9e0cb89938751dbc0747ee038394778
2015-12-04 15:55:32 -08:00
Elliott Hughes
ef2ba3dbf9 Merge "Fix GCC build." 2015-12-04 23:54:15 +00:00
Elliott Hughes
8766edc098 Fix GCC build.
error: '__sdidinit' initialized and declared 'extern' [-Werror]

Change-Id: I97d9c174da6a99ca61b72572dfb4694813372a60
2015-12-04 15:53:25 -08:00
Elliott Hughes
a3f5912129 Merge "Track rename from base/ to android-base/."
am: 0b40c13a5a

* commit '0b40c13a5a2da127cb1203d33a3d170671b39247':
  Track rename from base/ to android-base/.
2015-12-04 23:33:45 +00:00
Elliott Hughes
942d81c246 Merge "Remove __sinit and __sdidinit."
am: 2558b11230

* commit '2558b112300e0a27590b9e31f627fe94594fa6a0':
  Remove __sinit and __sdidinit.
2015-12-04 23:33:39 +00:00
Elliott Hughes
0b40c13a5a Merge "Track rename from base/ to android-base/." 2015-12-04 23:30:09 +00:00
Elliott Hughes
939a7e0119 Track rename from base/ to android-base/.
Change-Id: I0a4592945400b1fa6892bf7c1fa8659fd711efa3
2015-12-04 15:27:46 -08:00
Elliott Hughes
2558b11230 Merge "Remove __sinit and __sdidinit." 2015-12-04 23:27:07 +00:00
Tom Cherry
e049fa71cb Merge "add checks for initialization for system properties"
am: 136bf8fa45

* commit '136bf8fa45b243b56a8f2543d43970f253118cd7':
  add checks for initialization for system properties
2015-12-04 15:09:42 -08:00
Tom Cherry
136bf8fa45 Merge "add checks for initialization for system properties" 2015-12-04 23:06:31 +00:00
Mark Salyzyn
870f165ceb Add monotonic logging for bionic
Primarily a debug feature that can be switched at runtime to permit
developer to have the option of high-resolution Android logs with
either CLOCK_REALTIME (default) or CLOCK_MONOTONIC to correlate with
other system activities like kernel logs or systrace.

Bug: 23668800
Change-Id: Ib29024899540f51a72cad5dde25517a7134d68f7
2015-12-04 14:45:25 -08:00
Tom Cherry
6ed51c0e85 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
2015-12-04 13:26:47 -08:00
Dan Willemsen
a29ed0bbce libm: Use LOCAL_SRC_FILES_EXCLUDE_{arch}
Instead of adding the used common files to each arch that doesn't
override a file, make the architectures list the files they override.

Also updates the Android.bp file to match the Android.mk file.

Change-Id: I7d6a9c2e1c6b6cc9430aa818a89a2ccf52f62c98
2015-12-03 18:09:36 -08:00
Yabin Cui
21cca02a52 Merge "Clear pthread_internal_t allocated on user provided stack."
am: 2452cf3c33

* commit '2452cf3c332fdfdae6b6b27b57acaa6786a91c87':
  Clear pthread_internal_t allocated on user provided stack.
2015-12-04 01:05:37 +00:00
Yabin Cui
2452cf3c33 Merge "Clear pthread_internal_t allocated on user provided stack." 2015-12-04 00:58:05 +00:00
Yabin Cui
304348af19 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
2015-12-03 16:51:20 -08:00
Yabin Cui
fb3708640f Merge "Don\'t use StringPrintf() in gtest runner."
am: 514f46b74c

* commit '514f46b74c5424eb10f21349654e90fcf69b3b10':
  Don't use StringPrintf() in gtest runner.
2015-12-04 00:35:30 +00:00
Yabin Cui
514f46b74c Merge "Don't use StringPrintf() in gtest runner." 2015-12-04 00:29:47 +00:00
Yabin Cui
a32fc8685d Don't use StringPrintf() in gtest runner.
Change-Id: I0cd0b3cbb952c65b1c449e88ce12964b93029538
2015-12-03 16:28:03 -08:00
Tom Cherry
e670e2f859 Merge "Remove c++14\'isms from system_properties"
am: b35a2fb370

* commit 'b35a2fb370db711fcea38441a1295cd542fc3daa':
  Remove c++14'isms from system_properties
2015-12-03 23:53:24 +00:00
Dimitry Ivanov
0ee40ef239 Merge "libm: stop exporting __muldc3"
am: bf20d0226b

* commit 'bf20d0226b28a029f4cade8dc8f3aa38d1e51a1a':
  libm: stop exporting __muldc3
2015-12-03 23:53:13 +00:00
Tom Cherry
b35a2fb370 Merge "Remove c++14'isms from system_properties" 2015-12-03 23:48:54 +00:00
Dimitry Ivanov
bf20d0226b Merge "libm: stop exporting __muldc3" 2015-12-03 23:44:59 +00:00
Tom Cherry
845e24a05e Remove c++14'isms from system_properties
Change-Id: If78e7d2770e8f8321f0d1824c3c52f93820dd325
2015-12-03 15:40:23 -08:00
Dimitry Ivanov
a2ead18657 libm: stop exporting __muldc3
Bug: http://b/26004493
Change-Id: I991268d5e7b59bca646da25d0ad90a1cb4a9d4b9
2015-12-03 15:25:37 -08:00
Tom Cherry
84bc4f5cc7 Merge "Separate properties by selabel"
am: 376b94f1e7

* commit '376b94f1e777375eb9ebb04a882b898aafa94625':
  Separate properties by selabel
2015-12-03 22:58:48 +00:00
Tom Cherry
376b94f1e7 Merge "Separate properties by selabel" 2015-12-03 22:55:32 +00:00
Yabin Cui
b561043d3a Merge "Improve unit test runner."
am: f57ae1cd43

* commit 'f57ae1cd433f2bdc02cec6b0d2666f7708f1fc37':
  Improve unit test runner.
2015-12-03 22:34:44 +00:00
Yabin Cui
f57ae1cd43 Merge "Improve unit test runner." 2015-12-03 22:29:29 +00:00
Elliott Hughes
4371961e00 Remove __sinit and __sdidinit.
We're eagerly initializing stdio now, so this can all be simplified.

Change-Id: Icb288f8dd0ee08f02bea0d23670f75e78bed6b99
2015-12-03 13:23:03 -08:00
Yabin Cui
d4c9b9d5ac 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
2015-12-03 13:20:39 -08:00
Dan Willemsen
5bfa22ceab Merge "Re-add putw for LP32"
am: 22dca83e1c

* commit '22dca83e1c37d3b465b9fa432bbf7cb4bd0df868':
  Re-add putw for LP32
2015-12-03 02:01:07 +00:00
Dan Willemsen
22dca83e1c Merge "Re-add putw for LP32" 2015-12-03 01:56:00 +00:00
Dan Willemsen
b9055518fc Re-add putw for LP32
This was missed when switching to LOCAL_SRC_FILES_EXCLUDE

Change-Id: I6ea23c9eb31abe11e0ec4abfc2ee2f2a43c76ce2
2015-12-02 17:31:32 -08:00
Tom Cherry
49a309ff6a 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
2015-12-02 15:17:03 -08:00
Dimitry Ivanov
9f525b66eb Merge "Explicitly disallow default c-tor"
am: b24f7a0513

* commit 'b24f7a0513f7468ccf7563d7d347c6e7bab391d9':
  Explicitly disallow default c-tor
2015-12-02 18:47:27 +00:00
Dimitry Ivanov
b24f7a0513 Merge "Explicitly disallow default c-tor" 2015-12-02 18:44:20 +00:00
Dimitry Ivanov
a5e183c066 Explicitly disallow default c-tor
Change-Id: Ia52995a459443159e80383d5b396c3edd90a08ae
2015-12-01 16:57:19 -08:00
Chih-hung Hsieh
d74566026d Merge "Add bionic-unit-tests-gcc{32,64}, compiled with gcc."
am: 9cbabd8fe5

* commit '9cbabd8fe5ef3834682996ff23b4a5325e0586cb':
  Add bionic-unit-tests-gcc{32,64}, compiled with gcc.
2015-12-01 00:27:13 +00:00
Chih-hung Hsieh
9cbabd8fe5 Merge "Add bionic-unit-tests-gcc{32,64}, compiled with gcc." 2015-12-01 00:23:32 +00:00
Yabin Cui
1f4b0c44b3 Merge "Init stdio in __libc_init_common."
am: 6bef152af2

* commit '6bef152af2c622ee0c57f9c374b76f3dd352e52b':
  Init stdio in __libc_init_common.
2015-11-30 23:58:50 +00:00
Yabin Cui
4262d3e9ac Merge "Enable using clang to build __cxa_thread_atexit_impl."
am: af87c9ccfc

* commit 'af87c9ccfc3afbc7db9f0bc131d122453b5c882d':
  Enable using clang to build __cxa_thread_atexit_impl.
2015-11-30 23:58:41 +00:00
Yabin Cui
6bef152af2 Merge "Init stdio in __libc_init_common." 2015-11-30 23:57:02 +00:00
Yabin Cui
af87c9ccfc Merge "Enable using clang to build __cxa_thread_atexit_impl." 2015-11-30 23:56:41 +00:00
Yabin Cui
9b687dc243 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
2015-11-30 14:43:52 -08:00
Yabin Cui
51ca18d2a1 Merge "Don\'t use __thread in __cxa_thread_finalize()."
am: 28d3f00cf4

* commit '28d3f00cf4545812503c835ea906fa83309e48ed':
  Don't use __thread in __cxa_thread_finalize().
2015-11-30 22:01:36 +00:00
Yabin Cui
28d3f00cf4 Merge "Don't use __thread in __cxa_thread_finalize()." 2015-11-30 21:59:47 +00:00
Yabin Cui
d68c9e5906 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
2015-11-30 13:51:07 -08:00
Yabin Cui
6ac2fdd0f4 Merge "Fix pthread_test according to tsan report."
am: aec13988da

* commit 'aec13988dab7ff32cb005f42b952e3b9b55a4779':
  Fix pthread_test according to tsan report.
2015-11-30 21:42:42 +00:00
Yabin Cui
aec13988da Merge "Fix pthread_test according to tsan report." 2015-11-30 21:38:59 +00:00
Chih-hung Hsieh
4f94b7bfc0 Merge "Consider when building libc_thread_atexit_impl module"
am: 2bb85c848a

* commit '2bb85c848abb89951ec01342d6c8278311346395':
  Consider $(use_clang) when building libc_thread_atexit_impl module
2015-11-30 19:02:05 +00:00
Chih-hung Hsieh
2bb85c848a Merge "Consider $(use_clang) when building libc_thread_atexit_impl module" 2015-11-30 18:58:59 +00:00
Chih-Hung Hsieh
f688c5d5b4 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
2015-11-30 10:52:16 -08:00
Nikola Veljkovic
83f314f060 Consider $(use_clang) when building libc_thread_atexit_impl module
Change-Id: Ia369d94979f418198a2ee891385942d9bc5604d7
2015-11-25 18:09:34 +00:00
Yabin Cui
952e9eb086 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
2015-11-24 17:24:06 -08:00
Colin Cross
a36d1e0d31 Merge "Remove cflags and ldflags from crt defaults"
am: a01108d9bf

* commit 'a01108d9bf415854b9d36334483133adff3d7405':
  Remove cflags and ldflags from crt defaults
2015-11-24 21:41:22 +00:00
Colin Cross
a01108d9bf Merge "Remove cflags and ldflags from crt defaults" 2015-11-24 21:33:54 +00:00
Colin Cross
912e27a4b2 Merge "move arch variant structs down a level"
am: 8bd27182c5

* commit '8bd27182c505cdc8031ab23fea5d1dccb6b7405a':
  move arch variant structs down a level
2015-11-24 20:24:24 +00:00
Colin Cross
8bd27182c5 Merge "move arch variant structs down a level" 2015-11-24 20:21:20 +00:00
Colin Cross
bff87d19f1 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
2015-11-24 11:11:02 -08:00
Dimitry Ivanov
321314f2e9 Merge "Introduce anonymous namespace"
am: db8caa740a

* commit 'db8caa740a409c2ce75f875df84857e6be69eb9f':
  Introduce anonymous namespace
2015-11-24 02:45:14 +00:00
Dimitry Ivanov
db8caa740a Merge "Introduce anonymous namespace" 2015-11-24 02:23:34 +00:00
Dmitriy Ivanov
1ffec1cc4d 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
2015-11-23 16:13:10 -08:00
Colin Cross
6ab8f89d1c 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
2015-11-23 14:14:57 -08:00
Yabin Cui
edcee4e401 Merge "Change _stdio_handles_locking into _caller_handles_locking."
am: 17554356cc

* commit '17554356cc865908e5cbd7814c8be7e47c9c4ec5':
  Change _stdio_handles_locking into _caller_handles_locking.
2015-11-23 19:02:08 +00:00
Yabin Cui
17554356cc Merge "Change _stdio_handles_locking into _caller_handles_locking." 2015-11-23 18:57:26 +00:00
Dimitry Ivanov
a8f8cbb3fc Merge "Handling invalid section headers"
am: a7fc7f9909

* commit 'a7fc7f9909c221a0f64c5c5ecc5fadd5fba467c5':
  Handling invalid section headers
2015-11-23 07:33:23 +00:00
Dimitry Ivanov
a7fc7f9909 Merge "Handling invalid section headers" 2015-11-23 07:28:32 +00:00
Dmitriy Ivanov
3c5248182e 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
2015-11-22 23:25:06 -08:00
Yabin Cui
4469973bfb Merge "Use FUTEX_WAIT_BITSET to avoid converting timeouts."
am: 74ed96d597

* commit '74ed96d59731aa3661494330804d866e825209d3':
  Use FUTEX_WAIT_BITSET to avoid converting timeouts.
2015-11-21 01:55:27 +00:00
Yabin Cui
74ed96d597 Merge "Use FUTEX_WAIT_BITSET to avoid converting timeouts." 2015-11-21 01:50:29 +00:00
Yabin Cui
76144aaa63 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
2015-11-20 17:44:26 -08:00
Dimitry Ivanov
8bd9e9ec69 Merge "Move some utility functions to linker_utils"
am: fb3219fbd1

* commit 'fb3219fbd1dbb0a369d52cbd0200330fd8852bc1':
  Move some utility functions to linker_utils
2015-11-20 21:45:36 +00:00
Dimitry Ivanov
fb3219fbd1 Merge "Move some utility functions to linker_utils" 2015-11-20 21:42:18 +00:00
Dmitriy Ivanov
84bab5a955 Move some utility functions to linker_utils
Also adds unit-tests for page_start, page_offset, and safe_add

Change-Id: Ia1325b4682d367328a01599a19848e4ffcd2c0ea
2015-11-20 21:37:51 +00:00
Dimitry Ivanov
d34c33764e Merge "Improve error message for files with no sections"
am: a1ab0d8ed1

* commit 'a1ab0d8ed1c4025233b0d816164eefb1b84159b9':
  Improve error message for files with no sections
2015-11-20 19:19:40 +00:00
Dimitry Ivanov
a1ab0d8ed1 Merge "Improve error message for files with no sections" 2015-11-20 19:16:14 +00:00
Chih-hung Hsieh
bb06a84672 Merge "Disable clang for mips/mips64 libc."
am: 8d5fb0d787

* commit '8d5fb0d78716379d07eddbd75c88c9b7082436ef':
  Disable clang for mips/mips64 libc.
2015-11-20 18:57:17 +00:00
Dmitriy Ivanov
b76123fed8 Improve error message for files with no sections
Bug: http://b/25801618
Change-Id: I4f4f368e727ff48c84781279e3d17d4ac2d1b6b0
2015-11-20 10:49:12 -08:00
Chih-hung Hsieh
8d5fb0d787 Merge "Disable clang for mips/mips64 libc." 2015-11-20 18:27:14 +00:00
Chih-Hung Hsieh
b4bc156c6c 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
2015-11-20 09:55:35 -08:00
Elliott Hughes
cb3af215dc Merge "mmap: fix calculation of is_private_anonymous variable"
am: 43c9045017

* commit '43c90450174ab8839c05702ac01c4092f5b6cd19':
  mmap: fix calculation of is_private_anonymous variable
2015-11-20 17:34:03 +00:00
Elliott Hughes
43c9045017 Merge "mmap: fix calculation of is_private_anonymous variable" 2015-11-20 17:19:19 +00:00
Vitaly Vul
ee67dd75e2 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
2015-11-20 09:16:59 -08:00
Josh Gao
8af9a739c9 Merge changes I73a39c6d,Iab2af242
am: f30170dfa5

* commit 'f30170dfa514266a0bf007091aa54a866920208c':
  Fix test build break.
  extend the PTRDIFF_MAX size check to mremap
2015-11-20 02:00:16 +00:00
Josh Gao
f30170dfa5 Merge changes I73a39c6d,Iab2af242
* changes:
  Fix test build break.
  extend the PTRDIFF_MAX size check to mremap
2015-11-20 01:55:56 +00:00
Yabin Cui
b690cae8dd Merge "Fix tsan abort for lake of __libc_auxv initialization."
am: 79f8d64632

* commit '79f8d64632a57ccd62315286b809819de09e0317':
  Fix tsan abort for lake of __libc_auxv initialization.
2015-11-20 00:48:40 +00:00
Yabin Cui
79f8d64632 Merge "Fix tsan abort for lake of __libc_auxv initialization." 2015-11-20 00:40:00 +00:00
Colin Cross
75ba57de43 Merge "Update libc/Android.bp to match libc/Android.mk"
am: 9c6157c81d

* commit '9c6157c81d123d8c6ba1aa8d7ee5c67b0840666c':
  Update libc/Android.bp to match libc/Android.mk
2015-11-19 22:58:20 +00:00
Colin Cross
9c6157c81d Merge "Update libc/Android.bp to match libc/Android.mk" 2015-11-19 22:48:33 +00:00
Yabin Cui
284068f44f 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
2015-11-19 14:24:06 -08:00
Colin Cross
a35d23d251 Update libc/Android.bp to match libc/Android.mk
Change-Id: I4dfadc55688213f095949c56306e5071b2ab6135
2015-11-19 14:18:06 -08:00
Josh Gao
2feb9dde60 Fix test build break.
Change-Id: I73a39c6d4bb9baebbfb5572e9259bcd405116039
2015-11-19 13:44:20 -08:00
Yabin Cui
c9a659c57b Use FUTEX_WAIT_BITSET to avoid converting timeouts.
Add unittests for pthread APIs with timeout parameter.

Bug: 17569991

Change-Id: I6b3b9b2feae03680654cd64c3112ce7644632c87
2015-11-19 13:42:03 -08:00
Hung-ying Tyan
ce77e47b2f Merge "Add /odm/lib to shared lib search path"
am: 0ebe2f07c3

* commit '0ebe2f07c35d4b764bc5d8b5226004e3db46da91':
  Add /odm/lib to shared lib search path
2015-11-19 16:45:08 +00:00
Hung-ying Tyan
0ebe2f07c3 Merge "Add /odm/lib to shared lib search path" 2015-11-19 16:38:51 +00:00
Daniel Micay
c22a7de798 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
2015-11-19 08:57:47 -05:00
Junichi Uekawa
1ab4088062 Merge "Do not depend on host bits to get the right size to write."
am: 313632db57

* commit '313632db574d101275206ca025d21a5a3cd62150':
  Do not depend on host bits to get the right size to write.
2015-11-19 12:51:01 +00:00
Junichi Uekawa
313632db57 Merge "Do not depend on host bits to get the right size to write." 2015-11-19 12:44:19 +00:00
Junichi Uekawa
ff35b1e659 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
2015-11-19 11:28:20 +09:00
Yabin Cui
f091c1f2f1 Merge "Implement pthread spin."
am: 2c09e5de29

* commit '2c09e5de299ca87a9e68807e2b4af41ba61710f3':
  Implement pthread spin.
2015-11-19 02:03:24 +00:00
Yabin Cui
9d4bd6f0ca Merge "Avoid tsan warning about pthread_mutex_destroy."
am: ea5bb151af

* commit 'ea5bb151af5e1e364968cb1eac70c8a2c13ca7a7':
  Avoid tsan warning about pthread_mutex_destroy.
2015-11-19 02:03:13 +00:00
Yabin Cui
2c09e5de29 Merge "Implement pthread spin." 2015-11-19 01:55:37 +00:00
Yabin Cui
ea5bb151af Merge "Avoid tsan warning about pthread_mutex_destroy." 2015-11-19 01:55:25 +00:00
Yabin Cui
fe3a83a934 Implement pthread spin.
In order to run tsan unit tests, we need to support pthread spin APIs.

Bug: 18623621
Bug: 25392375
Change-Id: Icbb4a74e72e467824b3715982a01600031868e29
2015-11-18 17:51:21 -08:00
Hung-ying Tyan
f74b041cce 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
2015-11-18 23:45:25 +08:00
Dimitry Ivanov
3f539a1655 Merge "Ignore target sdk version for the public namespace"
am: 63f0e0db76

* commit '63f0e0db768ea9be4db3dd6a2fb62ea942afb9d6':
  Ignore target sdk version for the public namespace
2015-11-18 03:52:50 +00:00
Dimitry Ivanov
63f0e0db76 Merge "Ignore target sdk version for the public namespace" 2015-11-18 03:43:59 +00:00
Dmitriy Ivanov
3cc35e224c 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
2015-11-17 18:45:12 -08:00
Yabin Cui
0307eee293 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
2015-11-17 16:17:44 -08:00
Yabin Cui
a36158a77d 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
2015-11-16 21:15:58 -08:00
Yabin Cui
278fe431b6 Merge "Implement pthread barrier."
am: b804b9d67b

* commit 'b804b9d67b9e3a8c63471ff9892f6abea2a58684':
  Implement pthread barrier.
2015-11-17 00:28:20 +00:00
Yabin Cui
b804b9d67b Merge "Implement pthread barrier." 2015-11-17 00:22:54 +00:00
Dimitry Ivanov
159c3d617f Merge "Remove the warning about empty LD_LIBRARY_PATH"
am: 3c8c16022a

* commit '3c8c16022a513a32eb6b92cf23f4ef43ccf7ad6d':
  Remove the warning about empty LD_LIBRARY_PATH
2015-11-16 22:30:32 +00:00
Dimitry Ivanov
3c8c16022a Merge "Remove the warning about empty LD_LIBRARY_PATH" 2015-11-16 22:25:50 +00:00
Dmitriy Ivanov
fbfba64068 Remove the warning about empty LD_LIBRARY_PATH
Change-Id: I3eca11512d8055ab94dd0a6badcd83ce6440d675
2015-11-16 14:23:37 -08:00
Yabin Cui
e7c2fffa16 Implement pthread barrier.
Bug: 24341262
Change-Id: I5472549e5d7545c1c3f0bef78235f545557b9630
2015-11-16 14:02:26 -08:00
Chih-hung Hsieh
4d87f17621 Merge "Enable clang to compile more tests."
am: 949bfb9e3c

* commit '949bfb9e3cceac7913fe1debc39617c9ec01ae5e':
  Enable clang to compile more tests.
2015-11-16 21:36:51 +00:00
Chih-hung Hsieh
949bfb9e3c Merge "Enable clang to compile more tests." 2015-11-16 21:31:36 +00:00
Dimitry Ivanov
b061c9250d Merge "Fix arm64 and x86 builds"
am: 61f186d067

* commit '61f186d067a3efb6a86450092a567fb18c1641c3':
  Fix arm64 and x86 builds
2015-11-16 21:25:31 +00:00
Dimitry Ivanov
61f186d067 Merge "Fix arm64 and x86 builds" 2015-11-16 21:23:18 +00:00
Dmitriy Ivanov
d9b08a0bc0 Fix arm64 and x86 builds
Change-Id: Ic3746b2f200f42218b6ac857c1631e873c767c17
2015-11-16 13:17:27 -08:00
Dimitry Ivanov
2616cdcdb9 Merge "Introducing linker namespaces"
am: 1f0ccbb59c

* commit '1f0ccbb59cd32dfad0e6d9fd9619905e067076a6':
  Introducing linker namespaces
2015-11-16 20:21:05 +00:00
Dimitry Ivanov
1f0ccbb59c Merge "Introducing linker namespaces" 2015-11-16 20:14:37 +00:00
Chih-Hung Hsieh
1e79540807 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
2015-11-16 11:36:15 -08:00
Dmitriy Ivanov
42d5fcb9f4 Introducing linker namespaces
Bug: http://b/22548808
Change-Id: Ia3af3c0a167f1d16447a3d83bb045d143319b1e1
2015-11-15 12:09:16 -08:00
Elliott Hughes
69536213d6 Merge "Improve libc time zone fallback behavior."
am: 1b42c54471

* commit '1b42c544711316281e09c5da25850fac531b27cb':
  Improve libc time zone fallback behavior.
2015-11-13 18:28:57 +00:00
Elliott Hughes
1b42c54471 Merge "Improve libc time zone fallback behavior." 2015-11-13 18:24:41 +00:00
Elliott Hughes
d1c28a361b 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
2015-11-13 08:38:48 -08:00
Elliott Hughes
5187baa387 Merge "Fix strftime if tm_zone is null."
am: 5780f9d809

* commit '5780f9d80963fbe7b93f501dd3dd7edc7fab46b0':
  Fix strftime if tm_zone is null.
2015-11-13 03:04:31 +00:00
Elliott Hughes
5780f9d809 Merge "Fix strftime if tm_zone is null." 2015-11-13 02:58:30 +00:00
Nick Kralevich
bb725f7b77 Merge "FORTIFY_SOURCE: make sure gcc unittests are compiled with gcc"
am: 4ea67f6950

* commit '4ea67f695066b73796b24563d83e8b5a9190334d':
  FORTIFY_SOURCE: make sure gcc unittests are compiled with gcc
2015-11-13 01:12:41 +00:00
Nick Kralevich
4ea67f6950 Merge "FORTIFY_SOURCE: make sure gcc unittests are compiled with gcc" 2015-11-13 01:09:44 +00:00
Elliott Hughes
a9cac4c87a 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
2015-11-12 16:51:31 -08:00
Nick Kralevich
2ed1b29d00 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
2015-11-12 15:55:13 -08:00
Chih-hung Hsieh
a2e9d90811 Merge "Still cannot compile with clang on arm64."
am: 7c10ee9473

* commit '7c10ee9473b5c46da733b2d3d24cf90fb8ac7672':
  Still cannot compile with clang on arm64.
2015-11-12 20:51:05 +00:00
Chih-hung Hsieh
7c10ee9473 Merge "Still cannot compile with clang on arm64." 2015-11-12 20:45:48 +00:00
Chih-Hung Hsieh
c04647f8c2 Still cannot compile with clang on arm64.
When __cxa_thread_atexit_impl.cpp is compiled with clang on arm64,
Android cannot boot up.

BUG: 25662915
Change-Id: If997b544f43e956172ce605d86fe147d42fd39e0
2015-11-12 12:39:13 -08:00
Chih-hung Hsieh
c0116bd3db Merge "Enable clang for modules failed with TLS."
am: 0c447053de

* commit '0c447053de4b87d50ebec260c7e1d949fe934065':
  Enable clang for modules failed with TLS.
2015-11-12 01:09:37 +00:00
Chih-hung Hsieh
0c447053de Merge "Enable clang for modules failed with TLS." 2015-11-12 01:04:51 +00:00
Elliott Hughes
fd57638117 Merge "Clean up pthread_gettid_np test."
am: dbc6398e95

* commit 'dbc6398e95df44a18715ce5ba19b8e1a93b969d4':
  Clean up pthread_gettid_np test.
2015-11-12 01:04:38 +00:00
Elliott Hughes
dbc6398e95 Merge "Clean up pthread_gettid_np test." 2015-11-12 00:59:08 +00:00
Chih-Hung Hsieh
5058a005b8 Enable clang for modules failed with TLS.
New 3.8 clang/llvm can compile TLS code now.
* For x86_64, still disable clang due to f128 bug.
* For b/25643775, arm and arm64, disable clang in unit tests.
* Fix thread_local_test.cpp to compile with clang and
  limit gcc workaround only to arm and aarch64.

BUG: 25643775

Change-Id: Iecd006bf1fc417dbcce2c63343a59c4bf1fa77ea
2015-11-11 16:22:38 -08:00
Josh Gao
504e3274a0 Merge "Add 100 column limit to .clang-format."
am: b03e6bf924

* commit 'b03e6bf9247bb36162b9f4c61d07e488a18e126c':
  Add 100 column limit to .clang-format.
2015-11-11 22:25:42 +00:00
Josh Gao
b03e6bf924 Merge "Add 100 column limit to .clang-format." 2015-11-11 22:22:59 +00:00
Josh Gao
615f3aa8b4 Add 100 column limit to .clang-format.
Change-Id: I3c3fa5e61cfb2af7f2888dcee56229692ec1479c
2015-11-11 14:21:09 -08:00
Elliott Hughes
f208361b2b Clean up pthread_gettid_np test.
Change-Id: I0fad26c7824981bfa3ad3a8a0b28a1984062dcd1
2015-11-11 13:32:28 -08:00
Elliott Hughes
2b1e258fec Merge "Fix potential race condition on CTS TC pthread_gettid_np"
am: ffe5c24c86

* commit 'ffe5c24c8693f1f4fc8edb68075fb36df558b801':
  Fix potential race condition on CTS TC pthread_gettid_np
2015-11-11 21:25:38 +00:00
Elliott Hughes
ffe5c24c86 Merge "Fix potential race condition on CTS TC pthread_gettid_np" 2015-11-11 21:21:33 +00:00
Junjie Hu
de1246202a Fix potential race condition on CTS TC pthread_gettid_np
Root cause:
If start_routine thread exits before pthread_gettid_np is invokded, the "tid" field
will be cleared so that pthread_gettid_np will get "0" (which is cleared by kernel, 
due to the flag "CLONE_CHILD_CLEARTID" is set while calling clone system call inside
pthread_create).

Proposed patch:
Use a mutex to guarantee pthread_gettid_np will be invoked and returned before the
start_routine exits

Signed-off-by: Junjie Hu <junjie.hu@mediatek.com>

Change-Id: I22411f1b0f7446d76a0373cef4ccec858fac7018
(cherry picked from commit 4f8010293506d4e08d184e66bf4af44ef3483611)
2015-11-11 21:21:21 +00:00
Nick Kralevich
8640233fef Merge "libc_init_common.cpp: Clarify when environment stripping occurs"
am: 6209b99a73

* commit '6209b99a7351ed732ab25bb2ffa75465366b244f':
  libc_init_common.cpp: Clarify when environment stripping occurs
2015-11-11 02:09:36 +00:00
Nick Kralevich
6209b99a73 Merge "libc_init_common.cpp: Clarify when environment stripping occurs" 2015-11-11 02:06:59 +00:00
Nick Kralevich
2fb02651c8 libc_init_common.cpp: Clarify when environment stripping occurs
The current comment implies that we only strip sensitive
environment variables on executing a setuid program. This is
true but incomplete. The AT_SECURE flag is set whenever a
security transition occurs, such as executing a setuid program,
SELinux security transition, executing a file with file capabilities,
etc...

Fixup the comments.

Change-Id: I30a73992adfde14d6e5f642b3a1ead2ee56726be
2015-11-10 16:45:49 -08:00
Tom Cherry
8e86f33690 Merge "Refactor prop_area into a class"
am: 2a7f1b335d

* commit '2a7f1b335dcd08a480c4acc948ba202bae1a0a1f':
  Refactor prop_area into a class
2015-11-10 21:58:23 +00:00
Tom Cherry
2a7f1b335d Merge "Refactor prop_area into a class" 2015-11-10 21:54:39 +00:00
Tom Cherry
926ebe1094 Refactor prop_area into a class
Bug 21852512

Change-Id: I432bf592f1a71a046c32616fc334ad77c220f0ca
2015-11-09 17:22:44 -08:00
Josh Gao
2fdaa6c599 Merge "Fix test failure."
am: 11b3916b83

* commit '11b3916b83e33fce9e3123659fe4e61ef84d39b5':
  Fix test failure.
2015-11-10 00:10:20 +00:00
Josh Gao
11b3916b83 Merge "Fix test failure." 2015-11-10 00:08:09 +00:00
Josh Gao
09fac86ca3 Fix test failure.
Bug: http://b/25596173
Change-Id: I0cf8f550837d4a936d6a784063a0ec9509150358
2015-11-09 16:04:50 -08:00
Dan Willemsen
dcf501913d Merge "Update Android.bp with latest Android.mk changes"
am: 704e048cbf

* commit '704e048cbfcb69b7906371f9f4cae4cb6357096e':
  Update Android.bp with latest Android.mk changes
2015-11-09 22:31:50 +00:00
Dan Willemsen
704e048cbf Merge "Update Android.bp with latest Android.mk changes" 2015-11-09 22:28:18 +00:00
Dan Willemsen
dc6b0a7b93 Update Android.bp with latest Android.mk changes
Change-Id: I45f6292fcc4d4559519d88f948b4478204b08f25
2015-11-09 14:03:46 -08:00
Yabin Cui
a74eb4dbf5 Merge "Add fileno_unlocked to support thread sanitizer."
am: 0e6542b75b

* commit '0e6542b75b2f3ca155b452782d2122f34f807485':
  Add fileno_unlocked to support thread sanitizer.
2015-11-07 00:30:09 +00:00
Yabin Cui
0e6542b75b Merge "Add fileno_unlocked to support thread sanitizer." 2015-11-07 00:24:52 +00:00
Yabin Cui
fb994f4c04 Add fileno_unlocked to support thread sanitizer.
Bug: 25392375
Change-Id: If3f92a0e08a53f4b59e01397e8efa307d8572349
2015-11-06 16:13:47 -08:00
Elliott Hughes
4eba804ca0 Merge "fix the mremap signature"
am: 8b5b2c4672

* commit '8b5b2c467281de502ba1c8ffbe447ef95fbf5219':
  fix the mremap signature
2015-11-06 21:24:59 +00:00
Elliott Hughes
8b5b2c4672 Merge "fix the mremap signature" 2015-11-06 21:18:08 +00:00
Daniel Micay
4200e260d2 fix the mremap signature
The mremap definition was incorrect (unsigned long instead of int) and
it was missing the optional new_address parameter.

Change-Id: Ib9d0675aaa098c21617cedc9b2b8cf267be3aec4
2015-11-06 13:14:43 -08:00
Dimitry Ivanov
bc0b61e407 Merge "linker: cleanup solist after unsuccessful read"
am: 3482613685

* commit '3482613685342da365a7569220f8e6c27a1fe7e5':
  linker: cleanup solist after unsuccessful read
2015-11-06 19:02:08 +00:00
Dimitry Ivanov
3482613685 Merge "linker: cleanup solist after unsuccessful read" 2015-11-06 19:00:24 +00:00
Dmitriy Ivanov
fd7a91e692 linker: cleanup solist after unsuccessful read
Bug: http://b/25560017
Change-Id: I03c5a1d7aed34c480d341aacfb3b1afdfa037b99
2015-11-06 10:44:37 -08:00
Dimitry Ivanov
2dc1e91dba Merge "Fix linked_list::remove_if()"
am: 004fead6bc

* commit '004fead6bc55d1e65b4fb9ca1ac36646b99e5fdd':
  Fix linked_list::remove_if()
2015-11-06 02:35:02 +00:00
Dimitry Ivanov
004fead6bc Merge "Fix linked_list::remove_if()" 2015-11-06 02:32:34 +00:00
Dmitriy Ivanov
7a9311f7f1 Fix linked_list::remove_if()
When remove_if removes last element from the list
following push_back stops working.

Change-Id: Ia3e92763b83a2e172eaa10de7aecfb7a4be452d7
2015-11-05 17:41:05 -08:00
Colin Cross
10c6a7c7b9 Merge "Use cc_defaults"
am: ef5e647891

* commit 'ef5e647891f1a0aefeab4a87e9225e47087c6301':
  Use cc_defaults
2015-11-05 02:00:22 +00:00
Colin Cross
ef5e647891 Merge "Use cc_defaults" 2015-11-05 01:56:58 +00:00
Josh Gao
824084ce76 Merge "Fix GNU/POSIX basename headers."
am: dd7dcfcfdb

* commit 'dd7dcfcfdbab3b38fc40551defdf81c3b734e336':
  Fix GNU/POSIX basename headers.
2015-11-04 22:28:19 +00:00
Josh Gao
dd7dcfcfdb Merge "Fix GNU/POSIX basename headers." 2015-11-04 22:26:13 +00:00
Josh Gao
eb9b925012 Fix GNU/POSIX basename headers.
Including glibc's <libgen.h> will result in the user getting the POSIX
version of basename always, regardless of when it is included relative
to <string.h>. Prior to this patch, our implementation would result in
the one that's included first winning.

Bug: http://b/25459151
Change-Id: Id4aaf1670dad317d6bbc05763a84ee87596e8e59
2015-11-04 14:19:55 -08:00
Colin Cross
50c21ab47d Use cc_defaults
Use a cc_defaults module to reduce duplication.

Change-Id: Iaee6bf20b84123babcdc68d4feb06308f5f61a59
2015-11-03 17:25:36 -08:00
Dan Willemsen
021d959eba Merge "Update Android.bp with arch-specific version scripts"
am: 4b920f042a

* commit '4b920f042ac4b35c4dd3ff51f7b8f164a22e3500':
  Update Android.bp with arch-specific version scripts
2015-11-03 23:26:08 +00:00
Josh Gao
a59479434c Merge "fix PTRDIFF_MAX check in the 32-bit mmap wrapper"
am: af909869d8

* commit 'af909869d868585a47914ab51536192da50935cb':
  fix PTRDIFF_MAX check in the 32-bit mmap wrapper
2015-11-03 23:25:55 +00:00
Dan Willemsen
4b920f042a Merge "Update Android.bp with arch-specific version scripts" 2015-11-03 22:38:23 +00:00
Dan Willemsen
9e6f98fe9d Update Android.bp with arch-specific version scripts
Change-Id: I59b34f21b54e8a2084bb318a08c4092064f48083
2015-11-03 14:30:57 -08:00
Bill Yi
a4bff2106b Merge commit '6ebfb7b4ea158005a725f43564267e0aed764d80' into HEAD 2015-11-03 14:28:57 -08:00
Josh Gao
af909869d8 Merge "fix PTRDIFF_MAX check in the 32-bit mmap wrapper" 2015-11-03 19:35:05 +00:00
Daniel Micay
706186d266 fix PTRDIFF_MAX check in the 32-bit mmap wrapper
It wasn't making use of the page-rounded size.

Change-Id: I911345fcfd6419a4dbc18a4622b42e1b76729abb
2015-11-03 05:30:29 -05:00
Christopher Ferris
9fe02f3e3c Merge "Fix comment to reflect the actual reality."
am: e07558fb80

* commit 'e07558fb80da4e196e8b7e371041c1e75c56b29b':
  Fix comment to reflect the actual reality.
2015-11-02 21:10:19 +00:00
Dimitry Ivanov
86bf87c054 Merge "Generate libdl.so per-architecture version script"
am: 75dd3710e7

* commit '75dd3710e72e819ce6710e93672f937550ed3818':
  Generate libdl.so per-architecture version script
2015-10-31 18:20:28 +00:00
Christopher Ferris
0ba085de2c Merge "Make _signal hidden in all cases."
am: 6a8a09f7c4

* commit '6a8a09f7c40fb677a8dc8a233b58f62df8ae79dc':
  Make _signal hidden in all cases.
2015-10-31 16:15:17 +00:00
Elliott Hughes
a8f69017e5 Merge "Add prlimit to LP32."
am: c36be975ce

* commit 'c36be975ce4525b452435f43beb1fb9fc26a7fdc':
  Add prlimit to LP32.
2015-10-30 23:40:48 +00:00
Elliott Hughes
caa61b03b2 Merge "Remove <sys/shm.h>."
am: bdac9ec142

* commit 'bdac9ec142347a0dc9784bddd0f8336535e73529':
  Remove <sys/shm.h>.
2015-10-30 22:16:58 +00:00
Christopher Ferris
6297e3231c Merge "Move __set_errno to ndk_cruft.cpp."
am: e75453d5dd

* commit 'e75453d5dd8b373f6e7ef61ec22a6a3074d51e02':
  Move __set_errno to ndk_cruft.cpp.
2015-10-30 16:06:45 +00:00
Dimitry Ivanov
6ebfb7b4ea Merge "Fix mips and x86 builds" am: 50e9279589
am: fedb167c55

* commit 'fedb167c551540133d88d46a1de7c17b865cbf32':
  Fix mips and x86 builds
2015-10-29 00:59:46 +00:00
Dimitry Ivanov
fedb167c55 Merge "Fix mips and x86 builds"
am: 50e9279589

* commit '50e92795890c0d8b4bf54c535f66f3b2edf7bd59':
  Fix mips and x86 builds
2015-10-29 00:56:57 +00:00
Dimitry Ivanov
316938a676 Merge "Fix LDFLAGS for arm and x86" am: 5ccad497d4
am: bd5bf272a0

* commit 'bd5bf272a0fbb65ad1658106cde4c2ec5f5ce520':
  Fix LDFLAGS for arm and x86
2015-10-29 00:50:51 +00:00
Dimitry Ivanov
bd5bf272a0 Merge "Fix LDFLAGS for arm and x86"
am: 5ccad497d4

* commit '5ccad497d43e7587ec5581845e5094488093f76d':
  Fix LDFLAGS for arm and x86
2015-10-29 00:47:16 +00:00
Dimitry Ivanov
c5f943eb2e Merge "Generate per-architecture version scripts." am: 578d949e8d
am: b420ddd27e

* commit 'b420ddd27e1ce0becf0e57c0fc0efe9ec726ab21':
  Generate per-architecture version scripts.
2015-10-28 23:55:10 +00:00
Dimitry Ivanov
b420ddd27e Merge "Generate per-architecture version scripts."
am: 578d949e8d

* commit '578d949e8df782134127b4ae384f731d9d7c6694':
  Generate per-architecture version scripts.
2015-10-28 23:51:49 +00:00
Elliott Hughes
7f337bd1e3 Merge "Remove the legacy endusershell/getusershell/setusershell stubs." am: d9146c2404
am: 601183efaf

* commit '601183efafffb2a145736b4a3f73be1034d761b0':
  Remove the legacy endusershell/getusershell/setusershell stubs.
2015-10-28 23:48:12 +00:00
Elliott Hughes
601183efaf Merge "Remove the legacy endusershell/getusershell/setusershell stubs."
am: d9146c2404

* commit 'd9146c24041ad571e3725ab630d9ac94df3ff6d1':
  Remove the legacy endusershell/getusershell/setusershell stubs.
2015-10-28 23:43:05 +00:00
Elliott Hughes
2c11b07ee0 Merge "Implement scandirat and scandirat64." am: 1721be2229
am: a1be410fd7

* commit 'a1be410fd7f916063164fd9daf28ca992af828d7':
  Implement scandirat and scandirat64.
2015-10-27 22:02:54 +00:00
Elliott Hughes
a1be410fd7 Merge "Implement scandirat and scandirat64."
am: 1721be2229

* commit '1721be2229d07b5eea830f02a76e7be56d172aa9':
  Implement scandirat and scandirat64.
2015-10-27 21:57:55 +00:00
Dimitry Ivanov
75347e52b0 Merge "Implement load at fixed address feature" am: 5238eb0984
am: 9e599956b2

* commit '9e599956b2ece835b480182eee27209b4a831a19':
  Implement load at fixed address feature
2015-10-27 19:17:38 +00:00
Dimitry Ivanov
9e599956b2 Merge "Implement load at fixed address feature"
am: 5238eb0984

* commit '5238eb09844f9c1578353d4c9e297aadb34c71be':
  Implement load at fixed address feature
2015-10-27 19:12:34 +00:00
Elliott Hughes
3b9b14830b Merge "Fix <utmp.h> declarations." am: 60752a2eea
am: 6e780f2f47

* commit '6e780f2f47655ce264cfe90c4a721eb609fdbfec':
  Fix <utmp.h> declarations.
2015-10-27 15:15:10 +00:00
Elliott Hughes
6e780f2f47 Merge "Fix <utmp.h> declarations."
am: 60752a2eea

* commit '60752a2eeab8cd0b344b27c67a47e30628962211':
  Fix <utmp.h> declarations.
2015-10-27 15:11:58 +00:00
Elliott Hughes
164bd7349b Merge "Remove swap16/swap32/swap64 header pollution." am: a2cf3783d4
am: 00e9bfe523

* commit '00e9bfe523a045131142b13a766774f1ee43555e':
  Remove swap16/swap32/swap64 header pollution.
2015-10-27 02:14:39 +00:00
Elliott Hughes
00e9bfe523 Merge "Remove swap16/swap32/swap64 header pollution."
am: a2cf3783d4

* commit 'a2cf3783d4e9a4008ed468ef3204593f8f549934':
  Remove swap16/swap32/swap64 header pollution.
2015-10-27 02:11:17 +00:00
Dimitry Ivanov
159f0d4013 Merge "Implement Library Load Order Randomization" am: 6a4ddeb56e
am: 3d784087cd

* commit '3d784087cd292f5ed10f9560f28152db3c4d550e':
  Implement Library Load Order Randomization
2015-10-26 22:43:06 +00:00
Dimitry Ivanov
3d784087cd Merge "Implement Library Load Order Randomization"
am: 6a4ddeb56e

* commit '6a4ddeb56ef2144e98437ae82f84b09ea785e411':
  Implement Library Load Order Randomization
2015-10-26 22:38:01 +00:00
Christopher Ferris
382524878a Merge "Fix arm64 fenv warnings, and make warnings errors." am: 1ab8251030
am: 25a7efa7e9

* commit '25a7efa7e9a4bee5cae872c59a5edab8cae147da':
  Fix arm64 fenv warnings, and make warnings errors.
2015-10-24 16:10:07 +00:00
Christopher Ferris
25a7efa7e9 Merge "Fix arm64 fenv warnings, and make warnings errors."
am: 1ab8251030

* commit '1ab8251030407ec397009b46db025f8e9688abc8':
  Fix arm64 fenv warnings, and make warnings errors.
2015-10-24 16:06:17 +00:00
Christopher Ferris
c9ad2274b2 Merge "Rename LIBC64_HIDDEN to LIBC32_LEGACY_PUBLIC." am: ca430d9787
am: c5b9c4d72f

* commit 'c5b9c4d72f141fea8b03561c0c8f5f7068ea93ea':
  Rename LIBC64_HIDDEN to LIBC32_LEGACY_PUBLIC.
2015-10-23 21:08:31 +00:00
Dimitry Ivanov
172cdd79a5 Merge "refactoring: introduce MappedFileFragment" am: e08ab4b414
am: 67e282d511

* commit '67e282d5111fd8920b271dd1bbbb7348e06f719f':
  refactoring: introduce MappedFileFragment
2015-10-23 21:08:26 +00:00
Christopher Ferris
c5b9c4d72f Merge "Rename LIBC64_HIDDEN to LIBC32_LEGACY_PUBLIC."
am: ca430d9787

* commit 'ca430d9787f1c11c2df8e908c64fe2ef2e6d54ed':
  Rename LIBC64_HIDDEN to LIBC32_LEGACY_PUBLIC.
2015-10-23 21:02:56 +00:00
Dimitry Ivanov
67e282d511 Merge "refactoring: introduce MappedFileFragment"
am: e08ab4b414

* commit 'e08ab4b4144b8c4c920221b403daa220b43df2fb':
  refactoring: introduce MappedFileFragment
2015-10-23 21:02:51 +00:00
Andreas Gampe
bdff4ce8ed resolve merge conflicts of 216bff9ff3 to mnc-dr-dev.
am: 807032d0e1

* commit '807032d0e12877a4c92ac7f6072d5dd9e1f76f3c':
  Sync with upstream NetBSD lib/libc/regex.
2015-10-23 05:39:52 +00:00
Andreas Gampe
807032d0e1 resolve merge conflicts of 216bff9ff3 to mnc-dr-dev.
Change-Id: I63c4f3a4e56f30d6f476ad2c623c23ee7e1a3778
2015-10-22 22:15:26 -07:00
Yabin Cui
12b46fb00e Merge "Use bionic lock in pthread_internal_t." am: c45f3bf3e6
am: 0507b6e9e6

* commit '0507b6e9e65132a95bc0e366faa0df729b219b43':
  Use bionic lock in pthread_internal_t.
2015-10-23 04:36:12 +00:00
Yabin Cui
0507b6e9e6 Merge "Use bionic lock in pthread_internal_t."
am: c45f3bf3e6

* commit 'c45f3bf3e691f48af63c5ea2bf7a348a698013ac':
  Use bionic lock in pthread_internal_t.
2015-10-23 04:32:44 +00:00
Christopher Ferris
216bff9ff3 resolve merge conflicts of d676080a37 to lmp-mr1-ub-dev.
am: afff4442ae

* commit 'afff4442ae092469f298a71862d61c65ceb67b03':
  Sync with upstream NetBSD lib/libc/regex.
2015-10-22 22:27:54 +00:00
Christopher Ferris
afff4442ae resolve merge conflicts of d676080a37 to lmp-mr1-ub-dev.
Change-Id: I56c1bb2adb4b6a48733c928415e788e689b4944e
2015-10-21 14:56:52 -07:00
Elliott Hughes
d676080a37 Sync with upstream NetBSD lib/libc/regex.
am: 055a66c9b1

* commit '055a66c9b1017c01b82c12b65a571bf9efad8b19':
  Sync with upstream NetBSD lib/libc/regex.
2015-10-21 21:45:01 +00:00
Dan Willemsen
258a775d75 Merge "Switch to LOCAL_SRC_FILES_EXCLUDE" am: 5edf077c5b
am: 788eae7286

* commit '788eae728675bcf59f2b0809e85532c6ac357e2c':
  Switch to LOCAL_SRC_FILES_EXCLUDE
2015-10-20 20:58:25 +00:00
Dan Willemsen
788eae7286 Merge "Switch to LOCAL_SRC_FILES_EXCLUDE"
am: 5edf077c5b

* commit '5edf077c5b92f0db212e45ed5402339a6e4c7334':
  Switch to LOCAL_SRC_FILES_EXCLUDE
2015-10-20 20:52:01 +00:00
Mike Frysinger
4e0c4032d1 Merge "dlfcn: update ifdef around old_name_" am: 5c495dacda
am: 0fb6704e82

* commit '0fb6704e82fef450a01cca3b13d2fa02f66d47a5':
  dlfcn: update ifdef around old_name_
2015-10-20 18:42:59 +00:00
Mike Frysinger
0fb6704e82 Merge "dlfcn: update ifdef around old_name_"
am: 5c495dacda

* commit '5c495dacdadff9dfbe48be31d4b30c5fe75ac7db':
  dlfcn: update ifdef around old_name_
2015-10-20 18:31:32 +00:00
Josh Gao
56ecb9bf2a Merge "Remove deprecated use of ldm/stm in ARM setjmp." am: f5ea085844
am: 053867ded8

* commit '053867ded82271f3f2795f3dcf62b4e7735619c8':
  Remove deprecated use of ldm/stm in ARM setjmp.
2015-10-20 01:48:47 +00:00
Josh Gao
053867ded8 Merge "Remove deprecated use of ldm/stm in ARM setjmp."
am: f5ea085844

* commit 'f5ea085844c66e7a65709edd7485a49396e556ce':
  Remove deprecated use of ldm/stm in ARM setjmp.
2015-10-20 01:30:32 +00:00
Elliott Hughes
64f628f8d3 am 43b1f823: am 1a61896b: am 98384649: am 75316283: am 2d23418e: am 18442e02: (-s ours) am beb6e08a: Sync with upstream NetBSD lib/libc/regex.
* commit '43b1f823b5a739437cbe14e24d8449028e3c8f6e':
  Sync with upstream NetBSD lib/libc/regex.
2015-10-19 17:46:59 +00:00
Elliott Hughes
055a66c9b1 Sync with upstream NetBSD lib/libc/regex.
Bug: http://b/22850181
Change-Id: I11a51a2031e68a953ccd5691da98c699c7d01904

(cherry-picked from commit 71927a82379f7a72559ea96e6678d6215090937f)
2015-10-19 10:42:31 -07:00
Elliott Hughes
43b1f823b5 am 1a61896b: am 98384649: am 75316283: am 2d23418e: am 18442e02: (-s ours) am beb6e08a: Sync with upstream NetBSD lib/libc/regex.
* commit '1a61896b1bc470f9377eeeafec461aba0d0dda6c':
  Sync with upstream NetBSD lib/libc/regex.
2015-10-19 17:32:59 +00:00
Elliott Hughes
1a61896b1b am 98384649: am 75316283: am 2d23418e: am 18442e02: (-s ours) am beb6e08a: Sync with upstream NetBSD lib/libc/regex.
* commit '98384649b2d3f3eb5b03077bc0004e14a99a4d55':
  Sync with upstream NetBSD lib/libc/regex.
2015-10-19 17:29:49 +00:00
Elliott Hughes
98384649b2 am 75316283: am 2d23418e: am 18442e02: (-s ours) am beb6e08a: Sync with upstream NetBSD lib/libc/regex.
* commit '753162836a0d3a82739611c9e30aa872363558b1':
  Sync with upstream NetBSD lib/libc/regex.
2015-10-19 17:25:29 +00:00
Elliott Hughes
753162836a am 2d23418e: am 18442e02: (-s ours) am beb6e08a: Sync with upstream NetBSD lib/libc/regex.
* commit '2d23418e68acdab7e142cc75db2850a54aa829aa':
  Sync with upstream NetBSD lib/libc/regex.
2015-10-19 10:14:41 -07:00
Elliott Hughes
2d23418e68 am 18442e02: (-s ours) am beb6e08a: Sync with upstream NetBSD lib/libc/regex.
* commit '18442e023536c5cf205b820ed5d74b972b710acb':
  Sync with upstream NetBSD lib/libc/regex.
2015-10-19 10:07:34 -07:00
Elliott Hughes
18442e0235 am beb6e08a: Sync with upstream NetBSD lib/libc/regex.
* commit 'beb6e08abf1393663151afde2742bb23eccab4e1':
  Sync with upstream NetBSD lib/libc/regex.
2015-10-19 15:34:19 +00:00
Elliott Hughes
630855a6d5 am 6764e0b5: am d29ba555: Merge "Opt Brillo out of the ndk cruft."
* commit '6764e0b5e546c318d13fcac0ddbf0bea88271768':
  Opt Brillo out of the ndk cruft.
2015-10-17 03:16:47 +00:00
Elliott Hughes
6764e0b5e5 am d29ba555: Merge "Opt Brillo out of the ndk cruft."
* commit 'd29ba555130f1e61164cf6186cd6a29c7aa14719':
  Opt Brillo out of the ndk cruft.
2015-10-16 20:10:48 -07:00
Elliott Hughes
beb6e08abf Sync with upstream NetBSD lib/libc/regex.
Bug: http://b/22850181
(cherry-picked from commit 71927a82379f7a72559ea96e6678d6215090937f)

Change-Id: I11a51a2031e68a953ccd5691da98c699c7d01904
2015-10-16 17:52:55 -07:00
Dimitry Ivanov
a60b1aebb7 am 114605b0: am 5fd94dfe: Merge "Replace auto -> const auto&/auto&&"
* commit '114605b03666230f11113990b828356bfe692278':
  Replace auto -> const auto&/auto&&
2015-10-16 20:48:32 +00:00
Dimitry Ivanov
56cd1962b2 am c0e917ab: am 9c2122e8: Merge "Fix R_AARCH64_ABS/PREL relocations"
* commit 'c0e917abe5e94ce9729a8302b5ef3cb318003ea5':
  Fix R_AARCH64_ABS/PREL relocations
2015-10-16 20:48:30 +00:00
Dimitry Ivanov
114605b036 am 5fd94dfe: Merge "Replace auto -> const auto&/auto&&"
* commit '5fd94dfe3b36ee56e54d2002ad3a5e0fa8bff683':
  Replace auto -> const auto&/auto&&
2015-10-16 13:41:45 -07:00
Dimitry Ivanov
c0e917abe5 am 9c2122e8: Merge "Fix R_AARCH64_ABS/PREL relocations"
* commit '9c2122e803a01c80bef550eac2b24b5a79635a2a':
  Fix R_AARCH64_ABS/PREL relocations
2015-10-16 13:41:44 -07:00
Neil Fuller
3676052ce7 am 842866bd: Merge "Update timezone data to 2015g" into mnc-dr-dev
* commit '842866bd00220119e03fd8d2e6b77d7187b4b38c':
  Update timezone data to 2015g
2015-10-15 09:21:59 +00:00
Neil Fuller
842866bd00 Merge "Update timezone data to 2015g" into mnc-dr-dev 2015-10-15 08:25:58 +00:00
Dmitriy Ivanov
845dd0266b resolved conflicts for 95ac6dbb to mnc-dr-dev-plus-aosp
Change-Id: I8937cd33aa375824965d4f919038a99b30ab75ea
2015-10-14 18:41:36 -07:00
Dimitry Ivanov
c70d479dc6 am 8c9cb682: am 074efa02: Merge "Ensure that readlink has access to /proc/self/fd"
* commit '8c9cb6820fca3f73414219d816e10355a7052dbd':
  Ensure that readlink has access to /proc/self/fd
2015-10-15 01:37:37 +00:00
Dimitry Ivanov
8c9cb6820f am 074efa02: Merge "Ensure that readlink has access to /proc/self/fd"
* commit '074efa02a7de67589c36f75222e3b45c3f15206a':
  Ensure that readlink has access to /proc/self/fd
2015-10-15 01:31:15 +00:00
Christopher Ferris
9e2d37ccae am 3c30a156: Merge "Sync with upstream NetBSD lib/libc/regex." into mnc-dr-dev
* commit '3c30a156523f40250361e6ed8791919d1c71a4bb':
  Sync with upstream NetBSD lib/libc/regex.
2015-10-15 01:29:05 +00:00
Dimitry Ivanov
95ac6dbbb2 Merge "Ensure that readlink has access to /proc/self/fd" into mnc-dr-dev 2015-10-15 01:17:55 +00:00
Christopher Ferris
3c30a15652 Merge "Sync with upstream NetBSD lib/libc/regex." into mnc-dr-dev 2015-10-15 01:15:22 +00:00
Josh Gao
b16f1b4b89 am 559d9cf5: am c433a36f: Merge "Move malloc dispatch table to __libc_globals."
* commit '559d9cf5fa6d5339d1578530a73ecb81a91c27d9':
  Move malloc dispatch table to __libc_globals.
2015-10-14 23:54:59 +00:00
Josh Gao
559d9cf5fa am c433a36f: Merge "Move malloc dispatch table to __libc_globals."
* commit 'c433a36fb5fb8a1050e8ecbd94d215123b829e07':
  Move malloc dispatch table to __libc_globals.
2015-10-14 23:50:51 +00:00
Elliott Hughes
9a9572d577 Sync with upstream NetBSD lib/libc/regex.
Bug: http://b/22850181

(cherry picked from commit 71927a82379f7a72559ea96e6678d6215090937f)

Change-Id: I4a914f0594a66f38efb3026b7ba9d28a4887cb2d
2015-10-14 16:30:08 -07:00
Dmitriy Ivanov
cf92738fa5 Ensure that readlink has access to /proc/self/fd
/proc/self/fd is not available when PR_DUMPABLE is set to 0
which is default for the user builds. It leads to permission
denials on readlink.

This change fixes the problem by setting PR_DUMPABLE flag to 1
for readlink and restoring it's previous value after the call.

Bug: http://b/24912743
Change-Id: I3fd179c5c6b56af96d6a15ee597024ccb15e1a13
2015-10-14 11:15:45 -07:00
Neil Fuller
cd9278798a Update timezone data to 2015g
Changes affecting future time stamps

    Turkey's 2015 fall-back transition is scheduled for Nov. 8, not Oct. 25.
    (Thanks to Fatih.)

    Norfolk moves from +1130 to +1100 on 2015-10-04 at 02:00 local time.
    (Thanks to Alexander Krivenyshev.)

    Fiji's 2016 fall-back transition is scheduled for January 17, not 24.
    (Thanks to Ken Rylander.)

    Fort Nelson, British Columbia will not fall back on 2015-11-01. It has
    effectively been on MST (-0700) since it advanced its clocks on 2015-03-08.
    New zone America/Fort_Nelson.  (Thanks to Matt Johnson.)

  Changes affecting past time stamps

    Norfolk observed DST from 1974-10-27 02:00 to 1975-03-02 02:00.

Bug: 24595281
(cherry-picked from commit 31740bfdb942399235e42ea920b6b717dfa0279c)

Change-Id: I6a57fbdaf12a4b4ebf2a760fd3bd872055621106
2015-10-14 08:54:17 +00:00
Josh Gao
87bb58064d am 36ebee4f: am 198d13e8: Merge "make mmap fail on requests larger than PTRDIFF_MAX"
* commit '36ebee4f495b0c49ed686221dfe127f4ccd12b52':
  make mmap fail on requests larger than PTRDIFF_MAX
2015-10-14 02:27:42 +00:00
Josh Gao
36ebee4f49 am 198d13e8: Merge "make mmap fail on requests larger than PTRDIFF_MAX"
* commit '198d13e8c25e69f7dbda3f5e1a3258b13fe8db5d':
  make mmap fail on requests larger than PTRDIFF_MAX
2015-10-14 02:21:04 +00:00
Dimitry Ivanov
b8ab96910f am 090278d6: am 11c2179d: Merge "Log dlopen failures caused by text relocations"
* commit '090278d6c6e3501836c70ce555996511b96a38d9':
  Log dlopen failures caused by text relocations
2015-10-13 23:01:36 +00:00
Dimitry Ivanov
090278d6c6 am 11c2179d: Merge "Log dlopen failures caused by text relocations"
* commit '11c2179d468bba3336c3a3e8418ddaa98f58afce':
  Log dlopen failures caused by text relocations
2015-10-13 22:53:03 +00:00
Dmitriy Ivanov
1002265d0a resolved conflicts for f32b689d to mnc-dr-dev-plus-aosp
Change-Id: I95f90eb68dcb4b3f4b3d80260b2285c78692b535
2015-10-13 14:59:20 -07:00
Dimitry Ivanov
7197c2909d am 5db60c04: am 30cd7065: Merge "Correctly resolve realpath for absolute paths"
* commit '5db60c04c68ed5f0d9ef9bc0e8c2a84062287b8d':
  Correctly resolve realpath for absolute paths
2015-10-13 20:51:11 +00:00
Dimitry Ivanov
5db60c04c6 am 30cd7065: Merge "Correctly resolve realpath for absolute paths"
* commit '30cd7065b6cd37342e23904cb512c409b8bbd4f1':
  Correctly resolve realpath for absolute paths
2015-10-13 20:43:36 +00:00
Dmitriy Ivanov
f32b689d3d Log dlopen failures caused by text relocations
Some apps will fail to load native libraries with
text relocations when switching target sdk version to M.
It could be hard to diagnose because some of them
suppress dlerror and/or UnsatisfiedLinkError.

This change unconditionally logs the error message making
the cause of the failure more visible to developers.

Bug: http://b/24876001
Change-Id: I0477a0d1307d0879000f3a3a43b974b4cf34bdb2
2015-10-13 11:13:19 -07:00
Neil Fuller
1cdd99bcb9 am 12b4f21e: am fb7f45b6: Merge "Update timezone data to 2015g"
* commit '12b4f21e1969b0eceeedb52b2ff0f77a1f791908':
  Update timezone data to 2015g
2015-10-13 09:24:08 +00:00
Neil Fuller
12b4f21e19 am fb7f45b6: Merge "Update timezone data to 2015g"
* commit 'fb7f45b6a3242c9a9a547705de08cf59e6b7f935':
  Update timezone data to 2015g
2015-10-13 09:14:17 +00:00
Dimitry Ivanov
433cdaa85f am 5a805d91: am a5ad727e: Merge "linker: Switch to clang"
* commit '5a805d919c0a531c0e8bbae746d192db218d625d':
  linker: Switch to clang
2015-10-13 01:46:10 +00:00
Dimitry Ivanov
5a805d919c am a5ad727e: Merge "linker: Switch to clang"
* commit 'a5ad727e7619f4497792d67ae05b8ef15315b362':
  linker: Switch to clang
2015-10-13 01:40:49 +00:00
Dmitriy Ivanov
78f1871f4e resolved conflicts for a828a2f8 to mnc-dr-dev-plus-aosp
Change-Id: Ibe8c145eaadcd1fa9229d8a6eda1e33c0e59fb12
2015-10-12 15:02:28 -07:00
Elliott Hughes
452ab8f7e3 am 25cba7df: Merge "Make struct FILE opaque."
* commit '25cba7df5120a32b144769843781442031fc597b':
  Make struct FILE opaque.
2015-10-12 20:40:41 +00:00
Elliott Hughes
7c585f2b01 am e7839263: Merge "Fix stdio read after EOF behavior."
* commit 'e78392637d5086384a5631ddfdfa8d7ec8326ee3':
  Fix stdio read after EOF behavior.
2015-10-12 15:23:48 +00:00
Elliott Hughes
d8c03b774e am 1ab3f303: Merge "Fix inet_aton on LP32."
* commit '1ab3f303d2e7c8cc498a28fc3c8d9ded1fc46994':
  Fix inet_aton on LP32.
2015-10-10 00:44:51 +00:00
Mike Frysinger
132b9c90fc am c6f704bf: Merge "utmp.h: add more ut_type defines"
* commit 'c6f704bf77576b2cf27decd8ee50c99aeeb9e209':
  utmp.h: add more ut_type defines
2015-10-09 23:37:18 +00:00
Josh Gao
ac47790ad8 am 902ab885: Merge "Move setjmp cookie to a shared globals struct."
* commit '902ab8859f360d81d6bd03a76a77900743018a15':
  Move setjmp cookie to a shared globals struct.
2015-10-09 23:33:32 +00:00
Josh Gao
dc9ff1b80b am 73a91218: Merge "Move VDSO pointers to a shared globals struct."
* commit '73a91218d1f0b334b97648461b19eed96e6c4336':
  Move VDSO pointers to a shared globals struct.
2015-10-09 23:33:30 +00:00
Elliott Hughes
8733118fa5 am 487a1823: Merge "Fix inet_addr/inet_aton/inet_network."
* commit '487a1823e8617011009eded8eae9a75c1f871887':
  Fix inet_addr/inet_aton/inet_network.
2015-10-09 22:53:45 +00:00
Elliott Hughes
c1d7d92201 am f41fe717: Merge "Sync with upstream tzcode (2015g)."
* commit 'f41fe717655f01affc1d8244ff9efccc04d86620':
  Sync with upstream tzcode (2015g).
2015-10-09 22:42:25 +00:00
Dimitry Ivanov
533d7e403d am 6a59289b: Merge "Remove textrels support for platform libs"
* commit '6a59289b06deafe5eed49d86753297c604eadc86':
  Remove textrels support for platform libs
2015-10-09 21:14:26 +00:00
Josh Gao
786807b26c am d8df28ff: Merge "Implement setjmp cookies on MIPS and MIPS64"
* commit 'd8df28ff3833e620db1b61dd4038028dd160c870':
  Implement setjmp cookies on MIPS and MIPS64
2015-10-09 18:39:57 +00:00
Dan Albert
17e3aec523 am 599af934: Merge "Fix bionic_coverage for kati."
* commit '599af9346e3ea697dda1b0c38a99cce842154307':
  Fix bionic_coverage for kati.
2015-10-08 22:08:28 +00:00
Dimitry Ivanov
ec48a72a00 am 268f7391: Merge "Make dt_runpath work for libraries opened from apk"
* commit '268f73917831e709bc6a201658c19ffb5c8cbfd1':
  Make dt_runpath work for libraries opened from apk
2015-10-08 22:08:17 +00:00
Torne (Richard Coles)
a828a2f8e6 linker: don't pass dlextinfo to dependent loads.
Don't pass the parent load's dlextinfo to dependent loads, since this
causes the linker to try to load the dependencies using the same
addresses/relro/fds/etc as the main library, which is never going to
work. This was how it worked before ae69a95 which broke this.

Bug: 23742664
Change-Id: I53d8cdf0982d8758e6d2ced4864c704cdf74118f
2015-10-08 12:28:39 -07:00
Josh Gao
10f71abc4e am cc56abbb: Merge "Add missing register preserve in x86/x86_64 longjmp."
* commit 'cc56abbb007e090b830f510df6cb300ae12e1a89':
  Add missing register preserve in x86/x86_64 longjmp.
2015-10-07 21:32:47 +00:00
Yabin Cui
b5e05d29b5 am f9604906: Merge "Remove the workaround which fixes JOB_COUNT in CTS test."
* commit 'f96049062f04a922fda937aecc562517101a38cc':
  Remove the workaround which fixes JOB_COUNT in CTS test.
2015-10-07 17:20:29 +00:00
Dimitry Ivanov
29fe356575 am 98be6be1: am 748421be: Merge "Fix linker tests"
* commit '98be6be171b3792c51d83d19f015052112f8ddbf':
  Fix linker tests
2015-10-05 20:24:37 +00:00
Elliott Hughes
8daf53db75 am df62e317: am 5c50449b: Merge "Use const auto& in for loops."
* commit 'df62e3171ca52cbdadb3c3edc93c42cfacbad054':
  Use const auto& in for loops.
2015-10-03 16:35:32 +00:00
Mark Salyzyn
991a8a6bf7 am ee9dea83: am f7cf8b2c: Merge "bionic: tzset running hot"
* commit 'ee9dea83fbaf2261066fbb20e5942c147018c949':
  bionic: tzset running hot
2015-10-02 21:17:39 +00:00
Josh Gao
e22d32d06c am a7d5919c: am cf92ebcf: Merge "Use foreach loop to match setuid unsafe env vars."
* commit 'a7d5919cc92db395a943d8f5094e47d50148c39c':
  Use foreach loop to match setuid unsafe env vars.
2015-10-02 18:41:55 +00:00
Dimitry Ivanov
a978ec9e7b am 27f2e04c: am 143409d7: Merge "Fix the comment"
* commit '27f2e04c8c31cb4fbcc842ff457a1a4e53b61f4d':
  Fix the comment
2015-10-01 22:59:58 +00:00
Stephen Hines
03d14f9276 am 14b7c94f: am 4a65557d: Merge "Remove invalid left shifts of -1."
* commit '14b7c94f40c845715561d1f4031f650a03df0336':
  Remove invalid left shifts of -1.
2015-10-01 05:42:13 +00:00
Christopher Ferris
240a0a9068 am dc813fe3: am ad157a3c: Merge "Add a no dwarf version of assembler macros."
* commit 'dc813fe338626b28a8e9066c81fac6dac0982af5':
  Add a no dwarf version of assembler macros.
2015-09-30 23:59:48 +00:00
Christopher Ferris
b33e6097fe am 8bb2141b: am 3230d96a: Merge "libc: krait: Use performance version of memcpy"
* commit '8bb2141b7707b593245b77e3c73c26b7bb6f29fd':
  libc: krait: Use performance version of memcpy
2015-09-30 23:59:47 +00:00
Dimitry Ivanov
84b24d62d0 am 889dd564: am a0b9cad0: Merge "Optimize dlopen from a zip file"
* commit '889dd56428fdecedb55e11b990609993294561ff':
  Optimize dlopen from a zip file
2015-09-30 20:16:52 +00:00
Yabin Cui
8db320637c am 8cd11809: am c1eebd5f: Merge "Fix the way to count online cpus."
* commit '8cd1180904a0b8713c20feed5255bbedcfabe4e9':
  Fix the way to count online cpus.
2015-09-30 01:33:22 +00:00
Christopher Ferris
86fdb6bf23 am 4f3e3591: am 93a91f0c: Force cts to only run one test at a time.
* commit '4f3e3591ace36b6d86e3a1bc8b3f438989cb0618':
  Force cts to only run one test at a time.
2015-09-29 15:26:43 +00:00
Christopher Ferris
4f3e3591ac am 93a91f0c: Force cts to only run one test at a time.
* commit '93a91f0cf4f015762ac1ed57395c4c0de8ba7db3':
  Force cts to only run one test at a time.
2015-09-29 15:11:45 +00:00
Colin Cross
6a753ffec6 am 1c34fea8: am 8b279ead: Merge "Pass -q is zip for test"
* commit '1c34fea8033d64b7f2c54366add908aba7fa44dc':
  Pass -q is zip for test
2015-09-28 23:17:43 +00:00
Colin Cross
195a5bef1f am 289e58e8: am c80aa3f9: Merge "Turn common INFO messages down to VLOG(1)"
* commit '289e58e83e62b600c2b1764c6f9cfd07f1717bdc':
  Turn common INFO messages down to VLOG(1)
2015-09-28 22:57:48 +00:00
Dan Willemsen
3fb798c8ac am bfd9255d: am f16f4f8a: Merge "Fix file-check-cxx to handle quoted arguments"
* commit 'bfd9255ddba7db2e07de6483bf55f567c7f1f7a3':
  Fix file-check-cxx to handle quoted arguments
2015-09-28 20:48:00 +00:00
Dimitry Ivanov
2027e5e4ca am 97233047: am d5e8a049: Merge "Fix bug number for linker related workarounds"
* commit '972330476c26d5f610026fc006d05b128dc45e56':
  Fix bug number for linker related workarounds
2015-09-28 18:34:00 +00:00
Colin Cross
fd7251acd4 am b99b3f77: am 55f87a0c: Merge "Force non-color output for bionic FileCheck tests"
* commit 'b99b3f773cef7d160481f8c30b41c01839ca7090':
  Force non-color output for bionic FileCheck tests
2015-09-25 22:39:49 +00:00
Colin Cross
b74e9ddda5 am 0f575d44: am 4a54ec82: Merge "Add .PHONY for phony bionic test targets"
* commit '0f575d4482cebbedcc9d44634ba453fa57f21c3f':
  Add .PHONY for phony bionic test targets
2015-09-25 22:39:48 +00:00
Christopher Ferris
93a91f0cf4 Force cts to only run one test at a time.
Also, slightly increase the timeout for each test run.

Bug: 24198050

(cherry picked from commit daaaed18ce1d2f2da9d2240e974922299d937670)

Change-Id: I29e169e962da803a89abf0a28e071abcafa315b7
2015-09-25 15:33:20 -07:00
Christopher Ferris
a64bb4c172 am c1d4ba88: am b48ca46d: Merge "Force cts to only run one test at a time."
* commit 'c1d4ba88cfd824b938feed68a706d2a06e993d3a':
  Force cts to only run one test at a time.
2015-09-25 22:17:12 +00:00
Christopher Ferris
aaff959fc0 am 4344a02a: am 931e1399: Merge "Add cortex-a53.a57 target for 32 bit big/little."
* commit '4344a02a9efc93ff4f772f5722f1a455d8ef25cd':
  Add cortex-a53.a57 target for 32 bit big/little.
2015-09-25 16:44:03 +00:00
Christopher Ferris
774a4703e8 am 6eb06b03: am 70a9f0a3: Merge "Fix over read in strcpy/stpcpy/strcat."
* commit '6eb06b0399c95f52cd28ff7971582ebec42f45f7':
  Fix over read in strcpy/stpcpy/strcat.
2015-09-24 21:48:52 +00:00
Yabin Cui
609716ae95 am 01030c24: Increase alternative signal stack size on 64-bit devices.
* commit '01030c24b0e3ace1b4cdaf415354e2f315f4f3a9':
  Increase alternative signal stack size on 64-bit devices.
2015-09-24 00:21:13 +00:00
Yabin Cui
01030c24b0 Increase alternative signal stack size on 64-bit devices.
Bug: 23041777
Bug: 24187462
Change-Id: I7d84c0cc775a74753a3e8e101169c0fb5dbf7437
2015-09-23 16:36:20 -07:00
Dan Albert
2c60af3e81 am 56446a6c: am c38cee59: Merge "Prevent the build system from hiding our ABI."
* commit '56446a6c8e2fd54f23a348060a2bc121c0846603':
  Prevent the build system from hiding our ABI.
2015-09-23 20:22:04 +00:00
Elliott Hughes
678752ed2a am 83911975: am cb696c50: Merge "Remove libpagemap include hack."
* commit '839119757d4d841359ad5f16d3bde8e4581f8322':
  Remove libpagemap include hack.
2015-09-23 19:04:18 +00:00
Elliott Hughes
fff13b9196 am 12432ca4: am 8d92afe3: Merge "Fix another duplicate maps parser."
* commit '12432ca4839b4df9b040b2bd3b4401a48e1f8a06':
  Fix another duplicate maps parser.
2015-09-23 00:36:13 +00:00
Elliott Hughes
afba67bd2f am f599ea97: am 9e3a2491: Merge "Clean up /proc/<pid>/maps sscanfs."
* commit 'f599ea9743098a694262b7ab6c3b3d3f11eeb0dd':
  Clean up /proc/<pid>/maps sscanfs.
2015-09-22 23:05:43 +00:00
Jorge Lucangeli Obes
eb83e971b4 am 9583f7e7: am dd514539: Merge "Add preliminary OEM UID/GID support."
* commit '9583f7e7c2863c63596429ccb23a34fdbf272102':
  Add preliminary OEM UID/GID support.
2015-09-22 22:09:43 +00:00
Elliott Hughes
4e9118c25c am 1085de1c: am efcb5d9d: Merge "Remove some <sys/cdefs.h> cruft."
* commit '1085de1cc5f56bf3538ff75ec93939b8c868eb2a':
  Remove some <sys/cdefs.h> cruft.
2015-09-22 22:09:42 +00:00
Yabin Cui
78f5504b92 am 042a61de: am 3d00f79f: Merge "Increase alternative signal stack size on 64-bit devices."
* commit '042a61de21296a7c5e4243b1e50ec591d124de98':
  Increase alternative signal stack size on 64-bit devices.
2015-09-22 20:59:44 +00:00
Elliott Hughes
cccb36036f am d97f4224: am 822c40a3: Merge "<netinet/udp.h> should include <linux/udp.h>."
* commit 'd97f422405cfb3f1d6287f879ce828f7195e68d3':
  <netinet/udp.h> should include <linux/udp.h>.
2015-09-22 20:34:32 +00:00
Dan Albert
a2308b7f67 am 208d8e36: am 13997591: Merge "Add a hint about using --no-isolate for GDB."
* commit '208d8e369604e76363027289c09e08c9b4fc818b':
  Add a hint about using --no-isolate for GDB.
2015-09-19 19:59:53 +00:00
Christopher Ferris
a1ae03e21d am 4ed36397: am 777bd95c: Merge "Import scsi headers."
* commit '4ed363972e1120f924c84a56c513eb7e8077dcbc':
  Import scsi headers.
2015-09-19 19:59:52 +00:00
Greg Hackmann
672ff19c65 am 5fb12bc2: am 96b1323a: Merge "Define WIFCONTINUED()"
* commit '5fb12bc23273266b6afb08b61f1b5e558165c3d1':
  Define WIFCONTINUED()
2015-09-19 19:59:52 +00:00
Greg Hackmann
51c4d51d8f am a4ab398c: am 7c460451: Merge "Fix SOCK_* flag definitions"
* commit 'a4ab398c617055f5f5895f6b9f6ca5bf0f6e520f':
  Fix SOCK_* flag definitions
2015-09-19 19:59:51 +00:00
Elliott Hughes
10292607e4 am c0c6bcc8: am 355f3d0c: Merge "Fix mips FP abi bug in the linker."
* commit 'c0c6bcc8f7f90a7bb65d683efc97825625f072b0':
  Fix mips FP abi bug in the linker.
2015-09-18 15:34:09 +00:00
Christopher Ferris
1e9b59d37e am 577c64eb: am d9639559: Merge "Add support for manually modified kernel headers."
* commit '577c64ebbfc3fe183394e14b67d543d8ec0f6425':
  Add support for manually modified kernel headers.
2015-09-18 04:30:42 +00:00
Dan Willemsen
e06ef6709f am 305af045: am 353e7e5d: Merge "Update Android.bp for setjmp cookies"
* commit '305af04561b9b8bd612f16350f0dd41a25be7cc2':
  Update Android.bp for setjmp cookies
2015-09-17 22:52:33 +00:00
Josh Gao
ec94ca9284 am 91624eae: am 57866a6d: Merge changes Iea8d03de,I2014f959
* commit '91624eae9aa90e123ae37843d94861120d2433a4':
  Implement setjmp cookies on x86_64.
  Implement setjmp cookies on x86.
2015-09-17 22:31:45 +00:00
Josh Gao
5c12a504cf am 9e3d8730: am 823cff84: Merge changes I81408ef0,Id0eb8d06
* commit '9e3d873036b581b9986f42cc40f2d43f057ed7f1':
  Implement setjmp cookies on AArch64.
  Implement setjmp cookies on ARM.
2015-09-17 21:22:32 +00:00
Dan Willemsen
c101cc20bf am 64ce4787: am 90fc8e24: Merge "Add Android.bp for libc/libm/libdl"
* commit '64ce4787e593a547dab41210b28bc74e19318820':
  Add Android.bp for libc/libm/libdl
2015-09-17 19:52:53 +00:00
Yabin Cui
a59905b80c am 72e678c8: am cbd0a15b: Merge "Fix the way to get main thread stack start address."
* commit '72e678c8a7f78a04dffc57a6b2add45aeee4d1ec':
  Fix the way to get main thread stack start address.
2015-09-17 02:50:56 +00:00
Elliott Hughes
5278af69ac am bab1044d: am 14545d4c: Merge "Move several FreeBSD functions to OpenBSD."
* commit 'bab1044d27cc5b88809f2fc0e5be7e23f2ab6623':
  Move several FreeBSD functions to OpenBSD.
2015-09-15 15:25:18 +00:00
Elliott Hughes
8abd365509 am 364dbb3c: am 44c8ac8b: Merge "Sync with upstream NetBSD lib/libc/regex."
* commit '364dbb3cf493b00e48d8f29e4a845e78f8139f4f':
  Sync with upstream NetBSD lib/libc/regex.
2015-09-15 15:18:56 +00:00
Dan Albert
a4b45b70f5 am a1a46a8e: am cd0ed2f1: Merge "CMSG_DATA should return an unsigned char*."
* commit 'a1a46a8e946d1fd1c50f44e7e23f462e179ddbb1':
  CMSG_DATA should return an unsigned char*.
2015-09-11 23:04:58 +00:00
Dan Albert
b3c3fb5b59 am 32ec7498: am 1c7b84ca: Merge changes Ia1777fd4,I3998d88b
* commit '32ec74987344cedb5596e6da1891a9d54962f149':
  Unify unistd.h.
  Use attribute availability.
2015-09-08 20:38:46 +00:00
Elliott Hughes
a775a41130 am edc73f62: am ba9c1705: Merge "linker: don\'t pass dlextinfo to dependent loads"
* commit 'edc73f6286bcd1f7d0278d25d4484bf23a0e53b2':
  linker: don't pass dlextinfo to dependent loads
2015-09-04 18:21:34 +00:00
Christopher Ferris
23ff8fc4ee am 2fe50aa3: am cb0d96e6: Merge "Only close stdin/stdout/stderr for debug malloc."
* commit '2fe50aa3806f2c367dddfc5ddedd1c636223b823':
  Only close stdin/stdout/stderr for debug malloc.
2015-09-04 01:31:18 +00:00
Christopher Ferris
407dea47bd am 7bb544cc: am b423ffa6: Merge "Update to v3.18.21 kernel headers."
* commit '7bb544cc7c3d70af5f06dd5cf8b33e841b816ded':
  Update to v3.18.21 kernel headers.
2015-09-03 18:14:10 +00:00
Elliott Hughes
eb457e212e am 67c6da80: am cc251966: Merge "Rename debug_stacktrace to debug_backtrace."
* commit '67c6da80bb3b6b4febc783db04ce19cdeb187092':
  Rename debug_stacktrace to debug_backtrace.
2015-09-02 04:00:02 +00:00
Yabin Cui
80dbedc95a am d3c7f67a: am 32c85daa: Merge "build bionic gtest runner on mac."
* commit 'd3c7f67aed0b5ac0bd7fd03c6925cbaf6b1305ba':
  build bionic gtest runner on mac.
2015-09-01 23:29:21 +00:00
Elliott Hughes
695d4c62fd am c121e179: am a992004c: Merge "Regenerate NOTICE files."
* commit 'c121e179a2897e3e21d8455420dbd62822b32e53':
  Regenerate NOTICE files.
2015-08-29 04:14:22 +00:00
Elliott Hughes
0cc8e665fd am 74c5bba5: am cb58f528: Merge "Sync with upstream FreeBSD libm."
* commit '74c5bba5404f2c286eae3a492898656e80097b11':
  Sync with upstream FreeBSD libm.
2015-08-29 04:02:34 +00:00
Elliott Hughes
0f0c7197b5 am b57e9efd: am c2e634dd: Merge "Fix regoff_t for LP32 and _FILE_OFFSET_BITS=64."
* commit 'b57e9efd40d5765f9ff62f2aa3b6b2ca8523b024':
  Fix regoff_t for LP32 and _FILE_OFFSET_BITS=64.
2015-08-27 23:32:58 +00:00
Dan Albert
5e98eaee2d am a71f81a0: am 46c7bc83: Merge "Don\'t re-export libunwind_llvm."
* commit 'a71f81a08b6a94ef79c96b62733bb97de5350d79':
  Don't re-export libunwind_llvm.
2015-08-27 22:37:01 +00:00
Chih-hung Hsieh
4afb130399 am e7a09ff7: am bfaee4bd: Merge "Add test cases for __emutls_get_address."
* commit 'e7a09ff7d99740c5e74308abc1e209522811b814':
  Add test cases for __emutls_get_address.
2015-08-27 12:40:33 +00:00
Elliott Hughes
a0d1cda1a6 am c6effb3a: am 848808c6: Merge "Add preadv/pwritev."
* commit 'c6effb3af6f27c1acfbc2f776bb516e5f4d24476':
  Add preadv/pwritev.
2015-08-27 12:40:32 +00:00
Christopher Ferris
ed90d4caea am 1154bcb3: (-s ours) am d518a6d3: Merge "Fix the 16 bit/32 bit instruction check for arm."
* commit '1154bcb3c095606fcaa5e836e935cb3406f6703d':
2015-08-27 05:06:25 +00:00
Elliott Hughes
a56db54d1d am 03deb828: (-s ours) am 629ed517: Merge "Add strchrnul."
* commit '03deb8287b019e9d526b193a0b7fa5e3fa6e8f77':
2015-08-27 05:06:24 +00:00
Elliott Hughes
83c7b596e4 am 5f55f32e: (-s ours) am 4d5c4f08: Merge "Add the missing aarch64 user structs."
* commit '5f55f32e49c804b21a66b7656297e8a426660afe':
2015-08-27 05:06:24 +00:00
Neil Fuller
268344457e am 1c751e5e: (-s ours) am 82911942: Update timezone data to 2015f
* commit '1c751e5ec76085aced87d50757495083a0f46a73':
2015-08-27 05:06:23 +00:00
Neil Fuller
b455457761 am 58cf5d6b: (-s ours) am 53f2abb5: Merge "Update timezone data to 2015f"
* commit '58cf5d6b1daf54b50c7864df563227787cb91375':
2015-08-27 05:06:22 +00:00
Neil Fuller
356868f8ac am 7336be05: (-s ours) am f7286a26: Merge "Move tzdata scripts from bionic to external/icu"
* commit '7336be059850edf23ad51f16520a9a08eff7cfe5':
2015-08-27 05:06:21 +00:00
Elliott Hughes
11a740e879 am 0ed97d1b: (-s ours) am 5bf79420: Merge "Revert "Revert "Use compiler builtins for fabs."""
* commit '0ed97d1b5fc136226d1ab62a2aa982ee5d99cabd':
2015-08-27 05:06:20 +00:00
Elliott Hughes
82f20c916e am 1a265558: (-s ours) am c868b4c3: Merge "Revert "Use compiler builtins for fabs.""
* commit '1a26555846f49a9f7d15772ab014e01cac7a6f5b':
2015-08-27 05:06:18 +00:00
Josh Gao
d32cadd1a5 am ebcaf389: (-s ours) am 0f8f9300: Merge "Add exported __popcount_tab for libgcc compat under compiler-rt."
* commit 'ebcaf389cdcb1d18622c500a6c7021259171dd39':
2015-08-27 05:06:17 +00:00
Josh Gao
b8c276b778 am df4492f3: (-s ours) am fad8370c: Merge "Improve .clang-format."
* commit 'df4492f339662ae1468bce3ee33270142227146c':
2015-08-27 05:06:16 +00:00
Elliott Hughes
756574d53e am 51b0bf03: (-s ours) am a19a9348: Merge "Use compiler builtins for fabs."
* commit '51b0bf03c074aa36f100a3d4d688f9b1687d3300':
2015-08-27 05:06:15 +00:00
Dan Albert
4ca3de4502 am 8c6b0d16: (-s ours) am a80ae8b8: Merge "Add a .clang-format file."
* commit '8c6b0d164e0d7a1a3ae4a2497e3bb9d5ae208a02':
2015-08-27 05:06:14 +00:00
Nick Kralevich
437c3e48f9 am f94b491c: (-s ours) am 4d7d05bd: Merge "Revert "fix incompatibility with -fstack-protector-strong""
* commit 'f94b491c2b9f8f01038af73863b6ba3945f70d0b':
2015-08-27 05:06:13 +00:00
Nick Kralevich
40773fb797 am abd1975d: (-s ours) am 5f7a5125: Merge "fix incompatibility with -fstack-protector-strong"
* commit 'abd1975dcc814087afb1fe262b5f2ce389fb4ff9':
2015-08-27 05:06:12 +00:00
Yabin Cui
3aa60b82ef am 65248069: (-s ours) am 62c26ed9: Merge "add fortified implementations of write/pwrite{,64}"
* commit '652480695172d90209e5163e92180a3952fba29a':
2015-08-27 05:06:10 +00:00
Elliott Hughes
806055dace am 9835b61d: (-s ours) am 49715dcc: Merge "Fix a mistype in segment overrange checking"
* commit '9835b61d636720712f79e49a5672518ead4753f9':
2015-08-27 05:06:09 +00:00
Christopher Ferris
f962a1848e am 55cd7b0b: (-s ours) am 079fc833: Merge "Modify ip to get the instr being executed."
* commit '55cd7b0b761ffb62ea522204fb2b0567862e920d':
2015-08-27 05:06:08 +00:00
Dan Albert
91aeb800d6 am af86eeec: (-s ours) am df0891ad: Merge "Add a TLS slot for TSAN."
* commit 'af86eeecc90442530ae6fa6f99188913c0198281':
2015-08-27 05:06:07 +00:00
Christopher Ferris
393e69d77e am 888ad399: (-s ours) am e4d51cf3: Merge "Add optimized cortex-a7/cortex-a53 memset/memcpy."
* commit '888ad399ee0b4da90d745fb9b45e89aec18bd8e1':
2015-08-27 05:06:06 +00:00
Elliott Hughes
a849fe6e2e am 37763e7a: (-s ours) am 4a8c4ce4: Merge "libc: remove bcopy from memmove on 64-bit architectures"
* commit '37763e7a7a3fc4b045d8a330306d652991bfed62':
2015-08-27 05:06:04 +00:00
Ying Wang
8abc375ec9 am e46c4212: (-s ours) am 85197af9: Merge "Don\'t attach linker_asan to linker in module definition."
* commit 'e46c4212d6478975dbbb7f7105ad05c2cdb07d7b':
2015-08-27 05:06:03 +00:00
Elliott Hughes
f92664cbe5 am 3034028d: (-s ours) am 6816d8cc: Merge "Use __builtin_* in <math.h>."
* commit '3034028d7a1f93e46e212061efe7b57fe8758107':
2015-08-27 05:06:01 +00:00
Elliott Hughes
b635c4ebb2 am 0ff5dda1: (-s ours) am dd8adc35: Merge "libm: ARM: reorganize a bit to match ARM64"
* commit '0ff5dda1020c4da9c4d21d8d3d4ad9ba15848441':
2015-08-27 05:06:00 +00:00
Elliott Hughes
ec6a557b38 am 1789ac90: (-s ours) am b4f2112f: Merge "[MIPS] Invalidate cached pid in vfork."
* commit '1789ac90f7ca94c161958640297b6b4aafa152fd':
2015-08-27 05:05:58 +00:00
Dan Albert
79697a7096 am 9423fb23: (-s ours) am f2985ed8: Merge "Fix test steps for 64-bit bionic"
* commit '9423fb23757a0d6d4f112a3f231717896444207b':
2015-08-27 05:05:57 +00:00
Dan Albert
8cc0d89a9d am 34afc42a: (-s ours) am 2b934924: Merge "Add missing include."
* commit '34afc42ae749c9cd7ce660ef6ab0c50bdbb41497':
2015-08-27 05:05:53 +00:00
Yabin Cui
0bbda9838b am 2bcb25c1: (-s ours) am 0660be89: am a6a12a78: am 0fdcdd00: Merge "Fix flaky test time.timer_settime_0." into lollipop-mr1-cts-dev
* commit '2bcb25c1c3153a28229bffcdd4d289ac72b987cc':
2015-08-27 05:05:46 +00:00
Dan Albert
3ce99a04a9 am ee8576d1: (-s ours) am a3c01467: Merge "Move up to C++14."
* commit 'ee8576d11413c7b9d42f466fb378921b4cdb01f3':
2015-08-27 05:05:44 +00:00
Yabin Cui
7b02991de7 am c23143a5: (-s ours) am ff4afc13: Merge "Omit comment when reading --gtest_list_tests option\'s output."
* commit 'c23143a5fdd32a1cc0ca0efdb435d9f46b596113':
2015-08-27 05:05:42 +00:00
Elliott Hughes
29eaaa6ee5 am 23e0bdf7: (-s ours) am 182b91f6: Merge "Invalidate cached pid in vfork."
* commit '23e0bdf7d4476399c04557396e288ad21938e65f':
2015-08-27 05:05:40 +00:00
Andreas Gampe
34df06eb8a am fd202300: (-s ours) am e80369ab: Merge "Bionic: Add a TLS slot for ART for Thread self"
* commit 'fd202300d8639065406f054e7232e9135572bb81':
2015-08-27 05:05:38 +00:00
Elliott Hughes
45f262c084 am 711d7b9f: (-s ours) am b3db7764: Merge "name the arc4random structure mappings"
* commit '711d7b9f90648183af684f80b9de80fc83b43824':
2015-08-27 05:05:37 +00:00
Elliott Hughes
a31ba88d4c am 65941221: (-s ours) am f57f7945: Merge "Cherrypick upstream fnmatch.c fix."
* commit '65941221b5985c824783f8c549241695a0cb6f92':
2015-08-27 05:05:35 +00:00
Elliott Hughes
f1a2cd9713 am dc181dd7: (-s ours) am 2278d29a: Merge "[MIPS] Link .dex or .oat code lacking .MIPS.abiflags segment"
* commit 'dc181dd7882e1a633400fe410266dc58152c7c10':
2015-08-27 05:05:32 +00:00
Yabin Cui
37c4110f41 am 993a2bee: (-s ours) am 7e919dae: Merge "add a fortified implementation of getcwd"
* commit '993a2bee84e25604e7ef8c1d386e7cd3904627e0':
2015-08-27 05:05:30 +00:00
Elliott Hughes
ba06d5519e am 5b916453: (-s ours) am 25907058: Merge "Sync current upstream fnmatch.c."
* commit '5b916453f3d75ca9bbac6825191442c4b159e6a9':
2015-08-27 05:05:25 +00:00
Elliott Hughes
dc5970d025 am 9d7c6a7e: (-s ours) am 61c21b63: Merge "Revert "add a fortified implementation of getcwd""
* commit '9d7c6a7e570a8b91a094f0df4407b5624b469730':
2015-08-27 05:05:22 +00:00
Yabin Cui
e6623ebcaf am 4279bac2: (-s ours) am 442a3fca: Merge "add a fortified implementation of getcwd"
* commit '4279bac26a15b69a85d3d98a57ff7094b579f207':
2015-08-27 05:05:20 +00:00
Elliott Hughes
b51b07117c am 19a8b3fc: (-s ours) am 807f27f9: Merge "Stop sending SIGPIPE to debuggerd."
* commit '19a8b3fc8296974a4c65f52bd5da050b442bf901':
2015-08-27 05:05:18 +00:00
Elliott Hughes
1dd6f6436b am d473681f: (-s ours) am 44989174: Merge "Prevent buffer over-read in linker.cpp\'s parse_path."
* commit 'd473681fb1ba8e93154a16ca5d9290c66c6da224':
2015-08-27 05:05:15 +00:00
Elliott Hughes
3cb8b52334 am 89a64c0f: (-s ours) am 34c5f5ea: Merge "Remove PAGE_SIZE from <limits.h>."
* commit '89a64c0f2ee1abfbda37049b7700c104a0092946':
2015-08-27 05:05:12 +00:00
Elliott Hughes
d4cc5122d2 am 5c104603: (-s ours) am 374adfee: Merge "Don\'t transitively include <limits.h> from <sys/user.h>."
* commit '5c104603a01ef3bffa6819313508a29722756bcf':
2015-08-27 05:05:09 +00:00
Elliott Hughes
6ed2717b28 am c5de153b: (-s ours) am 1ff4094a: Merge "Remove PAGESIZE."
* commit 'c5de153bc6600a73722a594416a9398361dfb942':
2015-08-27 05:05:06 +00:00
Elliott Hughes
6141acb75f am a3c3a6b2: (-s ours) am c8ba22c8: Merge "Move PAGE_MASK into <sys/user.h>."
* commit 'a3c3a6b2df6de20f22139fae79c6bd124fc7fdb6':
2015-08-27 05:04:56 +00:00
Mark Salyzyn
9f80696d4e am 835a23cc: (-s ours) am 1923d4c0: Merge "deprecate TARGET_USES_LOGD"
* commit '835a23cc9caeeee7f591bd241dc88fbd205c7ef8':
2015-08-27 05:04:53 +00:00
Elliott Hughes
21b3d798e8 am c9bee108: (-s ours) am 4955cde2: Merge "Add a regression test for a fixed strnlen bug."
* commit 'c9bee108050ab367953f8f1d9cb73e837c1d06df':
2015-08-27 05:04:49 +00:00
Chih-hung Hsieh
8a955e1493 am c11758f2: (-s ours) am cebef1a7: Merge "Add one simple thread local storage test."
* commit 'c11758f2c9ff88d069c1fa22be5165220a07dc5c':
2015-08-27 05:04:47 +00:00
Christopher Ferris
741d5ae03d am e1f1a635: (-s ours) am e8ceb95c: Merge "Remove pushes from memsets (krait/cortex-a9)."
* commit 'e1f1a6353a4a537cca7ecc1a128bf98bf3790df1':
2015-08-27 05:04:44 +00:00
Yabin Cui
73a6ac348d am 0e63c39c: (-s ours) am 8af32633: Merge "add fortified implementations of fread/fwrite"
* commit '0e63c39cca56ae1d2b5877b6ffced3c6a4ca312b':
2015-08-27 05:04:41 +00:00
Elliott Hughes
273292a11a am d79de83b: (-s ours) am f16c6e17: Merge "Restore protection flags for ifunc during relocs."
* commit 'd79de83bfca0da705dbced60e0294f29da4aa63d':
2015-08-27 05:04:34 +00:00
Dmitriy Ivanov
a3b90f275a am ab6ca484: (-s ours) am de0fb393: Restore protection flags for ifunc during relocs.
* commit 'ab6ca484bd69842e9a56f01c7eef72e5368936d1':
2015-08-27 05:04:29 +00:00
Elliott Hughes
89722d9f65 am fd3cd1cc: (-s ours) am bff19682: Merge "name the atexit handler pages"
* commit 'fd3cd1cc2a508a8a70780253fbe60ef1798aca21':
2015-08-27 05:04:26 +00:00
Elliott Hughes
010563c886 am 7835c65c: (-s ours) am adc5795f: Merge "Use AT_PAGESZ for sysconf(_SC_PAGE_SIZE)."
* commit '7835c65ca777cd88b9ec656d780a7a48b591467f':
2015-08-27 05:04:24 +00:00
Christopher Ferris
f616c70e20 am dd3eb086: (-s ours) am a3a61983: Merge "Make all labels local."
* commit 'dd3eb0862e8a025783f952a32c3b785a255035c2':
2015-08-27 05:04:21 +00:00
Yabin Cui
fda41cce04 am 0bfe75bc: (-s ours) am b8320b80: Don\'t abort when failed to write tracing message.
* commit '0bfe75bc317d351404df13c560242dd3e44cf54b':
2015-08-27 05:04:11 +00:00
Yabin Cui
1ebd90caf1 am b9da7c15: (-s ours) am 9e1c862c: Merge "Don\'t abort when failed to write tracing message."
* commit 'b9da7c151df389426b379477676ddaceff43543a':
2015-08-27 05:04:09 +00:00
Yabin Cui
5ca7a74838 am c0c9704e: (-s ours) am 2565492d: Merge "Add getgrgid_r/getgrnam_r."
* commit 'c0c9704e1128bcc1e172e23032b63b7b31c75283':
2015-08-27 05:04:07 +00:00
Elliott Hughes
775339f00e am da24f8af: (-s ours) am 3b49d61a: Merge "libc: arch-x86: implement kernel vdso time functions"
* commit 'da24f8af38cb7829a3947ee320449c05f79f6a63':
2015-08-27 05:04:05 +00:00
Ying Wang
5f8b4eb2a8 am 9c4f3522: (-s ours) am 86ac443c: Merge "We don\'t have CXX_BARE any more"
* commit '9c4f35229df162e42a34aae94b3eb2e2436c4469':
2015-08-27 05:04:03 +00:00
Elliott Hughes
0931e46f64 am 2329b721: (-s ours) am bc0b8ff2: Merge "Use a less misleading name for the code that sets up the main thread."
* commit '2329b7218e2ca65767020f135b524d1c22957791':
2015-08-27 05:04:01 +00:00
Dan Albert
9405119369 am 8cc83e5c: (-s ours) am 7e52dbe4: Merge "Revert "Stop libc from cross-referencing unwind symbols"" into mnc-dev
* commit '8cc83e5c6669fe815d69abf9d3263425e751c741':
2015-08-27 05:03:59 +00:00
Ying Wang
8f137f06ea am 40e2b72f: (-s ours) am e39b279b: Merge "We don\'t have CXX_BARE any more" into mnc-dev
* commit '40e2b72fb30cd0aace5b85185e1d0989c9ff2e1a':
2015-08-27 05:03:57 +00:00
Christopher Ferris
3ff0bae759 am 953611ba: (-s ours) am aa55e7ad: Add support for non-zero vaddr in maps.
* commit '953611bae03e92e728226a729b990b9516914f9c':
2015-08-27 05:03:55 +00:00
Christopher Ferris
3a647e158d am a41556d3: (-s ours) am c99fabb7: Merge "Add support for non-zero vaddr in maps."
* commit 'a41556d398e3222d6e6d468c997a78c809c146fd':
2015-08-27 05:03:53 +00:00
Elliott Hughes
78f34b981e am ded55525: (-s ours) am 3bcfd47c: Merge "Revert "Revert "make vdso function pointers read-only at runtime"""
* commit 'ded555256d72c0f8491b5edc0e4550c45d61059d':
2015-08-27 05:03:51 +00:00
Dan Albert
930936ae7b am a645ebed: (-s ours) am f37c237b: Merge "Revert "Stop libc from cross-referencing unwind symbols""
* commit 'a645ebed9c42264f41bece4f9bf378ed37abc97b':
2015-08-27 05:03:49 +00:00
Dmitriy Ivanov
f98c881d8e am 8bdf8ab9: (-s ours) am e70d7a78: Merge "Fix dt_runpath test."
* commit '8bdf8ab97c59f6c0a0152d923dcb668681e4e031':
2015-08-27 05:03:47 +00:00
Elliott Hughes
70a5005ea6 am f8457c2d: (-s ours) am e5544ae1: Merge "<sys/time.h> should include [most of] <sys/select.h>."
* commit 'f8457c2d95e217f26553e8454f1e91673cf7ac8f':
2015-08-27 05:03:46 +00:00
Elliott Hughes
4110bb6452 am 6071a7b9: (-s ours) am 6c9ad82b: Merge "Revert "make vdso function pointers read-only at runtime""
* commit '6071a7b9ef107d0928588b9232c0bcbd4de82a53':
2015-08-27 05:03:44 +00:00
Elliott Hughes
f86b5a751c am ba1c89e9: (-s ours) am 4f2e1d3b: Merge "Add all the glibc one-line "synonym" header files."
* commit 'ba1c89e9b33c4bde320bcafcb564ac69c0303d92':
2015-08-27 05:03:42 +00:00
Elliott Hughes
93ec254b9e am 4ec3dcf8: (-s ours) am ca7bc509: Merge "make vdso function pointers read-only at runtime"
* commit '4ec3dcf8ecd34d6d530c94b0e45775eac43a92f4':
2015-08-27 05:03:40 +00:00
Dmitriy Ivanov
3d397fa661 am 436ff890: (-s ours) am a58d2498: Merge "Fix potential race condition on dlopen"
* commit '436ff890df2dedc6fc1083a8a71873a9731bb6c1':
2015-08-27 05:03:37 +00:00
Bertrand SIMONNET
09f2ae9b40 am df6eee9f: (-s ours) am 60bc9090: Merge "Add timespec/timeval conversion helpers."
* commit 'df6eee9f85d9482c9b561b6817fcfd8ce1a56d5c':
2015-08-27 05:03:35 +00:00
Dmitriy Ivanov
256e992517 am 0ee0dd8b: (-s ours) am cd588f84: Merge "Add constant for zip separator"
* commit '0ee0dd8b3d66e05a86ca12c35d16752b574bcad0':
2015-08-27 05:03:33 +00:00
Evgenii Stepanov
4972c73602 am fb186d55: (-s ours) am b3140904: Merge "Replace spaces with tabs in a Makefile."
* commit 'fb186d55e87c2c5817872fda81c29c18e9e0a22d':
2015-08-27 05:03:31 +00:00
Evgenii Stepanov
67e5c7f06f am 760345a9: (-s ours) am e9774a52: Merge "A special linker for ASan executables."
* commit '760345a959fdc9fbc849e6f72bbf386960f2d838':
2015-08-27 05:03:29 +00:00
Yabin Cui
9d4bfe17b9 am a89821ab: (-s ours) am 60a11dcb: Merge "Add test for an Android kernel bug about prctl."
* commit 'a89821abe3f2f3e763a95ac1e8e330fbbbca4996':
2015-08-27 05:03:27 +00:00
Christopher Ferris
eafe28f85a am bf880978: (-s ours) am a8d82f12: Merge "Update to v3.18.18 kernel headers."
* commit 'bf8809782ea6f13ae0c14750d53d5077e51c0205':
2015-08-27 05:03:25 +00:00
Christopher Ferris
74484e8bd4 am 72361125: (-s ours) am 5e3dc45a: Merge "Do not hold hash table lock while backtracing."
* commit '723611256117f2328101a1db4a7cad8ac8043978':
2015-08-27 05:03:20 +00:00
Christopher Ferris
ac02082fa0 am 6db9c199: (-s ours) am 43d35c35: Merge "Do not hold hash table lock while backtracing." into mnc-dev
* commit '6db9c199a81e8c104abc011246796faa22bfacc8':
2015-08-27 05:03:17 +00:00
Elliott Hughes
44cb343e4d am 45baf0f3: (-s ours) am 147a50d0: Merge "Prevent user-defined basename_r from breaking basename(3)."
* commit '45baf0f384e6e2cbaa5383765a8671a00c85ea55':
2015-08-27 05:03:15 +00:00
Neil Fuller
44808d163f am c64ed22e: (-s ours) am 64c82544: Merge "Update timezone data to 2015e" into mnc-dev
* commit 'c64ed22e9b7c341d7e95ce526b37aaacadd420e2':
2015-08-27 05:03:13 +00:00
Dmitriy Ivanov
91ceb2b70a am db996ae7: (-s ours) am a5bb841d: Fix memory-leak on soinfo_free()
* commit 'db996ae74c36e334899ad381d84a84c67cbe8bcc':
2015-08-27 05:03:11 +00:00
Dmitriy Ivanov
e875510e17 am 7974b834: (-s ours) am 880a2933: Merge "Fix memory-leak on soinfo_free()"
* commit '7974b83443d782c361f2bb92abfcdcba6dffa3c9':
2015-08-27 05:03:09 +00:00
Pirama Arumuga Nainar
9b8179fb7e am fcd01714: (-s ours) am d1e10d7d: Merge "Use delete[] to de-allocate pointers from new[]"
* commit 'fcd017148ba7ecf181f2f4065437c01c1c66cd4e':
2015-08-27 05:03:04 +00:00
Daniel Erat
22b9e685bc am 818295c3: (-s ours) am c6f25641: Merge "libc: Add sys/fcntl.h for compatibility."
* commit '818295c3f7e204baa1cd3f2d6e44c773dcd052af':
2015-08-27 05:03:02 +00:00
Evgenii Stepanov
9b484289e1 am b4f5d6d8: (-s ours) am 33ef6c20: Merge "Respect caller DT_RUNPATH in dlopen()."
* commit 'b4f5d6d89471ffc4cd5f528e95b4fbf869c339d5':
2015-08-27 05:02:59 +00:00
Christopher Ferris
82ff96be56 am ce302bff: (-s ours) am 90de6820: Merge "Replace bx lr with update of pc from the stack."
* commit 'ce302bff6ad655a46a04ef680d332b6ad72e2650':
2015-08-27 05:02:57 +00:00
Elliott Hughes
e75d37eb5a am b82a5a96: (-s ours) am 7a9732d6: Merge "Add some glibc-like #defines for libchrome."
* commit 'b82a5a96f8df82bc02878628d8549366bbe78fa0':
2015-08-27 05:02:53 +00:00
Elliott Hughes
0746d0f175 am 95997b69: (-s ours) am 89bbb846: Merge "Fix alignment after variable-length data."
* commit '95997b691f788c06b68710ad015c9dc668e7b91f':
2015-08-27 05:02:49 +00:00
Elliott Hughes
fca5c4413a am a6441ac5: (-s ours) am 65dd8582: Fix alignment after variable-length data.
* commit 'a6441ac5bf85d187aa47be7a22483c7d5d321599':
2015-08-27 05:02:45 +00:00
Elliott Hughes
12ec03e3af am 4059fcd2: (-s ours) am f542b309: Merge "Name the thread stack and signal stack guard pages."
* commit '4059fcd29ba2731b30001f7a8a12300431461cd3':
2015-08-27 05:02:40 +00:00
Christopher Ferris
6501864af4 am d518a6d3: Merge "Fix the 16 bit/32 bit instruction check for arm."
* commit 'd518a6d3bccc82cffb61fb7615b8ba09a564dec0':
  Fix the 16 bit/32 bit instruction check for arm.
2015-08-26 19:59:06 +00:00
Elliott Hughes
f2700df2ae am 629ed517: Merge "Add strchrnul."
* commit '629ed517126b3be32f2b2e8b710e63358691c296':
  Add strchrnul.
2015-08-26 18:43:58 +00:00
Elliott Hughes
7443dd5805 am 4d5c4f08: Merge "Add the missing aarch64 user structs."
* commit '4d5c4f085bc880af838d50f6bbd60d86e800b6e1':
  Add the missing aarch64 user structs.
2015-08-26 18:43:57 +00:00
Neil Fuller
cc4245a8de am 82911942: Update timezone data to 2015f
* commit '829119425bcc2b5fcec8fdf219026a5192c81234':
  Update timezone data to 2015f
2015-08-25 20:09:02 +00:00
Neil Fuller
ff78def4fc am 53f2abb5: Merge "Update timezone data to 2015f"
* commit '53f2abb5ffc103b9ea7fbe2fee13edead2553f3a':
  Update timezone data to 2015f
2015-08-25 18:49:51 +00:00
Neil Fuller
650e66cd7e am f7286a26: Merge "Move tzdata scripts from bionic to external/icu"
* commit 'f7286a26deba0da370003eb97918176a69b6cfa6':
  Move tzdata scripts from bionic to external/icu
2015-08-25 10:04:12 +00:00
Elliott Hughes
1b22327893 am 5bf79420: Merge "Revert "Revert "Use compiler builtins for fabs."""
* commit '5bf7942008287381e6d2aa2216d9ded24f639142':
  Revert "Revert "Use compiler builtins for fabs.""
2015-08-24 23:23:14 +00:00
Elliott Hughes
66a7be9961 am c868b4c3: Merge "Revert "Use compiler builtins for fabs.""
* commit 'c868b4c35184683fe74ff8c8d780d021c2b07464':
  Revert "Use compiler builtins for fabs."
2015-08-24 21:22:09 +00:00
Josh Gao
5ad3ebf08d am 0f8f9300: Merge "Add exported __popcount_tab for libgcc compat under compiler-rt."
* commit '0f8f9300b84fff37088218c69cc13bdc489963eb':
  Add exported __popcount_tab for libgcc compat under compiler-rt.
2015-08-24 21:00:03 +00:00
Josh Gao
aad7f33e2a am fad8370c: Merge "Improve .clang-format."
* commit 'fad8370cfbf24c8913fc898950698c3675133e23':
  Improve .clang-format.
2015-08-24 21:00:02 +00:00
Elliott Hughes
b8c08f44ab am a19a9348: Merge "Use compiler builtins for fabs."
* commit 'a19a9348b7160ce967c70a9f4f38afede8dcafa9':
  Use compiler builtins for fabs.
2015-08-24 20:45:59 +00:00
Dan Albert
784ccf07bf am a80ae8b8: Merge "Add a .clang-format file."
* commit 'a80ae8b84812d69ca63647262ab888b2f40d55a0':
  Add a .clang-format file.
2015-08-24 20:00:37 +00:00
Nick Kralevich
f17f8157b2 am 4d7d05bd: Merge "Revert "fix incompatibility with -fstack-protector-strong""
* commit '4d7d05bd60b1d0bc20c95dd764fc2d916a12bb74':
  Revert "fix incompatibility with -fstack-protector-strong"
2015-08-24 07:10:15 +00:00
Nick Kralevich
51d2579367 am 5f7a5125: Merge "fix incompatibility with -fstack-protector-strong"
* commit '5f7a5125a53951543e27276877fa6b71eb08a5d8':
  fix incompatibility with -fstack-protector-strong
2015-08-24 04:30:22 +00:00
Yabin Cui
d54d116352 am 62c26ed9: Merge "add fortified implementations of write/pwrite{,64}"
* commit '62c26ed93e76ca9b3dd265f41eb3685ed2e72808':
  add fortified implementations of write/pwrite{,64}
2015-08-21 03:17:54 +00:00
Elliott Hughes
21a285029b am 49715dcc: Merge "Fix a mistype in segment overrange checking"
* commit '49715dcc8a8be1b4545b91e453467e1c45343e51':
  Fix a mistype in segment overrange checking
2015-08-20 23:26:37 +00:00
Christopher Ferris
3c0d78d576 am 079fc833: Merge "Modify ip to get the instr being executed."
* commit '079fc833137d5067c0cd3dc5211e72019314dd80':
  Modify ip to get the instr being executed.
2015-08-19 22:20:21 +00:00
Dan Albert
4a8f4867fc am df0891ad: Merge "Add a TLS slot for TSAN."
* commit 'df0891adcfe97dd8e4c825ea6ea586cc5bd09ef6':
  Add a TLS slot for TSAN.
2015-08-18 22:55:41 +00:00
Christopher Ferris
e6f16b2d7d am e4d51cf3: Merge "Add optimized cortex-a7/cortex-a53 memset/memcpy."
* commit 'e4d51cf37a861e258e423de14619982af51d2527':
  Add optimized cortex-a7/cortex-a53 memset/memcpy.
2015-08-18 17:33:46 +00:00
Elliott Hughes
4400c1d448 am 4a8c4ce4: Merge "libc: remove bcopy from memmove on 64-bit architectures"
* commit '4a8c4ce403f702c0b8279873fae3d62497c4a123':
  libc: remove bcopy from memmove on 64-bit architectures
2015-08-18 00:39:54 +00:00
Ying Wang
fa20d51e91 am 85197af9: Merge "Don\'t attach linker_asan to linker in module definition."
* commit '85197af92b52dd02caa7146ea5f47fad5cbc0101':
  Don't attach linker_asan to linker in module definition.
2015-08-18 00:24:04 +00:00
Elliott Hughes
6ac9e42958 am 6816d8cc: Merge "Use __builtin_* in <math.h>."
* commit '6816d8cc69dc1d142d722686d006f25df94afcd3':
  Use __builtin_* in <math.h>.
2015-08-14 23:47:34 +00:00
Elliott Hughes
12229387f4 am dd8adc35: Merge "libm: ARM: reorganize a bit to match ARM64"
* commit 'dd8adc35346e671b3c3b2ecb26c13b84c742695c':
  libm: ARM: reorganize a bit to match ARM64
2015-08-14 21:23:32 +00:00
Elliott Hughes
ee6c6845c0 am b4f2112f: Merge "[MIPS] Invalidate cached pid in vfork."
* commit 'b4f2112fa99dab401cd65db4c524d95b1e97614e':
  [MIPS] Invalidate cached pid in vfork.
2015-08-12 03:02:38 +00:00
Dan Albert
e7cf1de6b9 am f2985ed8: Merge "Fix test steps for 64-bit bionic"
* commit 'f2985ed840af2d5572fafb03074f17afa516d967':
  Fix test steps for 64-bit bionic
2015-08-12 02:11:05 +00:00
Dan Albert
4c615501e5 am 2b934924: Merge "Add missing include."
* commit '2b93492478b497181edf51f5829b984c4e904e52':
  Add missing include.
2015-08-12 00:43:41 +00:00
Yabin Cui
857336809e am 0660be89: am a6a12a78: am 0fdcdd00: Merge "Fix flaky test time.timer_settime_0." into lollipop-mr1-cts-dev
* commit '0660be899f2d907dedbcb643315b73e652ec9510':
  Fix flaky test time.timer_settime_0.
2015-08-11 19:32:20 +00:00
Dan Albert
4b99bef35b am a3c01467: Merge "Move up to C++14."
* commit 'a3c01467ecf31cab1410ce7b8554e2e77dae3309':
  Move up to C++14.
2015-08-10 23:59:12 +00:00
Yabin Cui
b23720dfc4 am ff4afc13: Merge "Omit comment when reading --gtest_list_tests option\'s output."
* commit 'ff4afc136ef5d00d33a611e7bc1950249db9fbcf':
  Omit comment when reading --gtest_list_tests option's output.
2015-08-10 22:22:47 +00:00
Elliott Hughes
9a549011ad am 182b91f6: Merge "Invalidate cached pid in vfork."
* commit '182b91f62809b03870f561a88135f5453966fe41':
  Invalidate cached pid in vfork.
2015-08-10 20:08:08 +00:00
Andreas Gampe
5e64d60690 am e80369ab: Merge "Bionic: Add a TLS slot for ART for Thread self"
* commit 'e80369ab0c484a99925a49a81ab0675538fab38a':
  Bionic: Add a TLS slot for ART for Thread self
2015-08-04 22:51:40 +00:00
Elliott Hughes
6a5a09be4e am b3db7764: Merge "name the arc4random structure mappings"
* commit 'b3db7764d0757392c73c716423f49dc0809c5a23':
  name the arc4random structure mappings
2015-08-04 01:12:55 +00:00
Elliott Hughes
d6edf15728 am f57f7945: Merge "Cherrypick upstream fnmatch.c fix."
* commit 'f57f7945159a0abbca248817d1d4af1e9d89e323':
  Cherrypick upstream fnmatch.c fix.
2015-08-03 21:46:53 +00:00
Elliott Hughes
3926593b36 am 2278d29a: Merge "[MIPS] Link .dex or .oat code lacking .MIPS.abiflags segment"
* commit '2278d29ada4cda53d81b87446254cea16e1b24fa':
  [MIPS] Link .dex or .oat code lacking .MIPS.abiflags segment
2015-08-03 19:32:35 +00:00
Yabin Cui
c028e4aaa3 am 7e919dae: Merge "add a fortified implementation of getcwd"
* commit '7e919daeaad62515ebbbf7b06badc77625a14d90':
  add a fortified implementation of getcwd
2015-08-03 18:02:03 +00:00
Elliott Hughes
90acccbd97 am 25907058: Merge "Sync current upstream fnmatch.c."
* commit '259070585820b4900622363dd7f968d6b644d75d':
  Sync current upstream fnmatch.c.
2015-08-01 15:48:05 +00:00
Elliott Hughes
52d8e318f9 am 61c21b63: Merge "Revert "add a fortified implementation of getcwd""
* commit '61c21b63bc1602bce8685757fb1c2a788cc9eb8d':
  Revert "add a fortified implementation of getcwd"
2015-08-01 15:47:56 +00:00
Yabin Cui
f11ff78db5 am 442a3fca: Merge "add a fortified implementation of getcwd"
* commit '442a3fcae68152a95ef481ef99932d1bc001dc08':
  add a fortified implementation of getcwd
2015-08-01 15:47:52 +00:00
Elliott Hughes
125481fe3c am 807f27f9: Merge "Stop sending SIGPIPE to debuggerd."
* commit '807f27f9548077f114dc009f60764fb0241a2620':
  Stop sending SIGPIPE to debuggerd.
2015-07-30 15:39:23 +00:00
Elliott Hughes
73854d9f1a am 44989174: Merge "Prevent buffer over-read in linker.cpp\'s parse_path."
* commit '4498917406ee543116ea7ed987d26a15b2c1496c':
  Prevent buffer over-read in linker.cpp's parse_path.
2015-07-30 00:50:45 +00:00
Elliott Hughes
45ea30c472 am 34c5f5ea: Merge "Remove PAGE_SIZE from <limits.h>."
* commit '34c5f5eacdedcea6b987854a4bca07c703495d62':
  Remove PAGE_SIZE from <limits.h>.
2015-07-29 15:58:32 +00:00
Elliott Hughes
73ca982c97 am 374adfee: Merge "Don\'t transitively include <limits.h> from <sys/user.h>."
* commit '374adfee473725994ee2568ce5aba93a7500064e':
  Don't transitively include <limits.h> from <sys/user.h>.
2015-07-29 07:17:51 +00:00
Elliott Hughes
475b542458 am 1ff4094a: Merge "Remove PAGESIZE."
* commit '1ff4094a7f106b3de390acb1e36c45bbb878a153':
  Remove PAGESIZE.
2015-07-29 07:17:48 +00:00
Elliott Hughes
cd6b01e214 am c8ba22c8: Merge "Move PAGE_MASK into <sys/user.h>."
* commit 'c8ba22c847bd5bfc97d29a4c565fd32993200a01':
  Move PAGE_MASK into <sys/user.h>.
2015-07-29 00:01:51 +00:00
Mark Salyzyn
6f0c9b4827 am 1923d4c0: Merge "deprecate TARGET_USES_LOGD"
* commit '1923d4c03a68c89f304b601545f5e8db026b9be0':
  deprecate TARGET_USES_LOGD
2015-07-28 19:51:17 +00:00
Elliott Hughes
26ac060046 am 4955cde2: Merge "Add a regression test for a fixed strnlen bug."
* commit '4955cde2c55d4860f12039a96d14fc756b1308a3':
  Add a regression test for a fixed strnlen bug.
2015-07-28 15:27:25 +00:00
Chih-hung Hsieh
d3d40b1531 am cebef1a7: Merge "Add one simple thread local storage test."
* commit 'cebef1a7812fe3552f12dd7e885a1f879a9946ed':
  Add one simple thread local storage test.
2015-07-28 02:02:20 +00:00
Christopher Ferris
4f4dd3caae am e8ceb95c: Merge "Remove pushes from memsets (krait/cortex-a9)."
* commit 'e8ceb95c680eacc3b5d16644a48a28b45f421e2f':
  Remove pushes from memsets (krait/cortex-a9).
2015-07-27 23:33:21 +00:00
Yabin Cui
98fc81cf5e am 8af32633: Merge "add fortified implementations of fread/fwrite"
* commit '8af32633498184e58e6f8d5d75b9f9cdbef5b6be':
  add fortified implementations of fread/fwrite
2015-07-27 23:14:45 +00:00
Dmitriy Ivanov
e6464678b3 am de0fb393: Restore protection flags for ifunc during relocs.
* commit 'de0fb393ae8136a5958fe17eee0c6285e2f7f91a':
  Restore protection flags for ifunc during relocs.
2015-07-27 22:23:32 +00:00
Elliott Hughes
291c314005 am f16c6e17: Merge "Restore protection flags for ifunc during relocs."
* commit 'f16c6e17b22c278320d0e662d1f1e1213f8fbc71':
  Restore protection flags for ifunc during relocs.
2015-07-27 22:02:23 +00:00
Elliott Hughes
9816016893 am bff19682: Merge "name the atexit handler pages"
* commit 'bff196822230b5a8b1f5bafeed88ded821d390a9':
  name the atexit handler pages
2015-07-27 18:50:47 +00:00
Elliott Hughes
e9f23862fe am adc5795f: Merge "Use AT_PAGESZ for sysconf(_SC_PAGE_SIZE)."
* commit 'adc5795fb7b674e6d40d1f190c675607c1379343':
  Use AT_PAGESZ for sysconf(_SC_PAGE_SIZE).
2015-07-25 18:56:53 +00:00
Yabin Cui
22091a09ae am b8320b80: Don\'t abort when failed to write tracing message.
* commit 'b8320b8021856ae61b3012b82c2ae96df97e3ec4':
  Don't abort when failed to write tracing message.
2015-07-24 04:16:39 +00:00
Christopher Ferris
beebbff0a0 am a3a61983: Merge "Make all labels local."
* commit 'a3a619835d302f5414883e2307ca48406b15a4a5':
  Make all labels local.
2015-07-24 01:17:09 +00:00
Dan Albert
c9d373e2d9 am 7e52dbe4: Merge "Revert "Stop libc from cross-referencing unwind symbols"" into mnc-dev
* commit '7e52dbe4d24daf61a8bd4bbbd0761c55468c3c7e':
  Revert "Stop libc from cross-referencing unwind symbols"
2015-07-23 21:50:48 +00:00
Yabin Cui
bb65e61f6b am 9e1c862c: Merge "Don\'t abort when failed to write tracing message."
* commit '9e1c862cb649f054aaa1c2141409387bf3d5f3eb':
  Don't abort when failed to write tracing message.
2015-07-23 19:10:22 +00:00
Yabin Cui
758bc0a806 am 2565492d: Merge "Add getgrgid_r/getgrnam_r."
* commit '2565492db0d67b95348cd1c3026ed338ca59aa37':
  Add getgrgid_r/getgrnam_r.
2015-07-22 03:44:16 +00:00
Elliott Hughes
cf3d602b28 am 3b49d61a: Merge "libc: arch-x86: implement kernel vdso time functions"
* commit '3b49d61ac2f7a02d5e7f25a24836b060f922f079':
  libc: arch-x86: implement kernel vdso time functions
2015-07-22 02:12:02 +00:00
Ying Wang
788e7c9937 am e39b279b: Merge "We don\'t have CXX_BARE any more" into mnc-dev
* commit 'e39b279bb4971d0c3322214ea977275f1bc58c0b':
  We don't have CXX_BARE any more
2015-07-21 21:50:27 +00:00
Ying Wang
e16cf1d531 am 86ac443c: Merge "We don\'t have CXX_BARE any more"
* commit '86ac443cd1df83bbef4a18046714e067a9d13247':
  We don't have CXX_BARE any more
2015-07-21 21:40:44 +00:00
Elliott Hughes
41298d1aae am bc0b8ff2: Merge "Use a less misleading name for the code that sets up the main thread."
* commit 'bc0b8ff2fbfb38f73114aef7df8e302025245441':
  Use a less misleading name for the code that sets up the main thread.
2015-07-21 20:53:23 +00:00
Christopher Ferris
bbfdd50518 am aa55e7ad: Add support for non-zero vaddr in maps.
* commit 'aa55e7ad249e49025d0507f513a6c45f8491a4e5':
  Add support for non-zero vaddr in maps.
2015-07-21 19:46:36 +00:00
Christopher Ferris
e47102098b am c99fabb7: Merge "Add support for non-zero vaddr in maps."
* commit 'c99fabb7a097e9aeed49ce03584cce113d086905':
  Add support for non-zero vaddr in maps.
2015-07-21 18:28:52 +00:00
Elliott Hughes
c2b097252a am 3bcfd47c: Merge "Revert "Revert "make vdso function pointers read-only at runtime"""
* commit '3bcfd47c6836a952b2093c64feb9f1e382891256':
  Revert "Revert "make vdso function pointers read-only at runtime""
2015-07-21 18:28:13 +00:00
Dan Albert
5905cee174 am f37c237b: Merge "Revert "Stop libc from cross-referencing unwind symbols""
* commit 'f37c237b8b15c00ac748fe2657a50df54fa55d5a':
  Revert "Stop libc from cross-referencing unwind symbols"
2015-07-21 02:35:27 +00:00
Dmitriy Ivanov
d2aeefed8e am e70d7a78: Merge "Fix dt_runpath test."
* commit 'e70d7a78f0bfba8b09d37c145769cb8d1d7c5fb6':
  Fix dt_runpath test.
2015-07-20 19:17:27 +00:00
Elliott Hughes
2733ec035d am e5544ae1: Merge "<sys/time.h> should include [most of] <sys/select.h>."
* commit 'e5544ae1f8a23ae77908e822e83a73ebd4b656ec':
  <sys/time.h> should include [most of] <sys/select.h>.
2015-07-20 18:44:56 +00:00
Elliott Hughes
039b290b9d am 6c9ad82b: Merge "Revert "make vdso function pointers read-only at runtime""
* commit '6c9ad82b1c0f26f5edb5d5ca246b88451c5ea238':
  Revert "make vdso function pointers read-only at runtime"
2015-07-20 18:44:55 +00:00
Elliott Hughes
af584b5e7b am 4f2e1d3b: Merge "Add all the glibc one-line "synonym" header files."
* commit '4f2e1d3b1e3b3729b551c22c5a0be8d07795adfd':
  Add all the glibc one-line "synonym" header files.
2015-07-17 22:04:59 +00:00
Elliott Hughes
87b64fb447 am ca7bc509: Merge "make vdso function pointers read-only at runtime"
* commit 'ca7bc509cf3b321b4721137df1e5407415fc7dd7':
  make vdso function pointers read-only at runtime
2015-07-17 18:39:31 +00:00
Dmitriy Ivanov
c6a87cc8cb am a58d2498: Merge "Fix potential race condition on dlopen"
* commit 'a58d24984045b474883ad14500a465ab331db47d':
  Fix potential race condition on dlopen
2015-07-17 18:17:06 +00:00
Bertrand SIMONNET
cca803af0c am 60bc9090: Merge "Add timespec/timeval conversion helpers."
* commit '60bc90909a49121789bf86f5d14f63967e8000e0':
  Add timespec/timeval conversion helpers.
2015-07-16 22:27:51 +00:00
Dmitriy Ivanov
9bd373c4fc am cd588f84: Merge "Add constant for zip separator"
* commit 'cd588f847f3f23a9c60e32ab1e37c170e9f5be57':
  Add constant for zip separator
2015-07-16 16:26:33 +00:00
Evgenii Stepanov
beaf565cd4 am b3140904: Merge "Replace spaces with tabs in a Makefile."
* commit 'b31409040f1766d92e76e72bbdc1b346f4bb9d8e':
  Replace spaces with tabs in a Makefile.
2015-07-15 23:57:15 +00:00
Evgenii Stepanov
43a783714f am e9774a52: Merge "A special linker for ASan executables."
* commit 'e9774a5227749035dc55357ae3a34edaf545c3b3':
  A special linker for ASan executables.
2015-07-15 17:50:49 +00:00
Yabin Cui
2f54a44110 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 20:27:23 +00:00
Christopher Ferris
3b9900d346 am a8d82f12: Merge "Update to v3.18.18 kernel headers."
* commit 'a8d82f126d1830ebee99e2622d08489a844e3e62':
  Update to v3.18.18 kernel headers.
2015-07-14 20:27:06 +00:00
Christopher Ferris
653f4b1504 am 43d35c35: Merge "Do not hold hash table lock while backtracing." into mnc-dev
* commit '43d35c356e2fbe0b022cef52445e93053c4ddbfd':
  Do not hold hash table lock while backtracing.
2015-07-14 17:15:51 +00:00
Christopher Ferris
287cf2664f am 5e3dc45a: Merge "Do not hold hash table lock while backtracing."
* commit '5e3dc45a16c63b716bc4b7bed2f5752b41a5d5d5':
  Do not hold hash table lock while backtracing.
2015-07-13 20:53:02 +00:00
Elliott Hughes
acf2b7bea6 am 147a50d0: Merge "Prevent user-defined basename_r from breaking basename(3)."
* commit '147a50d06e1183e3f39f4f6d0fa28748b33d4aa9':
  Prevent user-defined basename_r from breaking basename(3).
2015-07-11 07:23:37 +00:00
Neil Fuller
533efc20b7 am 64c82544: Merge "Update timezone data to 2015e" into mnc-dev
* commit '64c825441637b379be56a04622089e8e9b4b0da4':
  Update timezone data to 2015e
2015-07-10 10:35:23 +00:00
Dmitriy Ivanov
538a4d7029 am a5bb841d: Fix memory-leak on soinfo_free()
* commit 'a5bb841df799e10e7d0ae3202b097da8a1c23507':
  Fix memory-leak on soinfo_free()
2015-07-10 00:59:25 +00:00
Dmitriy Ivanov
9d4402a95c am 880a2933: Merge "Fix memory-leak on soinfo_free()"
* commit '880a293390b64da806a072f4ace2c2784b340876':
  Fix memory-leak on soinfo_free()
2015-07-09 23:54:12 +00:00
Pirama Arumuga Nainar
a13ece0d6c 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:06:07 +00:00
Daniel Erat
16d78688b4 am c6f25641: Merge "libc: Add sys/fcntl.h for compatibility."
* commit 'c6f25641eb874cd15f92759beff1ad67cfd8228b':
  libc: Add sys/fcntl.h for compatibility.
2015-07-08 21:44:59 +00:00
Evgenii Stepanov
c9bd26e96b am 33ef6c20: Merge "Respect caller DT_RUNPATH in dlopen()."
* commit '33ef6c20f2ddf19b29ed3a4e50139fa391b1a3d4':
  Respect caller DT_RUNPATH in dlopen().
2015-07-08 20:16:59 +00:00
Christopher Ferris
a2e2c3d2ae am 90de6820: Merge "Replace bx lr with update of pc from the stack."
* commit '90de6820f736de1239b218ea2b63d15c38505e93':
  Replace bx lr with update of pc from the stack.
2015-07-08 19:40:38 +00:00
Elliott Hughes
049a5ae002 am 7a9732d6: Merge "Add some glibc-like #defines for libchrome."
* commit '7a9732d663906bedd8734c9952e35728c2662767':
  Add some glibc-like #defines for libchrome.
2015-07-07 17:24:48 +00:00
Elliott Hughes
805844ff0c am 65dd8582: Fix alignment after variable-length data.
* commit '65dd858239c4e32a5a1afbc14ac30dbcdd2a50a3':
  Fix alignment after variable-length data.
2015-07-06 23:29:41 +00:00
Elliott Hughes
b6c2d3f30b am 89bbb846: Merge "Fix alignment after variable-length data."
* commit '89bbb846b9831f232b87d54a6eeb759ac603cc43':
  Fix alignment after variable-length data.
2015-07-06 22:54:52 +00:00
Elliott Hughes
6a31a37cc1 am f542b309: Merge "Name the thread stack and signal stack guard pages."
* commit 'f542b30970ae863caceea1f635115f1195461e31':
  Name the thread stack and signal stack guard pages.
2015-07-06 20:22:48 +00:00
139 changed files with 10100 additions and 2580 deletions

View File

@ -2,6 +2,7 @@ BasedOnStyle: Google
AllowShortBlocksOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
ColumnLimit: 100
CommentPragmas: NOLINT:.*
DerivePointerAlignment: false
IndentWidth: 2

View File

@ -169,9 +169,10 @@ As mentioned above, this is currently a two-step process:
Updating tzdata
---------------
This is fully automated:
This is fully automated (and these days handled by the libcore team, because
they own icu, and that needs to be updated in sync with bionic):
1. Run update-tzdata.py.
1. Run update-tzdata.py in external/icu/tools/.
Verifying changes
@ -268,18 +269,22 @@ However, this also makes it difficult to run the tests under GDB. To prevent
each test from being forked, run the tests with the flag `--no-isolate`.
LP32 ABI bugs
-------------
32-bit ABI bugs
---------------
This probably belongs in the NDK documentation rather than here, but these
are the known ABI bugs in LP32:
are the known ABI bugs in the 32-bit ABI:
* `time_t` is 32-bit. <http://b/5819737>
* `time_t` is 32-bit. <http://b/5819737>. In the 64-bit ABI, time_t is
64-bit.
* `off_t` is 32-bit. There is `off64_t`, but no `_FILE_OFFSET_BITS` support.
Many of the `off64_t` functions are missing in older releases, and
stdio uses 32-bit offsets, so there's no way to fully implement
`_FILE_OFFSET_BITS`.
* `off_t` is 32-bit. There is `off64_t`, and in newer releases there is
almost-complete support for `_FILE_OFFSET_BITS`. Unfortunately our stdio
implementation uses 32-bit offsets and -- worse -- function pointers to
functions that use 32-bit offsets, so there's no good way to implement
the last few pieces <http://b/24807045>. In the 64-bit ABI, off_t is
off64_t.
* `sigset_t` is too small on ARM and x86 (but correct on MIPS), so support
for real-time signals is broken. <http://b/5828899>
for real-time signals is broken. <http://b/5828899> In the 64-bit ABI,
`sigset_t` is the correct size for every architecture.

View File

@ -24,7 +24,7 @@
#include <string>
#include <vector>
#include <base/stringprintf.h>
#include <android-base/stringprintf.h>
#include <benchmark/Benchmark.h>

View File

@ -23,7 +23,7 @@
#include <string>
#include <base/stringprintf.h>
#include <android-base/stringprintf.h>
int Round(int n) {
int base = 1;

File diff suppressed because it is too large Load Diff

View File

@ -47,7 +47,6 @@ libc_common_src_files := \
bionic/if_indextoname.c \
bionic/if_nametoindex.c \
bionic/initgroups.c \
bionic/ioctl.c \
bionic/isatty.c \
bionic/memmem.c \
bionic/pututline.c \
@ -150,7 +149,9 @@ libc_bionic_ndk_src_files := \
bionic/getpid.cpp \
bionic/gettid.cpp \
bionic/__gnu_basename.cpp \
bionic/ifaddrs.cpp \
bionic/inotify_init.cpp \
bionic/ioctl.cpp \
bionic/lchown.cpp \
bionic/lfs64_support.cpp \
bionic/__libc_current_sigrtmax.cpp \
@ -170,6 +171,7 @@ libc_bionic_ndk_src_files := \
bionic/mkfifo.cpp \
bionic/mknod.cpp \
bionic/mntent.cpp \
bionic/mremap.cpp \
bionic/NetdClientDispatch.cpp \
bionic/open.cpp \
bionic/pathconf.cpp \
@ -242,9 +244,11 @@ libc_bionic_ndk_src_files := \
libc_bionic_src_files :=
# The fork implementation depends on pthread data, so we can't include it in
# libc_ndk.a.
libc_bionic_src_files += bionic/fork.cpp
# The following implementations depend on pthread data, so we can't include
# them in libc_ndk.a.
libc_bionic_src_files += \
bionic/__cxa_thread_atexit_impl.cpp \
bionic/fork.cpp \
# The data that backs getauxval is initialized in the libc init functions which
# are invoked by the linker. If this file is included in libc_ndk.a, only one of
@ -563,6 +567,7 @@ libc_upstream_openbsd_ndk_src_files := \
libc_pthread_src_files := \
bionic/pthread_atfork.cpp \
bionic/pthread_attr.cpp \
bionic/pthread_barrier.cpp \
bionic/pthread_cond.cpp \
bionic/pthread_create.cpp \
bionic/pthread_detach.cpp \
@ -582,9 +587,7 @@ libc_pthread_src_files := \
bionic/pthread_setname_np.cpp \
bionic/pthread_setschedparam.cpp \
bionic/pthread_sigmask.cpp \
libc_thread_atexit_impl_src_files := \
bionic/__cxa_thread_atexit_impl.cpp \
bionic/pthread_spinlock.cpp \
libc_arch_static_src_files := \
bionic/dl_iterate_phdr_static.cpp \
@ -622,6 +625,11 @@ ifeq ($(TARGET_ARCH),x86_64)
use_clang := false
endif
# b/25291096, Clang/llvm compiled libc.so for mips/mips64 failed to boot.
ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),mips mips64))
use_clang := false
endif
ifeq ($(use_clang),)
use_clang := false
endif
@ -637,7 +645,7 @@ ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
libc_common_cflags += -DDEBUG
endif
ifeq ($(MALLOC_IMPL),dlmalloc)
ifeq ($(MALLOC_SVELTE),true)
libc_common_cflags += -DUSE_DLMALLOC
libc_malloc_src := bionic/dlmalloc.c
else
@ -646,13 +654,6 @@ else
libc_common_c_includes += external/jemalloc/include
endif
# To customize dlmalloc's alignment, set BOARD_MALLOC_ALIGNMENT in
# the appropriate BoardConfig.mk file.
#
ifneq ($(BOARD_MALLOC_ALIGNMENT),)
libc_common_cflags += -DMALLOC_ALIGNMENT=$(BOARD_MALLOC_ALIGNMENT)
endif
# Define some common conlyflags
libc_common_conlyflags := \
-std=gnu99
@ -683,13 +684,21 @@ endef
# libc_stack_protector.a - stack protector code
# ========================================================
#
# The stack protector code needs to be compiled
# with -fno-stack-protector, since it modifies the
# stack canary.
# Code that implements the stack protector (or that runs
# before TLS has been set up) needs to be compiled with
# -fno-stack-protector, since it accesses the stack canary
# TLS slot.
include $(CLEAR_VARS)
LOCAL_SRC_FILES := bionic/__stack_chk_fail.cpp
LOCAL_SRC_FILES := \
bionic/__libc_init_main_thread.cpp \
bionic/__stack_chk_fail.cpp \
LOCAL_SRC_FILES_arm64 := arch-arm64/bionic/__set_tls.c
LOCAL_SRC_FILES_x86 := arch-x86/bionic/__set_tls.c
LOCAL_SRC_FILES_x86_64 := arch-x86_64/bionic/__set_tls.c
LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector
LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
LOCAL_CPPFLAGS := $(libc_common_cppflags)
@ -706,6 +715,30 @@ $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
include $(BUILD_STATIC_LIBRARY)
# libc_init_static.cpp also needs to be built without stack protector,
# because it's responsible for setting up TLS for static executables.
# This isn't the case for dynamic executables because the dynamic linker
# has already set up the main thread's TLS.
include $(CLEAR_VARS)
LOCAL_SRC_FILES := bionic/libc_init_static.cpp
LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector
LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
LOCAL_CPPFLAGS := $(libc_common_cppflags)
LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_MODULE := libc_init_static
LOCAL_CLANG := $(use_clang)
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
LOCAL_CXX_STL := none
LOCAL_SYSTEM_SHARED_LIBRARIES :=
LOCAL_SANITIZE := never
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
include $(BUILD_STATIC_LIBRARY)
# ========================================================
# libc_tzcode.a - upstream 'tzcode' code
# ========================================================
@ -724,6 +757,7 @@ LOCAL_CFLAGS := $(libc_common_cflags) \
LOCAL_CFLAGS += -DALL_STATE
# Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
LOCAL_CFLAGS += -DSTD_INSPIRED
# Obviously, we want to be thread-safe.
LOCAL_CFLAGS += -DTHREAD_SAFE
# The name of the tm_gmtoff field in our struct tm.
LOCAL_CFLAGS += -DTM_GMTOFF=tm_gmtoff
@ -731,6 +765,8 @@ LOCAL_CFLAGS += -DTM_GMTOFF=tm_gmtoff
LOCAL_CFLAGS += -DTZDIR=\"/system/usr/share/zoneinfo\"
# Include timezone and daylight globals.
LOCAL_CFLAGS += -DUSG_COMPAT=1
# Use the empty string (instead of " ") as the timezone abbreviation fallback.
LOCAL_CFLAGS += -DWILDABBR=\"\"
LOCAL_CFLAGS += -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU
LOCAL_CFLAGS += -Dlint
@ -939,6 +975,7 @@ LOCAL_SANITIZE := never
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_openbsd_src_files))
$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES_EXCLUDE,libc_openbsd_src_files_exclude))
include $(BUILD_STATIC_LIBRARY)
@ -1034,24 +1071,6 @@ $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_bionic_ndk_src_files))
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(libc_thread_atexit_impl_src_files)
LOCAL_CFLAGS := $(libc_common_cflags) -Wframe-larger-than=2048
LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
LOCAL_CPPFLAGS := $(libc_common_cppflags) -Wold-style-cast
LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_MODULE := libc_thread_atexit_impl
# TODO: Clang tries to use __tls_get_addr which is not supported yet
# remove after it is implemented.
LOCAL_CLANG := false
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
LOCAL_CXX_STL := none
LOCAL_SYSTEM_SHARED_LIBRARIES :=
LOCAL_SANITIZE := never
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
include $(BUILD_STATIC_LIBRARY)
# ========================================================
# libc_pthread.a - pthreads parts that previously lived in
@ -1209,7 +1228,7 @@ LOCAL_WHOLE_STATIC_LIBRARIES := \
LOCAL_WHOLE_STATIC_LIBRARIES_arm := libc_aeabi
LOCAL_CXX_STL := none
ifneq ($(MALLOC_IMPL),dlmalloc)
ifneq ($(MALLOC_SVELTE),true)
LOCAL_WHOLE_STATIC_LIBRARIES += libjemalloc
endif
@ -1249,7 +1268,6 @@ LOCAL_WHOLE_STATIC_LIBRARIES := \
libc_pthread \
libc_stack_protector \
libc_syscalls \
libc_thread_atexit_impl \
libc_tzcode \
LOCAL_WHOLE_STATIC_LIBRARIES_arm := libc_aeabi
@ -1282,7 +1300,6 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
$(libc_arch_static_src_files) \
bionic/libc_init_static.cpp
LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_CFLAGS := $(libc_common_cflags) \
@ -1294,7 +1311,7 @@ LOCAL_CPPFLAGS := $(libc_common_cppflags)
LOCAL_MODULE := libc_nomalloc
LOCAL_CLANG := $(use_clang)
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common libc_init_static
LOCAL_CXX_STL := none
LOCAL_SYSTEM_SHARED_LIBRARIES :=
LOCAL_SANITIZE := never
@ -1334,7 +1351,6 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
$(libc_arch_static_src_files) \
bionic/malloc_debug_common.cpp \
bionic/libc_init_static.cpp \
LOCAL_CFLAGS := $(libc_common_cflags) \
-DLIBC_STATIC \
@ -1345,9 +1361,9 @@ LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_MODULE := libc
LOCAL_CLANG := $(use_clang)
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common libc_init_static
ifneq ($(MALLOC_IMPL),dlmalloc)
ifneq ($(MALLOC_SVELTE),true)
LOCAL_WHOLE_STATIC_LIBRARIES += libjemalloc
endif
@ -1391,6 +1407,9 @@ LOCAL_ADDITIONAL_DEPENDENCIES := \
$(LOCAL_PATH)/libc.mips64.map \
$(LOCAL_PATH)/libc.x86.map \
$(LOCAL_PATH)/libc.x86_64.map \
$(LOCAL_PATH)/libc.arm.brillo.map \
$(LOCAL_PATH)/libc.mips.brillo.map \
$(LOCAL_PATH)/libc.x86.brillo.map \
# Leave the symbols in the shared library so that stack unwinders can produce
# meaningful name resolution.
@ -1410,7 +1429,7 @@ LOCAL_PACK_MODULE_RELOCATIONS := false
LOCAL_SHARED_LIBRARIES := libdl
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
ifneq ($(MALLOC_IMPL),dlmalloc)
ifneq ($(MALLOC_SVELTE),true)
LOCAL_WHOLE_STATIC_LIBRARIES += libjemalloc
endif
@ -1422,11 +1441,18 @@ LOCAL_LDFLAGS_arm := -Wl,--hash-style=both
LOCAL_LDFLAGS_x86 := -Wl,--hash-style=both
# Don't re-export new/delete and friends, even if the compiler really wants to.
ifdef BRILLO
LOCAL_LDFLAGS_arm += -Wl,--version-script,$(LOCAL_PATH)/libc.arm.brillo.map
LOCAL_LDFLAGS_mips += -Wl,--version-script,$(LOCAL_PATH)/libc.mips.brillo.map
LOCAL_LDFLAGS_x86 += -Wl,--version-script,$(LOCAL_PATH)/libc.x86.brillo.map
else
LOCAL_LDFLAGS_arm += -Wl,--version-script,$(LOCAL_PATH)/libc.arm.map
LOCAL_LDFLAGS_arm64 += -Wl,--version-script,$(LOCAL_PATH)/libc.arm64.map
LOCAL_LDFLAGS_mips += -Wl,--version-script,$(LOCAL_PATH)/libc.mips.map
LOCAL_LDFLAGS_mips64 += -Wl,--version-script,$(LOCAL_PATH)/libc.mips64.map
LOCAL_LDFLAGS_x86 += -Wl,--version-script,$(LOCAL_PATH)/libc.x86.map
endif
LOCAL_LDFLAGS_arm64 += -Wl,--version-script,$(LOCAL_PATH)/libc.arm64.map
LOCAL_LDFLAGS_mips64 += -Wl,--version-script,$(LOCAL_PATH)/libc.mips64.map
LOCAL_LDFLAGS_x86_64 += -Wl,--version-script,$(LOCAL_PATH)/libc.x86_64.map
# We'd really like to do this for all architectures, but since this wasn't done

View File

@ -107,7 +107,7 @@ ssize_t pwritev|pwritev64(int, const struct iovec*, int, off_t) arm64,mips64
int ___close:close(int) all
pid_t __getpid:getpid() all
int munmap(void*, size_t) all
void* mremap(void*, size_t, size_t, unsigned long) all
void* ___mremap:mremap(void*, size_t, size_t, int, void*) all
int msync(const void*, size_t, int) all
int mprotect(const void*, size_t, int) all
int madvise(void*, size_t, int) all

View File

@ -51,34 +51,62 @@ extern int __cxa_atexit(void (*)(void*), void*, void*);
*/
int __attribute__((weak))
__aeabi_atexit(void *object, void (*destructor) (void *), void *dso_handle) {
__aeabi_atexit_impl(void *object, void (*destructor) (void *), void *dso_handle) {
return __cxa_atexit(destructor, object, dso_handle);
}
int __attribute__((weak))
__aeabi_atexit_impl2(void *object, void (*destructor) (void *), void *dso_handle) {
return __cxa_atexit(destructor, object, dso_handle);
}
void __attribute__((weak))
__aeabi_memcpy8(void *dest, const void *src, size_t n) {
void __attribute__((weak)) __aeabi_memcpy8_impl(void *dest, const void *src, size_t n) {
memcpy(dest, src, n);
}
void __attribute__((weak)) __aeabi_memcpy4(void *dest, const void *src, size_t n) {
void __attribute__((weak)) __aeabi_memcpy4_impl(void *dest, const void *src, size_t n) {
memcpy(dest, src, n);
}
void __attribute__((weak)) __aeabi_memcpy(void *dest, const void *src, size_t n) {
void __attribute__((weak)) __aeabi_memcpy_impl(void *dest, const void *src, size_t n) {
memcpy(dest, src, n);
}
void __attribute__((weak)) __aeabi_memcpy8_impl2(void *dest, const void *src, size_t n) {
memcpy(dest, src, n);
}
void __attribute__((weak)) __aeabi_memcpy4_impl2(void *dest, const void *src, size_t n) {
memcpy(dest, src, n);
}
void __attribute__((weak)) __aeabi_memcpy_impl2(void *dest, const void *src, size_t n) {
memcpy(dest, src, n);
}
void __attribute__((weak)) __aeabi_memmove8(void *dest, const void *src, size_t n) {
void __attribute__((weak)) __aeabi_memmove8_impl(void *dest, const void *src, size_t n) {
memmove(dest, src, n);
}
void __attribute__((weak)) __aeabi_memmove4(void *dest, const void *src, size_t n) {
void __attribute__((weak)) __aeabi_memmove4_impl(void *dest, const void *src, size_t n) {
memmove(dest, src, n);
}
void __attribute__((weak)) __aeabi_memmove(void *dest, const void *src, size_t n) {
void __attribute__((weak)) __aeabi_memmove_impl(void *dest, const void *src, size_t n) {
memmove(dest, src, n);
}
void __attribute__((weak)) __aeabi_memmove8_impl2(void *dest, const void *src, size_t n) {
memmove(dest, src, n);
}
void __attribute__((weak)) __aeabi_memmove4_impl2(void *dest, const void *src, size_t n) {
memmove(dest, src, n);
}
void __attribute__((weak)) __aeabi_memmove_impl2(void *dest, const void *src, size_t n) {
memmove(dest, src, n);
}
@ -87,27 +115,71 @@ void __attribute__((weak)) __aeabi_memmove(void *dest, const void *src, size_t n
* This allows __aeabi_memclr to tail-call __aeabi_memset
*/
void __attribute__((weak)) __aeabi_memset8(void *dest, size_t n, int c) {
void __attribute__((weak)) __aeabi_memset8_impl(void *dest, size_t n, int c) {
memset(dest, c, n);
}
void __attribute__((weak)) __aeabi_memset4(void *dest, size_t n, int c) {
void __attribute__((weak)) __aeabi_memset4_impl(void *dest, size_t n, int c) {
memset(dest, c, n);
}
void __attribute__((weak)) __aeabi_memset(void *dest, size_t n, int c) {
void __attribute__((weak)) __aeabi_memset_impl(void *dest, size_t n, int c) {
memset(dest, c, n);
}
void __attribute__((weak)) __aeabi_memset8_impl2(void *dest, size_t n, int c) {
memset(dest, c, n);
}
void __attribute__((weak)) __aeabi_memset4_impl2(void *dest, size_t n, int c) {
memset(dest, c, n);
}
void __attribute__((weak)) __aeabi_memset_impl2(void *dest, size_t n, int c) {
memset(dest, c, n);
}
void __attribute__((weak)) __aeabi_memclr8(void *dest, size_t n) {
__aeabi_memset8(dest, n, 0);
void __attribute__((weak)) __aeabi_memclr8_impl(void *dest, size_t n) {
__aeabi_memset8_impl(dest, n, 0);
}
void __attribute__((weak)) __aeabi_memclr4(void *dest, size_t n) {
__aeabi_memset4(dest, n, 0);
void __attribute__((weak)) __aeabi_memclr4_impl(void *dest, size_t n) {
__aeabi_memset4_impl(dest, n, 0);
}
void __attribute__((weak)) __aeabi_memclr(void *dest, size_t n) {
__aeabi_memset(dest, n, 0);
void __attribute__((weak)) __aeabi_memclr_impl(void *dest, size_t n) {
__aeabi_memset_impl(dest, n, 0);
}
void __attribute__((weak)) __aeabi_memclr8_impl2(void *dest, size_t n) {
__aeabi_memset8_impl(dest, n, 0);
}
void __attribute__((weak)) __aeabi_memclr4_impl2(void *dest, size_t n) {
__aeabi_memset4_impl(dest, n, 0);
}
void __attribute__((weak)) __aeabi_memclr_impl2(void *dest, size_t n) {
__aeabi_memset_impl(dest, n, 0);
}
#define __AEABI_SYMVERS(fn_name) \
__asm__(".symver " #fn_name "_impl, " #fn_name "@@LIBC_N"); \
__asm__(".symver " #fn_name "_impl2, " #fn_name "@LIBC_PRIVATE")
__AEABI_SYMVERS(__aeabi_atexit);
__AEABI_SYMVERS(__aeabi_memcpy8);
__AEABI_SYMVERS(__aeabi_memcpy4);
__AEABI_SYMVERS(__aeabi_memcpy);
__AEABI_SYMVERS(__aeabi_memmove8);
__AEABI_SYMVERS(__aeabi_memmove4);
__AEABI_SYMVERS(__aeabi_memmove);
__AEABI_SYMVERS(__aeabi_memset8);
__AEABI_SYMVERS(__aeabi_memset4);
__AEABI_SYMVERS(__aeabi_memset);
__AEABI_SYMVERS(__aeabi_memclr8);
__AEABI_SYMVERS(__aeabi_memclr4);
__AEABI_SYMVERS(__aeabi_memclr);
#undef __AEABI_SYMVERS

View File

@ -37,7 +37,13 @@
* the expectation that libc will define it and call through to
* a differently-named function in the dynamic linker.
*/
_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc, int *pcount)
{
_Unwind_Ptr __gnu_Unwind_Find_exidx_impl(_Unwind_Ptr pc, int *pcount) {
return dl_unwind_find_exidx(pc, pcount);
}
_Unwind_Ptr __gnu_Unwind_Find_exidx_impl2(_Unwind_Ptr pc, int *pcount) {
return dl_unwind_find_exidx(pc, pcount);
}
__asm__(".symver __gnu_Unwind_Find_exidx_impl,__gnu_Unwind_Find_exidx@LIBC_PRIVATE");
__asm__(".symver __gnu_Unwind_Find_exidx_impl2,__gnu_Unwind_Find_exidx@@LIBC_N");

View File

@ -0,0 +1,23 @@
/* Generated by gensyscalls.py. Do not edit. */
#include <private/bionic_asm.h>
ENTRY(___mremap)
mov ip, sp
stmfd sp!, {r4, r5, r6, r7}
.cfi_def_cfa_offset 16
.cfi_rel_offset r4, 0
.cfi_rel_offset r5, 4
.cfi_rel_offset r6, 8
.cfi_rel_offset r7, 12
ldmfd ip, {r4, r5, r6}
ldr r7, =__NR_mremap
swi #0
ldmfd sp!, {r4, r5, r6, r7}
.cfi_def_cfa_offset 0
cmn r0, #(MAX_ERRNO + 1)
bxls lr
neg r0, r0
b __set_errno_internal
END(___mremap)
.hidden ___mremap

View File

@ -1,14 +0,0 @@
/* Generated by gensyscalls.py. Do not edit. */
#include <private/bionic_asm.h>
ENTRY(mremap)
mov ip, r7
ldr r7, =__NR_mremap
swi #0
mov r7, ip
cmn r0, #(MAX_ERRNO + 1)
bxls lr
neg r0, r0
b __set_errno_internal
END(mremap)

View File

@ -42,7 +42,6 @@ libc_bionic_src_files_arm64 += \
arch-arm64/bionic/__bionic_clone.S \
arch-arm64/bionic/_exit_with_stack_teardown.S \
arch-arm64/bionic/setjmp.S \
arch-arm64/bionic/__set_tls.c \
arch-arm64/bionic/syscall.S \
arch-arm64/bionic/vfork.S \

View File

@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
ENTRY(mremap)
ENTRY(___mremap)
mov x8, __NR_mremap
svc #0
@ -11,4 +11,5 @@ ENTRY(mremap)
b.hi __set_errno_internal
ret
END(mremap)
END(___mremap)
.hidden ___mremap

View File

@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
ENTRY(mremap)
ENTRY(___mremap)
.set noreorder
.cpload t9
li v0, __NR_mremap
@ -16,4 +16,5 @@ ENTRY(mremap)
j t9
nop
.set reorder
END(mremap)
END(___mremap)
.hidden ___mremap

View File

@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
ENTRY(mremap)
ENTRY(___mremap)
.set push
.set noreorder
li v0, __NR_mremap
@ -22,4 +22,5 @@ ENTRY(mremap)
j t9
move ra, t0
.set pop
END(mremap)
END(___mremap)
.hidden ___mremap

View File

@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
ENTRY(mremap)
ENTRY(___mremap)
pushl %ebx
.cfi_def_cfa_offset 8
.cfi_rel_offset ebx, 0
@ -15,10 +15,14 @@ ENTRY(mremap)
pushl %esi
.cfi_adjust_cfa_offset 4
.cfi_rel_offset esi, 0
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
mov 32(%esp), %esi
pushl %edi
.cfi_adjust_cfa_offset 4
.cfi_rel_offset edi, 0
mov 24(%esp), %ebx
mov 28(%esp), %ecx
mov 32(%esp), %edx
mov 36(%esp), %esi
mov 40(%esp), %edi
movl $__NR_mremap, %eax
int $0x80
cmpl $-MAX_ERRNO, %eax
@ -28,9 +32,11 @@ ENTRY(mremap)
call __set_errno_internal
addl $4, %esp
1:
popl %edi
popl %esi
popl %edx
popl %ecx
popl %ebx
ret
END(mremap)
END(___mremap)
.hidden ___mremap

View File

@ -109,7 +109,6 @@ libc_bionic_src_files_x86 += \
arch-x86/bionic/libgcc_compat.c \
arch-x86/bionic/__restore.S \
arch-x86/bionic/setjmp.S \
arch-x86/bionic/__set_tls.c \
arch-x86/bionic/syscall.S \
arch-x86/bionic/vfork.S \

View File

@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
ENTRY(mremap)
ENTRY(___mremap)
movq %rcx, %r10
movl $__NR_mremap, %eax
syscall
@ -13,4 +13,5 @@ ENTRY(mremap)
call __set_errno_internal
1:
ret
END(mremap)
END(___mremap)
.hidden ___mremap

View File

@ -25,7 +25,6 @@ libc_bionic_src_files_x86_64 += \
arch-x86_64/bionic/_exit_with_stack_teardown.S \
arch-x86_64/bionic/__restore_rt.S \
arch-x86_64/bionic/setjmp.S \
arch-x86_64/bionic/__set_tls.c \
arch-x86_64/bionic/syscall.S \
arch-x86_64/bionic/vfork.S \

View File

@ -109,7 +109,7 @@ extern "C" int __cxa_guard_acquire(_guard_t* gv) {
}
}
__futex_wait_ex(&gv->state, false, CONSTRUCTION_UNDERWAY_WITH_WAITER, NULL);
__futex_wait_ex(&gv->state, false, CONSTRUCTION_UNDERWAY_WITH_WAITER, false, nullptr);
old_value = atomic_load_explicit(&gv->state, memory_order_relaxed);
}
}

View File

@ -15,32 +15,34 @@
*/
#include <sys/cdefs.h>
struct thread_local_dtor {
#include "pthread_internal.h"
class thread_local_dtor {
public:
void (*func) (void *);
void *arg;
void *dso_handle; // unused...
thread_local_dtor* next;
};
static __thread thread_local_dtor* thread_local_dtors = nullptr;
extern "C" int __cxa_thread_atexit_impl(void (*func) (void *), void *arg, void *dso_handle) {
thread_local_dtor* dtor = new thread_local_dtor();
dtor->func = func;
dtor->arg = arg;
dtor->dso_handle = dso_handle;
dtor->next = thread_local_dtors;
thread_local_dtors = dtor;
pthread_internal_t* thread = __get_thread();
dtor->next = thread->thread_local_dtors;
thread->thread_local_dtors = dtor;
return 0;
}
extern "C" __LIBC_HIDDEN__ void __cxa_thread_finalize() {
while (thread_local_dtors != nullptr) {
thread_local_dtor* current = thread_local_dtors;
thread_local_dtors = current->next;
pthread_internal_t* thread = __get_thread();
while (thread->thread_local_dtors != nullptr) {
thread_local_dtor* current = thread->thread_local_dtors;
thread->thread_local_dtors = current->next;
current->func(current->arg);
delete current;

View File

@ -0,0 +1,85 @@
/*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "libc_init_common.h"
#include "private/bionic_auxv.h"
#include "private/bionic_globals.h"
#include "private/KernelArgumentBlock.h"
#include "pthread_internal.h"
extern "C" int __set_tls(void* ptr);
extern "C" int __set_tid_address(int* tid_address);
// Setup for the main thread. For dynamic executables, this is called by the
// linker _before_ libc is mapped in memory. This means that all writes to
// globals from this function will apply to linker-private copies and will not
// be visible from libc later on.
//
// Note: this function creates a pthread_internal_t for the initial thread and
// stores the pointer in TLS, but does not add it to pthread's thread list. This
// has to be done later from libc itself (see __libc_init_common).
//
// This is in a file by itself because it needs to be built with
// -fno-stack-protector because it's responsible for setting up the main
// thread's TLS (which stack protector relies on).
void __libc_init_main_thread(KernelArgumentBlock& args) {
__libc_auxv = args.auxv;
static pthread_internal_t main_thread;
// The -fstack-protector implementation uses TLS, so make sure that's
// set up before we call any function that might get a stack check inserted.
__set_tls(main_thread.tls);
// Tell the kernel to clear our tid field when we exit, so we're like any other pthread.
// As a side-effect, this tells us our pid (which is the same as the main thread's tid).
main_thread.tid = __set_tid_address(&main_thread.tid);
main_thread.set_cached_pid(main_thread.tid);
// We don't want to free the main thread's stack even when the main thread exits
// because things like environment variables with global scope live on it.
// We also can't free the pthread_internal_t itself, since that lives on the main
// thread's stack rather than on the heap.
// The main thread has no mmap allocated space for stack or pthread_internal_t.
main_thread.mmap_size = 0;
pthread_attr_init(&main_thread.attr);
main_thread.attr.guard_size = 0; // The main thread has no guard page.
main_thread.attr.stack_size = 0; // User code should never see this; we'll compute it when asked.
// TODO: the main thread's sched_policy and sched_priority need to be queried.
__init_thread(&main_thread);
__init_tls(&main_thread);
// Store a pointer to the kernel argument block in a TLS slot to be
// picked up by the libc constructor.
main_thread.tls[TLS_SLOT_BIONIC_PREINIT] = &args;
__init_alternate_signal_stack(&main_thread);
}

View File

@ -34,27 +34,25 @@ constexpr char SYSTRACE_PROPERTY_NAME[] = "debug.atrace.tags.enableflags";
static Lock g_lock;
static const prop_info* g_pinfo;
static uint32_t g_serial = -1;
static uint32_t g_property_serial = -1;
static uint32_t g_property_area_serial = -1;
static uint64_t g_tags;
static int g_trace_marker_fd = -1;
static bool should_trace() {
bool result = false;
g_lock.lock();
// If g_pinfo is null, this means that systrace hasn't been run and it's safe to
// assume that no trace writing will need to take place. However, to avoid running
// this costly find check each time, we set it to a non-tracing value so that next
// time, it will just check the serial to see if the value has been changed.
// this function also deals with the bootup case, during which the call to property
// set will fail if the property server hasn't yet started.
if (g_pinfo == NULL) {
// debug.atrace.tags.enableflags is set to a safe non-tracing value during property
// space initialization, so it should only be null in two cases, if there are
// insufficient permissions for this process to access the property, in which
// case an audit will be logged, and during boot before the property server has
// been started, in which case we store the global property_area serial to prevent
// the costly find operation until we see a changed property_area.
if (!g_pinfo && g_property_area_serial != __system_property_area_serial()) {
g_property_area_serial = __system_property_area_serial();
g_pinfo = __system_property_find(SYSTRACE_PROPERTY_NAME);
if (g_pinfo == NULL) {
__system_property_set(SYSTRACE_PROPERTY_NAME, "0");
g_pinfo = __system_property_find(SYSTRACE_PROPERTY_NAME);
}
}
if (g_pinfo != NULL) {
if (g_pinfo) {
// Find out which tags have been enabled on the command line and set
// the value of tags accordingly. If the value of the property changes,
// the serial will also change, so the costly system_property_read function
@ -62,11 +60,11 @@ static bool should_trace() {
// first. The values within pinfo may change, but its location is guaranteed
// not to move.
uint32_t cur_serial = __system_property_serial(g_pinfo);
if (cur_serial != g_serial) {
g_serial = cur_serial;
if (cur_serial != g_property_serial) {
g_property_serial = cur_serial;
char value[PROP_VALUE_MAX];
__system_property_read(g_pinfo, 0, value);
g_tags = strtoull(value, NULL, 0);
g_tags = strtoull(value, nullptr, 0);
}
result = ((g_tags & ATRACE_TAG_BIONIC) != 0);
}

View File

@ -52,18 +52,12 @@ void timeval_from_timespec(timeval& tv, const timespec& ts) {
tv.tv_usec = ts.tv_nsec / 1000;
}
// Initializes 'ts' with the difference between 'abs_ts' and the current time
// according to 'clock'. Returns false if abstime already expired, true otherwise.
bool timespec_from_absolute_timespec(timespec& ts, const timespec& abs_ts, clockid_t clock) {
clock_gettime(clock, &ts);
ts.tv_sec = abs_ts.tv_sec - ts.tv_sec;
ts.tv_nsec = abs_ts.tv_nsec - ts.tv_nsec;
if (ts.tv_nsec < 0) {
ts.tv_sec--;
ts.tv_nsec += NS_PER_S;
void absolute_timespec_from_timespec(timespec& abs_ts, const timespec& ts, clockid_t clock) {
clock_gettime(clock, &abs_ts);
abs_ts.tv_sec += ts.tv_sec;
abs_ts.tv_nsec += ts.tv_nsec;
if (abs_ts.tv_nsec >= NS_PER_S) {
abs_ts.tv_nsec -= NS_PER_S;
abs_ts.tv_sec++;
}
if (ts.tv_nsec < 0 || ts.tv_sec < 0) {
return false;
}
return true;
}

View File

@ -36,23 +36,15 @@
// struct __sfileext (see fileext.h).
void flockfile(FILE* fp) {
if (!__sdidinit) {
__sinit();
}
if (fp != NULL) {
if (fp != nullptr) {
pthread_mutex_lock(&_FLOCK(fp));
}
}
int ftrylockfile(FILE* fp) {
if (!__sdidinit) {
__sinit();
}
// The specification for ftrylockfile() says it returns 0 on success,
// or non-zero on error. So return an errno code directly on error.
if (fp == NULL) {
if (fp == nullptr) {
return EINVAL;
}
@ -60,11 +52,7 @@ int ftrylockfile(FILE* fp) {
}
void funlockfile(FILE* fp) {
if (!__sdidinit) {
__sinit();
}
if (fp != NULL) {
if (fp != nullptr) {
pthread_mutex_unlock(&_FLOCK(fp));
}
}

241
libc/bionic/ifaddrs.cpp Normal file
View File

@ -0,0 +1,241 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <ifaddrs.h>
#include <errno.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <net/if.h>
#include <netinet/in.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
// The public ifaddrs struct is full of pointers. Rather than track several
// different allocations, we use a maximally-sized structure with the public
// part at offset 0, and pointers into its hidden tail.
struct ifaddrs_storage {
// Must come first, so that `ifaddrs_storage` is-a `ifaddrs`.
ifaddrs ifa;
// The interface index, so we can match RTM_NEWADDR messages with
// earlier RTM_NEWLINK messages (to copy the interface flags).
int interface_index;
// Storage for the pointers in `ifa`.
sockaddr_storage addr;
sockaddr_storage netmask;
sockaddr_storage ifa_ifu;
char name[IFNAMSIZ + 1];
ifaddrs_storage(ifaddrs** list) {
memset(this, 0, sizeof(*this));
// push_front onto `list`.
ifa.ifa_next = *list;
*list = reinterpret_cast<ifaddrs*>(this);
}
// Netlink gives us the address family in the header, and the
// sockaddr_in or sockaddr_in6 bytes as the payload. We need to
// stitch the two bits together into the sockaddr that's part of
// our portable interface.
void SetAddress(int family, const void* data, size_t byteCount) {
addr.ss_family = family;
memcpy(SockaddrBytes(family, &addr), data, byteCount);
ifa.ifa_addr = reinterpret_cast<sockaddr*>(&addr);
}
void SetBroadcastAddress(int family, const void* data, size_t byteCount) {
ifa_ifu.ss_family = family;
memcpy(SockaddrBytes(family, &ifa_ifu), data, byteCount);
ifa.ifa_dstaddr = reinterpret_cast<sockaddr*>(&ifa_ifu);
}
// Netlink gives us the prefix length as a bit count. We need to turn
// that into a BSD-compatible netmask represented by a sockaddr*.
void SetNetmask(int family, size_t prefix_length) {
// ...and work out the netmask from the prefix length.
netmask.ss_family = family;
uint8_t* dst = SockaddrBytes(family, &netmask);
memset(dst, 0xff, prefix_length / 8);
if ((prefix_length % 8) != 0) {
dst[prefix_length/8] = (0xff << (8 - (prefix_length % 8)));
}
ifa.ifa_netmask = reinterpret_cast<sockaddr*>(&netmask);
}
private:
// Returns a pointer to the first byte in the address data (which is
// stored in network byte order).
uint8_t* SockaddrBytes(int family, sockaddr_storage* ss) {
if (family == AF_INET) {
sockaddr_in* ss4 = reinterpret_cast<sockaddr_in*>(ss);
return reinterpret_cast<uint8_t*>(&ss4->sin_addr);
} else if (family == AF_INET6) {
sockaddr_in6* ss6 = reinterpret_cast<sockaddr_in6*>(ss);
return reinterpret_cast<uint8_t*>(&ss6->sin6_addr);
}
return nullptr;
}
};
#if !defined(__clang__)
// GCC gets confused by NLMSG_DATA and doesn't realize that the old-style
// cast is from a system header and should be ignored.
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif
static void __handle_netlink_response(ifaddrs** out, nlmsghdr* hdr) {
if (hdr->nlmsg_type == RTM_NEWLINK) {
ifinfomsg* ifi = reinterpret_cast<ifinfomsg*>(NLMSG_DATA(hdr));
// Create a new ifaddr entry, and set the interface index and flags.
ifaddrs_storage* new_addr = new ifaddrs_storage(out);
new_addr->interface_index = ifi->ifi_index;
new_addr->ifa.ifa_flags = ifi->ifi_flags;
// Go through the various bits of information and find the name.
rtattr* rta = IFLA_RTA(ifi);
size_t rta_len = IFLA_PAYLOAD(hdr);
while (RTA_OK(rta, rta_len)) {
if (rta->rta_type == IFLA_IFNAME) {
if (RTA_PAYLOAD(rta) < sizeof(new_addr->name)) {
memcpy(new_addr->name, RTA_DATA(rta), RTA_PAYLOAD(rta));
new_addr->ifa.ifa_name = new_addr->name;
}
}
rta = RTA_NEXT(rta, rta_len);
}
} else if (hdr->nlmsg_type == RTM_NEWADDR) {
ifaddrmsg* msg = reinterpret_cast<ifaddrmsg*>(NLMSG_DATA(hdr));
// We should already know about this from an RTM_NEWLINK message.
ifaddrs_storage* addr = reinterpret_cast<ifaddrs_storage*>(*out);
while (addr != nullptr && addr->interface_index != static_cast<int>(msg->ifa_index)) {
addr = reinterpret_cast<ifaddrs_storage*>(addr->ifa.ifa_next);
}
// If this is an unknown interface, ignore whatever we're being told about it.
if (addr == nullptr) return;
// Create a new ifaddr entry and copy what we already know.
ifaddrs_storage* new_addr = new ifaddrs_storage(out);
// We can just copy the name rather than look for IFA_LABEL.
strcpy(new_addr->name, addr->name);
new_addr->ifa.ifa_name = new_addr->name;
new_addr->ifa.ifa_flags = addr->ifa.ifa_flags;
new_addr->interface_index = addr->interface_index;
// Go through the various bits of information and find the address
// and any broadcast/destination address.
rtattr* rta = IFA_RTA(msg);
size_t rta_len = IFA_PAYLOAD(hdr);
while (RTA_OK(rta, rta_len)) {
if (rta->rta_type == IFA_ADDRESS) {
if (msg->ifa_family == AF_INET || msg->ifa_family == AF_INET6) {
addr->SetAddress(msg->ifa_family, RTA_DATA(rta), RTA_PAYLOAD(rta));
addr->SetNetmask(msg->ifa_family, msg->ifa_prefixlen);
}
} else if (rta->rta_type == IFA_BROADCAST) {
if (msg->ifa_family == AF_INET || msg->ifa_family == AF_INET6) {
addr->SetBroadcastAddress(msg->ifa_family, RTA_DATA(rta), RTA_PAYLOAD(rta));
}
}
rta = RTA_NEXT(rta, rta_len);
}
}
}
static bool __send_netlink_request(int fd, int type) {
struct NetlinkMessage {
nlmsghdr hdr;
rtgenmsg msg;
} request;
memset(&request, 0, sizeof(request));
request.hdr.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST;
request.hdr.nlmsg_type = type;
request.hdr.nlmsg_len = sizeof(request);
request.msg.rtgen_family = AF_UNSPEC; // All families.
return (TEMP_FAILURE_RETRY(send(fd, &request, sizeof(request), 0)) == sizeof(request));
}
static bool __read_netlink_responses(int fd, ifaddrs** out, char* buf, size_t buf_len) {
ssize_t bytes_read;
// Read through all the responses, handing interesting ones to __handle_netlink_response.
while ((bytes_read = TEMP_FAILURE_RETRY(recv(fd, buf, buf_len, 0))) > 0) {
nlmsghdr* hdr = reinterpret_cast<nlmsghdr*>(buf);
for (; NLMSG_OK(hdr, static_cast<size_t>(bytes_read)); hdr = NLMSG_NEXT(hdr, bytes_read)) {
if (hdr->nlmsg_type == NLMSG_DONE) return true;
if (hdr->nlmsg_type == NLMSG_ERROR) return false;
__handle_netlink_response(out, hdr);
}
}
// We only get here if recv fails before we see a NLMSG_DONE.
return false;
}
int getifaddrs(ifaddrs** out) {
// Make cleanup easy.
*out = nullptr;
// The kernel keeps packets under 8KiB (NLMSG_GOODSIZE),
// but that's a bit too large to go on the stack.
size_t buf_len = 8192;
char* buf = new char[buf_len];
if (buf == nullptr) return -1;
// Open the netlink socket and ask for all the links and addresses.
int fd = socket(PF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, NETLINK_ROUTE);
bool okay = fd != -1 &&
__send_netlink_request(fd, RTM_GETLINK) && __read_netlink_responses(fd, out, buf, buf_len) &&
__send_netlink_request(fd, RTM_GETADDR) && __read_netlink_responses(fd, out, buf, buf_len);
if (!okay) {
freeifaddrs(*out);
// Ensure that callers crash if they forget to check for success.
*out = nullptr;
}
{
int saved_errno = errno;
close(fd);
delete[] buf;
errno = saved_errno;
}
return okay ? 0 : -1;
}
void freeifaddrs(ifaddrs* list) {
while (list != nullptr) {
ifaddrs* current = list;
list = list->ifa_next;
free(current);
}
}

View File

@ -25,19 +25,16 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/ioctl.h>
#include <stdarg.h>
extern int __ioctl(int, int, void *);
extern "C" int __ioctl(int, int, void *);
int ioctl(int fd, int request, ...)
{
va_list ap;
void * arg;
va_start(ap, request);
arg = va_arg(ap, void *);
va_end(ap);
return __ioctl(fd, request, arg);
int ioctl(int fd, int request, ...) {
va_list ap;
va_start(ap, request);
void* arg = va_arg(ap, void*);
va_end(ap);
return __ioctl(fd, request, arg);
}

View File

@ -52,8 +52,6 @@
extern "C" abort_msg_t** __abort_message_ptr;
extern "C" int __system_properties_init(void);
extern "C" int __set_tls(void* ptr);
extern "C" int __set_tid_address(int* tid_address);
__LIBC_HIDDEN__ WriteProtected<libc_globals> __libc_globals;
@ -66,50 +64,11 @@ char** environ;
// Declared in "private/bionic_ssp.h".
uintptr_t __stack_chk_guard = 0;
// Setup for the main thread. For dynamic executables, this is called by the
// linker _before_ libc is mapped in memory. This means that all writes to
// globals from this function will apply to linker-private copies and will not
// be visible from libc later on.
//
// Note: this function creates a pthread_internal_t for the initial thread and
// stores the pointer in TLS, but does not add it to pthread's thread list. This
// has to be done later from libc itself (see __libc_init_common).
void __libc_init_main_thread(KernelArgumentBlock& args) {
__libc_auxv = args.auxv;
static pthread_internal_t main_thread;
// Tell the kernel to clear our tid field when we exit, so we're like any other pthread.
// As a side-effect, this tells us our pid (which is the same as the main thread's tid).
main_thread.tid = __set_tid_address(&main_thread.tid);
main_thread.set_cached_pid(main_thread.tid);
// We don't want to free the main thread's stack even when the main thread exits
// because things like environment variables with global scope live on it.
// We also can't free the pthread_internal_t itself, since that lives on the main
// thread's stack rather than on the heap.
// The main thread has no mmap allocated space for stack or pthread_internal_t.
main_thread.mmap_size = 0;
pthread_attr_init(&main_thread.attr);
main_thread.attr.guard_size = 0; // The main thread has no guard page.
main_thread.attr.stack_size = 0; // User code should never see this; we'll compute it when asked.
// TODO: the main thread's sched_policy and sched_priority need to be queried.
__init_thread(&main_thread);
__init_tls(&main_thread);
__set_tls(main_thread.tls);
// Store a pointer to the kernel argument block in a TLS slot to be
// picked up by the libc constructor.
main_thread.tls[TLS_SLOT_BIONIC_PREINIT] = &args;
__init_alternate_signal_stack(&main_thread);
}
void __libc_init_globals(KernelArgumentBlock& args) {
// Initialize libc globals that are needed in both the linker and in libc.
// In dynamic binaries, this is run at least twice for different copies of the
// globals, once for the linker's copy and once for the one in libc.so.
__libc_auxv = args.auxv;
__libc_globals.initialize();
__libc_globals.mutate([&args](libc_globals* globals) {
__libc_init_vdso(globals, args);
@ -121,7 +80,6 @@ void __libc_init_common(KernelArgumentBlock& args) {
// Initialize various globals.
environ = args.envp;
errno = 0;
__libc_auxv = args.auxv;
__progname = args.argv[0] ? args.argv[0] : "<unknown>";
__abort_message_ptr = args.abort_message_ptr;
@ -245,7 +203,11 @@ static bool __is_valid_environment_variable(const char* name) {
}
static bool __is_unsafe_environment_variable(const char* name) {
// None of these should be allowed in setuid programs.
// None of these should be allowed when the AT_SECURE auxv
// flag is set. This flag is set to inform userspace that a
// security transition has occurred, for example, as a result
// of executing a setuid program or the result of an SELinux
// security transition.
static constexpr const char* UNSAFE_VARIABLE_NAMES[] = {
"GCONV_PATH",
"GETCONF_DIR",
@ -329,7 +291,7 @@ void __libc_init_AT_SECURE(KernelArgumentBlock& args) {
if (getauxval(AT_SECURE)) {
// If this is a setuid/setgid program, close the security hole described in
// ftp://ftp.freebsd.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-02:23.stdio.asc
// https://www.freebsd.org/security/advisories/FreeBSD-SA-02:23.stdio.asc
__nullify_closed_stdio();
__sanitize_environment_variables(args.envp);

View File

@ -25,6 +25,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* libc_init_dynamic.c
*

View File

@ -25,17 +25,6 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* libc_init_static.c
*
* The program startup function __libc_init() defined here is
* used for static executables only (i.e. those that don't depend
* on shared libraries). It is called from arch-$ARCH/bionic/crtbegin_static.S
* which is directly invoked by the kernel when the program is launched.
*
* The 'structors' parameter contains pointers to various initializer
* arrays that must be run before the program's 'main' routine is launched.
*/
#include <elf.h>
#include <errno.h>
@ -79,12 +68,19 @@ static void apply_gnu_relro() {
}
}
// The program startup function __libc_init() defined here is
// used for static executables only (i.e. those that don't depend
// on shared libraries). It is called from arch-$ARCH/bionic/crtbegin_static.S
// which is directly invoked by the kernel when the program is launched.
//
// The 'structors' parameter contains pointers to various initializer
// arrays that must be run before the program's 'main' routine is launched.
__noreturn void __libc_init(void* raw_args,
void (*onexit)(void) __unused,
int (*slingshot)(int, char**, char**),
structors_array_t const * const structors) {
KernelArgumentBlock args(raw_args);
__libc_init_main_thread(args);
// Initializing the globals requires TLS to be available for errno.

View File

@ -31,6 +31,7 @@
#include <android/set_abort_message.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <pthread.h>
@ -46,6 +47,9 @@
#include <time.h>
#include <unistd.h>
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <sys/_system_properties.h>
static pthread_mutex_t g_abort_msg_lock = PTHREAD_MUTEX_INITIALIZER;
__LIBC_HIDDEN__ abort_msg_t** __abort_message_ptr; // Accessible to __libc_init_common.
@ -481,6 +485,64 @@ static int __libc_open_log_socket() {
return log_fd;
}
struct cache {
const prop_info* pinfo;
uint32_t serial;
char c;
};
static void refresh_cache(struct cache *cache, const char *key)
{
if (!cache->pinfo) {
cache->pinfo = __system_property_find(key);
if (!cache->pinfo) {
return;
}
}
uint32_t serial = __system_property_serial(cache->pinfo);
if (serial == cache->serial) {
return;
}
cache->serial = serial;
char buf[PROP_VALUE_MAX];
__system_property_read(cache->pinfo, 0, buf);
cache->c = buf[0];
}
// Timestamp state generally remains constant, since a change is
// rare, we can accept a trylock failure gracefully.
static pthread_mutex_t lock_clockid = PTHREAD_MUTEX_INITIALIZER;
static clockid_t __android_log_clockid()
{
static struct cache r_time_cache = { NULL, static_cast<uint32_t>(-1), 0 };
static struct cache p_time_cache = { NULL, static_cast<uint32_t>(-1), 0 };
char c;
if (pthread_mutex_trylock(&lock_clockid)) {
// We are willing to accept some race in this context
if (!(c = p_time_cache.c)) {
c = r_time_cache.c;
}
} else {
static uint32_t serial;
uint32_t current_serial = __system_property_area_serial();
if (current_serial != serial) {
refresh_cache(&r_time_cache, "ro.logd.timestamp");
refresh_cache(&p_time_cache, "persist.logd.timestamp");
serial = current_serial;
}
if (!(c = p_time_cache.c)) {
c = r_time_cache.c;
}
pthread_mutex_unlock(&lock_clockid);
}
return (tolower(c) == 'm') ? CLOCK_MONOTONIC : CLOCK_REALTIME;
}
struct log_time { // Wire format
uint32_t tv_sec;
uint32_t tv_nsec;
@ -501,7 +563,7 @@ static int __libc_write_log(int priority, const char* tag, const char* msg) {
vec[1].iov_base = &tid;
vec[1].iov_len = sizeof(tid);
timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
clock_gettime(__android_log_clockid(), &ts);
log_time realtime_ts;
realtime_ts.tv_sec = ts.tv_sec;
realtime_ts.tv_nsec = ts.tv_nsec;
@ -544,7 +606,7 @@ static int __libc_android_log_event(int32_t tag, char type, const void* payload,
vec[1].iov_base = &tid;
vec[1].iov_len = sizeof(tid);
timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
clock_gettime(__android_log_clockid(), &ts);
log_time realtime_ts;
realtime_ts.tv_sec = ts.tv_sec;
realtime_ts.tv_nsec = ts.tv_nsec;

View File

@ -27,6 +27,7 @@
*/
#include <errno.h>
#include <stdint.h>
#include <sys/mman.h>
#include <unistd.h>
@ -48,15 +49,19 @@ void* mmap64(void* addr, size_t size, int prot, int flags, int fd, off64_t offse
// prevent allocations large enough for `end - start` to overflow
size_t rounded = BIONIC_ALIGN(size, PAGE_SIZE);
if (rounded < size || size > PTRDIFF_MAX) {
if (rounded < size || rounded > PTRDIFF_MAX) {
errno = ENOMEM;
return MAP_FAILED;
}
bool is_private_anonymous = (flags & (MAP_PRIVATE | MAP_ANONYMOUS)) != 0;
bool is_private_anonymous =
(flags & (MAP_PRIVATE | MAP_ANONYMOUS)) == (MAP_PRIVATE | MAP_ANONYMOUS);
bool is_stack_or_grows_down = (flags & (MAP_STACK | MAP_GROWSDOWN)) != 0;
void* result = __mmap2(addr, size, prot, flags, fd, offset >> MMAP2_SHIFT);
if (result != MAP_FAILED && kernel_has_MADV_MERGEABLE && is_private_anonymous) {
if (result != MAP_FAILED && kernel_has_MADV_MERGEABLE &&
is_private_anonymous && !is_stack_or_grows_down) {
ErrnoRestorer errno_restorer;
int rc = madvise(result, size, MADV_MERGEABLE);
if (rc == -1 && errno == EINVAL) {

57
libc/bionic/mremap.cpp Normal file
View File

@ -0,0 +1,57 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <errno.h>
#include <sys/mman.h>
#include <stdarg.h>
#include <stdint.h>
#include <unistd.h>
#include "private/bionic_macros.h"
extern "C" void* ___mremap(void*, size_t, size_t, int, void*);
void* mremap(void* old_address, size_t old_size, size_t new_size, int flags, ...) {
// prevent allocations large enough for `end - start` to overflow
size_t rounded = BIONIC_ALIGN(new_size, PAGE_SIZE);
if (rounded < new_size || rounded > PTRDIFF_MAX) {
errno = ENOMEM;
return MAP_FAILED;
}
void* new_address = nullptr;
// The optional argument is only valid if the MREMAP_FIXED flag is set,
// so we assume it's not present otherwise.
if ((flags & MREMAP_FIXED) != 0) {
va_list ap;
va_start(ap, flags);
new_address = va_arg(ap, void*);
va_end(ap);
}
return ___mremap(old_address, old_size, new_size, flags, new_address);
}

View File

@ -47,37 +47,34 @@
#include "private/libc_logging.h"
// Brillo doesn't need to support any legacy cruft.
#if !defined(__BRILLO__)
extern "C" {
// Most of the cruft is only for 32-bit Android targets.
#if !defined(__LP64__)
// Brillo and LP64 don't need to support any legacy cruft.
#if !defined(__BRILLO__) && !defined(__LP64__)
// These were accidentally declared in <unistd.h> because we stupidly used to inline
// getpagesize() and __getpageshift(). Needed for backwards compatibility with old NDK apps.
extern "C" {
unsigned int __page_size = PAGE_SIZE;
unsigned int __page_shift = 12;
}
unsigned int __page_size = PAGE_SIZE;
unsigned int __page_shift = 12;
// TODO: remove this backward compatibility hack (for jb-mr1 strace binaries).
extern "C" pid_t __wait4(pid_t pid, int* status, int options, struct rusage* rusage) {
pid_t __wait4(pid_t pid, int* status, int options, struct rusage* rusage) {
return wait4(pid, status, options, rusage);
}
// TODO: does anything still need this?
extern "C" int __open() {
int __open() {
abort();
}
// TODO: does anything still need this?
extern "C" void** __get_tls() {
void** __get_tls() {
#include "private/__get_tls.h"
return __get_tls();
}
// This non-standard function was in our <string.h> for some reason.
extern "C" void memswap(void* m1, void* m2, size_t n) {
void memswap(void* m1, void* m2, size_t n) {
char* p = reinterpret_cast<char*>(m1);
char* p_end = p + n;
char* q = reinterpret_cast<char*>(m2);
@ -90,13 +87,13 @@ extern "C" void memswap(void* m1, void* m2, size_t n) {
}
}
extern "C" int pthread_attr_setstackaddr(pthread_attr_t*, void*) {
int pthread_attr_setstackaddr(pthread_attr_t*, void*) {
// This was removed from POSIX.1-2008, and is not implemented on bionic.
// Needed for ABI compatibility with the NDK.
return ENOSYS;
}
extern "C" int pthread_attr_getstackaddr(const pthread_attr_t* attr, void** stack_addr) {
int pthread_attr_getstackaddr(const pthread_attr_t* attr, void** stack_addr) {
// This was removed from POSIX.1-2008.
// Needed for ABI compatibility with the NDK.
*stack_addr = (char*)attr->stack_base + attr->stack_size;
@ -104,7 +101,7 @@ extern "C" int pthread_attr_getstackaddr(const pthread_attr_t* attr, void** stac
}
// Non-standard cruft that should only ever have been in system/core/toolbox.
extern "C" char* strtotimeval(const char* str, struct timeval* ts) {
char* strtotimeval(const char* str, struct timeval* ts) {
char* s;
ts->tv_sec = strtoumax(str, &s, 10);
@ -146,7 +143,7 @@ static inline int digitval(int ch) {
}
// This non-standard function was in our <inttypes.h> for some reason.
extern "C" uintmax_t strntoumax(const char *nptr, char **endptr, int base, size_t n) {
uintmax_t strntoumax(const char *nptr, char **endptr, int base, size_t n) {
const unsigned char* p = (const unsigned char *)nptr;
const unsigned char* end = p + n;
int minus = 0;
@ -194,12 +191,12 @@ extern "C" uintmax_t strntoumax(const char *nptr, char **endptr, int base, size_
}
// This non-standard function was in our <inttypes.h> for some reason.
extern "C" intmax_t strntoimax(const char* nptr, char** endptr, int base, size_t n) {
intmax_t strntoimax(const char* nptr, char** endptr, int base, size_t n) {
return (intmax_t) strntoumax(nptr, endptr, base, n);
}
// POSIX calls this dprintf, but LP32 Android had fdprintf instead.
extern "C" int fdprintf(int fd, const char* fmt, ...) {
int fdprintf(int fd, const char* fmt, ...) {
va_list ap;
va_start(ap, fmt);
int rc = vdprintf(fd, fmt, ap);
@ -208,7 +205,7 @@ extern "C" int fdprintf(int fd, const char* fmt, ...) {
}
// POSIX calls this vdprintf, but LP32 Android had fdprintf instead.
extern "C" int vfdprintf(int fd, const char* fmt, va_list ap) {
int vfdprintf(int fd, const char* fmt, va_list ap) {
return vdprintf(fd, fmt, ap);
}
@ -219,64 +216,64 @@ extern "C" int vfdprintf(int fd, const char* fmt, va_list ap) {
#undef __futex_wait
// This used to be in <sys/atomics.h>.
extern "C" int __futex_wake(volatile void* ftx, int count) {
int __futex_wake(volatile void* ftx, int count) {
return __real_futex_wake(ftx, count);
}
// This used to be in <sys/atomics.h>.
extern "C" int __futex_wait(volatile void* ftx, int value, const struct timespec* timeout) {
int __futex_wait(volatile void* ftx, int value, const struct timespec* timeout) {
return __real_futex_wait(ftx, value, timeout);
}
// Unity's libmono uses this.
extern "C" int tkill(pid_t tid, int sig) {
int tkill(pid_t tid, int sig) {
return syscall(__NR_tkill, tid, sig);
}
// This was removed from POSIX 2008.
extern "C" wchar_t* wcswcs(wchar_t* haystack, wchar_t* needle) {
wchar_t* wcswcs(wchar_t* haystack, wchar_t* needle) {
return wcsstr(haystack, needle);
}
// This was removed from POSIX 2008.
extern "C" sighandler_t bsd_signal(int signum, sighandler_t handler) {
sighandler_t bsd_signal(int signum, sighandler_t handler) {
return signal(signum, handler);
}
#if !defined(__i386__)
// This was removed from POSIX 2008.
#undef bcopy
extern "C" void bcopy(const void* src, void* dst, size_t n) {
memcpy(dst, src, n);
void bcopy(const void* src, void* dst, size_t n) {
memmove(dst, src, n);
}
#else
// x86 has an assembler implementation.
#endif
// sysv_signal() was never in POSIX.
extern sighandler_t _signal(int signum, sighandler_t handler, int flags);
extern "C" sighandler_t sysv_signal(int signum, sighandler_t handler) {
extern "C++" sighandler_t _signal(int signum, sighandler_t handler, int flags);
sighandler_t sysv_signal(int signum, sighandler_t handler) {
return _signal(signum, handler, SA_RESETHAND);
}
// This is a system call that was never in POSIX. Use readdir(3) instead.
extern "C" int __getdents64(unsigned int, dirent*, unsigned int);
extern "C" int getdents(unsigned int fd, dirent* dirp, unsigned int count) {
int __getdents64(unsigned int, dirent*, unsigned int);
int getdents(unsigned int fd, dirent* dirp, unsigned int count) {
return __getdents64(fd, dirp, count);
}
// This is a BSDism that we never implemented correctly. Used by Firefox.
extern "C" int issetugid() {
int issetugid() {
return 0;
}
// This was removed from POSIX 2004.
extern "C" pid_t wait3(int* status, int options, struct rusage* rusage) {
pid_t wait3(int* status, int options, struct rusage* rusage) {
return wait4(-1, status, options, rusage);
}
// This was removed from POSIX 2004.
extern "C" int getdtablesize() {
int getdtablesize() {
struct rlimit r;
if (getrlimit(RLIMIT_NOFILE, &r) < 0) {
@ -286,6 +283,10 @@ extern "C" int getdtablesize() {
return r.rlim_cur;
}
// A leaked BSD stdio implementation detail that's now a no-op.
void __sinit() {}
int __sdidinit = 1;
// Only used by ftime, which was removed from POSIX 2008.
struct timeb {
time_t time;
@ -295,7 +296,7 @@ struct timeb {
};
// This was removed from POSIX 2008.
extern "C" int ftime(struct timeb* tb) {
int ftime(struct timeb* tb) {
struct timeval tv;
struct timezone tz;
@ -317,35 +318,42 @@ extern "C" int ftime(struct timeb* tb) {
}
// This was removed from POSIX 2008.
extern "C" char* index(const char* str, int ch) {
char* index(const char* str, int ch) {
return strchr(str, ch);
}
// This was removed from BSD.
extern "C" void arc4random_stir(void) {
void arc4random_stir(void) {
// The current implementation stirs itself as needed.
}
// This was removed from BSD.
extern "C" void arc4random_addrandom(unsigned char*, int) {
void arc4random_addrandom(unsigned char*, int) {
// The current implementation adds randomness as needed.
}
// Old versions of the NDK did not export malloc_usable_size, but did
// export dlmalloc_usable_size. We are moving away from dlmalloc in L
// so make this call malloc_usable_size.
extern "C" size_t dlmalloc_usable_size(void* ptr) {
size_t dlmalloc_usable_size(void* ptr) {
return malloc_usable_size(ptr);
}
// In L we added a public pthread_gettid_np, but some apps were using the private API.
extern "C" pid_t __pthread_gettid(pthread_t t) {
pid_t __pthread_gettid_libc(pthread_t t) {
return pthread_gettid_np(t);
}
pid_t __pthread_gettid_libc_private(pthread_t t) {
return pthread_gettid_np(t);
}
__asm__(".symver __pthread_gettid_libc,__pthread_gettid@LIBC");
__asm__(".symver __pthread_gettid_libc_private,__pthread_gettid@@LIBC_PRIVATE");
// Older versions of apportable used dlmalloc directly instead of malloc,
// so export this compatibility shim that simply calls malloc.
extern "C" void* dlmalloc(size_t size) {
void* dlmalloc(size_t size) {
return malloc(size);
}
@ -353,39 +361,39 @@ extern "C" void* dlmalloc(size_t size) {
#include "pthread_internal.h"
#undef __get_thread
// Various third-party apps contain a backport of our pthread_rwlock implementation that uses this.
extern "C" pthread_internal_t* __get_thread() {
pthread_internal_t* __get_thread() {
return __real_get_thread();
}
// This one exists only for the LP32 NDK and is not present anywhere else.
extern "C" long __set_errno_internal(int);
extern "C" long __set_errno(int n) {
extern long __set_errno_internal(int);
long __set_errno(int n) {
return __set_errno_internal(n);
}
#endif // !defined(__LP64__)
// This was never implemented in bionic, only needed for ABI compatibility with the NDK.
// In the M time frame, over 1000 apps have a reference to this!
extern "C" void endpwent() { }
void endpwent() { }
// Since dlmalloc_inspect_all and dlmalloc_trim are exported for systems
// that use dlmalloc, be consistent and export them everywhere.
#if defined(USE_JEMALLOC)
extern "C" void dlmalloc_inspect_all(void (*)(void*, void*, size_t, void*), void*) {
void dlmalloc_inspect_all(void (*)(void*, void*, size_t, void*), void*) {
}
extern "C" int dlmalloc_trim(size_t) {
int dlmalloc_trim(size_t) {
return 0;
}
#else
extern "C" void dlmalloc_inspect_all_real(void (*)(void*, void*, size_t, void*), void*);
extern "C" void dlmalloc_inspect_all(void (*handler)(void*, void*, size_t, void*), void* arg) {
void dlmalloc_inspect_all_real(void (*)(void*, void*, size_t, void*), void*);
void dlmalloc_inspect_all(void (*handler)(void*, void*, size_t, void*), void* arg) {
dlmalloc_inspect_all_real(handler, arg);
}
extern "C" int dlmalloc_trim_real(size_t);
extern "C" int dlmalloc_trim(size_t pad) {
int dlmalloc_trim_real(size_t);
int dlmalloc_trim(size_t pad) {
return dlmalloc_trim_real(pad);
}
#endif
#endif // !defined(__BRILLO__)
#endif // !defined(__BRILLO__) && !defined (__LP64__)
} // extern "C"

View File

@ -45,7 +45,7 @@ struct atfork_t {
class atfork_list_t {
public:
atfork_list_t() : first_(nullptr), last_(nullptr) {}
constexpr atfork_list_t() : first_(nullptr), last_(nullptr) {}
template<typename F>
void walk_forward(F f) {

View File

@ -0,0 +1,183 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <pthread.h>
#include <stdatomic.h>
#include <stdint.h>
#include "private/bionic_futex.h"
int pthread_barrierattr_init(pthread_barrierattr_t* attr) {
*attr = 0;
return 0;
}
int pthread_barrierattr_destroy(pthread_barrierattr_t* attr) {
*attr = 0;
return 0;
}
int pthread_barrierattr_getpshared(pthread_barrierattr_t* attr, int* pshared) {
*pshared = (*attr & 1) ? PTHREAD_PROCESS_SHARED : PTHREAD_PROCESS_PRIVATE;
return 0;
}
int pthread_barrierattr_setpshared(pthread_barrierattr_t* attr, int pshared) {
if (pshared == PTHREAD_PROCESS_SHARED) {
*attr |= 1;
} else {
*attr &= ~1;
}
return 0;
}
enum BarrierState {
WAIT,
RELEASE,
};
struct pthread_barrier_internal_t {
// One barrier can be used for unlimited number of cycles. In each cycle, [init_count]
// threads must call pthread_barrier_wait() before any of them successfully return from
// the call. It is undefined behavior if there are more than [init_count] threads call
// pthread_barrier_wait() in one cycle.
uint32_t init_count;
// Barrier state. It is WAIT if waiting for more threads to enter the barrier in this cycle,
// otherwise threads are leaving the barrier.
_Atomic(BarrierState) state;
// Number of threads having entered but not left the barrier in this cycle.
atomic_uint wait_count;
// Whether the barrier is shared across processes.
bool pshared;
uint32_t __reserved[4];
};
static_assert(sizeof(pthread_barrier_t) == sizeof(pthread_barrier_internal_t),
"pthread_barrier_t should actually be pthread_barrier_internal_t in implementation."
);
static_assert(alignof(pthread_barrier_t) >= 4,
"pthread_barrier_t should fulfill the alignment of pthread_barrier_internal_t.");
static inline pthread_barrier_internal_t* __get_internal_barrier(pthread_barrier_t* barrier) {
return reinterpret_cast<pthread_barrier_internal_t*>(barrier);
}
int pthread_barrier_init(pthread_barrier_t* barrier_interface, const pthread_barrierattr_t* attr,
unsigned count) {
pthread_barrier_internal_t* barrier = __get_internal_barrier(barrier_interface);
if (count == 0) {
return EINVAL;
}
barrier->init_count = count;
atomic_init(&barrier->state, WAIT);
atomic_init(&barrier->wait_count, 0);
barrier->pshared = false;
if (attr != nullptr && (*attr & 1)) {
barrier->pshared = true;
}
return 0;
}
// According to POSIX standard, pthread_barrier_wait() synchronizes memory between participating
// threads. It means all memory operations made by participating threads before calling
// pthread_barrier_wait() can be seen by all participating threads after the function call.
// We establish this by making a happens-before relation between all threads entering the barrier
// with the last thread entering the barrier, and a happens-before relation between the last
// thread entering the barrier with all threads leaving the barrier.
int pthread_barrier_wait(pthread_barrier_t* barrier_interface) {
pthread_barrier_internal_t* barrier = __get_internal_barrier(barrier_interface);
// Wait until all threads for the previous cycle have left the barrier. This is needed
// as a participating thread can call pthread_barrier_wait() again before other
// threads have left the barrier. Use acquire operation here to synchronize with
// the last thread leaving the previous cycle, so we can read correct wait_count below.
while(atomic_load_explicit(&barrier->state, memory_order_acquire) == RELEASE) {
__futex_wait_ex(&barrier->state, barrier->pshared, RELEASE, false, nullptr);
}
uint32_t prev_wait_count = atomic_load_explicit(&barrier->wait_count, memory_order_relaxed);
while (true) {
// It happens when there are more than [init_count] threads trying to enter the barrier
// at one cycle. We read the POSIX standard as disallowing this, since additional arriving
// threads are not synchronized with respect to the barrier reset. We also don't know of
// any reasonable cases in which this would be intentional.
if (prev_wait_count >= barrier->init_count) {
return EINVAL;
}
// Use memory_order_acq_rel operation here to synchronize between all threads entering
// the barrier with the last thread entering the barrier.
if (atomic_compare_exchange_weak_explicit(&barrier->wait_count, &prev_wait_count,
prev_wait_count + 1u, memory_order_acq_rel,
memory_order_relaxed)) {
break;
}
}
int result = 0;
if (prev_wait_count + 1 == barrier->init_count) {
result = PTHREAD_BARRIER_SERIAL_THREAD;
if (prev_wait_count != 0) {
// Use release operation here to synchronize between the last thread entering the
// barrier with all threads leaving the barrier.
atomic_store_explicit(&barrier->state, RELEASE, memory_order_release);
__futex_wake_ex(&barrier->state, barrier->pshared, prev_wait_count);
}
} else {
// Use acquire operation here to synchronize between the last thread entering the
// barrier with all threads leaving the barrier.
while (atomic_load_explicit(&barrier->state, memory_order_acquire) == WAIT) {
__futex_wait_ex(&barrier->state, barrier->pshared, WAIT, false, nullptr);
}
}
// Use release operation here to make it not reordered with previous operations.
if (atomic_fetch_sub_explicit(&barrier->wait_count, 1, memory_order_release) == 1) {
// Use release operation here to synchronize with threads entering the barrier for
// the next cycle, or the thread calling pthread_barrier_destroy().
atomic_store_explicit(&barrier->state, WAIT, memory_order_release);
__futex_wake_ex(&barrier->state, barrier->pshared, barrier->init_count);
}
return result;
}
int pthread_barrier_destroy(pthread_barrier_t* barrier_interface) {
pthread_barrier_internal_t* barrier = __get_internal_barrier(barrier_interface);
if (barrier->init_count == 0) {
return EINVAL;
}
// Use acquire operation here to synchronize with the last thread leaving the barrier.
// So we can read correct wait_count below.
while (atomic_load_explicit(&barrier->state, memory_order_acquire) == RELEASE) {
__futex_wait_ex(&barrier->state, barrier->pshared, RELEASE, false, nullptr);
}
if (atomic_load_explicit(&barrier->wait_count, memory_order_relaxed) != 0) {
return EBUSY;
}
barrier->init_count = 0;
return 0;
}

View File

@ -111,8 +111,8 @@ struct pthread_cond_internal_t {
return COND_IS_SHARED(atomic_load_explicit(&state, memory_order_relaxed));
}
int get_clock() {
return COND_GET_CLOCK(atomic_load_explicit(&state, memory_order_relaxed));
bool use_realtime_clock() {
return COND_GET_CLOCK(atomic_load_explicit(&state, memory_order_relaxed)) == CLOCK_REALTIME;
}
#if defined(__LP64__)
@ -170,12 +170,17 @@ static int __pthread_cond_pulse(pthread_cond_internal_t* cond, int thread_count)
return 0;
}
static int __pthread_cond_timedwait_relative(pthread_cond_internal_t* cond, pthread_mutex_t* mutex,
const timespec* rel_timeout_or_null) {
unsigned int old_state = atomic_load_explicit(&cond->state, memory_order_relaxed);
static int __pthread_cond_timedwait(pthread_cond_internal_t* cond, pthread_mutex_t* mutex,
bool use_realtime_clock, const timespec* abs_timeout_or_null) {
int result = check_timespec(abs_timeout_or_null, true);
if (result != 0) {
return result;
}
unsigned int old_state = atomic_load_explicit(&cond->state, memory_order_relaxed);
pthread_mutex_unlock(mutex);
int status = __futex_wait_ex(&cond->state, cond->process_shared(), old_state, rel_timeout_or_null);
int status = __futex_wait_ex(&cond->state, cond->process_shared(), old_state,
use_realtime_clock, abs_timeout_or_null);
pthread_mutex_lock(mutex);
if (status == -ETIMEDOUT) {
@ -184,21 +189,6 @@ static int __pthread_cond_timedwait_relative(pthread_cond_internal_t* cond, pthr
return 0;
}
static int __pthread_cond_timedwait(pthread_cond_internal_t* cond, pthread_mutex_t* mutex,
const timespec* abs_timeout_or_null, clockid_t clock) {
timespec ts;
timespec* rel_timeout = NULL;
if (abs_timeout_or_null != NULL) {
rel_timeout = &ts;
if (!timespec_from_absolute_timespec(*rel_timeout, *abs_timeout_or_null, clock)) {
return ETIMEDOUT;
}
}
return __pthread_cond_timedwait_relative(cond, mutex, rel_timeout);
}
int pthread_cond_broadcast(pthread_cond_t* cond_interface) {
return __pthread_cond_pulse(__get_internal_cond(cond_interface), INT_MAX);
}
@ -209,14 +199,14 @@ int pthread_cond_signal(pthread_cond_t* cond_interface) {
int pthread_cond_wait(pthread_cond_t* cond_interface, pthread_mutex_t* mutex) {
pthread_cond_internal_t* cond = __get_internal_cond(cond_interface);
return __pthread_cond_timedwait(cond, mutex, NULL, cond->get_clock());
return __pthread_cond_timedwait(cond, mutex, false, nullptr);
}
int pthread_cond_timedwait(pthread_cond_t *cond_interface, pthread_mutex_t * mutex,
const timespec *abstime) {
pthread_cond_internal_t* cond = __get_internal_cond(cond_interface);
return __pthread_cond_timedwait(cond, mutex, abstime, cond->get_clock());
return __pthread_cond_timedwait(cond, mutex, cond->use_realtime_clock(), abstime);
}
#if !defined(__LP64__)
@ -225,8 +215,7 @@ extern "C" int pthread_cond_timedwait_monotonic(pthread_cond_t* cond_interface,
pthread_mutex_t* mutex,
const timespec* abs_timeout) {
return __pthread_cond_timedwait(__get_internal_cond(cond_interface), mutex, abs_timeout,
CLOCK_MONOTONIC);
return __pthread_cond_timedwait(__get_internal_cond(cond_interface), mutex, false, abs_timeout);
}
extern "C" int pthread_cond_timedwait_monotonic_np(pthread_cond_t* cond_interface,
@ -238,8 +227,13 @@ extern "C" int pthread_cond_timedwait_monotonic_np(pthread_cond_t* cond_interfac
extern "C" int pthread_cond_timedwait_relative_np(pthread_cond_t* cond_interface,
pthread_mutex_t* mutex,
const timespec* rel_timeout) {
return __pthread_cond_timedwait_relative(__get_internal_cond(cond_interface), mutex, rel_timeout);
timespec ts;
timespec* abs_timeout = nullptr;
if (rel_timeout != nullptr) {
absolute_timespec_from_timespec(ts, *rel_timeout, CLOCK_REALTIME);
abs_timeout = &ts;
}
return __pthread_cond_timedwait(__get_internal_cond(cond_interface), mutex, true, abs_timeout);
}
extern "C" int pthread_cond_timeout_np(pthread_cond_t* cond_interface,

View File

@ -53,13 +53,6 @@ extern "C" int __isthreaded;
// This code is used both by each new pthread and the code that initializes the main thread.
void __init_tls(pthread_internal_t* thread) {
if (thread->mmap_size == 0) {
// If the TLS area was not allocated by mmap(), it may not have been cleared to zero.
// So assume the worst and zero the TLS area.
memset(thread->tls, 0, sizeof(thread->tls));
memset(thread->key_data, 0, sizeof(thread->key_data));
}
// Slot 0 must point to itself. The x86 Linux kernel reads the TLS from %fs:0.
thread->tls[TLS_SLOT_SELF] = thread->tls;
thread->tls[TLS_SLOT_THREAD_ID] = thread;
@ -175,6 +168,11 @@ static int __allocate_thread(pthread_attr_t* attr, pthread_internal_t** threadp,
(reinterpret_cast<uintptr_t>(stack_top) - sizeof(pthread_internal_t)) & ~0xf);
pthread_internal_t* thread = reinterpret_cast<pthread_internal_t*>(stack_top);
if (mmap_size == 0) {
// If thread was not allocated by mmap(), it may not have been cleared to zero.
// So assume the worst and zero it.
memset(thread, 0, sizeof(pthread_internal_t));
}
attr->stack_size = stack_top - reinterpret_cast<uint8_t*>(attr->stack_base);
thread->mmap_size = mmap_size;

View File

@ -40,7 +40,8 @@
/* Has the thread been joined by another thread? */
#define PTHREAD_ATTR_FLAG_JOINED 0x00000002
struct pthread_key_data_t {
class pthread_key_data_t {
public:
uintptr_t seq; // Use uintptr_t just for alignment, as we use pointer below.
void* data;
};
@ -52,9 +53,12 @@ enum ThreadJoinState {
THREAD_DETACHED
};
struct pthread_internal_t {
struct pthread_internal_t* next;
struct pthread_internal_t* prev;
class thread_local_dtor;
class pthread_internal_t {
public:
class pthread_internal_t* next;
class pthread_internal_t* prev;
pid_t tid;
@ -94,6 +98,8 @@ struct pthread_internal_t {
size_t mmap_size;
thread_local_dtor* thread_local_dtors;
void* tls[BIONIC_TLS_SLOTS];
pthread_key_data_t key_data[BIONIC_PTHREAD_KEY_COUNT];

View File

@ -166,11 +166,14 @@ int pthread_mutexattr_getpshared(const pthread_mutexattr_t* attr, int* pshared)
#define MUTEX_STATE_BITS_LOCKED_UNCONTENDED MUTEX_STATE_TO_BITS(MUTEX_STATE_LOCKED_UNCONTENDED)
#define MUTEX_STATE_BITS_LOCKED_CONTENDED MUTEX_STATE_TO_BITS(MUTEX_STATE_LOCKED_CONTENDED)
/* return true iff the mutex if locked with no waiters */
#define MUTEX_STATE_BITS_IS_LOCKED_UNCONTENDED(v) (((v) & MUTEX_STATE_MASK) == MUTEX_STATE_BITS_LOCKED_UNCONTENDED)
// Return true iff the mutex is unlocked.
#define MUTEX_STATE_BITS_IS_UNLOCKED(v) (((v) & MUTEX_STATE_MASK) == MUTEX_STATE_BITS_UNLOCKED)
/* return true iff the mutex if locked with maybe waiters */
#define MUTEX_STATE_BITS_IS_LOCKED_CONTENDED(v) (((v) & MUTEX_STATE_MASK) == MUTEX_STATE_BITS_LOCKED_CONTENDED)
// Return true iff the mutex is locked with no waiters.
#define MUTEX_STATE_BITS_IS_LOCKED_UNCONTENDED(v) (((v) & MUTEX_STATE_MASK) == MUTEX_STATE_BITS_LOCKED_UNCONTENDED)
// return true iff the mutex is locked with maybe waiters.
#define MUTEX_STATE_BITS_IS_LOCKED_CONTENDED(v) (((v) & MUTEX_STATE_MASK) == MUTEX_STATE_BITS_LOCKED_CONTENDED)
/* used to flip from LOCKED_UNCONTENDED to LOCKED_CONTENDED */
#define MUTEX_STATE_BITS_FLIP_CONTENTION(v) ((v) ^ (MUTEX_STATE_BITS_LOCKED_CONTENDED ^ MUTEX_STATE_BITS_LOCKED_UNCONTENDED))
@ -296,11 +299,15 @@ static inline __always_inline int __pthread_normal_mutex_trylock(pthread_mutex_i
*/
static inline __always_inline int __pthread_normal_mutex_lock(pthread_mutex_internal_t* mutex,
uint16_t shared,
const timespec* abs_timeout_or_null,
clockid_t clock) {
bool use_realtime_clock,
const timespec* abs_timeout_or_null) {
if (__predict_true(__pthread_normal_mutex_trylock(mutex, shared) == 0)) {
return 0;
}
int result = check_timespec(abs_timeout_or_null, true);
if (result != 0) {
return result;
}
ScopedTrace trace("Contending for pthread mutex");
@ -317,15 +324,8 @@ static inline __always_inline int __pthread_normal_mutex_lock(pthread_mutex_inte
// made by other threads visible to the current CPU.
while (atomic_exchange_explicit(&mutex->state, locked_contended,
memory_order_acquire) != unlocked) {
timespec ts;
timespec* rel_timeout = NULL;
if (abs_timeout_or_null != NULL) {
rel_timeout = &ts;
if (!timespec_from_absolute_timespec(*rel_timeout, *abs_timeout_or_null, clock)) {
return ETIMEDOUT;
}
}
if (__futex_wait_ex(&mutex->state, shared, locked_contended, rel_timeout) == -ETIMEDOUT) {
if (__futex_wait_ex(&mutex->state, shared, locked_contended, use_realtime_clock,
abs_timeout_or_null) == -ETIMEDOUT) {
return ETIMEDOUT;
}
}
@ -396,14 +396,15 @@ static inline __always_inline int __recursive_or_errorcheck_mutex_wait(
pthread_mutex_internal_t* mutex,
uint16_t shared,
uint16_t old_state,
const timespec* rel_timeout) {
bool use_realtime_clock,
const timespec* abs_timeout) {
// __futex_wait always waits on a 32-bit value. But state is 16-bit. For a normal mutex, the owner_tid
// field in mutex is not used. On 64-bit devices, the __pad field in mutex is not used.
// But when a recursive or errorcheck mutex is used on 32-bit devices, we need to add the
// owner_tid value in the value argument for __futex_wait, otherwise we may always get EAGAIN error.
#if defined(__LP64__)
return __futex_wait_ex(&mutex->state, shared, old_state, rel_timeout);
return __futex_wait_ex(&mutex->state, shared, old_state, use_realtime_clock, abs_timeout);
#else
// This implementation works only when the layout of pthread_mutex_internal_t matches below expectation.
@ -412,19 +413,21 @@ static inline __always_inline int __recursive_or_errorcheck_mutex_wait(
static_assert(offsetof(pthread_mutex_internal_t, owner_tid) == 2, "");
uint32_t owner_tid = atomic_load_explicit(&mutex->owner_tid, memory_order_relaxed);
return __futex_wait_ex(&mutex->state, shared, (owner_tid << 16) | old_state, rel_timeout);
return __futex_wait_ex(&mutex->state, shared, (owner_tid << 16) | old_state,
use_realtime_clock, abs_timeout);
#endif
}
static int __pthread_mutex_lock_with_timeout(pthread_mutex_internal_t* mutex,
const timespec* abs_timeout_or_null, clockid_t clock) {
bool use_realtime_clock,
const timespec* abs_timeout_or_null) {
uint16_t old_state = atomic_load_explicit(&mutex->state, memory_order_relaxed);
uint16_t mtype = (old_state & MUTEX_TYPE_MASK);
uint16_t shared = (old_state & MUTEX_SHARED_MASK);
// Handle common case first.
if ( __predict_true(mtype == MUTEX_TYPE_BITS_NORMAL) ) {
return __pthread_normal_mutex_lock(mutex, shared, abs_timeout_or_null, clock);
return __pthread_normal_mutex_lock(mutex, shared, use_realtime_clock, abs_timeout_or_null);
}
// Do we already own this recursive or error-check mutex?
@ -484,16 +487,13 @@ static int __pthread_mutex_lock_with_timeout(pthread_mutex_internal_t* mutex,
old_state = new_state;
}
// We are in locked_contended state, sleep until someone wakes us up.
timespec ts;
timespec* rel_timeout = NULL;
if (abs_timeout_or_null != NULL) {
rel_timeout = &ts;
if (!timespec_from_absolute_timespec(*rel_timeout, *abs_timeout_or_null, clock)) {
return ETIMEDOUT;
}
int result = check_timespec(abs_timeout_or_null, true);
if (result != 0) {
return result;
}
if (__recursive_or_errorcheck_mutex_wait(mutex, shared, old_state, rel_timeout) == -ETIMEDOUT) {
// We are in locked_contended state, sleep until someone wakes us up.
if (__recursive_or_errorcheck_mutex_wait(mutex, shared, old_state, use_realtime_clock,
abs_timeout_or_null) == -ETIMEDOUT) {
return ETIMEDOUT;
}
old_state = atomic_load_explicit(&mutex->state, memory_order_relaxed);
@ -518,7 +518,7 @@ int pthread_mutex_lock(pthread_mutex_t* mutex_interface) {
return 0;
}
}
return __pthread_mutex_lock_with_timeout(mutex, NULL, 0);
return __pthread_mutex_lock_with_timeout(mutex, false, nullptr);
}
int pthread_mutex_unlock(pthread_mutex_t* mutex_interface) {
@ -613,17 +613,12 @@ int pthread_mutex_trylock(pthread_mutex_t* mutex_interface) {
#if !defined(__LP64__)
extern "C" int pthread_mutex_lock_timeout_np(pthread_mutex_t* mutex_interface, unsigned ms) {
timespec ts;
timespec_from_ms(ts, ms);
timespec abs_timeout;
clock_gettime(CLOCK_MONOTONIC, &abs_timeout);
abs_timeout.tv_sec += ms / 1000;
abs_timeout.tv_nsec += (ms % 1000) * 1000000;
if (abs_timeout.tv_nsec >= NS_PER_S) {
abs_timeout.tv_sec++;
abs_timeout.tv_nsec -= NS_PER_S;
}
absolute_timespec_from_timespec(abs_timeout, ts, CLOCK_MONOTONIC);
int error = __pthread_mutex_lock_with_timeout(__get_internal_mutex(mutex_interface),
&abs_timeout, CLOCK_MONOTONIC);
false, &abs_timeout);
if (error == ETIMEDOUT) {
error = EBUSY;
}
@ -633,14 +628,18 @@ extern "C" int pthread_mutex_lock_timeout_np(pthread_mutex_t* mutex_interface, u
int pthread_mutex_timedlock(pthread_mutex_t* mutex_interface, const timespec* abs_timeout) {
return __pthread_mutex_lock_with_timeout(__get_internal_mutex(mutex_interface),
abs_timeout, CLOCK_REALTIME);
true, abs_timeout);
}
int pthread_mutex_destroy(pthread_mutex_t* mutex_interface) {
// Use trylock to ensure that the mutex is valid and not already locked.
int error = pthread_mutex_trylock(mutex_interface);
if (error != 0) {
return error;
pthread_mutex_internal_t* mutex = __get_internal_mutex(mutex_interface);
uint16_t old_state = atomic_load_explicit(&mutex->state, memory_order_relaxed);
// Store 0xffff to make the mutex unusable. Although POSIX standard says it is undefined
// behavior to destroy a locked mutex, we prefer not to change mutex->state in that situation.
if (MUTEX_STATE_BITS_IS_UNLOCKED(old_state) &&
atomic_compare_exchange_strong_explicit(&mutex->state, &old_state, 0xffff,
memory_order_relaxed, memory_order_relaxed)) {
return 0;
}
return 0;
return EBUSY;
}

View File

@ -79,7 +79,7 @@ int pthread_once(pthread_once_t* once_control, void (*init_routine)(void)) {
}
// The initialization is underway, wait for its finish.
__futex_wait_ex(once_control_ptr, 0, old_value, NULL);
__futex_wait_ex(once_control_ptr, 0, old_value, false, nullptr);
old_value = atomic_load_explicit(once_control_ptr, memory_order_acquire);
}
}

View File

@ -294,9 +294,13 @@ static int __pthread_rwlock_timedrdlock(pthread_rwlock_internal_t* rwlock,
}
while (true) {
int ret = __pthread_rwlock_tryrdlock(rwlock);
if (ret == 0 || ret == EAGAIN) {
return ret;
int result = __pthread_rwlock_tryrdlock(rwlock);
if (result == 0 || result == EAGAIN) {
return result;
}
result = check_timespec(abs_timeout_or_null, true);
if (result != 0) {
return result;
}
int old_state = atomic_load_explicit(&rwlock->state, memory_order_relaxed);
@ -304,16 +308,6 @@ static int __pthread_rwlock_timedrdlock(pthread_rwlock_internal_t* rwlock,
continue;
}
timespec ts;
timespec* rel_timeout = NULL;
if (abs_timeout_or_null != NULL) {
rel_timeout = &ts;
if (!timespec_from_absolute_timespec(*rel_timeout, *abs_timeout_or_null, CLOCK_REALTIME)) {
return ETIMEDOUT;
}
}
rwlock->pending_lock.lock();
rwlock->pending_reader_count++;
@ -327,10 +321,10 @@ static int __pthread_rwlock_timedrdlock(pthread_rwlock_internal_t* rwlock,
int old_serial = rwlock->pending_reader_wakeup_serial;
rwlock->pending_lock.unlock();
int futex_ret = 0;
int futex_result = 0;
if (!__can_acquire_read_lock(old_state, rwlock->writer_nonrecursive_preferred)) {
futex_ret = __futex_wait_ex(&rwlock->pending_reader_wakeup_serial, rwlock->pshared,
old_serial, rel_timeout);
futex_result = __futex_wait_ex(&rwlock->pending_reader_wakeup_serial, rwlock->pshared,
old_serial, true, abs_timeout_or_null);
}
rwlock->pending_lock.lock();
@ -341,7 +335,7 @@ static int __pthread_rwlock_timedrdlock(pthread_rwlock_internal_t* rwlock,
}
rwlock->pending_lock.unlock();
if (futex_ret == -ETIMEDOUT) {
if (futex_result == -ETIMEDOUT) {
return ETIMEDOUT;
}
}
@ -372,9 +366,13 @@ static int __pthread_rwlock_timedwrlock(pthread_rwlock_internal_t* rwlock,
return EDEADLK;
}
while (true) {
int ret = __pthread_rwlock_trywrlock(rwlock);
if (ret == 0) {
return ret;
int result = __pthread_rwlock_trywrlock(rwlock);
if (result == 0) {
return result;
}
result = check_timespec(abs_timeout_or_null, true);
if (result != 0) {
return result;
}
int old_state = atomic_load_explicit(&rwlock->state, memory_order_relaxed);
@ -382,16 +380,6 @@ static int __pthread_rwlock_timedwrlock(pthread_rwlock_internal_t* rwlock,
continue;
}
timespec ts;
timespec* rel_timeout = NULL;
if (abs_timeout_or_null != NULL) {
rel_timeout = &ts;
if (!timespec_from_absolute_timespec(*rel_timeout, *abs_timeout_or_null, CLOCK_REALTIME)) {
return ETIMEDOUT;
}
}
rwlock->pending_lock.lock();
rwlock->pending_writer_count++;
@ -401,10 +389,10 @@ static int __pthread_rwlock_timedwrlock(pthread_rwlock_internal_t* rwlock,
int old_serial = rwlock->pending_writer_wakeup_serial;
rwlock->pending_lock.unlock();
int futex_ret = 0;
int futex_result = 0;
if (!__can_acquire_write_lock(old_state)) {
futex_ret = __futex_wait_ex(&rwlock->pending_writer_wakeup_serial, rwlock->pshared,
old_serial, rel_timeout);
futex_result = __futex_wait_ex(&rwlock->pending_writer_wakeup_serial, rwlock->pshared,
old_serial, true, abs_timeout_or_null);
}
rwlock->pending_lock.lock();
@ -415,7 +403,7 @@ static int __pthread_rwlock_timedwrlock(pthread_rwlock_internal_t* rwlock,
}
rwlock->pending_lock.unlock();
if (futex_ret == -ETIMEDOUT) {
if (futex_result == -ETIMEDOUT) {
return ETIMEDOUT;
}
}
@ -427,7 +415,7 @@ int pthread_rwlock_rdlock(pthread_rwlock_t* rwlock_interface) {
if (__predict_true(__pthread_rwlock_tryrdlock(rwlock) == 0)) {
return 0;
}
return __pthread_rwlock_timedrdlock(rwlock, NULL);
return __pthread_rwlock_timedrdlock(rwlock, nullptr);
}
int pthread_rwlock_timedrdlock(pthread_rwlock_t* rwlock_interface, const timespec* abs_timeout) {
@ -446,7 +434,7 @@ int pthread_rwlock_wrlock(pthread_rwlock_t* rwlock_interface) {
if (__predict_true(__pthread_rwlock_trywrlock(rwlock) == 0)) {
return 0;
}
return __pthread_rwlock_timedwrlock(rwlock, NULL);
return __pthread_rwlock_timedwrlock(rwlock, nullptr);
}
int pthread_rwlock_timedwrlock(pthread_rwlock_t* rwlock_interface, const timespec* abs_timeout) {

View File

@ -0,0 +1,81 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <pthread.h>
#include "private/bionic_lock.h"
// User-level spinlocks can be hazardous to battery life on Android.
// We implement a simple compromise that behaves mostly like a spinlock,
// but prevents excessively long spinning.
struct pthread_spinlock_internal_t {
Lock lock;
};
static_assert(sizeof(pthread_spinlock_t) == sizeof(pthread_spinlock_internal_t),
"pthread_spinlock_t should actually be pthread_spinlock_internal_t.");
static_assert(alignof(pthread_spinlock_t) >= 4,
"pthread_spinlock_t should fulfill the alignment of pthread_spinlock_internal_t.");
static inline pthread_spinlock_internal_t* __get_internal_spinlock(pthread_spinlock_t* lock) {
return reinterpret_cast<pthread_spinlock_internal_t*>(lock);
}
int pthread_spin_init(pthread_spinlock_t* lock_interface, int pshared) {
pthread_spinlock_internal_t* lock = __get_internal_spinlock(lock_interface);
lock->lock.init(pshared);
return 0;
}
int pthread_spin_destroy(pthread_spinlock_t* lock_interface) {
pthread_spinlock_internal_t* lock = __get_internal_spinlock(lock_interface);
return lock->lock.trylock() ? 0 : EBUSY;
}
int pthread_spin_trylock(pthread_spinlock_t* lock_interface) {
pthread_spinlock_internal_t* lock = __get_internal_spinlock(lock_interface);
return lock->lock.trylock() ? 0 : EBUSY;
}
int pthread_spin_lock(pthread_spinlock_t* lock_interface) {
pthread_spinlock_internal_t* lock = __get_internal_spinlock(lock_interface);
for (int i = 0; i < 10000; ++i) {
if (lock->lock.trylock()) {
return 0;
}
}
lock->lock.lock();
return 0;
}
int pthread_spin_unlock(pthread_spinlock_t* lock_interface) {
pthread_spinlock_internal_t* lock = __get_internal_spinlock(lock_interface);
lock->lock.unlock();
return 0;
}

View File

@ -220,7 +220,7 @@ int sem_wait(sem_t* sem) {
return 0;
}
__futex_wait_ex(sem_count_ptr, shared, shared | SEMCOUNT_MINUS_ONE, NULL);
__futex_wait_ex(sem_count_ptr, shared, shared | SEMCOUNT_MINUS_ONE, false, nullptr);
}
}
@ -235,36 +235,29 @@ int sem_timedwait(sem_t* sem, const timespec* abs_timeout) {
}
// Check it as per POSIX.
if (abs_timeout == NULL || abs_timeout->tv_sec < 0 || abs_timeout->tv_nsec < 0 || abs_timeout->tv_nsec >= NS_PER_S) {
errno = EINVAL;
int result = check_timespec(abs_timeout, false);
if (result != 0) {
errno = result;
return -1;
}
unsigned int shared = SEM_GET_SHARED(sem_count_ptr);
while (true) {
// POSIX mandates CLOCK_REALTIME here.
timespec ts;
if (!timespec_from_absolute_timespec(ts, *abs_timeout, CLOCK_REALTIME)) {
errno = ETIMEDOUT;
return -1;
}
// Try to grab the semaphore. If the value was 0, this will also change it to -1.
if (__sem_dec(sem_count_ptr) > 0) {
break;
return 0;
}
// Contention detected. Wait for a wakeup event.
int ret = __futex_wait_ex(sem_count_ptr, shared, shared | SEMCOUNT_MINUS_ONE, &ts);
int result = __futex_wait_ex(sem_count_ptr, shared, shared | SEMCOUNT_MINUS_ONE, true, abs_timeout);
// Return in case of timeout or interrupt.
if (ret == -ETIMEDOUT || ret == -EINTR) {
errno = -ret;
if (result == -ETIMEDOUT || result == -EINTR) {
errno = -result;
return -1;
}
}
return 0;
}
int sem_post(sem_t* sem) {

View File

@ -25,34 +25,38 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <new>
#include <stdatomic.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <stddef.h>
#include <ctype.h>
#include <errno.h>
#include <poll.h>
#include <fcntl.h>
#include <poll.h>
#include <stdatomic.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <new>
#include <linux/xattr.h>
#include <netinet/in.h>
#include <sys/mman.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/un.h>
#include <sys/xattr.h>
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <sys/_system_properties.h>
#include <sys/system_properties.h>
#include "private/bionic_futex.h"
#include "private/bionic_lock.h"
#include "private/bionic_macros.h"
#include "private/libc_logging.h"
static const char property_service_socket[] = "/dev/socket/" PROP_SERVICE_NAME;
@ -112,23 +116,57 @@ private:
DISALLOW_COPY_AND_ASSIGN(prop_bt);
};
struct prop_area {
uint32_t bytes_used;
atomic_uint_least32_t serial;
uint32_t magic;
uint32_t version;
uint32_t reserved[28];
char data[0];
class prop_area {
public:
prop_area(const uint32_t magic, const uint32_t version) :
magic(magic), version(version) {
atomic_init(&serial, 0);
memset(reserved, 0, sizeof(reserved));
magic_(magic), version_(version) {
atomic_init(&serial_, 0);
memset(reserved_, 0, sizeof(reserved_));
// Allocate enough space for the root node.
bytes_used = sizeof(prop_bt);
bytes_used_ = sizeof(prop_bt);
}
const prop_info *find(const char *name);
bool add(const char *name, unsigned int namelen,
const char *value, unsigned int valuelen);
bool foreach(void (*propfn)(const prop_info *pi, void *cookie), void *cookie);
atomic_uint_least32_t *serial() { return &serial_; }
uint32_t magic() const { return magic_; }
uint32_t version() const { return version_; }
private:
void *allocate_obj(const size_t size, uint_least32_t *const off);
prop_bt *new_prop_bt(const char *name, uint8_t namelen, uint_least32_t *const off);
prop_info *new_prop_info(const char *name, uint8_t namelen,
const char *value, uint8_t valuelen,
uint_least32_t *const off);
void *to_prop_obj(uint_least32_t off);
prop_bt *to_prop_bt(atomic_uint_least32_t *off_p);
prop_info *to_prop_info(atomic_uint_least32_t *off_p);
prop_bt *root_node();
prop_bt *find_prop_bt(prop_bt *const bt, const char *name,
uint8_t namelen, bool alloc_if_needed);
const prop_info *find_property(prop_bt *const trie, const char *name,
uint8_t namelen, const char *value,
uint8_t valuelen, bool alloc_if_needed);
bool foreach_property(prop_bt *const trie,
void (*propfn)(const prop_info *pi, void *cookie),
void *cookie);
uint32_t bytes_used_;
atomic_uint_least32_t serial_;
uint32_t magic_;
uint32_t version_;
uint32_t reserved_[28];
char data_[0];
DISALLOW_COPY_AND_ASSIGN(prop_area);
};
@ -158,10 +196,11 @@ struct find_nth_cookie {
}
};
static char property_filename[PATH_MAX] = PROP_FILENAME;
static char property_filename[PROP_FILENAME_MAX] = PROP_FILENAME;
static bool compat_mode = false;
static size_t pa_data_size;
static size_t pa_size;
static bool initialized = false;
// NOTE: This isn't static because system_properties_compat.c
// requires it.
@ -182,13 +221,12 @@ static int get_fd_from_env(void)
return atoi(env);
}
static int map_prop_area_rw()
{
static prop_area* map_prop_area_rw(const char* filename, const char* context,
bool* fsetxattr_failed) {
/* dev is a tmpfs that we can use to carve a shared workspace
* out of, so let's do that...
*/
const int fd = open(property_filename,
O_RDWR | O_CREAT | O_NOFOLLOW | O_CLOEXEC | O_EXCL, 0444);
const int fd = open(filename, O_RDWR | O_CREAT | O_NOFOLLOW | O_CLOEXEC | O_EXCL, 0444);
if (fd < 0) {
if (errno == EACCES) {
@ -197,12 +235,31 @@ static int map_prop_area_rw()
*/
abort();
}
return -1;
return nullptr;
}
if (context) {
if (fsetxattr(fd, XATTR_NAME_SELINUX, context, strlen(context) + 1, 0) != 0) {
__libc_format_log(ANDROID_LOG_ERROR, "libc",
"fsetxattr failed to set context (%s) for \"%s\"", context, filename);
/*
* fsetxattr() will fail during system properties tests due to selinux policy.
* We do not want to create a custom policy for the tester, so we will continue in
* this function but set a flag that an error has occurred.
* Init, which is the only daemon that should ever call this function will abort
* when this error occurs.
* Otherwise, the tester will ignore it and continue, albeit without any selinux
* property separation.
*/
if (fsetxattr_failed) {
*fsetxattr_failed = true;
}
}
}
if (ftruncate(fd, PA_SIZE) < 0) {
close(fd);
return -1;
return nullptr;
}
pa_size = PA_SIZE;
@ -212,29 +269,26 @@ static int map_prop_area_rw()
void *const memory_area = mmap(NULL, pa_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (memory_area == MAP_FAILED) {
close(fd);
return -1;
return nullptr;
}
prop_area *pa = new(memory_area) prop_area(PROP_AREA_MAGIC, PROP_AREA_VERSION);
/* plug into the lib property services */
__system_property_area__ = pa;
close(fd);
return 0;
return pa;
}
static int map_fd_ro(const int fd) {
static prop_area* map_fd_ro(const int fd) {
struct stat fd_stat;
if (fstat(fd, &fd_stat) < 0) {
return -1;
return nullptr;
}
if ((fd_stat.st_uid != 0)
|| (fd_stat.st_gid != 0)
|| ((fd_stat.st_mode & (S_IWGRP | S_IWOTH)) != 0)
|| (fd_stat.st_size < static_cast<off_t>(sizeof(prop_area))) ) {
return -1;
return nullptr;
}
pa_size = fd_stat.st_size;
@ -242,29 +296,28 @@ static int map_fd_ro(const int fd) {
void* const map_result = mmap(NULL, pa_size, PROT_READ, MAP_SHARED, fd, 0);
if (map_result == MAP_FAILED) {
return -1;
return nullptr;
}
prop_area* pa = reinterpret_cast<prop_area*>(map_result);
if ((pa->magic != PROP_AREA_MAGIC) || (pa->version != PROP_AREA_VERSION &&
pa->version != PROP_AREA_VERSION_COMPAT)) {
if ((pa->magic() != PROP_AREA_MAGIC) ||
(pa->version() != PROP_AREA_VERSION &&
pa->version() != PROP_AREA_VERSION_COMPAT)) {
munmap(pa, pa_size);
return -1;
return nullptr;
}
if (pa->version == PROP_AREA_VERSION_COMPAT) {
if (pa->version() == PROP_AREA_VERSION_COMPAT) {
compat_mode = true;
}
__system_property_area__ = pa;
return 0;
return pa;
}
static int map_prop_area()
{
int fd = open(property_filename, O_CLOEXEC | O_NOFOLLOW | O_RDONLY);
static prop_area* map_prop_area(const char* filename, bool is_legacy) {
int fd = open(filename, O_CLOEXEC | O_NOFOLLOW | O_RDONLY);
bool close_fd = true;
if (fd == -1 && errno == ENOENT) {
if (fd == -1 && errno == ENOENT && is_legacy) {
/*
* For backwards compatibility, if the file doesn't
* exist, we use the environment to get the file descriptor.
@ -273,16 +326,18 @@ static int map_prop_area()
* returns other errors such as ENOMEM or ENFILE, since it
* might be possible for an external program to trigger this
* condition.
* Only do this for the legacy prop file, secured prop files
* do not have a backup
*/
fd = get_fd_from_env();
close_fd = false;
}
if (fd < 0) {
return -1;
return nullptr;
}
const int map_result = map_fd_ro(fd);
prop_area* map_result = map_fd_ro(fd);
if (close_fd) {
close(fd);
}
@ -290,20 +345,19 @@ static int map_prop_area()
return map_result;
}
static void *allocate_obj(const size_t size, uint_least32_t *const off)
void *prop_area::allocate_obj(const size_t size, uint_least32_t *const off)
{
prop_area *pa = __system_property_area__;
const size_t aligned = BIONIC_ALIGN(size, sizeof(uint_least32_t));
if (pa->bytes_used + aligned > pa_data_size) {
if (bytes_used_ + aligned > pa_data_size) {
return NULL;
}
*off = pa->bytes_used;
pa->bytes_used += aligned;
return pa->data + *off;
*off = bytes_used_;
bytes_used_ += aligned;
return data_ + *off;
}
static prop_bt *new_prop_bt(const char *name, uint8_t namelen, uint_least32_t *const off)
prop_bt *prop_area::new_prop_bt(const char *name, uint8_t namelen, uint_least32_t *const off)
{
uint_least32_t new_offset;
void *const p = allocate_obj(sizeof(prop_bt) + namelen + 1, &new_offset);
@ -316,7 +370,7 @@ static prop_bt *new_prop_bt(const char *name, uint8_t namelen, uint_least32_t *c
return NULL;
}
static prop_info *new_prop_info(const char *name, uint8_t namelen,
prop_info *prop_area::new_prop_info(const char *name, uint8_t namelen,
const char *value, uint8_t valuelen, uint_least32_t *const off)
{
uint_least32_t new_offset;
@ -330,27 +384,25 @@ static prop_info *new_prop_info(const char *name, uint8_t namelen,
return NULL;
}
static void *to_prop_obj(uint_least32_t off)
void *prop_area::to_prop_obj(uint_least32_t off)
{
if (off > pa_data_size)
return NULL;
if (!__system_property_area__)
return NULL;
return (__system_property_area__->data + off);
return (data_ + off);
}
static inline prop_bt *to_prop_bt(atomic_uint_least32_t* off_p) {
inline prop_bt *prop_area::to_prop_bt(atomic_uint_least32_t* off_p) {
uint_least32_t off = atomic_load_explicit(off_p, memory_order_consume);
return reinterpret_cast<prop_bt*>(to_prop_obj(off));
}
static inline prop_info *to_prop_info(atomic_uint_least32_t* off_p) {
inline prop_info *prop_area::to_prop_info(atomic_uint_least32_t* off_p) {
uint_least32_t off = atomic_load_explicit(off_p, memory_order_consume);
return reinterpret_cast<prop_info*>(to_prop_obj(off));
}
static inline prop_bt *root_node()
inline prop_bt *prop_area::root_node()
{
return reinterpret_cast<prop_bt*>(to_prop_obj(0));
}
@ -366,8 +418,8 @@ static int cmp_prop_name(const char *one, uint8_t one_len, const char *two,
return strncmp(one, two, one_len);
}
static prop_bt *find_prop_bt(prop_bt *const bt, const char *name,
uint8_t namelen, bool alloc_if_needed)
prop_bt *prop_area::find_prop_bt(prop_bt *const bt, const char *name,
uint8_t namelen, bool alloc_if_needed)
{
prop_bt* current = bt;
@ -417,7 +469,7 @@ static prop_bt *find_prop_bt(prop_bt *const bt, const char *name,
}
}
static const prop_info *find_property(prop_bt *const trie, const char *name,
const prop_info *prop_area::find_property(prop_bt *const trie, const char *name,
uint8_t namelen, const char *value, uint8_t valuelen,
bool alloc_if_needed)
{
@ -543,44 +595,439 @@ static void find_nth_fn(const prop_info *pi, void *ptr)
cookie->count++;
}
static int foreach_property(prop_bt *const trie,
bool prop_area::foreach_property(prop_bt *const trie,
void (*propfn)(const prop_info *pi, void *cookie), void *cookie)
{
if (!trie)
return -1;
return false;
uint_least32_t left_offset = atomic_load_explicit(&trie->left, memory_order_relaxed);
if (left_offset != 0) {
const int err = foreach_property(to_prop_bt(&trie->left), propfn, cookie);
if (err < 0)
return -1;
return false;
}
uint_least32_t prop_offset = atomic_load_explicit(&trie->prop, memory_order_relaxed);
if (prop_offset != 0) {
prop_info *info = to_prop_info(&trie->prop);
if (!info)
return -1;
return false;
propfn(info, cookie);
}
uint_least32_t children_offset = atomic_load_explicit(&trie->children, memory_order_relaxed);
if (children_offset != 0) {
const int err = foreach_property(to_prop_bt(&trie->children), propfn, cookie);
if (err < 0)
return -1;
return false;
}
uint_least32_t right_offset = atomic_load_explicit(&trie->right, memory_order_relaxed);
if (right_offset != 0) {
const int err = foreach_property(to_prop_bt(&trie->right), propfn, cookie);
if (err < 0)
return false;
}
return true;
}
const prop_info *prop_area::find(const char *name) {
return find_property(root_node(), name, strlen(name), nullptr, 0, false);
}
bool prop_area::add(const char *name, unsigned int namelen,
const char *value, unsigned int valuelen) {
return find_property(root_node(), name, namelen, value, valuelen, true);
}
bool prop_area::foreach(void (*propfn)(const prop_info* pi, void* cookie), void* cookie) {
return foreach_property(root_node(), propfn, cookie);
}
class context_node {
public:
context_node(context_node* next, const char* context, prop_area* pa)
: next(next), context_(strdup(context)), pa_(pa), no_access_(false) {
lock_.init(false);
}
~context_node() {
unmap();
free(context_);
}
bool open(bool access_rw, bool* fsetxattr_failed);
bool check_access_and_open();
void reset_access();
const char* context() const { return context_; }
prop_area* pa() { return pa_; }
context_node* next;
private:
bool check_access();
void unmap();
Lock lock_;
char* context_;
prop_area* pa_;
bool no_access_;
};
struct prefix_node {
prefix_node(struct prefix_node* next, const char* prefix, context_node* context)
: prefix(strdup(prefix)), prefix_len(strlen(prefix)), context(context), next(next) {
}
~prefix_node() {
free(prefix);
}
char* prefix;
const size_t prefix_len;
context_node* context;
struct prefix_node* next;
};
template <typename List, typename... Args>
static inline void list_add(List** list, Args... args) {
*list = new List(*list, args...);
}
static void list_add_after_len(prefix_node** list, const char* prefix, context_node* context) {
size_t prefix_len = strlen(prefix);
auto next_list = list;
while (*next_list) {
if ((*next_list)->prefix_len < prefix_len || (*next_list)->prefix[0] == '*') {
list_add(next_list, prefix, context);
return;
}
next_list = &(*next_list)->next;
}
list_add(next_list, prefix, context);
}
template <typename List, typename Func>
static void list_foreach(List* list, Func func) {
while (list) {
func(list);
list = list->next;
}
}
template <typename List, typename Func>
static List* list_find(List* list, Func func) {
while (list) {
if (func(list)) {
return list;
}
list = list->next;
}
return nullptr;
}
template <typename List>
static void list_free(List** list) {
while (*list) {
auto old_list = *list;
*list = old_list->next;
delete old_list;
}
}
static prefix_node* prefixes = nullptr;
static context_node* contexts = nullptr;
/*
* pthread_mutex_lock() calls into system_properties in the case of contention.
* This creates a risk of dead lock if any system_properties functions
* use pthread locks after system_property initialization.
*
* For this reason, the below three functions use a bionic Lock and static
* allocation of memory for each filename.
*/
bool context_node::open(bool access_rw, bool* fsetxattr_failed) {
lock_.lock();
if (pa_) {
lock_.unlock();
return true;
}
char filename[PROP_FILENAME_MAX];
int len = snprintf(filename, sizeof(filename), "%s/%s", property_filename, context_);
if (len < 0 || len > PROP_FILENAME_MAX) {
lock_.unlock();
return false;
}
if (access_rw) {
pa_ = map_prop_area_rw(filename, context_, fsetxattr_failed);
} else {
pa_ = map_prop_area(filename, false);
}
lock_.unlock();
return pa_;
}
bool context_node::check_access_and_open() {
if (!pa_ && !no_access_) {
if (!check_access() || !open(false, nullptr)) {
no_access_ = true;
}
}
return pa_;
}
void context_node::reset_access() {
if (!check_access()) {
unmap();
no_access_ = true;
} else {
no_access_ = false;
}
}
bool context_node::check_access() {
char filename[PROP_FILENAME_MAX];
int len = snprintf(filename, sizeof(filename), "%s/%s", property_filename, context_);
if (len < 0 || len > PROP_FILENAME_MAX) {
return false;
}
return access(filename, R_OK) == 0;
}
void context_node::unmap() {
if (!pa_) {
return;
}
munmap(pa_, pa_size);
if (pa_ == __system_property_area__) {
__system_property_area__ = nullptr;
}
pa_ = nullptr;
}
static bool map_system_property_area(bool access_rw, bool* fsetxattr_failed) {
char filename[PROP_FILENAME_MAX];
int len = snprintf(filename, sizeof(filename), "%s/properties_serial", property_filename);
if (len < 0 || len > PROP_FILENAME_MAX) {
__system_property_area__ = nullptr;
return false;
}
if (access_rw) {
__system_property_area__ =
map_prop_area_rw(filename, "u:object_r:properties_serial:s0", fsetxattr_failed);
} else {
__system_property_area__ = map_prop_area(filename, false);
}
return __system_property_area__;
}
static prop_area* get_prop_area_for_name(const char* name) {
auto entry = list_find(prefixes, [name](prefix_node* l) {
return l->prefix[0] == '*' || !strncmp(l->prefix, name, l->prefix_len);
});
if (!entry) {
return nullptr;
}
auto cnode = entry->context;
if (!cnode->pa()) {
/*
* We explicitly do not check no_access_ in this case because unlike the
* case of foreach(), we want to generate an selinux audit for each
* non-permitted property access in this function.
*/
cnode->open(false, nullptr);
}
return cnode->pa();
}
/*
* The below two functions are duplicated from label_support.c in libselinux.
* TODO: Find a location suitable for these functions such that both libc and
* libselinux can share a common source file.
*/
/*
* The read_spec_entries and read_spec_entry functions may be used to
* replace sscanf to read entries from spec files. The file and
* property services now use these.
*/
/* Read an entry from a spec file (e.g. file_contexts) */
static inline int read_spec_entry(char **entry, char **ptr, int *len)
{
*entry = NULL;
char *tmp_buf = NULL;
while (isspace(**ptr) && **ptr != '\0')
(*ptr)++;
tmp_buf = *ptr;
*len = 0;
while (!isspace(**ptr) && **ptr != '\0') {
(*ptr)++;
(*len)++;
}
if (*len) {
*entry = strndup(tmp_buf, *len);
if (!*entry)
return -1;
}
return 0;
}
/*
* line_buf - Buffer containing the spec entries .
* num_args - The number of spec parameter entries to process.
* ... - A 'char **spec_entry' for each parameter.
* returns - The number of items processed.
*
* This function calls read_spec_entry() to do the actual string processing.
*/
static int read_spec_entries(char *line_buf, int num_args, ...)
{
char **spec_entry, *buf_p;
int len, rc, items, entry_len = 0;
va_list ap;
len = strlen(line_buf);
if (line_buf[len - 1] == '\n')
line_buf[len - 1] = '\0';
else
/* Handle case if line not \n terminated by bumping
* the len for the check below (as the line is NUL
* terminated by getline(3)) */
len++;
buf_p = line_buf;
while (isspace(*buf_p))
buf_p++;
/* Skip comment lines and empty lines. */
if (*buf_p == '#' || *buf_p == '\0')
return 0;
/* Process the spec file entries */
va_start(ap, num_args);
items = 0;
while (items < num_args) {
spec_entry = va_arg(ap, char **);
if (len - 1 == buf_p - line_buf) {
va_end(ap);
return items;
}
rc = read_spec_entry(spec_entry, &buf_p, &entry_len);
if (rc < 0) {
va_end(ap);
return rc;
}
if (entry_len)
items++;
}
va_end(ap);
return items;
}
static bool initialize_properties() {
FILE* file = fopen("/property_contexts", "re");
if (!file) {
return false;
}
char* buffer = nullptr;
size_t line_len;
char* prop_prefix = nullptr;
char* context = nullptr;
while (getline(&buffer, &line_len, file) > 0) {
int items = read_spec_entries(buffer, 2, &prop_prefix, &context);
if (items <= 0) {
continue;
}
if (items == 1) {
free(prop_prefix);
continue;
}
/*
* init uses ctl.* properties as an IPC mechanism and does not write them
* to a property file, therefore we do not need to create property files
* to store them.
*/
if (!strncmp(prop_prefix, "ctl.", 4)) {
free(prop_prefix);
free(context);
continue;
}
auto old_context = list_find(
contexts, [context](context_node* l) { return !strcmp(l->context(), context); });
if (old_context) {
list_add_after_len(&prefixes, prop_prefix, old_context);
} else {
list_add(&contexts, context, nullptr);
list_add_after_len(&prefixes, prop_prefix, contexts);
}
free(prop_prefix);
free(context);
}
free(buffer);
fclose(file);
return true;
}
static bool is_dir(const char* pathname) {
struct stat info;
if (stat(pathname, &info) == -1) {
return false;
}
return S_ISDIR(info.st_mode);
}
static void free_and_unmap_contexts() {
list_free(&prefixes);
list_free(&contexts);
if (__system_property_area__) {
munmap(__system_property_area__, pa_size);
__system_property_area__ = nullptr;
}
}
int __system_properties_init()
{
return map_prop_area();
if (initialized) {
list_foreach(contexts, [](context_node* l) { l->reset_access(); });
return 0;
}
if (is_dir(property_filename)) {
if (!initialize_properties()) {
return -1;
}
if (!map_system_property_area(false, nullptr)) {
free_and_unmap_contexts();
return -1;
}
} else {
__system_property_area__ = map_prop_area(property_filename, true);
if (!__system_property_area__) {
return -1;
}
list_add(&contexts, "legacy_system_prop_area", __system_property_area__);
list_add_after_len(&prefixes, "*", contexts);
}
initialized = true;
return 0;
}
int __system_property_set_filename(const char *filename)
@ -595,7 +1042,24 @@ int __system_property_set_filename(const char *filename)
int __system_property_area_init()
{
return map_prop_area_rw();
free_and_unmap_contexts();
mkdir(property_filename, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
if (!initialize_properties()) {
return -1;
}
bool open_failed = false;
bool fsetxattr_failed = false;
list_foreach(contexts, [&fsetxattr_failed, &open_failed](context_node* l) {
if (!l->open(true, &fsetxattr_failed)) {
open_failed = true;
}
});
if (open_failed || !map_system_property_area(true, &fsetxattr_failed)) {
free_and_unmap_contexts();
return -1;
}
initialized = true;
return fsetxattr_failed ? -2 : 0;
}
unsigned int __system_property_area_serial()
@ -605,15 +1069,26 @@ unsigned int __system_property_area_serial()
return -1;
}
// Make sure this read fulfilled before __system_property_serial
return atomic_load_explicit(&(pa->serial), memory_order_acquire);
return atomic_load_explicit(pa->serial(), memory_order_acquire);
}
const prop_info *__system_property_find(const char *name)
{
if (!__system_property_area__) {
return nullptr;
}
if (__predict_false(compat_mode)) {
return __system_property_find_compat(name);
}
return find_property(root_node(), name, strlen(name), NULL, 0, false);
prop_area* pa = get_prop_area_for_name(name);
if (!pa) {
__libc_format_log(ANDROID_LOG_ERROR, "libc", "Access denied finding property \"%s\"", name);
return nullptr;
}
return pa->find(name);
}
// The C11 standard doesn't allow atomic loads from const fields,
@ -688,11 +1163,15 @@ int __system_property_set(const char *key, const char *value)
int __system_property_update(prop_info *pi, const char *value, unsigned int len)
{
prop_area *pa = __system_property_area__;
if (len >= PROP_VALUE_MAX)
return -1;
prop_area* pa = __system_property_area__;
if (!pa) {
return -1;
}
uint32_t serial = atomic_load_explicit(&pi->serial, memory_order_relaxed);
serial |= 1;
atomic_store_explicit(&pi->serial, serial, memory_order_relaxed);
@ -708,10 +1187,10 @@ int __system_property_update(prop_info *pi, const char *value, unsigned int len)
__futex_wake(&pi->serial, INT32_MAX);
atomic_store_explicit(
&pa->serial,
atomic_load_explicit(&pa->serial, memory_order_relaxed) + 1,
pa->serial(),
atomic_load_explicit(pa->serial(), memory_order_relaxed) + 1,
memory_order_release);
__futex_wake(&pa->serial, INT32_MAX);
__futex_wake(pa->serial(), INT32_MAX);
return 0;
}
@ -719,9 +1198,6 @@ int __system_property_update(prop_info *pi, const char *value, unsigned int len)
int __system_property_add(const char *name, unsigned int namelen,
const char *value, unsigned int valuelen)
{
prop_area *pa = __system_property_area__;
const prop_info *pi;
if (namelen >= PROP_NAME_MAX)
return -1;
if (valuelen >= PROP_VALUE_MAX)
@ -729,17 +1205,28 @@ int __system_property_add(const char *name, unsigned int namelen,
if (namelen < 1)
return -1;
pi = find_property(root_node(), name, namelen, value, valuelen, true);
if (!pi)
if (!__system_property_area__) {
return -1;
}
prop_area* pa = get_prop_area_for_name(name);
if (!pa) {
__libc_format_log(ANDROID_LOG_ERROR, "libc", "Access denied adding property \"%s\"", name);
return -1;
}
bool ret = pa->add(name, namelen, value, valuelen);
if (!ret)
return -1;
// There is only a single mutator, but we want to make sure that
// updates are visible to a reader waiting for the update.
atomic_store_explicit(
&pa->serial,
atomic_load_explicit(&pa->serial, memory_order_relaxed) + 1,
__system_property_area__->serial(),
atomic_load_explicit(__system_property_area__->serial(), memory_order_relaxed) + 1,
memory_order_release);
__futex_wake(&pa->serial, INT32_MAX);
__futex_wake(__system_property_area__->serial(), INT32_MAX);
return 0;
}
@ -761,9 +1248,13 @@ unsigned int __system_property_wait_any(unsigned int serial)
prop_area *pa = __system_property_area__;
uint32_t my_serial;
if (!pa) {
return 0;
}
do {
__futex_wait(&pa->serial, serial, NULL);
my_serial = atomic_load_explicit(&pa->serial, memory_order_acquire);
__futex_wait(pa->serial(), serial, NULL);
my_serial = atomic_load_explicit(pa->serial(), memory_order_acquire);
} while (my_serial == serial);
return my_serial;
@ -784,9 +1275,18 @@ const prop_info *__system_property_find_nth(unsigned n)
int __system_property_foreach(void (*propfn)(const prop_info *pi, void *cookie),
void *cookie)
{
if (!__system_property_area__) {
return -1;
}
if (__predict_false(compat_mode)) {
return __system_property_foreach_compat(propfn, cookie);
}
return foreach_property(root_node(), propfn, cookie);
list_foreach(contexts, [propfn, cookie](context_node* l) {
if (l->check_access_and_open()) {
l->pa()->foreach(propfn, cookie);
}
});
return 0;
}

View File

@ -98,6 +98,11 @@ enum {
*/
ANDROID_DLEXT_LOAD_AT_FIXED_ADDRESS = 0x100,
/* This flag used to load library in a different namespace. The namespace is
* specified in library_namespace.
*/
ANDROID_DLEXT_USE_NAMESPACE = 0x200,
/* Mask of valid bits */
ANDROID_DLEXT_VALID_FLAG_BITS = ANDROID_DLEXT_RESERVED_ADDRESS |
ANDROID_DLEXT_RESERVED_ADDRESS_HINT |
@ -107,9 +112,12 @@ enum {
ANDROID_DLEXT_USE_LIBRARY_FD_OFFSET |
ANDROID_DLEXT_FORCE_LOAD |
ANDROID_DLEXT_FORCE_FIXED_VADDR |
ANDROID_DLEXT_LOAD_AT_FIXED_ADDRESS,
ANDROID_DLEXT_LOAD_AT_FIXED_ADDRESS |
ANDROID_DLEXT_USE_NAMESPACE,
};
struct android_namespace_t;
typedef struct {
uint64_t flags;
void* reserved_addr;
@ -117,10 +125,75 @@ typedef struct {
int relro_fd;
int library_fd;
off64_t library_fd_offset;
struct android_namespace_t* library_namespace;
} android_dlextinfo;
extern void* android_dlopen_ext(const char* filename, int flag, const android_dlextinfo* extinfo);
/*
* Initializes public and anonymous namespaces. The public_ns_sonames is the list of sonames
* to be included into public namespace separated by colon. Example: "libc.so:libm.so:libdl.so".
* The libraries in this list should be loaded prior to this call.
*
* The anon_ns_library_path is the search path for anonymous namespace. The anonymous namespace
* is used in the case when linker cannot identify the caller of dlopen/dlsym. This happens
* for the code not loaded by dynamic linker; for example calls from the mono-compiled code.
*/
extern bool android_init_namespaces(const char* public_ns_sonames,
const char* anon_ns_library_path);
enum {
/* A regular namespace is the namespace with a custom search path that does
* not impose any restrictions on the location of native libraries.
*/
ANDROID_NAMESPACE_TYPE_REGULAR = 0,
/* An isolated namespace requires all the libraries to be on the search path
* or under permitted_when_isolated_path. The search path is the union of
* ld_library_path and default_library_path.
*/
ANDROID_NAMESPACE_TYPE_ISOLATED = 1,
/* The shared namespace clones the list of libraries of the caller namespace upon creation
* which means that they are shared between namespaces - the caller namespace and the new one
* will use the same copy of a library if it was loaded prior to android_create_namespace call.
*
* Note that libraries loaded after the namespace is created will not be shared.
*
* Shared namespaces can be isolated or regular. Note that they do not inherit the search path nor
* permitted_path from the caller's namespace.
*/
ANDROID_NAMESPACE_TYPE_SHARED = 2,
ANDROID_NAMESPACE_TYPE_SHARED_ISOLATED = ANDROID_NAMESPACE_TYPE_SHARED |
ANDROID_NAMESPACE_TYPE_ISOLATED,
};
/*
* Creates new linker namespace.
* ld_library_path and default_library_path represent the search path
* for the libraries in the namespace.
*
* The libraries in the namespace are searched by folowing order:
* 1. ld_library_path (Think of this as namespace-local LD_LIBRARY_PATH)
* 2. In directories specified by DT_RUNPATH of the "needed by" binary.
* 3. deault_library_path (This of this as namespace-local default library path)
*
* When type is ANDROID_NAMESPACE_TYPE_ISOLATED the resulting namespace requires all of
* the libraries to be on the search path or under the permitted_when_isolated_path;
* the search_path is ld_library_path:default_library_path. Note that the
* permitted_when_isolated_path path is not part of the search_path and
* does not affect the search order. It is a way to allow loading libraries from specific
* locations when using absolute path.
* If a library or any of its dependencies are outside of the permitted_when_isolated_path
* and search_path, and it is not part of the public namespace dlopen will fail.
*/
extern struct android_namespace_t* android_create_namespace(const char* name,
const char* ld_library_path,
const char* default_library_path,
uint64_t type,
const char* permitted_when_isolated_path);
__END_DECLS
#endif /* __ANDROID_DLEXT_H__ */

View File

@ -43,11 +43,12 @@ typedef struct {
in dli_sname */
} Dl_info;
extern void* dlopen(const char* filename, int flag);
extern int dlclose(void* handle);
extern const char* dlerror(void);
extern void* dlsym(void* handle, const char* symbol);
extern int dladdr(const void* addr, Dl_info *info);
extern void* dlopen(const char* filename, int flag);
extern int dlclose(void* handle);
extern const char* dlerror(void);
extern void* dlsym(void* handle, const char* symbol) __nonnull((2));
extern void* dlvsym(void* handle, const char* symbol, const char* version) __nonnull((2, 3));
extern int dladdr(const void* addr, Dl_info *info);
enum {
#if defined(__LP64__)

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2011 The Android Open Source Project
* Copyright (C) 2015 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -25,17 +25,35 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _BIONIC_TIME_H
#define _BIONIC_TIME_H
#include <time.h>
#ifndef _IFADDRS_H_
#define _IFADDRS_H_
#include <sys/cdefs.h>
#include <netinet/in.h>
#include <sys/socket.h>
__BEGIN_DECLS
// We can't remove this (and this file) until we fix MtpUtils.cpp.
time_t mktime_tz(struct tm* const, char const*);
struct ifaddrs {
struct ifaddrs* ifa_next;
char* ifa_name;
unsigned int ifa_flags;
struct sockaddr* ifa_addr;
struct sockaddr* ifa_netmask;
union {
struct sockaddr* ifu_broadaddr;
struct sockaddr* ifu_dstaddr;
} ifa_ifu;
void* ifa_data;
};
#define ifa_broadaddr ifa_ifu.ifu_broadaddr
#define ifa_dstaddr ifa_ifu.ifu_dstaddr
void freeifaddrs(struct ifaddrs*);
int getifaddrs(struct ifaddrs**);
__END_DECLS
#endif /* _BIONIC_TIME_H */
#endif

View File

@ -32,18 +32,19 @@
#include <sys/cdefs.h>
#include <sys/types.h>
__BEGIN_DECLS
#if !defined(__bionic_using_gnu_basename)
/*
* <string.h> gets you the GNU basename.
* <libgen.h> the POSIX one.
* Note that our "POSIX" one has the wrong argument cv-qualifiers, but doesn't
* modify its input and uses thread-local storage for the result if necessary.
* Including <string.h> will get you the GNU basename, unless <libgen.h> is
* included, either before or after including <string.h>.
*
* Note that this has the wrong argument cv-qualifiers, but doesn't modify its
* input and uses thread-local storage for the result if necessary.
*/
extern char* basename(const char*);
#define __bionic_using_posix_basename
#endif
extern char* __posix_basename(const char*) __RENAME(basename);
#define basename __posix_basename
/* This has the wrong argument cv-qualifiers, but doesn't modify its input and uses thread-local storage for the result if necessary. */
extern char* dirname(const char*);

View File

@ -96,6 +96,26 @@ typedef int pthread_once_t;
#define PTHREAD_ONCE_INIT 0
typedef struct {
#if defined(__LP64__)
int64_t __private[4];
#else
int32_t __private[8];
#endif
} pthread_barrier_t;
typedef int pthread_barrierattr_t;
#define PTHREAD_BARRIER_SERIAL_THREAD -1
typedef struct {
#if defined(__LP64__)
int64_t __private;
#else
int32_t __private[2];
#endif
} pthread_spinlock_t;
#if defined(__LP64__)
#define PTHREAD_STACK_MIN (4 * PAGE_SIZE)
#else
@ -130,7 +150,7 @@ int pthread_attr_setschedparam(pthread_attr_t*, const struct sched_param*) __non
int pthread_attr_setschedpolicy(pthread_attr_t*, int) __nonnull((1));
int pthread_attr_setscope(pthread_attr_t*, int) __nonnull((1));
int pthread_attr_setstack(pthread_attr_t*, void*, size_t) __nonnull((1));
int pthread_attr_setstacksize(pthread_attr_t*, size_t stack_size) __nonnull((1));
int pthread_attr_setstacksize(pthread_attr_t*, size_t) __nonnull((1));
int pthread_condattr_destroy(pthread_condattr_t*) __nonnull((1));
int pthread_condattr_getclock(const pthread_condattr_t*, clockid_t*) __nonnull((1, 2));
@ -205,9 +225,24 @@ int pthread_rwlock_timedrdlock(pthread_rwlock_t*, const struct timespec*) __nonn
int pthread_rwlock_timedwrlock(pthread_rwlock_t*, const struct timespec*) __nonnull((1, 2));
int pthread_rwlock_tryrdlock(pthread_rwlock_t*) __nonnull((1));
int pthread_rwlock_trywrlock(pthread_rwlock_t*) __nonnull((1));
int pthread_rwlock_unlock(pthread_rwlock_t *rwlock) __nonnull((1));
int pthread_rwlock_unlock(pthread_rwlock_t *) __nonnull((1));
int pthread_rwlock_wrlock(pthread_rwlock_t*) __nonnull((1));
int pthread_barrierattr_init(pthread_barrierattr_t* attr) __nonnull((1));
int pthread_barrierattr_destroy(pthread_barrierattr_t* attr) __nonnull((1));
int pthread_barrierattr_getpshared(pthread_barrierattr_t* attr, int* pshared) __nonnull((1, 2));
int pthread_barrierattr_setpshared(pthread_barrierattr_t* attr, int pshared) __nonnull((1));
int pthread_barrier_init(pthread_barrier_t*, const pthread_barrierattr_t*, unsigned) __nonnull((1));
int pthread_barrier_destroy(pthread_barrier_t*) __nonnull((1));
int pthread_barrier_wait(pthread_barrier_t*) __nonnull((1));
int pthread_spin_destroy(pthread_spinlock_t*) __nonnull((1));
int pthread_spin_init(pthread_spinlock_t*, int) __nonnull((1));
int pthread_spin_lock(pthread_spinlock_t*) __nonnull((1));
int pthread_spin_trylock(pthread_spinlock_t*) __nonnull((1));
int pthread_spin_unlock(pthread_spinlock_t*) __nonnull((1));
pthread_t pthread_self(void) __pure2;
int pthread_setname_np(pthread_t, const char*) __nonnull((2));

View File

@ -270,6 +270,7 @@ int vasprintf(char ** __restrict, const char * __restrict,
void clearerr_unlocked(FILE*);
int feof_unlocked(FILE*);
int ferror_unlocked(FILE*);
int fileno_unlocked(FILE*);
/*
* Stdio function-access interface.

View File

@ -115,18 +115,18 @@ extern size_t strxfrm(char* __restrict, const char* __restrict, size_t);
extern int strcoll_l(const char *, const char *, locale_t) __purefunc;
extern size_t strxfrm_l(char* __restrict, const char* __restrict, size_t, locale_t);
#if defined(__USE_GNU) && !defined(__bionic_using_posix_basename)
#if defined(__USE_GNU) && !defined(basename)
/*
* glibc has a basename in <string.h> that's different to the POSIX one in <libgen.h>.
* It doesn't modify its argument, and in C++ it's const-correct.
*/
#if defined(__cplusplus)
extern "C++" char* basename(char*) __RENAME(__gnu_basename) __nonnull((1));
extern "C++" const char* basename(const char*) __RENAME(__gnu_basename) __nonnull((1));
#else
extern char* basename(const char*) __RENAME(__gnu_basename) __nonnull((1));
#endif
#define __bionic_using_gnu_basename
#endif
extern void* __memchr_chk(const void*, int, size_t, size_t);

View File

@ -41,6 +41,7 @@ typedef struct prop_msg prop_msg;
#define PROP_AREA_VERSION_COMPAT 0x45434f76
#define PROP_SERVICE_NAME "property_service"
#define PROP_FILENAME_MAX 1024
#define PROP_FILENAME "/dev/__properties__"
#define PA_SIZE (128 * 1024)

View File

@ -59,7 +59,7 @@ extern void* mmap64(void*, size_t, int, int, int, off64_t);
extern int munmap(void*, size_t);
extern int msync(const void*, size_t, int);
extern int mprotect(const void*, size_t, int);
extern void* mremap(void*, size_t, size_t, unsigned long);
extern void* mremap(void*, size_t, size_t, int, ...);
extern int mlockall(int);
extern int munlockall(void);

1434
libc/libc.arm.brillo.map Normal file

File diff suppressed because it is too large Load Diff

View File

@ -10,43 +10,25 @@ LIBC {
__b64_ntop;
__b64_pton;
__brk; # arm x86 mips
__cmpdf2; # arm
__cmsg_nxthdr;
__connect; # arm x86 mips
__ctype_get_mb_cur_max;
__cxa_atexit;
__cxa_finalize;
__cxa_thread_atexit_impl;
__divdf3; # arm
__divdi3; # arm x86 mips
__divsf3; # arm
__divsi3; # arm
__dn_comp;
__dn_count_labels;
__dn_skipname;
__epoll_pwait; # arm x86 mips
__eqdf2; # arm
__errno;
__exit; # arm x86 mips
__extendsfdf2; # arm
__fbufsize;
__fcntl64; # arm x86 mips
__FD_CLR_chk;
__FD_ISSET_chk;
__FD_SET_chk;
__fgets_chk;
__fixdfsi; # arm
__fixsfsi; # arm
__fixunssfsi; # arm
__flbf;
__floatdidf; # arm
__floatdisf; # arm
__floatsidf; # arm
__floatsisf; # arm
__floatundidf; # arm
__floatundisf; # arm
__floatunsidf; # arm
__floatunsisf; # arm
__fp_nquery;
__fp_query;
__fpclassify;
@ -58,23 +40,14 @@ LIBC {
__freadable;
__fsetlocking;
__fstatfs64; # arm x86 mips
__futex_wait; # arm x86 mips
__futex_wake; # arm x86 mips
__fwritable;
__gedf2; # arm
__get_h_errno;
__get_thread; # arm x86 mips
__get_tls; # arm x86 mips
__getcpu; # arm x86 mips
__getcwd; # arm x86 mips
__getdents64; # arm x86 mips
__getpid; # arm x86 mips
__getpriority; # arm x86 mips
__gnu_basename;
__gnu_ldivmod_helper; # arm
__gnu_strerror_r;
__gnu_uldivmod_helper; # arm
__gtdf2; # arm
__hostalias;
__ioctl; # arm x86 mips
__isfinite;
@ -90,25 +63,18 @@ LIBC {
__isnormalf;
__isnormall;
__isthreaded;
__ledf2; # arm
__libc_current_sigrtmax;
__libc_current_sigrtmin;
__libc_init;
__llseek; # arm x86 mips
__loc_aton;
__loc_ntoa;
__lshrdi3; # arm
__ltdf2; # arm
__memchr_chk;
__memcpy_chk;
__memmove_chk;
__memrchr_chk;
__memset_chk;
__mmap2; # arm x86 mips
__muldf3; # arm
__muldi3; # arm
__mulsf3; # arm
__nedf2; # arm
__ns_format_ttl; # arm x86 mips
__ns_get16; # arm x86 mips
__ns_get32; # arm x86 mips
@ -131,7 +97,6 @@ LIBC {
__ns_skiprr; # arm x86 mips
__ns_sprintrr; # arm x86 mips
__ns_sprintrrf; # arm x86 mips
__open; # arm x86 mips
__open_2;
__openat; # arm x86 mips
__openat_2;
@ -148,11 +113,7 @@ LIBC {
__p_time;
__p_type;
__p_type_syms;
__page_shift; # arm x86 mips
__page_size; # arm x86 mips
__poll_chk;
__popcount_tab; # arm
__popcountsi2; # arm x86 mips
__ppoll; # arm x86 mips
__ppoll_chk;
__pread64_chk;
@ -161,7 +122,7 @@ LIBC {
__pselect6; # arm x86 mips
__pthread_cleanup_pop;
__pthread_cleanup_push;
__pthread_gettid; # arm x86 mips
__pthread_gettid; # arm x86 mips nobrillo
__ptrace; # arm x86 mips
__putlong;
__putshort;
@ -191,7 +152,6 @@ LIBC {
__res_send;
__res_send_setqhook;
__res_send_setrhook;
__restore_core_regs; # arm
__rt_sigaction; # arm x86 mips
__rt_sigpending; # arm x86 mips
__rt_sigprocmask; # arm x86 mips
@ -201,27 +161,14 @@ LIBC {
__sched_cpucount;
__sched_cpufree;
__sched_getaffinity; # arm x86 mips
__sclose; # arm x86 mips
__sdidinit; # arm x86 mips
__set_errno; # arm x86 mips
__set_tid_address; # arm x86 mips
__set_tls; # arm mips
__sF;
__sflags; # arm x86 mips
__sflush; # arm x86 mips
__sfp; # arm x86 mips
__sglue; # arm x86 mips
__sigaction; # arm x86 mips
__signalfd4; # arm x86 mips
__sinit; # arm x86 mips
__smakebuf; # arm x86 mips
__snprintf_chk;
__socket; # arm x86 mips
__sprintf_chk;
__sread; # arm x86 mips
__srefill; # arm x86 mips
__srget; # arm x86 mips
__sseek; # arm x86 mips
__stack_chk_fail;
__stack_chk_guard;
__statfs64; # arm x86 mips
@ -238,49 +185,37 @@ LIBC {
__strncpy_chk;
__strncpy_chk2;
__strrchr_chk;
__subdf3; # arm
__subsf3; # arm
__swbuf; # arm x86 mips
__swrite; # arm x86 mips
__swsetup; # arm x86 mips
__sym_ntop;
__sym_ntos;
__sym_ston;
__system_properties_init;
__system_property_add;
__system_property_area__;
__system_property_area_init;
__system_property_area_serial;
__system_property_find;
__system_property_find_nth;
__system_property_foreach;
__system_property_get;
__system_property_read;
__system_property_serial;
__system_property_set;
__system_property_set_filename;
__system_property_update;
__system_property_wait_any;
__system_properties_init; # arm x86 mips
__system_property_add; # arm x86 mips
__system_property_area__; # arm x86 mips
__system_property_area_init; # arm x86 mips
__system_property_area_serial; # arm x86 mips
__system_property_find; # arm x86 mips
__system_property_find_nth; # arm x86 mips
__system_property_foreach; # arm x86 mips
__system_property_get; # arm x86 mips
__system_property_read; # arm x86 mips
__system_property_serial; # arm x86 mips
__system_property_set; # arm x86 mips
__system_property_set_filename; # arm x86 mips
__system_property_update; # arm x86 mips
__system_property_wait_any; # arm x86 mips
__timer_create; # arm x86 mips
__timer_delete; # arm x86 mips
__timer_getoverrun; # arm x86 mips
__timer_gettime; # arm x86 mips
__timer_settime; # arm x86 mips
__truncdfsf2; # arm
__udivdi3; # arm x86 mips
__udivsi3; # arm
__umask_chk;
__unorddf2; # arm
__unordsf2; # arm
__vsnprintf_chk;
__vsprintf_chk;
__wait4; # arm x86 mips
__waitid; # arm x86 mips
_ctype_;
_Exit;
_exit;
_flushlbf;
_fwalk; # arm x86 mips
_getlong;
_getshort;
_longjmp;
@ -307,9 +242,7 @@ LIBC {
android_gethostbynamefornet;
android_set_abort_message;
arc4random;
arc4random_addrandom; # arm x86 mips
arc4random_buf;
arc4random_stir; # arm x86 mips
arc4random_uniform;
asctime;
asctime64; # arm x86 mips
@ -323,14 +256,11 @@ LIBC {
atoll;
basename;
basename_r; # arm x86 mips
bcopy; # arm x86 mips
bind;
bindresvport;
brk;
bsd_signal; # arm x86 mips
bsearch;
btowc;
bzero; # arm x86 mips
c16rtomb;
c32rtomb;
cacheflush; # arm mips
@ -383,7 +313,6 @@ LIBC {
dup3;
duplocale;
endmntent;
endpwent;
endservent;
endutent;
environ;
@ -430,7 +359,6 @@ LIBC {
fdatasync;
fdopen;
fdopendir;
fdprintf; # arm x86 mips
feof;
feof_unlocked;
ferror;
@ -462,7 +390,6 @@ LIBC {
fputws;
fread;
free;
free_malloc_leak_info;
freeaddrinfo;
freelocale;
fremovexattr;
@ -483,7 +410,6 @@ LIBC {
fsync;
ftell;
ftello;
ftime; # arm x86 mips
ftok;
ftruncate;
ftruncate64;
@ -504,7 +430,6 @@ LIBC {
fwscanf;
gai_strerror;
get_avphys_pages;
get_malloc_leak_info;
get_nprocs;
get_nprocs_conf;
get_phys_pages;
@ -516,8 +441,6 @@ LIBC {
getchar_unlocked;
getcwd;
getdelim;
getdents; # arm x86 mips
getdtablesize; # arm x86 mips
getegid;
getenv;
geteuid;
@ -592,7 +515,6 @@ LIBC {
if_nametoindex;
imaxabs;
imaxdiv;
index; # arm x86 mips
inet_addr;
inet_aton;
inet_lnaof;
@ -645,7 +567,6 @@ LIBC {
isprint_l;
ispunct;
ispunct_l;
issetugid; # arm x86 mips
isspace;
isspace_l;
isupper;
@ -735,7 +656,6 @@ LIBC {
mempcpy;
memrchr;
memset;
memswap; # arm x86 mips
mincore;
mkdir;
mkdirat;
@ -755,7 +675,6 @@ LIBC {
mktemp;
mktime;
mktime64; # arm x86 mips
mktime_tz;
mlock;
mlockall;
mmap;
@ -826,7 +745,6 @@ LIBC {
pthread_attr_getschedpolicy;
pthread_attr_getscope;
pthread_attr_getstack;
pthread_attr_getstackaddr; # arm x86 mips
pthread_attr_getstacksize;
pthread_attr_init;
pthread_attr_setdetachstate;
@ -835,7 +753,6 @@ LIBC {
pthread_attr_setschedpolicy;
pthread_attr_setscope;
pthread_attr_setstack;
pthread_attr_setstackaddr; # arm x86 mips
pthread_attr_setstacksize;
pthread_cond_broadcast;
pthread_cond_destroy;
@ -951,7 +868,6 @@ LIBC {
res_mkquery;
res_query;
res_search;
restore_core_regs; # arm
rewind;
rewinddir;
rmdir;
@ -1094,8 +1010,6 @@ LIBC {
strncpy;
strndup;
strnlen;
strntoimax; # arm x86 mips
strntoumax; # arm x86 mips
strpbrk;
strptime;
strrchr;
@ -1114,7 +1028,6 @@ LIBC {
strtoll;
strtoll_l;
strtoq;
strtotimeval; # arm x86 mips
strtoul;
strtoull;
strtoull_l;
@ -1136,7 +1049,6 @@ LIBC {
sysinfo;
syslog;
system;
sysv_signal; # arm x86 mips
tcdrain;
tcflow;
tcflush;
@ -1168,7 +1080,6 @@ LIBC {
timerfd_settime;
times;
timezone;
tkill; # arm x86 mips
tmpfile;
tmpnam;
toascii;
@ -1210,7 +1121,6 @@ LIBC {
vdprintf;
verr;
verrx;
vfdprintf; # arm x86 mips
vfork;
vfprintf;
vfscanf;
@ -1230,7 +1140,6 @@ LIBC {
vwprintf;
vwscanf;
wait;
wait3; # arm x86 mips
wait4;
waitid;
waitpid;
@ -1279,7 +1188,6 @@ LIBC {
wcstoull;
wcstoull_l;
wcstoumax;
wcswcs; # arm x86 mips
wcswidth;
wcsxfrm;
wcsxfrm_l;
@ -1304,17 +1212,46 @@ LIBC {
LIBC_N {
global:
__aeabi_atexit; # arm
__aeabi_memclr; # arm
__aeabi_memclr4; # arm
__aeabi_memclr8; # arm
__aeabi_memcpy; # arm
__aeabi_memcpy4; # arm
__aeabi_memcpy8; # arm
__aeabi_memmove; # arm
__aeabi_memmove4; # arm
__aeabi_memmove8; # arm
__aeabi_memset; # arm
__aeabi_memset4; # arm
__aeabi_memset8; # arm
__fread_chk;
__fwrite_chk;
__getcwd_chk;
__gnu_Unwind_Find_exidx; # arm
__pwrite_chk;
__pwrite64_chk;
__write_chk;
fileno_unlocked;
freeifaddrs;
getgrgid_r;
getgrnam_r;
getifaddrs;
preadv;
preadv64;
prlimit; # arm mips x86
pthread_barrierattr_destroy;
pthread_barrierattr_getpshared;
pthread_barrierattr_init;
pthread_barrierattr_setpshared;
pthread_barrier_destroy;
pthread_barrier_init;
pthread_barrier_wait;
pthread_spin_destroy;
pthread_spin_init;
pthread_spin_lock;
pthread_spin_trylock;
pthread_spin_unlock;
pwritev;
pwritev64;
scandirat;
@ -1398,8 +1335,33 @@ LIBC_PRIVATE {
__ashrdi3; # arm
__bionic_brk; # arm x86 mips
__bionic_libgcc_compat_symbols; # arm x86
__bionic_libgcc_unwind_symbols; # arm
__cmpdf2; # arm
__divdf3; # arm
__divdi3; # arm x86 mips
__divsf3; # arm
__divsi3; # arm
__dso_handle; # arm
__eqdf2; # arm
__extendsfdf2; # arm
__fixdfsi; # arm
__fixsfsi; # arm
__fixunssfsi; # arm
__floatdidf; # arm
__floatdisf; # arm
__floatsidf; # arm
__floatsisf; # arm
__floatundidf; # arm
__floatundisf; # arm
__floatunsidf; # arm
__floatunsisf; # arm
__futex_wait; # arm x86 mips nobrillo
__futex_wake; # arm x86 mips nobrillo
__gedf2; # arm
__get_thread; # arm x86 mips nobrillo
__get_tls; # arm x86 mips nobrillo
__getdents64; # arm x86 mips
__gnu_ldivmod_helper; # arm
__gnu_uldivmod_helper; # arm
__gnu_Unwind_Backtrace; # arm
__gnu_unwind_execute; # arm
__gnu_Unwind_Find_exidx; # arm
@ -1418,6 +1380,46 @@ LIBC_PRIVATE {
__gnu_Unwind_Save_VFP_D_16_to_31; # arm
__gnu_Unwind_Save_WMMXC; # arm
__gnu_Unwind_Save_WMMXD; # arm
__gtdf2; # arm
__ledf2; # arm
__lshrdi3; # arm
__ltdf2; # arm
__muldf3; # arm
__muldi3; # arm
__mulsf3; # arm
__nedf2; # arm
__open; # arm x86 mips nobrillo
__page_shift; # arm x86 mips nobrillo
__page_size; # arm x86 mips nobrillo
__popcount_tab; # arm
__popcountsi2; # arm x86 mips
__pthread_gettid; # arm x86 mips nobrillo
__restore_core_regs; # arm
__sclose; # arm x86 mips
__sdidinit; # arm x86 mips nobrillo
__set_errno; # arm x86 mips nobrillo
__sflags; # arm x86 mips
__sflush; # arm x86 mips
__sfp; # arm x86 mips
__sglue; # arm x86 mips
__sinit; # arm x86 mips nobrillo
__smakebuf; # arm x86 mips
__sread; # arm x86 mips
__srefill; # arm x86 mips
__srget; # arm x86 mips
__sseek; # arm x86 mips
__subdf3; # arm
__subsf3; # arm
__swbuf; # arm x86 mips
__swrite; # arm x86 mips
__swsetup; # arm x86 mips
__truncdfsf2; # arm
__udivdi3; # arm mips
__udivsi3; # arm
__unorddf2; # arm
__unordsf2; # arm
__wait4; # arm x86 mips nobrillo
_fwalk; # arm x86 mips
_Unwind_Backtrace; # arm
_Unwind_Complete; # arm
_Unwind_DeleteException; # arm
@ -1433,14 +1435,40 @@ LIBC_PRIVATE {
_Unwind_VRS_Get; # arm
_Unwind_VRS_Pop; # arm
_Unwind_VRS_Set; # arm
arc4random_addrandom; # arm x86 mips nobrillo
arc4random_stir; # arm x86 mips nobrillo
atexit; # arm
dlmalloc; # arm x86 mips
dlmalloc_inspect_all;
dlmalloc_trim;
dlmalloc_usable_size; # arm x86 mips
bcopy; # arm x86 mips nobrillo
bzero; # arm x86 mips nobrillo
bsd_signal; # arm x86 mips nobrillo
dlmalloc; # arm x86 mips nobrillo
dlmalloc_inspect_all; # arm x86 mips nobrillo
dlmalloc_trim; # arm x86 mips nobrillo
dlmalloc_usable_size; # arm x86 mips nobrillo
endpwent; # arm x86 mips nobrillo
fdprintf; # arm x86 mips nobrillo
free_malloc_leak_info;
ftime; # arm x86 mips nobrillo
get_malloc_leak_info;
getdents; # arm x86 mips nobrillo
getdtablesize; # arm x86 mips nobrillo
gMallocLeakZygoteChild;
index; # arm x86 mips nobrillo
issetugid; # arm x86 mips nobrillo
memswap; # arm x86 mips nobrillo
pthread_attr_getstackaddr; # arm x86 mips nobrillo
pthread_attr_setstackaddr; # arm x86 mips nobrillo
restore_core_regs; # arm
SHA1Final; # arm x86 mips
SHA1Init; # arm x86 mips
SHA1Transform; # arm x86 mips
SHA1Update; # arm x86 mips
strntoimax; # arm x86 mips nobrillo
strntoumax; # arm x86 mips nobrillo
strtotimeval; # arm x86 mips nobrillo
sysv_signal; # arm x86 mips nobrillo
tkill; # arm x86 mips nobrillo
vfdprintf; # arm x86 mips nobrillo
wait3; # arm x86 mips nobrillo
wcswcs; # arm x86 mips nobrillo
} LIBC_N;

View File

@ -131,21 +131,6 @@ LIBC {
__sym_ntop;
__sym_ntos;
__sym_ston;
__system_properties_init;
__system_property_add;
__system_property_area__;
__system_property_area_init;
__system_property_area_serial;
__system_property_find;
__system_property_find_nth;
__system_property_foreach;
__system_property_get;
__system_property_read;
__system_property_serial;
__system_property_set;
__system_property_set_filename;
__system_property_update;
__system_property_wait_any;
__umask_chk;
__vsnprintf_chk;
__vsprintf_chk;
@ -241,7 +226,6 @@ LIBC {
dup3;
duplocale;
endmntent;
endpwent;
endservent;
endutent;
environ;
@ -317,7 +301,6 @@ LIBC {
fputws;
fread;
free;
free_malloc_leak_info;
freeaddrinfo;
freelocale;
fremovexattr;
@ -358,7 +341,6 @@ LIBC {
fwscanf;
gai_strerror;
get_avphys_pages;
get_malloc_leak_info;
get_nprocs;
get_nprocs_conf;
get_phys_pages;
@ -599,7 +581,6 @@ LIBC {
mkstemps64;
mktemp;
mktime;
mktime_tz;
mlock;
mlockall;
mmap;
@ -1156,10 +1137,25 @@ LIBC_N {
__pwrite_chk;
__pwrite64_chk;
__write_chk;
fileno_unlocked;
freeifaddrs;
getgrgid_r;
getgrnam_r;
getifaddrs;
preadv;
preadv64;
pthread_barrierattr_destroy;
pthread_barrierattr_getpshared;
pthread_barrierattr_init;
pthread_barrierattr_setpshared;
pthread_barrier_destroy;
pthread_barrier_init;
pthread_barrier_wait;
pthread_spin_destroy;
pthread_spin_init;
pthread_spin_lock;
pthread_spin_trylock;
pthread_spin_unlock;
pwritev;
pwritev64;
scandirat;
@ -1169,7 +1165,22 @@ LIBC_N {
LIBC_PRIVATE {
global:
dlmalloc_inspect_all;
dlmalloc_trim;
__system_properties_init; # arm64 x86_64 mips64
__system_property_add; # arm64 x86_64 mips64
__system_property_area__; # arm64 x86_64 mips64
__system_property_area_init; # arm64 x86_64 mips64
__system_property_area_serial; # arm64 x86_64 mips64
__system_property_find; # arm64 x86_64 mips64
__system_property_find_nth; # arm64 x86_64 mips64
__system_property_foreach; # arm64 x86_64 mips64
__system_property_get; # arm64 x86_64 mips64
__system_property_read; # arm64 x86_64 mips64
__system_property_serial; # arm64 x86_64 mips64
__system_property_set; # arm64 x86_64 mips64
__system_property_set_filename; # arm64 x86_64 mips64
__system_property_update; # arm64 x86_64 mips64
__system_property_wait_any; # arm64 x86_64 mips64
free_malloc_leak_info;
get_malloc_leak_info;
gMallocLeakZygoteChild;
} LIBC_N;

View File

@ -9,25 +9,18 @@ LIBC {
__b64_ntop;
__b64_pton;
__brk; # arm x86 mips
__cmpdf2; # arm
__cmsg_nxthdr;
__connect; # arm x86 mips
__ctype_get_mb_cur_max;
__cxa_atexit;
__cxa_finalize;
__cxa_thread_atexit_impl;
__divdf3; # arm
__divdi3; # arm x86 mips
__divsf3; # arm
__divsi3; # arm
__dn_comp;
__dn_count_labels;
__dn_skipname;
__epoll_pwait; # arm x86 mips
__eqdf2; # arm
__errno;
__exit; # arm x86 mips
__extendsfdf2; # arm
__fadvise64; # x86 mips
__fbufsize;
__fcntl64; # arm x86 mips
@ -35,18 +28,7 @@ LIBC {
__FD_ISSET_chk;
__FD_SET_chk;
__fgets_chk;
__fixdfsi; # arm
__fixsfsi; # arm
__fixunssfsi; # arm
__flbf;
__floatdidf; # arm
__floatdisf; # arm
__floatsidf; # arm
__floatsisf; # arm
__floatundidf; # arm
__floatundisf; # arm
__floatunsidf; # arm
__floatunsisf; # arm
__fp_nquery;
__fp_query;
__fpclassify;
@ -58,23 +40,14 @@ LIBC {
__freadable;
__fsetlocking;
__fstatfs64; # arm x86 mips
__futex_wait; # arm x86 mips
__futex_wake; # arm x86 mips
__fwritable;
__gedf2; # arm
__get_h_errno;
__get_thread; # arm x86 mips
__get_tls; # arm x86 mips
__getcpu; # arm x86 mips
__getcwd; # arm x86 mips
__getdents64; # arm x86 mips
__getpid; # arm x86 mips
__getpriority; # arm x86 mips
__gnu_basename;
__gnu_ldivmod_helper; # arm
__gnu_strerror_r;
__gnu_uldivmod_helper; # arm
__gtdf2; # arm
__hostalias;
__ioctl; # arm x86 mips
__isfinite;
@ -90,15 +63,12 @@ LIBC {
__isnormalf;
__isnormall;
__isthreaded;
__ledf2; # arm
__libc_current_sigrtmax;
__libc_current_sigrtmin;
__libc_init;
__llseek; # arm x86 mips
__loc_aton;
__loc_ntoa;
__lshrdi3; # arm
__ltdf2; # arm
__memchr_chk;
__memcpy_chk;
__memmove_chk;
@ -106,10 +76,6 @@ LIBC {
__memset_chk;
__mmap2; # arm x86 mips
__moddi3; # x86 mips
__muldf3; # arm
__muldi3; # arm
__mulsf3; # arm
__nedf2; # arm
__ns_format_ttl; # arm x86 mips
__ns_get16; # arm x86 mips
__ns_get32; # arm x86 mips
@ -132,7 +98,6 @@ LIBC {
__ns_skiprr; # arm x86 mips
__ns_sprintrr; # arm x86 mips
__ns_sprintrrf; # arm x86 mips
__open; # arm x86 mips
__open_2;
__openat; # arm x86 mips
__openat_2;
@ -149,11 +114,7 @@ LIBC {
__p_time;
__p_type;
__p_type_syms;
__page_shift; # arm x86 mips
__page_size; # arm x86 mips
__poll_chk;
__popcount_tab; # arm
__popcountsi2; # arm x86 mips
__ppoll; # arm x86 mips
__ppoll_chk;
__pread64_chk;
@ -162,7 +123,7 @@ LIBC {
__pselect6; # arm x86 mips
__pthread_cleanup_pop;
__pthread_cleanup_push;
__pthread_gettid; # arm x86 mips
__pthread_gettid; # arm x86 mips nobrillo
__ptrace; # arm x86 mips
__putlong;
__putshort;
@ -192,7 +153,6 @@ LIBC {
__res_send;
__res_send_setqhook;
__res_send_setrhook;
__restore_core_regs; # arm
__rt_sigaction; # arm x86 mips
__rt_sigpending; # arm x86 mips
__rt_sigprocmask; # arm x86 mips
@ -202,28 +162,15 @@ LIBC {
__sched_cpucount;
__sched_cpufree;
__sched_getaffinity; # arm x86 mips
__sclose; # arm x86 mips
__sdidinit; # arm x86 mips
__set_errno; # arm x86 mips
__set_thread_area; # x86
__set_tid_address; # arm x86 mips
__set_tls; # arm mips
__sF;
__sflags; # arm x86 mips
__sflush; # arm x86 mips
__sfp; # arm x86 mips
__sglue; # arm x86 mips
__sigaction; # arm x86 mips
__signalfd4; # arm x86 mips
__sinit; # arm x86 mips
__smakebuf; # arm x86 mips
__snprintf_chk;
__socket; # arm x86 mips
__sprintf_chk;
__sread; # arm x86 mips
__srefill; # arm x86 mips
__srget; # arm x86 mips
__sseek; # arm x86 mips
__stack_chk_fail;
__stack_chk_guard;
__statfs64; # arm x86 mips
@ -240,51 +187,39 @@ LIBC {
__strncpy_chk;
__strncpy_chk2;
__strrchr_chk;
__subdf3; # arm
__subsf3; # arm
__swbuf; # arm x86 mips
__swrite; # arm x86 mips
__swsetup; # arm x86 mips
__sym_ntop;
__sym_ntos;
__sym_ston;
__system_properties_init;
__system_property_add;
__system_property_area__;
__system_property_area_init;
__system_property_area_serial;
__system_property_find;
__system_property_find_nth;
__system_property_foreach;
__system_property_get;
__system_property_read;
__system_property_serial;
__system_property_set;
__system_property_set_filename;
__system_property_update;
__system_property_wait_any;
__system_properties_init; # arm x86 mips
__system_property_add; # arm x86 mips
__system_property_area__; # arm x86 mips
__system_property_area_init; # arm x86 mips
__system_property_area_serial; # arm x86 mips
__system_property_find; # arm x86 mips
__system_property_find_nth; # arm x86 mips
__system_property_foreach; # arm x86 mips
__system_property_get; # arm x86 mips
__system_property_read; # arm x86 mips
__system_property_serial; # arm x86 mips
__system_property_set; # arm x86 mips
__system_property_set_filename; # arm x86 mips
__system_property_update; # arm x86 mips
__system_property_wait_any; # arm x86 mips
__timer_create; # arm x86 mips
__timer_delete; # arm x86 mips
__timer_getoverrun; # arm x86 mips
__timer_gettime; # arm x86 mips
__timer_settime; # arm x86 mips
__truncdfsf2; # arm
__udivdi3; # arm x86 mips
__udivsi3; # arm
__udivdi3; # x86
__umask_chk;
__umoddi3; # x86 mips
__unorddf2; # arm
__unordsf2; # arm
__vsnprintf_chk;
__vsprintf_chk;
__wait4; # arm x86 mips
__waitid; # arm x86 mips
_ctype_;
_Exit;
_exit;
_flush_cache; # mips
_flushlbf;
_fwalk; # arm x86 mips
_getlong;
_getshort;
_longjmp;
@ -311,9 +246,7 @@ LIBC {
android_gethostbynamefornet;
android_set_abort_message;
arc4random;
arc4random_addrandom; # arm x86 mips
arc4random_buf;
arc4random_stir; # arm x86 mips
arc4random_uniform;
asctime;
asctime64; # arm x86 mips
@ -327,14 +260,11 @@ LIBC {
atoll;
basename;
basename_r; # arm x86 mips
bcopy; # arm x86 mips
bind;
bindresvport;
brk;
bsd_signal; # arm x86 mips
bsearch;
btowc;
bzero; # arm x86 mips
c16rtomb;
c32rtomb;
cacheflush; # arm mips
@ -387,7 +317,6 @@ LIBC {
dup3;
duplocale;
endmntent;
endpwent;
endservent;
endutent;
environ;
@ -434,7 +363,6 @@ LIBC {
fdatasync;
fdopen;
fdopendir;
fdprintf; # arm x86 mips
feof;
feof_unlocked;
ferror;
@ -466,7 +394,6 @@ LIBC {
fputws;
fread;
free;
free_malloc_leak_info;
freeaddrinfo;
freelocale;
fremovexattr;
@ -487,7 +414,6 @@ LIBC {
fsync;
ftell;
ftello;
ftime; # arm x86 mips
ftok;
ftruncate;
ftruncate64;
@ -508,7 +434,6 @@ LIBC {
fwscanf;
gai_strerror;
get_avphys_pages;
get_malloc_leak_info;
get_nprocs;
get_nprocs_conf;
get_phys_pages;
@ -520,8 +445,6 @@ LIBC {
getchar_unlocked;
getcwd;
getdelim;
getdents; # arm x86 mips
getdtablesize; # arm x86 mips
getegid;
getenv;
geteuid;
@ -596,7 +519,6 @@ LIBC {
if_nametoindex;
imaxabs;
imaxdiv;
index; # arm x86 mips
inet_addr;
inet_aton;
inet_lnaof;
@ -649,7 +571,6 @@ LIBC {
isprint_l;
ispunct;
ispunct_l;
issetugid; # arm x86 mips
isspace;
isspace_l;
isupper;
@ -739,7 +660,6 @@ LIBC {
mempcpy;
memrchr;
memset;
memswap; # arm x86 mips
mincore;
mkdir;
mkdirat;
@ -759,7 +679,6 @@ LIBC {
mktemp;
mktime;
mktime64; # arm x86 mips
mktime_tz;
mlock;
mlockall;
mmap;
@ -853,7 +772,6 @@ LIBC {
pthread_attr_getschedpolicy;
pthread_attr_getscope;
pthread_attr_getstack;
pthread_attr_getstackaddr; # arm x86 mips
pthread_attr_getstacksize;
pthread_attr_init;
pthread_attr_setdetachstate;
@ -862,7 +780,6 @@ LIBC {
pthread_attr_setschedpolicy;
pthread_attr_setscope;
pthread_attr_setstack;
pthread_attr_setstackaddr; # arm x86 mips
pthread_attr_setstacksize;
pthread_cond_broadcast;
pthread_cond_destroy;
@ -978,7 +895,6 @@ LIBC {
res_mkquery;
res_query;
res_search;
restore_core_regs; # arm
rewind;
rewinddir;
rmdir;
@ -1121,8 +1037,6 @@ LIBC {
strncpy;
strndup;
strnlen;
strntoimax; # arm x86 mips
strntoumax; # arm x86 mips
strpbrk;
strptime;
strrchr;
@ -1141,7 +1055,6 @@ LIBC {
strtoll;
strtoll_l;
strtoq;
strtotimeval; # arm x86 mips
strtoul;
strtoull;
strtoull_l;
@ -1163,7 +1076,6 @@ LIBC {
sysinfo;
syslog;
system;
sysv_signal; # arm x86 mips
tcdrain;
tcflow;
tcflush;
@ -1195,7 +1107,6 @@ LIBC {
timerfd_settime;
times;
timezone;
tkill; # arm x86 mips
tmpfile;
tmpnam;
toascii;
@ -1237,7 +1148,6 @@ LIBC {
vdprintf;
verr;
verrx;
vfdprintf; # arm x86 mips
vfork;
vfprintf;
vfscanf;
@ -1257,7 +1167,6 @@ LIBC {
vwprintf;
vwscanf;
wait;
wait3; # arm x86 mips
wait4;
waitid;
waitpid;
@ -1306,7 +1215,6 @@ LIBC {
wcstoull;
wcstoull_l;
wcstoumax;
wcswcs; # arm x86 mips
wcswidth;
wcsxfrm;
wcsxfrm_l;
@ -1331,17 +1239,46 @@ LIBC {
LIBC_N {
global:
__aeabi_atexit; # arm
__aeabi_memclr; # arm
__aeabi_memclr4; # arm
__aeabi_memclr8; # arm
__aeabi_memcpy; # arm
__aeabi_memcpy4; # arm
__aeabi_memcpy8; # arm
__aeabi_memmove; # arm
__aeabi_memmove4; # arm
__aeabi_memmove8; # arm
__aeabi_memset; # arm
__aeabi_memset4; # arm
__aeabi_memset8; # arm
__fread_chk;
__fwrite_chk;
__getcwd_chk;
__gnu_Unwind_Find_exidx; # arm
__pwrite_chk;
__pwrite64_chk;
__write_chk;
fileno_unlocked;
freeifaddrs;
getgrgid_r;
getgrnam_r;
getifaddrs;
preadv;
preadv64;
prlimit; # arm mips x86
pthread_barrierattr_destroy;
pthread_barrierattr_getpshared;
pthread_barrierattr_init;
pthread_barrierattr_setpshared;
pthread_barrier_destroy;
pthread_barrier_init;
pthread_barrier_wait;
pthread_spin_destroy;
pthread_spin_init;
pthread_spin_lock;
pthread_spin_trylock;
pthread_spin_unlock;
pwritev;
pwritev64;
scandirat;
@ -1425,8 +1362,33 @@ LIBC_PRIVATE {
__ashrdi3; # arm
__bionic_brk; # arm x86 mips
__bionic_libgcc_compat_symbols; # arm x86
__bionic_libgcc_unwind_symbols; # arm
__cmpdf2; # arm
__divdf3; # arm
__divdi3; # arm x86 mips
__divsf3; # arm
__divsi3; # arm
__dso_handle; # arm
__eqdf2; # arm
__extendsfdf2; # arm
__fixdfsi; # arm
__fixsfsi; # arm
__fixunssfsi; # arm
__floatdidf; # arm
__floatdisf; # arm
__floatsidf; # arm
__floatsisf; # arm
__floatundidf; # arm
__floatundisf; # arm
__floatunsidf; # arm
__floatunsisf; # arm
__futex_wait; # arm x86 mips nobrillo
__futex_wake; # arm x86 mips nobrillo
__gedf2; # arm
__get_thread; # arm x86 mips nobrillo
__get_tls; # arm x86 mips nobrillo
__getdents64; # arm x86 mips
__gnu_ldivmod_helper; # arm
__gnu_uldivmod_helper; # arm
__gnu_Unwind_Backtrace; # arm
__gnu_unwind_execute; # arm
__gnu_Unwind_Find_exidx; # arm
@ -1445,6 +1407,62 @@ LIBC_PRIVATE {
__gnu_Unwind_Save_VFP_D_16_to_31; # arm
__gnu_Unwind_Save_WMMXC; # arm
__gnu_Unwind_Save_WMMXD; # arm
__gtdf2; # arm
__ledf2; # arm
__lshrdi3; # arm
__ltdf2; # arm
__muldf3; # arm
__muldi3; # arm
__mulsf3; # arm
__nedf2; # arm
__open; # arm x86 mips nobrillo
__page_shift; # arm x86 mips nobrillo
__page_size; # arm x86 mips nobrillo
__popcount_tab; # arm
__popcountsi2; # arm x86 mips
__pthread_gettid; # arm x86 mips nobrillo
__restore_core_regs; # arm
__sclose; # arm x86 mips
__sdidinit; # arm x86 mips nobrillo
__set_errno; # arm x86 mips nobrillo
__sflags; # arm x86 mips
__sflush; # arm x86 mips
__sfp; # arm x86 mips
__sglue; # arm x86 mips
__sinit; # arm x86 mips nobrillo
__smakebuf; # arm x86 mips
__sread; # arm x86 mips
__srefill; # arm x86 mips
__srget; # arm x86 mips
__sseek; # arm x86 mips
__subdf3; # arm
__subsf3; # arm
__swbuf; # arm x86 mips
__swrite; # arm x86 mips
__swsetup; # arm x86 mips
__system_properties_init; # arm64 x86_64 mips64
__system_property_add; # arm64 x86_64 mips64
__system_property_area__; # arm64 x86_64 mips64
__system_property_area_init; # arm64 x86_64 mips64
__system_property_area_serial; # arm64 x86_64 mips64
__system_property_find; # arm64 x86_64 mips64
__system_property_find_nth; # arm64 x86_64 mips64
__system_property_foreach; # arm64 x86_64 mips64
__system_property_get; # arm64 x86_64 mips64
__system_property_read; # arm64 x86_64 mips64
__system_property_serial; # arm64 x86_64 mips64
__system_property_set; # arm64 x86_64 mips64
__system_property_set_filename; # arm64 x86_64 mips64
__system_property_update; # arm64 x86_64 mips64
__system_property_wait_any; # arm64 x86_64 mips64
__truncdfsf2; # arm
__udivdi3; # arm mips
__udivsi3; # arm
__umoddi3; # x86 mips
__unorddf2; # arm
__unordsf2; # arm
__wait4; # arm x86 mips nobrillo
_fwalk; # arm x86 mips
_Unwind_Backtrace; # arm
_Unwind_Complete; # arm
_Unwind_DeleteException; # arm
@ -1460,14 +1478,40 @@ LIBC_PRIVATE {
_Unwind_VRS_Get; # arm
_Unwind_VRS_Pop; # arm
_Unwind_VRS_Set; # arm
arc4random_addrandom; # arm x86 mips nobrillo
arc4random_stir; # arm x86 mips nobrillo
atexit; # arm
dlmalloc; # arm x86 mips
dlmalloc_inspect_all;
dlmalloc_trim;
dlmalloc_usable_size; # arm x86 mips
bcopy; # arm x86 mips nobrillo
bzero; # arm x86 mips nobrillo
bsd_signal; # arm x86 mips nobrillo
dlmalloc; # arm x86 mips nobrillo
dlmalloc_inspect_all; # arm x86 mips nobrillo
dlmalloc_trim; # arm x86 mips nobrillo
dlmalloc_usable_size; # arm x86 mips nobrillo
endpwent; # arm x86 mips nobrillo
fdprintf; # arm x86 mips nobrillo
free_malloc_leak_info;
ftime; # arm x86 mips nobrillo
get_malloc_leak_info;
getdents; # arm x86 mips nobrillo
getdtablesize; # arm x86 mips nobrillo
gMallocLeakZygoteChild;
index; # arm x86 mips nobrillo
issetugid; # arm x86 mips nobrillo
memswap; # arm x86 mips nobrillo
pthread_attr_getstackaddr; # arm x86 mips nobrillo
pthread_attr_setstackaddr; # arm x86 mips nobrillo
restore_core_regs; # arm
SHA1Final; # arm x86 mips
SHA1Init; # arm x86 mips
SHA1Transform; # arm x86 mips
SHA1Update; # arm x86 mips
strntoimax; # arm x86 mips nobrillo
strntoumax; # arm x86 mips nobrillo
strtotimeval; # arm x86 mips nobrillo
sysv_signal; # arm x86 mips nobrillo
tkill; # arm x86 mips nobrillo
vfdprintf; # arm x86 mips nobrillo
wait3; # arm x86 mips nobrillo
wcswcs; # arm x86 mips nobrillo
} LIBC_N;

1276
libc/libc.mips.brillo.map Normal file

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,6 @@ LIBC {
__cxa_atexit;
__cxa_finalize;
__cxa_thread_atexit_impl;
__divdi3; # arm x86 mips
__dn_comp;
__dn_count_labels;
__dn_skipname;
@ -38,15 +37,10 @@ LIBC {
__freadable;
__fsetlocking;
__fstatfs64; # arm x86 mips
__futex_wait; # arm x86 mips
__futex_wake; # arm x86 mips
__fwritable;
__get_h_errno;
__get_thread; # arm x86 mips
__get_tls; # arm x86 mips
__getcpu; # arm x86 mips
__getcwd; # arm x86 mips
__getdents64; # arm x86 mips
__getpid; # arm x86 mips
__getpriority; # arm x86 mips
__gnu_basename;
@ -101,7 +95,6 @@ LIBC {
__ns_skiprr; # arm x86 mips
__ns_sprintrr; # arm x86 mips
__ns_sprintrrf; # arm x86 mips
__open; # arm x86 mips
__open_2;
__openat; # arm x86 mips
__openat_2;
@ -118,10 +111,7 @@ LIBC {
__p_time;
__p_type;
__p_type_syms;
__page_shift; # arm x86 mips
__page_size; # arm x86 mips
__poll_chk;
__popcountsi2; # arm x86 mips
__ppoll; # arm x86 mips
__ppoll_chk;
__pread64_chk;
@ -130,7 +120,7 @@ LIBC {
__pselect6; # arm x86 mips
__pthread_cleanup_pop;
__pthread_cleanup_push;
__pthread_gettid; # arm x86 mips
__pthread_gettid; # arm x86 mips nobrillo
__ptrace; # arm x86 mips
__putlong;
__putshort;
@ -169,27 +159,14 @@ LIBC {
__sched_cpucount;
__sched_cpufree;
__sched_getaffinity; # arm x86 mips
__sclose; # arm x86 mips
__sdidinit; # arm x86 mips
__set_errno; # arm x86 mips
__set_tid_address; # arm x86 mips
__set_tls; # arm mips
__sF;
__sflags; # arm x86 mips
__sflush; # arm x86 mips
__sfp; # arm x86 mips
__sglue; # arm x86 mips
__sigaction; # arm x86 mips
__signalfd4; # arm x86 mips
__sinit; # arm x86 mips
__smakebuf; # arm x86 mips
__snprintf_chk;
__socket; # arm x86 mips
__sprintf_chk;
__sread; # arm x86 mips
__srefill; # arm x86 mips
__srget; # arm x86 mips
__sseek; # arm x86 mips
__stack_chk_fail;
__stack_chk_guard;
__statfs64; # arm x86 mips
@ -206,45 +183,38 @@ LIBC {
__strncpy_chk;
__strncpy_chk2;
__strrchr_chk;
__swbuf; # arm x86 mips
__swrite; # arm x86 mips
__swsetup; # arm x86 mips
__sym_ntop;
__sym_ntos;
__sym_ston;
__system_properties_init;
__system_property_add;
__system_property_area__;
__system_property_area_init;
__system_property_area_serial;
__system_property_find;
__system_property_find_nth;
__system_property_foreach;
__system_property_get;
__system_property_read;
__system_property_serial;
__system_property_set;
__system_property_set_filename;
__system_property_update;
__system_property_wait_any;
__system_properties_init; # arm x86 mips
__system_property_add; # arm x86 mips
__system_property_area__; # arm x86 mips
__system_property_area_init; # arm x86 mips
__system_property_area_serial; # arm x86 mips
__system_property_find; # arm x86 mips
__system_property_find_nth; # arm x86 mips
__system_property_foreach; # arm x86 mips
__system_property_get; # arm x86 mips
__system_property_read; # arm x86 mips
__system_property_serial; # arm x86 mips
__system_property_set; # arm x86 mips
__system_property_set_filename; # arm x86 mips
__system_property_update; # arm x86 mips
__system_property_wait_any; # arm x86 mips
__timer_create; # arm x86 mips
__timer_delete; # arm x86 mips
__timer_getoverrun; # arm x86 mips
__timer_gettime; # arm x86 mips
__timer_settime; # arm x86 mips
__udivdi3; # arm x86 mips
__umask_chk;
__umoddi3; # x86 mips
__vsnprintf_chk;
__vsprintf_chk;
__wait4; # arm x86 mips
__waitid; # arm x86 mips
_ctype_;
_Exit;
_exit;
_flush_cache; # mips
_flushlbf;
_fwalk; # arm x86 mips
_getlong;
_getshort;
_longjmp;
@ -271,9 +241,7 @@ LIBC {
android_gethostbynamefornet;
android_set_abort_message;
arc4random;
arc4random_addrandom; # arm x86 mips
arc4random_buf;
arc4random_stir; # arm x86 mips
arc4random_uniform;
asctime;
asctime64; # arm x86 mips
@ -287,14 +255,11 @@ LIBC {
atoll;
basename;
basename_r; # arm x86 mips
bcopy; # arm x86 mips
bind;
bindresvport;
brk;
bsd_signal; # arm x86 mips
bsearch;
btowc;
bzero; # arm x86 mips
c16rtomb;
c32rtomb;
cacheflush; # arm mips
@ -347,7 +312,6 @@ LIBC {
dup3;
duplocale;
endmntent;
endpwent;
endservent;
endutent;
environ;
@ -394,7 +358,6 @@ LIBC {
fdatasync;
fdopen;
fdopendir;
fdprintf; # arm x86 mips
feof;
feof_unlocked;
ferror;
@ -426,7 +389,6 @@ LIBC {
fputws;
fread;
free;
free_malloc_leak_info;
freeaddrinfo;
freelocale;
fremovexattr;
@ -447,7 +409,6 @@ LIBC {
fsync;
ftell;
ftello;
ftime; # arm x86 mips
ftok;
ftruncate;
ftruncate64;
@ -468,7 +429,6 @@ LIBC {
fwscanf;
gai_strerror;
get_avphys_pages;
get_malloc_leak_info;
get_nprocs;
get_nprocs_conf;
get_phys_pages;
@ -480,8 +440,6 @@ LIBC {
getchar_unlocked;
getcwd;
getdelim;
getdents; # arm x86 mips
getdtablesize; # arm x86 mips
getegid;
getenv;
geteuid;
@ -556,7 +514,6 @@ LIBC {
if_nametoindex;
imaxabs;
imaxdiv;
index; # arm x86 mips
inet_addr;
inet_aton;
inet_lnaof;
@ -609,7 +566,6 @@ LIBC {
isprint_l;
ispunct;
ispunct_l;
issetugid; # arm x86 mips
isspace;
isspace_l;
isupper;
@ -699,7 +655,6 @@ LIBC {
mempcpy;
memrchr;
memset;
memswap; # arm x86 mips
mincore;
mkdir;
mkdirat;
@ -719,7 +674,6 @@ LIBC {
mktemp;
mktime;
mktime64; # arm x86 mips
mktime_tz;
mlock;
mlockall;
mmap;
@ -790,7 +744,6 @@ LIBC {
pthread_attr_getschedpolicy;
pthread_attr_getscope;
pthread_attr_getstack;
pthread_attr_getstackaddr; # arm x86 mips
pthread_attr_getstacksize;
pthread_attr_init;
pthread_attr_setdetachstate;
@ -799,7 +752,6 @@ LIBC {
pthread_attr_setschedpolicy;
pthread_attr_setscope;
pthread_attr_setstack;
pthread_attr_setstackaddr; # arm x86 mips
pthread_attr_setstacksize;
pthread_cond_broadcast;
pthread_cond_destroy;
@ -1057,8 +1009,6 @@ LIBC {
strncpy;
strndup;
strnlen;
strntoimax; # arm x86 mips
strntoumax; # arm x86 mips
strpbrk;
strptime;
strrchr;
@ -1077,7 +1027,6 @@ LIBC {
strtoll;
strtoll_l;
strtoq;
strtotimeval; # arm x86 mips
strtoul;
strtoull;
strtoull_l;
@ -1099,7 +1048,6 @@ LIBC {
sysinfo;
syslog;
system;
sysv_signal; # arm x86 mips
tcdrain;
tcflow;
tcflush;
@ -1131,7 +1079,6 @@ LIBC {
timerfd_settime;
times;
timezone;
tkill; # arm x86 mips
tmpfile;
tmpnam;
toascii;
@ -1173,7 +1120,6 @@ LIBC {
vdprintf;
verr;
verrx;
vfdprintf; # arm x86 mips
vfork;
vfprintf;
vfscanf;
@ -1193,7 +1139,6 @@ LIBC {
vwprintf;
vwscanf;
wait;
wait3; # arm x86 mips
wait4;
waitid;
waitpid;
@ -1242,7 +1187,6 @@ LIBC {
wcstoull;
wcstoull_l;
wcstoumax;
wcswcs; # arm x86 mips
wcswidth;
wcsxfrm;
wcsxfrm_l;
@ -1273,11 +1217,26 @@ LIBC_N {
__pwrite_chk;
__pwrite64_chk;
__write_chk;
fileno_unlocked;
freeifaddrs;
getgrgid_r;
getgrnam_r;
getifaddrs;
preadv;
preadv64;
prlimit; # arm mips x86
pthread_barrierattr_destroy;
pthread_barrierattr_getpshared;
pthread_barrierattr_init;
pthread_barrierattr_setpshared;
pthread_barrier_destroy;
pthread_barrier_init;
pthread_barrier_wait;
pthread_spin_destroy;
pthread_spin_init;
pthread_spin_lock;
pthread_spin_trylock;
pthread_spin_unlock;
pwritev;
pwritev64;
scandirat;
@ -1289,13 +1248,69 @@ LIBC_PRIVATE {
global:
__accept4; # arm x86 mips
__bionic_brk; # arm x86 mips
dlmalloc; # arm x86 mips
dlmalloc_inspect_all;
dlmalloc_trim;
dlmalloc_usable_size; # arm x86 mips
__divdi3; # arm x86 mips
__futex_wait; # arm x86 mips nobrillo
__futex_wake; # arm x86 mips nobrillo
__get_thread; # arm x86 mips nobrillo
__get_tls; # arm x86 mips nobrillo
__getdents64; # arm x86 mips
__open; # arm x86 mips nobrillo
__page_shift; # arm x86 mips nobrillo
__page_size; # arm x86 mips nobrillo
__popcountsi2; # arm x86 mips
__pthread_gettid; # arm x86 mips nobrillo
__sclose; # arm x86 mips
__sdidinit; # arm x86 mips nobrillo
__set_errno; # arm x86 mips nobrillo
__sflags; # arm x86 mips
__sflush; # arm x86 mips
__sfp; # arm x86 mips
__sglue; # arm x86 mips
__sinit; # arm x86 mips nobrillo
__smakebuf; # arm x86 mips
__sread; # arm x86 mips
__srefill; # arm x86 mips
__srget; # arm x86 mips
__sseek; # arm x86 mips
__swbuf; # arm x86 mips
__swrite; # arm x86 mips
__swsetup; # arm x86 mips
__udivdi3; # arm mips
__umoddi3; # x86 mips
__wait4; # arm x86 mips nobrillo
_fwalk; # arm x86 mips
arc4random_addrandom; # arm x86 mips nobrillo
arc4random_stir; # arm x86 mips nobrillo
bcopy; # arm x86 mips nobrillo
bzero; # arm x86 mips nobrillo
bsd_signal; # arm x86 mips nobrillo
dlmalloc; # arm x86 mips nobrillo
dlmalloc_inspect_all; # arm x86 mips nobrillo
dlmalloc_trim; # arm x86 mips nobrillo
dlmalloc_usable_size; # arm x86 mips nobrillo
endpwent; # arm x86 mips nobrillo
fdprintf; # arm x86 mips nobrillo
free_malloc_leak_info;
ftime; # arm x86 mips nobrillo
get_malloc_leak_info;
getdents; # arm x86 mips nobrillo
getdtablesize; # arm x86 mips nobrillo
gMallocLeakZygoteChild;
index; # arm x86 mips nobrillo
issetugid; # arm x86 mips nobrillo
memswap; # arm x86 mips nobrillo
pthread_attr_getstackaddr; # arm x86 mips nobrillo
pthread_attr_setstackaddr; # arm x86 mips nobrillo
SHA1Final; # arm x86 mips
SHA1Init; # arm x86 mips
SHA1Transform; # arm x86 mips
SHA1Update; # arm x86 mips
strntoimax; # arm x86 mips nobrillo
strntoumax; # arm x86 mips nobrillo
strtotimeval; # arm x86 mips nobrillo
sysv_signal; # arm x86 mips nobrillo
tkill; # arm x86 mips nobrillo
vfdprintf; # arm x86 mips nobrillo
wait3; # arm x86 mips nobrillo
wcswcs; # arm x86 mips nobrillo
} LIBC_N;

View File

@ -131,21 +131,6 @@ LIBC {
__sym_ntop;
__sym_ntos;
__sym_ston;
__system_properties_init;
__system_property_add;
__system_property_area__;
__system_property_area_init;
__system_property_area_serial;
__system_property_find;
__system_property_find_nth;
__system_property_foreach;
__system_property_get;
__system_property_read;
__system_property_serial;
__system_property_set;
__system_property_set_filename;
__system_property_update;
__system_property_wait_any;
__umask_chk;
__vsnprintf_chk;
__vsprintf_chk;
@ -241,7 +226,6 @@ LIBC {
dup3;
duplocale;
endmntent;
endpwent;
endservent;
endutent;
environ;
@ -317,7 +301,6 @@ LIBC {
fputws;
fread;
free;
free_malloc_leak_info;
freeaddrinfo;
freelocale;
fremovexattr;
@ -358,7 +341,6 @@ LIBC {
fwscanf;
gai_strerror;
get_avphys_pages;
get_malloc_leak_info;
get_nprocs;
get_nprocs_conf;
get_phys_pages;
@ -599,7 +581,6 @@ LIBC {
mkstemps64;
mktemp;
mktime;
mktime_tz;
mlock;
mlockall;
mmap;
@ -1156,10 +1137,25 @@ LIBC_N {
__pwrite_chk;
__pwrite64_chk;
__write_chk;
fileno_unlocked;
freeifaddrs;
getgrgid_r;
getgrnam_r;
getifaddrs;
preadv;
preadv64;
pthread_barrierattr_destroy;
pthread_barrierattr_getpshared;
pthread_barrierattr_init;
pthread_barrierattr_setpshared;
pthread_barrier_destroy;
pthread_barrier_init;
pthread_barrier_wait;
pthread_spin_destroy;
pthread_spin_init;
pthread_spin_lock;
pthread_spin_trylock;
pthread_spin_unlock;
pwritev;
pwritev64;
scandirat;
@ -1169,7 +1165,22 @@ LIBC_N {
LIBC_PRIVATE {
global:
dlmalloc_inspect_all;
dlmalloc_trim;
__system_properties_init; # arm64 x86_64 mips64
__system_property_add; # arm64 x86_64 mips64
__system_property_area__; # arm64 x86_64 mips64
__system_property_area_init; # arm64 x86_64 mips64
__system_property_area_serial; # arm64 x86_64 mips64
__system_property_find; # arm64 x86_64 mips64
__system_property_find_nth; # arm64 x86_64 mips64
__system_property_foreach; # arm64 x86_64 mips64
__system_property_get; # arm64 x86_64 mips64
__system_property_read; # arm64 x86_64 mips64
__system_property_serial; # arm64 x86_64 mips64
__system_property_set; # arm64 x86_64 mips64
__system_property_set_filename; # arm64 x86_64 mips64
__system_property_update; # arm64 x86_64 mips64
__system_property_wait_any; # arm64 x86_64 mips64
free_malloc_leak_info;
get_malloc_leak_info;
gMallocLeakZygoteChild;
} LIBC_N;

1275
libc/libc.x86.brillo.map Normal file

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,6 @@ LIBC {
__cxa_atexit;
__cxa_finalize;
__cxa_thread_atexit_impl;
__divdi3; # arm x86 mips
__dn_comp;
__dn_count_labels;
__dn_skipname;
@ -38,15 +37,10 @@ LIBC {
__freadable;
__fsetlocking;
__fstatfs64; # arm x86 mips
__futex_wait; # arm x86 mips
__futex_wake; # arm x86 mips
__fwritable;
__get_h_errno;
__get_thread; # arm x86 mips
__get_tls; # arm x86 mips
__getcpu; # arm x86 mips
__getcwd; # arm x86 mips
__getdents64; # arm x86 mips
__getpid; # arm x86 mips
__getpriority; # arm x86 mips
__gnu_basename;
@ -101,7 +95,6 @@ LIBC {
__ns_skiprr; # arm x86 mips
__ns_sprintrr; # arm x86 mips
__ns_sprintrrf; # arm x86 mips
__open; # arm x86 mips
__open_2;
__openat; # arm x86 mips
__openat_2;
@ -118,10 +111,7 @@ LIBC {
__p_time;
__p_type;
__p_type_syms;
__page_shift; # arm x86 mips
__page_size; # arm x86 mips
__poll_chk;
__popcountsi2; # arm x86 mips
__ppoll; # arm x86 mips
__ppoll_chk;
__pread64_chk;
@ -130,7 +120,7 @@ LIBC {
__pselect6; # arm x86 mips
__pthread_cleanup_pop;
__pthread_cleanup_push;
__pthread_gettid; # arm x86 mips
__pthread_gettid; # arm x86 mips nobrillo
__ptrace; # arm x86 mips
__putlong;
__putshort;
@ -169,27 +159,14 @@ LIBC {
__sched_cpucount;
__sched_cpufree;
__sched_getaffinity; # arm x86 mips
__sclose; # arm x86 mips
__sdidinit; # arm x86 mips
__set_errno; # arm x86 mips
__set_thread_area; # x86
__set_tid_address; # arm x86 mips
__sF;
__sflags; # arm x86 mips
__sflush; # arm x86 mips
__sfp; # arm x86 mips
__sglue; # arm x86 mips
__sigaction; # arm x86 mips
__signalfd4; # arm x86 mips
__sinit; # arm x86 mips
__smakebuf; # arm x86 mips
__snprintf_chk;
__socket; # arm x86 mips
__sprintf_chk;
__sread; # arm x86 mips
__srefill; # arm x86 mips
__srget; # arm x86 mips
__sseek; # arm x86 mips
__stack_chk_fail;
__stack_chk_guard;
__statfs64; # arm x86 mips
@ -206,44 +183,38 @@ LIBC {
__strncpy_chk;
__strncpy_chk2;
__strrchr_chk;
__swbuf; # arm x86 mips
__swrite; # arm x86 mips
__swsetup; # arm x86 mips
__sym_ntop;
__sym_ntos;
__sym_ston;
__system_properties_init;
__system_property_add;
__system_property_area__;
__system_property_area_init;
__system_property_area_serial;
__system_property_find;
__system_property_find_nth;
__system_property_foreach;
__system_property_get;
__system_property_read;
__system_property_serial;
__system_property_set;
__system_property_set_filename;
__system_property_update;
__system_property_wait_any;
__system_properties_init; # arm x86 mips
__system_property_add; # arm x86 mips
__system_property_area__; # arm x86 mips
__system_property_area_init; # arm x86 mips
__system_property_area_serial; # arm x86 mips
__system_property_find; # arm x86 mips
__system_property_find_nth; # arm x86 mips
__system_property_foreach; # arm x86 mips
__system_property_get; # arm x86 mips
__system_property_read; # arm x86 mips
__system_property_serial; # arm x86 mips
__system_property_set; # arm x86 mips
__system_property_set_filename; # arm x86 mips
__system_property_update; # arm x86 mips
__system_property_wait_any; # arm x86 mips
__timer_create; # arm x86 mips
__timer_delete; # arm x86 mips
__timer_getoverrun; # arm x86 mips
__timer_gettime; # arm x86 mips
__timer_settime; # arm x86 mips
__udivdi3; # arm x86 mips
__udivdi3; # x86
__umask_chk;
__umoddi3; # x86 mips
__vsnprintf_chk;
__vsprintf_chk;
__wait4; # arm x86 mips
__waitid; # arm x86 mips
_ctype_;
_Exit;
_exit;
_flushlbf;
_fwalk; # arm x86 mips
_getlong;
_getshort;
_longjmp;
@ -270,9 +241,7 @@ LIBC {
android_gethostbynamefornet;
android_set_abort_message;
arc4random;
arc4random_addrandom; # arm x86 mips
arc4random_buf;
arc4random_stir; # arm x86 mips
arc4random_uniform;
asctime;
asctime64; # arm x86 mips
@ -286,14 +255,11 @@ LIBC {
atoll;
basename;
basename_r; # arm x86 mips
bcopy; # arm x86 mips
bind;
bindresvport;
brk;
bsd_signal; # arm x86 mips
bsearch;
btowc;
bzero; # arm x86 mips
c16rtomb;
c32rtomb;
calloc;
@ -345,7 +311,6 @@ LIBC {
dup3;
duplocale;
endmntent;
endpwent;
endservent;
endutent;
environ;
@ -392,7 +357,6 @@ LIBC {
fdatasync;
fdopen;
fdopendir;
fdprintf; # arm x86 mips
feof;
feof_unlocked;
ferror;
@ -424,7 +388,6 @@ LIBC {
fputws;
fread;
free;
free_malloc_leak_info;
freeaddrinfo;
freelocale;
fremovexattr;
@ -445,7 +408,6 @@ LIBC {
fsync;
ftell;
ftello;
ftime; # arm x86 mips
ftok;
ftruncate;
ftruncate64;
@ -466,7 +428,6 @@ LIBC {
fwscanf;
gai_strerror;
get_avphys_pages;
get_malloc_leak_info;
get_nprocs;
get_nprocs_conf;
get_phys_pages;
@ -478,8 +439,6 @@ LIBC {
getchar_unlocked;
getcwd;
getdelim;
getdents; # arm x86 mips
getdtablesize; # arm x86 mips
getegid;
getenv;
geteuid;
@ -554,7 +513,6 @@ LIBC {
if_nametoindex;
imaxabs;
imaxdiv;
index; # arm x86 mips
inet_addr;
inet_aton;
inet_lnaof;
@ -607,7 +565,6 @@ LIBC {
isprint_l;
ispunct;
ispunct_l;
issetugid; # arm x86 mips
isspace;
isspace_l;
isupper;
@ -697,7 +654,6 @@ LIBC {
mempcpy;
memrchr;
memset;
memswap; # arm x86 mips
mincore;
mkdir;
mkdirat;
@ -717,7 +673,6 @@ LIBC {
mktemp;
mktime;
mktime64; # arm x86 mips
mktime_tz;
mlock;
mlockall;
mmap;
@ -788,7 +743,6 @@ LIBC {
pthread_attr_getschedpolicy;
pthread_attr_getscope;
pthread_attr_getstack;
pthread_attr_getstackaddr; # arm x86 mips
pthread_attr_getstacksize;
pthread_attr_init;
pthread_attr_setdetachstate;
@ -797,7 +751,6 @@ LIBC {
pthread_attr_setschedpolicy;
pthread_attr_setscope;
pthread_attr_setstack;
pthread_attr_setstackaddr; # arm x86 mips
pthread_attr_setstacksize;
pthread_cond_broadcast;
pthread_cond_destroy;
@ -1055,8 +1008,6 @@ LIBC {
strncpy;
strndup;
strnlen;
strntoimax; # arm x86 mips
strntoumax; # arm x86 mips
strpbrk;
strptime;
strrchr;
@ -1075,7 +1026,6 @@ LIBC {
strtoll;
strtoll_l;
strtoq;
strtotimeval; # arm x86 mips
strtoul;
strtoull;
strtoull_l;
@ -1097,7 +1047,6 @@ LIBC {
sysinfo;
syslog;
system;
sysv_signal; # arm x86 mips
tcdrain;
tcflow;
tcflush;
@ -1129,7 +1078,6 @@ LIBC {
timerfd_settime;
times;
timezone;
tkill; # arm x86 mips
tmpfile;
tmpnam;
toascii;
@ -1171,7 +1119,6 @@ LIBC {
vdprintf;
verr;
verrx;
vfdprintf; # arm x86 mips
vfork;
vfprintf;
vfscanf;
@ -1191,7 +1138,6 @@ LIBC {
vwprintf;
vwscanf;
wait;
wait3; # arm x86 mips
wait4;
waitid;
waitpid;
@ -1240,7 +1186,6 @@ LIBC {
wcstoull;
wcstoull_l;
wcstoumax;
wcswcs; # arm x86 mips
wcswidth;
wcsxfrm;
wcsxfrm_l;
@ -1271,11 +1216,26 @@ LIBC_N {
__pwrite_chk;
__pwrite64_chk;
__write_chk;
fileno_unlocked;
freeifaddrs;
getgrgid_r;
getgrnam_r;
getifaddrs;
preadv;
preadv64;
prlimit; # arm mips x86
pthread_barrierattr_destroy;
pthread_barrierattr_getpshared;
pthread_barrierattr_init;
pthread_barrierattr_setpshared;
pthread_barrier_destroy;
pthread_barrier_init;
pthread_barrier_wait;
pthread_spin_destroy;
pthread_spin_init;
pthread_spin_lock;
pthread_spin_trylock;
pthread_spin_unlock;
pwritev;
pwritev64;
scandirat;
@ -1288,13 +1248,68 @@ LIBC_PRIVATE {
__accept4; # arm x86 mips
__bionic_brk; # arm x86 mips
__bionic_libgcc_compat_symbols; # arm x86
dlmalloc; # arm x86 mips
dlmalloc_inspect_all;
dlmalloc_trim;
dlmalloc_usable_size; # arm x86 mips
__divdi3; # arm x86 mips
__futex_wait; # arm x86 mips nobrillo
__futex_wake; # arm x86 mips nobrillo
__get_thread; # arm x86 mips nobrillo
__get_tls; # arm x86 mips nobrillo
__getdents64; # arm x86 mips
__open; # arm x86 mips nobrillo
__page_shift; # arm x86 mips nobrillo
__page_size; # arm x86 mips nobrillo
__popcountsi2; # arm x86 mips
__pthread_gettid; # arm x86 mips nobrillo
__sclose; # arm x86 mips
__sdidinit; # arm x86 mips nobrillo
__set_errno; # arm x86 mips nobrillo
__sflags; # arm x86 mips
__sflush; # arm x86 mips
__sfp; # arm x86 mips
__sglue; # arm x86 mips
__sinit; # arm x86 mips nobrillo
__smakebuf; # arm x86 mips
__sread; # arm x86 mips
__srefill; # arm x86 mips
__srget; # arm x86 mips
__sseek; # arm x86 mips
__swbuf; # arm x86 mips
__swrite; # arm x86 mips
__swsetup; # arm x86 mips
__umoddi3; # x86 mips
__wait4; # arm x86 mips nobrillo
_fwalk; # arm x86 mips
arc4random_addrandom; # arm x86 mips nobrillo
arc4random_stir; # arm x86 mips nobrillo
bcopy; # arm x86 mips nobrillo
bzero; # arm x86 mips nobrillo
bsd_signal; # arm x86 mips nobrillo
dlmalloc; # arm x86 mips nobrillo
dlmalloc_inspect_all; # arm x86 mips nobrillo
dlmalloc_trim; # arm x86 mips nobrillo
dlmalloc_usable_size; # arm x86 mips nobrillo
endpwent; # arm x86 mips nobrillo
fdprintf; # arm x86 mips nobrillo
free_malloc_leak_info;
ftime; # arm x86 mips nobrillo
get_malloc_leak_info;
getdents; # arm x86 mips nobrillo
getdtablesize; # arm x86 mips nobrillo
gMallocLeakZygoteChild;
index; # arm x86 mips nobrillo
issetugid; # arm x86 mips nobrillo
memswap; # arm x86 mips nobrillo
pthread_attr_getstackaddr; # arm x86 mips nobrillo
pthread_attr_setstackaddr; # arm x86 mips nobrillo
SHA1Final; # arm x86 mips
SHA1Init; # arm x86 mips
SHA1Transform; # arm x86 mips
SHA1Update; # arm x86 mips
strntoimax; # arm x86 mips nobrillo
strntoumax; # arm x86 mips nobrillo
strtotimeval; # arm x86 mips nobrillo
sysv_signal; # arm x86 mips nobrillo
tkill; # arm x86 mips nobrillo
vfdprintf; # arm x86 mips nobrillo
wait3; # arm x86 mips nobrillo
wcswcs; # arm x86 mips nobrillo
} LIBC_N;

View File

@ -131,21 +131,6 @@ LIBC {
__sym_ntop;
__sym_ntos;
__sym_ston;
__system_properties_init;
__system_property_add;
__system_property_area__;
__system_property_area_init;
__system_property_area_serial;
__system_property_find;
__system_property_find_nth;
__system_property_foreach;
__system_property_get;
__system_property_read;
__system_property_serial;
__system_property_set;
__system_property_set_filename;
__system_property_update;
__system_property_wait_any;
__umask_chk;
__vsnprintf_chk;
__vsprintf_chk;
@ -241,7 +226,6 @@ LIBC {
dup3;
duplocale;
endmntent;
endpwent;
endservent;
endutent;
environ;
@ -317,7 +301,6 @@ LIBC {
fputws;
fread;
free;
free_malloc_leak_info;
freeaddrinfo;
freelocale;
fremovexattr;
@ -358,7 +341,6 @@ LIBC {
fwscanf;
gai_strerror;
get_avphys_pages;
get_malloc_leak_info;
get_nprocs;
get_nprocs_conf;
get_phys_pages;
@ -599,7 +581,6 @@ LIBC {
mkstemps64;
mktemp;
mktime;
mktime_tz;
mlock;
mlockall;
mmap;
@ -1156,10 +1137,25 @@ LIBC_N {
__pwrite_chk;
__pwrite64_chk;
__write_chk;
fileno_unlocked;
freeifaddrs;
getgrgid_r;
getgrnam_r;
getifaddrs;
preadv;
preadv64;
pthread_barrierattr_destroy;
pthread_barrierattr_getpshared;
pthread_barrierattr_init;
pthread_barrierattr_setpshared;
pthread_barrier_destroy;
pthread_barrier_init;
pthread_barrier_wait;
pthread_spin_destroy;
pthread_spin_init;
pthread_spin_lock;
pthread_spin_trylock;
pthread_spin_unlock;
pwritev;
pwritev64;
scandirat;
@ -1169,7 +1165,22 @@ LIBC_N {
LIBC_PRIVATE {
global:
dlmalloc_inspect_all;
dlmalloc_trim;
__system_properties_init; # arm64 x86_64 mips64
__system_property_add; # arm64 x86_64 mips64
__system_property_area__; # arm64 x86_64 mips64
__system_property_area_init; # arm64 x86_64 mips64
__system_property_area_serial; # arm64 x86_64 mips64
__system_property_find; # arm64 x86_64 mips64
__system_property_find_nth; # arm64 x86_64 mips64
__system_property_foreach; # arm64 x86_64 mips64
__system_property_get; # arm64 x86_64 mips64
__system_property_read; # arm64 x86_64 mips64
__system_property_serial; # arm64 x86_64 mips64
__system_property_set; # arm64 x86_64 mips64
__system_property_set_filename; # arm64 x86_64 mips64
__system_property_update; # arm64 x86_64 mips64
__system_property_wait_any; # arm64 x86_64 mips64
free_malloc_leak_info;
get_malloc_leak_info;
gMallocLeakZygoteChild;
} LIBC_N;

View File

@ -38,32 +38,25 @@ class KernelArgumentBlock {
argv = reinterpret_cast<char**>(args + 1);
envp = argv + argc + 1;
// Skip over all environment variable definitions to find aux vector.
// The end of the environment block is marked by two NULL pointers.
// Skip over all environment variable definitions to find the aux vector.
// The end of the environment block is marked by a NULL pointer.
char** p = envp;
while (*p != NULL) {
++p;
}
++p; // Skip second NULL;
++p; // Skip the NULL itself.
auxv = reinterpret_cast<ElfW(auxv_t)*>(p);
}
// Similar to ::getauxval but doesn't require the libc global variables to be set up,
// so it's safe to call this really early on. This function also lets you distinguish
// between the inability to find the given type and its value just happening to be 0.
unsigned long getauxval(unsigned long type, bool* found_match = NULL) {
// so it's safe to call this really early on.
unsigned long getauxval(unsigned long type) {
for (ElfW(auxv_t)* v = auxv; v->a_type != AT_NULL; ++v) {
if (v->a_type == type) {
if (found_match != NULL) {
*found_match = true;
}
return v->a_un.a_val;
}
}
if (found_match != NULL) {
*found_match = false;
}
return 0;
}

View File

@ -34,7 +34,7 @@ class ScopedPthreadMutexLocker {
private:
pthread_mutex_t* mu_;
DISALLOW_COPY_AND_ASSIGN(ScopedPthreadMutexLocker);
DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedPthreadMutexLocker);
};
#endif // SCOPED_PTHREAD_MUTEX_LOCKER_H

View File

@ -40,10 +40,12 @@ __BEGIN_DECLS
struct timespec;
static inline __always_inline int __futex(volatile void* ftx, int op, int value, const struct timespec* timeout) {
static inline __always_inline int __futex(volatile void* ftx, int op, int value,
const struct timespec* timeout,
int bitset) {
// Our generated syscall assembler sets errno, but our callers (pthread functions) don't want to.
int saved_errno = errno;
int result = syscall(__NR_futex, ftx, op, value, timeout);
int result = syscall(__NR_futex, ftx, op, value, timeout, NULL, bitset);
if (__predict_false(result == -1)) {
result = -errno;
errno = saved_errno;
@ -52,19 +54,22 @@ static inline __always_inline int __futex(volatile void* ftx, int op, int value,
}
static inline int __futex_wake(volatile void* ftx, int count) {
return __futex(ftx, FUTEX_WAKE, count, NULL);
return __futex(ftx, FUTEX_WAKE, count, NULL, 0);
}
static inline int __futex_wake_ex(volatile void* ftx, bool shared, int count) {
return __futex(ftx, shared ? FUTEX_WAKE : FUTEX_WAKE_PRIVATE, count, NULL);
return __futex(ftx, shared ? FUTEX_WAKE : FUTEX_WAKE_PRIVATE, count, NULL, 0);
}
static inline int __futex_wait(volatile void* ftx, int value, const struct timespec* timeout) {
return __futex(ftx, FUTEX_WAIT, value, timeout);
return __futex(ftx, FUTEX_WAIT, value, timeout, 0);
}
static inline int __futex_wait_ex(volatile void* ftx, bool shared, int value, const struct timespec* timeout) {
return __futex(ftx, shared ? FUTEX_WAIT : FUTEX_WAIT_PRIVATE, value, timeout);
static inline int __futex_wait_ex(volatile void* ftx, bool shared, int value,
bool use_realtime_clock, const struct timespec* abs_timeout) {
return __futex(ftx, (shared ? FUTEX_WAIT_BITSET : FUTEX_WAIT_BITSET_PRIVATE) |
(use_realtime_clock ? FUTEX_CLOCK_REALTIME : 0), value, abs_timeout,
FUTEX_BITSET_MATCH_ANY);
}
__END_DECLS

View File

@ -30,6 +30,7 @@
#include <stdatomic.h>
#include "private/bionic_futex.h"
#include "private/bionic_macros.h"
// Lock is used in places like pthread_rwlock_t, which can be initialized without calling
// an initialization function. So make sure Lock can be initialized by setting its memory to 0.
@ -49,6 +50,12 @@ class Lock {
this->process_shared = process_shared;
}
bool trylock() {
LockState old_state = Unlocked;
return __predict_true(atomic_compare_exchange_strong_explicit(&state, &old_state,
LockedWithoutWaiter, memory_order_acquire, memory_order_relaxed));
}
void lock() {
LockState old_state = Unlocked;
if (__predict_true(atomic_compare_exchange_strong_explicit(&state, &old_state,
@ -57,7 +64,7 @@ class Lock {
}
while (atomic_exchange_explicit(&state, LockedWithWaiter, memory_order_acquire) != Unlocked) {
// TODO: As the critical section is brief, it is a better choice to spin a few times befor sleeping.
__futex_wait_ex(&state, process_shared, LockedWithWaiter, NULL);
__futex_wait_ex(&state, process_shared, LockedWithWaiter, false, nullptr);
}
return;
}

View File

@ -42,8 +42,8 @@
(((value) + (alignment) - 1) & ~((alignment) - 1))
#define BIONIC_ROUND_UP_POWER_OF_2(value) \
(sizeof(value) == 8) \
((sizeof(value) == 8) \
? (1UL << (64 - __builtin_clzl(static_cast<unsigned long>(value)))) \
: (1UL << (32 - __builtin_clz(static_cast<unsigned int>(value))))
: (1UL << (32 - __builtin_clz(static_cast<unsigned int>(value)))))
#endif // _BIONIC_MACROS_H_

View File

@ -29,9 +29,12 @@
#ifndef _BIONIC_TIME_CONVERSIONS_H
#define _BIONIC_TIME_CONVERSIONS_H
#include <errno.h>
#include <time.h>
#include <sys/cdefs.h>
#include "private/bionic_constants.h"
__BEGIN_DECLS
__LIBC_HIDDEN__ bool timespec_from_timeval(timespec& ts, const timeval& tv);
@ -39,8 +42,24 @@ __LIBC_HIDDEN__ void timespec_from_ms(timespec& ts, const int ms);
__LIBC_HIDDEN__ void timeval_from_timespec(timeval& tv, const timespec& ts);
__LIBC_HIDDEN__ bool timespec_from_absolute_timespec(timespec& ts, const timespec& abs_ts, clockid_t clock);
__LIBC_HIDDEN__ void absolute_timespec_from_timespec(timespec& abs_ts, const timespec& ts,
clockid_t clock);
__END_DECLS
static inline int check_timespec(const timespec* ts, bool null_allowed) {
if (null_allowed && ts == nullptr) {
return 0;
}
// glibc just segfaults if you pass a null timespec.
// That seems a lot more likely to catch bad code than returning EINVAL.
if (ts->tv_nsec < 0 || ts->tv_nsec >= NS_PER_S) {
return EINVAL;
}
if (ts->tv_sec < 0) {
return ETIMEDOUT;
}
return 0;
}
#endif

View File

@ -121,7 +121,7 @@ __END_DECLS
#if defined(__cplusplus)
class KernelArgumentBlock;
extern __LIBC_HIDDEN__ void __libc_init_main_thread(KernelArgumentBlock& args);
extern __LIBC_HIDDEN__ void __libc_init_main_thread(KernelArgumentBlock&);
#endif
#endif /* __BIONIC_PRIVATE_BIONIC_TLS_H_ */

View File

@ -44,37 +44,44 @@
#define ALIGNBYTES (sizeof(uintptr_t) - 1)
#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES)
int __sdidinit;
#define NDYNAMIC 10 /* add ten more whenever necessary */
#define std(flags, file) \
{0,0,0,flags,file,{0,0},0,__sF+file,__sclose,__sread,__sseek,__swrite, \
{(unsigned char *)(__sFext+file), 0},NULL,0,{0},{0},{0,0},0,0}
/* the usual - (stdin + stdout + stderr) */
static FILE usual[FOPEN_MAX - 3];
static struct __sfileext usualext[FOPEN_MAX - 3];
static struct glue uglue = { 0, FOPEN_MAX - 3, usual };
static struct glue *lastglue = &uglue;
_THREAD_PRIVATE_MUTEX(__sfp_mutex);
static struct __sfileext __sFext[3];
// TODO: when we no longer have to support both clang and GCC, we can simplify all this.
#define SBUF_INIT {0,0}
#if defined(__LP64__)
#define MBSTATE_T_INIT {{0},{0}}
#else
#define MBSTATE_T_INIT {{0}}
#endif
#define WCHAR_IO_DATA_INIT {MBSTATE_T_INIT,MBSTATE_T_INIT,{0},0,0}
static struct __sfileext __sFext[3] = {
{ SBUF_INIT, WCHAR_IO_DATA_INIT, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, false },
{ SBUF_INIT, WCHAR_IO_DATA_INIT, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, false },
{ SBUF_INIT, WCHAR_IO_DATA_INIT, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, false },
};
// __sF is exported for backwards compatibility. Until M, we didn't have symbols
// for stdin/stdout/stderr; they were macros accessing __sF.
FILE __sF[3] = {
std(__SRD, STDIN_FILENO), /* stdin */
std(__SWR, STDOUT_FILENO), /* stdout */
std(__SWR|__SNBF, STDERR_FILENO) /* stderr */
std(__SRD, STDIN_FILENO),
std(__SWR, STDOUT_FILENO),
std(__SWR|__SNBF, STDERR_FILENO),
};
struct glue __sglue = { &uglue, 3, __sF };
FILE* stdin = &__sF[0];
FILE* stdout = &__sF[1];
FILE* stderr = &__sF[2];
struct glue __sglue = { NULL, 3, __sF };
static struct glue* lastglue = &__sglue;
static struct glue *
moreglue(int n)
{
@ -114,9 +121,6 @@ __sfp(void)
int n;
struct glue *g;
if (!__sdidinit)
__sinit();
_THREAD_PRIVATE_MUTEX_LOCK(__sfp_mutex);
for (g = &__sglue; g != NULL; g = g->next) {
for (fp = g->iobs, n = g->niobs; --n >= 0; fp++)
@ -149,48 +153,7 @@ found:
return (fp);
}
/*
* exit() and abort() call _cleanup() through the callback registered
* with __atexit_register_cleanup(), set whenever we open or buffer a
* file. This chicanery is done so that programs that do not use stdio
* need not link it all in.
*
* The name `_cleanup' is, alas, fairly well known outside stdio.
*/
void
_cleanup(void)
{
__LIBC_HIDDEN__ void __libc_stdio_cleanup(void) {
/* (void) _fwalk(fclose); */
(void) _fwalk(__sflush); /* `cheating' */
}
/*
* __sinit() is called whenever stdio's internal variables must be set up.
*/
void
__sinit(void)
{
_THREAD_PRIVATE_MUTEX(__sinit_mutex);
_THREAD_PRIVATE_MUTEX_LOCK(__sinit_mutex);
if (__sdidinit) {
/* bail out if caller lost the race */
_THREAD_PRIVATE_MUTEX_UNLOCK(__sinit_mutex);
return;
}
/* Initialize stdin/stdout/stderr (for the recursive mutex). http://b/18208568. */
for (size_t i = 0; i < 3; ++i) {
_FILEEXT_SETUP(__sF+i, __sFext+i);
}
/* Initialize the pre-allocated (but initially unused) streams. */
for (size_t i = 0; i < FOPEN_MAX - 3; ++i) {
_FILEEXT_SETUP(usual+i, usualext+i);
}
/* make sure we clean up on exit */
__atexit_register_cleanup(_cleanup); /* conservative */
__sdidinit = 1;
_THREAD_PRIVATE_MUTEX_UNLOCK(__sinit_mutex);
}

View File

@ -109,7 +109,7 @@ struct __sfileext {
pthread_mutex_t _lock;
/* __fsetlocking support */
bool _stdio_handles_locking;
bool _caller_handles_locking;
};
#if defined(__cplusplus)
@ -131,7 +131,7 @@ do { \
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); \
pthread_mutex_init(&_FLOCK(fp), &attr); \
pthread_mutexattr_destroy(&attr); \
_EXT(fp)->_stdio_handles_locking = true; \
_EXT(fp)->_caller_handles_locking = false; \
} while (0)
#define _FILEEXT_SETUP(f, fext) \
@ -153,10 +153,8 @@ __LIBC32_LEGACY_PUBLIC__ int __srefill(FILE*);
__LIBC32_LEGACY_PUBLIC__ int __swsetup(FILE*);
/* These were referenced by a couple of different pieces of middleware and the Crystax NDK. */
__LIBC32_LEGACY_PUBLIC__ extern int __sdidinit;
__LIBC32_LEGACY_PUBLIC__ int __sflags(const char*, int*);
__LIBC32_LEGACY_PUBLIC__ FILE* __sfp(void);
__LIBC32_LEGACY_PUBLIC__ void __sinit(void);
__LIBC32_LEGACY_PUBLIC__ void __smakebuf(FILE*);
/* These are referenced by the Greed for Glory franchise. */
@ -170,7 +168,6 @@ __LIBC32_LEGACY_PUBLIC__ int _fwalk(int (*)(FILE *));
#pragma GCC visibility push(hidden)
int __sflush_locked(FILE *);
void _cleanup(void);
int __swhatbuf(FILE *, size_t *, int *);
wint_t __fgetwc_unlock(FILE *);
wint_t __ungetwc(wint_t, FILE *);
@ -179,8 +176,6 @@ int __svfscanf(FILE * __restrict, const char * __restrict, __va_list);
int __vfwprintf(FILE * __restrict, const wchar_t * __restrict, __va_list);
int __vfwscanf(FILE * __restrict, const wchar_t * __restrict, __va_list);
extern void __atexit_register_cleanup(void (*)(void));
/*
* Return true if the given FILE cannot be written now.
*/
@ -208,8 +203,8 @@ extern void __atexit_register_cleanup(void (*)(void));
(fp)->_lb._base = NULL; \
}
#define FLOCKFILE(fp) if (_EXT(fp)->_stdio_handles_locking) flockfile(fp)
#define FUNLOCKFILE(fp) if (_EXT(fp)->_stdio_handles_locking) funlockfile(fp)
#define FLOCKFILE(fp) if (!_EXT(fp)->_caller_handles_locking) flockfile(fp)
#define FUNLOCKFILE(fp) if (!_EXT(fp)->_caller_handles_locking) funlockfile(fp)
#define FLOATING_POINT
#define PRINTF_WIDE_CHAR
@ -237,6 +232,10 @@ struct __suio;
extern int __sfvwrite(FILE *, struct __suio *);
wint_t __fputwc_unlock(wchar_t wc, FILE *fp);
/* Remove the if (!__sdidinit) __sinit() idiom from untouched upstream stdio code. */
extern void __sinit(void); // Not actually implemented.
#define __sdidinit 1
#pragma GCC visibility pop
__END_DECLS

View File

@ -51,11 +51,6 @@ lflush(FILE *fp)
int
__srefill(FILE *fp)
{
/* make sure stdio is set up */
if (!__sdidinit)
__sinit();
fp->_r = 0; /* largely a convenience for callers */
#if !defined(__ANDROID__)

View File

@ -74,7 +74,7 @@ void _flushlbf() {
}
int __fsetlocking(FILE* fp, int type) {
int old_state = _EXT(fp)->_stdio_handles_locking ? FSETLOCKING_INTERNAL : FSETLOCKING_BYCALLER;
int old_state = _EXT(fp)->_caller_handles_locking ? FSETLOCKING_BYCALLER : FSETLOCKING_INTERNAL;
if (type == FSETLOCKING_QUERY) {
return old_state;
}
@ -84,7 +84,7 @@ int __fsetlocking(FILE* fp, int type) {
__libc_fatal("Bad type (%d) passed to __fsetlocking", type);
}
_EXT(fp)->_stdio_handles_locking = (type == FSETLOCKING_INTERNAL);
_EXT(fp)->_caller_handles_locking = (type == FSETLOCKING_BYCALLER);
return old_state;
}
@ -99,3 +99,7 @@ int feof_unlocked(FILE* fp) {
int ferror_unlocked(FILE* fp) {
return __sferror(fp);
}
int fileno_unlocked(FILE* fp) {
return __sfileno(fp);
}

View File

@ -185,51 +185,12 @@ restart:
}
_ATEXIT_UNLOCK();
extern void __libc_stdio_cleanup(void);
__libc_stdio_cleanup();
/* BEGIN android-changed: call __unregister_atfork if dso is not null */
if (dso != NULL) {
__unregister_atfork(dso);
}
/* END android-changed */
}
/*
* Register the cleanup function
*/
void
__atexit_register_cleanup(void (*func)(void))
{
struct atexit *p;
size_t pgsize = getpagesize();
if (pgsize < sizeof(*p))
return;
_ATEXIT_LOCK();
p = __atexit;
while (p != NULL && p->next != NULL)
p = p->next;
if (p == NULL) {
p = mmap(NULL, pgsize, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, -1, 0);
if (p == MAP_FAILED)
goto unlock;
/* BEGIN android-changed */
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, p, pgsize,
"atexit handlers");
/* END android-changed */
p->ind = 1;
p->max = (pgsize - ((char *)&p->fns[0] - (char *)p)) /
sizeof(p->fns[0]);
p->next = NULL;
__atexit = p;
} else {
if (mprotect(p, pgsize, PROT_READ | PROT_WRITE))
goto unlock;
}
p->fns[0].fn_ptr = (void (*)(void *))func;
p->fns[0].fn_arg = NULL;
p->fns[0].fn_dso = NULL;
mprotect(p, pgsize, PROT_READ);
restartloop = 1;
unlock:
_ATEXIT_UNLOCK();
}

View File

@ -36,20 +36,26 @@ class VersionScriptGenerator(object):
basename = os.path.basename(script)
dirname = os.path.dirname(script)
for arch in all_arches:
name = basename.split(".")[0] + "." + arch + ".map"
tmp_path = os.path.join(bionic_temp, name)
dest_path = os.path.join(dirname, name)
with open(tmp_path, "w") as fout:
with open(script, "r") as fin:
fout.write("# %s\n" % warning)
for line in fin:
index = line.find("#")
if index != -1:
arches = line[index+1:].split()
if arch not in arches:
continue
fout.write(line)
shutil.copyfile(tmp_path, dest_path)
for brillo in [False, True]:
has_nobrillo = False
name = basename.split(".")[0] + "." + arch + (".brillo" if brillo else "") + ".map"
tmp_path = os.path.join(bionic_temp, name)
dest_path = os.path.join(dirname, name)
with open(tmp_path, "w") as fout:
with open(script, "r") as fin:
fout.write("# %s\n" % warning)
for line in fin:
index = line.find("#")
if index != -1:
tags = line[index+1:].split()
if arch not in tags:
continue
if brillo and "nobrillo" in tags:
has_nobrillo = True
continue
fout.write(line)
if not brillo or has_nobrillo:
shutil.copyfile(tmp_path, dest_path)
generator = VersionScriptGenerator()

View File

@ -1316,9 +1316,10 @@ static void
tzset_unlocked(void)
{
#if defined(__ANDROID__)
// The TZ environment variable is meant to override the system-wide setting.
const char * name = getenv("TZ");
// Try the "persist.sys.timezone" system property.
// If that's not set, look at the "persist.sys.timezone" system property.
if (name == NULL) {
static const prop_info *pi;
@ -1340,6 +1341,10 @@ tzset_unlocked(void)
}
}
// If that's not available (because you're running AOSP on a WiFi-only
// device, say), fall back to GMT.
if (name == NULL) name = gmt;
tzsetlcl(name);
#else
tzsetlcl(getenv("TZ"));
@ -2457,50 +2462,4 @@ static int __bionic_open_tzdata(const char* olson_id) {
return fd;
}
// Caches the most recent timezone (http://b/8270865).
static int __bionic_tzload_cached(const char* name, struct state* const sp, const int doextend) {
lock();
// Our single-item cache.
static char* g_cached_time_zone_name;
static struct state g_cached_time_zone;
// Do we already have this timezone cached?
if (g_cached_time_zone_name != NULL && strcmp(name, g_cached_time_zone_name) == 0) {
*sp = g_cached_time_zone;
unlock();
return 0;
}
// Can we load it?
int rc = tzload(name, sp, doextend);
if (rc == 0) {
// Update the cache.
free(g_cached_time_zone_name);
g_cached_time_zone_name = strdup(name);
g_cached_time_zone = *sp;
}
unlock();
return rc;
}
// Non-standard API: mktime(3) but with an explicit timezone parameter.
// This can't actually be hidden/removed until we fix MtpUtils.cpp
__attribute__((visibility("default"))) time_t mktime_tz(struct tm* const tmp, const char* tz) {
struct state* st = malloc(sizeof(*st));
time_t return_value;
if (st == NULL)
return 0;
if (__bionic_tzload_cached(tz, st, true) != 0) {
// TODO: not sure what's best here, but for now, we fall back to gmt.
gmtload(st);
}
return_value = time1(tmp, localsub, st, 0L);
free(st);
return return_value;
}
// END android-added

View File

@ -502,7 +502,23 @@ label:
continue;
case 'Z':
#ifdef TM_ZONE
pt = _add(t->TM_ZONE, pt, ptlim, modifier);
// BEGIN: Android-changed.
{
const char* zone = t->TM_ZONE;
if (!zone || !*zone) {
// "The value of tm_isdst shall be positive if Daylight Savings Time is
// in effect, 0 if Daylight Savings Time is not in effect, and negative
// if the information is not available."
if (t->tm_isdst == 0) zone = tzname[0];
else if (t->tm_isdst > 0) zone = tzname[1];
// "Replaced by the timezone name or abbreviation, or by no bytes if no
// timezone information exists."
if (!zone || !*zone) zone = "";
}
pt = _add(zone, pt, ptlim, modifier);
}
// END: Android-changed.
#else
if (t->tm_isdst >= 0)
pt = _add(tzname[t->tm_isdst != 0],

View File

@ -4822,8 +4822,13 @@ void* dlcalloc(size_t n_elements, size_t elem_size) {
req = MAX_SIZE_T; /* force downstream failure on overflow */
}
mem = dlmalloc(req);
if (mem != 0 && calloc_must_clear(mem2chunk(mem)))
memset(mem, 0, req);
if (mem != 0) {
mchunkptr p = mem2chunk(mem);
if (calloc_must_clear(p)) {
/* Make sure to clear all of the buffer, not just the requested size. */
memset(mem, 0, chunksize(p) - overhead_for(p));
}
}
return mem;
}

View File

@ -32,6 +32,6 @@
#define __unlockenv() 0
#include <stddef.h>
int reallocarr(void*, size_t, size_t);
__LIBC_HIDDEN__ int reallocarr(void*, size_t, size_t);
#endif

View File

@ -13,15 +13,28 @@ cc_library {
// DO NOT REMOVE --exclude-libs!
ldflags: ["-Wl,--exclude-libs=libgcc.a"],
version_script: "libdl.map",
// for x86, exclude libgcc_eh.a for the same reasons as above
arch: {
arm: {
version_script: "libdl.arm.map",
},
arm64: {
version_script: "libdl.arm64.map",
},
mips: {
version_script: "libdl.mips.map",
},
mips64: {
version_script: "libdl.mips64.map",
},
x86: {
ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
version_script: "libdl.x86.map",
},
x86_64: {
ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
version_script: "libdl.x86_64.map",
},
},
srcs: ["libdl.c"],

View File

@ -33,7 +33,13 @@ LOCAL_CFLAGS := -Wall -Wextra -Wunused -Werror
LOCAL_CXX_STL := none
LOCAL_MODULE := libdl
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk \
$(LOCAL_PATH)/libdl.arm.map \
$(LOCAL_PATH)/libdl.arm64.map \
$(LOCAL_PATH)/libdl.mips.map \
$(LOCAL_PATH)/libdl.mips64.map \
$(LOCAL_PATH)/libdl.x86.map \
$(LOCAL_PATH)/libdl.x86_64.map \
# NOTE: libdl needs __aeabi_unwind_cpp_pr0 from libgcc.a but libgcc.a needs a
# few symbols from libc. Using --no-undefined here results in having to link

View File

@ -14,10 +14,17 @@ LIBC {
*;
};
LIBC_N {
global:
android_init_namespaces;
android_create_namespace;
dlvsym;
} LIBC;
LIBC_PRIVATE {
global:
android_get_application_target_sdk_version;
android_set_application_target_sdk_version;
android_get_LD_LIBRARY_PATH;
android_update_LD_LIBRARY_PATH;
} LIBC;
} LIBC_N;

View File

@ -13,10 +13,17 @@ LIBC {
*;
};
LIBC_N {
global:
android_init_namespaces;
android_create_namespace;
dlvsym;
} LIBC;
LIBC_PRIVATE {
global:
android_get_application_target_sdk_version;
android_set_application_target_sdk_version;
android_get_LD_LIBRARY_PATH;
android_update_LD_LIBRARY_PATH;
} LIBC;
} LIBC_N;

View File

@ -24,21 +24,48 @@
// in the dynamic linker and hijacked at runtime.
void* dlopen(const char* filename __unused, int flag __unused) { return 0; }
const char* dlerror(void) { return 0; }
void* dlsym(void* handle __unused, const char* symbol __unused) { return 0; }
void* dlvsym(void* handle __unused, const char* symbol __unused, const char* version __unused) {
return 0;
}
int dladdr(const void* addr __unused, Dl_info* info __unused) { return 0; }
int dlclose(void* handle __unused) { return 0; }
#if defined(__arm__)
_Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr pc __unused, int* pcount __unused) { return 0; }
#endif
int dl_iterate_phdr(int (*cb)(struct dl_phdr_info* info, size_t size, void* data) __unused, void* data __unused) { return 0; }
int dl_iterate_phdr(int (*cb)(struct dl_phdr_info* info, size_t size, void* data) __unused,
void* data __unused) {
return 0;
}
void android_get_LD_LIBRARY_PATH(char* buffer __unused, size_t buffer_size __unused) { }
void android_update_LD_LIBRARY_PATH(const char* ld_library_path __unused) { }
void* android_dlopen_ext(const char* filename __unused, int flag __unused, const android_dlextinfo* extinfo __unused) { return 0; }
void* android_dlopen_ext(const char* filename __unused, int flag __unused,
const android_dlextinfo* extinfo __unused) {
return 0;
}
void android_set_application_target_sdk_version(uint32_t target __unused) { }
uint32_t android_get_application_target_sdk_version() { return 0; }
bool android_init_namespaces(const char* public_ns_sonames __unused,
const char* anon_ns_library_path __unused) {
return false;
}
struct android_namespace_t* android_create_namespace(const char* name __unused,
const char* ld_library_path __unused,
const char* default_library_path __unused,
uint64_t type __unused,
const char* permitted_when_isolated_path __unused) {
return 0;
}

View File

@ -28,10 +28,17 @@ LIBC {
*;
};
LIBC_N {
global:
android_init_namespaces;
android_create_namespace;
dlvsym;
} LIBC;
LIBC_PRIVATE {
global:
android_get_application_target_sdk_version;
android_set_application_target_sdk_version;
android_get_LD_LIBRARY_PATH;
android_update_LD_LIBRARY_PATH;
} LIBC;
} LIBC_N;

View File

@ -13,10 +13,17 @@ LIBC {
*;
};
LIBC_N {
global:
android_init_namespaces;
android_create_namespace;
dlvsym;
} LIBC;
LIBC_PRIVATE {
global:
android_get_application_target_sdk_version;
android_set_application_target_sdk_version;
android_get_LD_LIBRARY_PATH;
android_update_LD_LIBRARY_PATH;
} LIBC;
} LIBC_N;

View File

@ -13,10 +13,17 @@ LIBC {
*;
};
LIBC_N {
global:
android_init_namespaces;
android_create_namespace;
dlvsym;
} LIBC;
LIBC_PRIVATE {
global:
android_get_application_target_sdk_version;
android_set_application_target_sdk_version;
android_get_LD_LIBRARY_PATH;
android_update_LD_LIBRARY_PATH;
} LIBC;
} LIBC_N;

View File

@ -13,10 +13,17 @@ LIBC {
*;
};
LIBC_N {
global:
android_init_namespaces;
android_create_namespace;
dlvsym;
} LIBC;
LIBC_PRIVATE {
global:
android_get_application_target_sdk_version;
android_set_application_target_sdk_version;
android_get_LD_LIBRARY_PATH;
android_update_LD_LIBRARY_PATH;
} LIBC;
} LIBC_N;

View File

@ -13,10 +13,17 @@ LIBC {
*;
};
LIBC_N {
global:
android_init_namespaces;
android_create_namespace;
dlvsym;
} LIBC;
LIBC_PRIVATE {
global:
android_get_application_target_sdk_version;
android_set_application_target_sdk_version;
android_get_LD_LIBRARY_PATH;
android_update_LD_LIBRARY_PATH;
} LIBC;
} LIBC_N;

View File

@ -3,18 +3,7 @@
bionic_coverage = false
// TODO: this comes from from upstream's libc, not libm, but it's an
// implementation detail that should have hidden visibility, so it needs
// to be in whatever library the math code is in.
libm_common_src_files = ["digittoint.c"]
// TODO: this is not in the BSDs.
libm_common_src_files += [
"significandl.c",
"sincos.c",
]
libm_common_src_files += [
libm_common_src_files = [
"upstream-freebsd/lib/msun/bsdsrc/b_exp.c",
"upstream-freebsd/lib/msun/bsdsrc/b_log.c",
"upstream-freebsd/lib/msun/bsdsrc/b_tgamma.c",
@ -186,8 +175,19 @@ libm_common_src_files += [
]
libm_common_src_files += [
"fake_long_double.c",
// TODO: this comes from from upstream's libc, not libm, but it's an
// implementation detail that should have hidden visibility, so it needs
// to be in whatever library the math code is in.
"digittoint.c",
// Functionality not in the BSDs.
"significandl.c",
"sincos.c",
// Modified versions of BSD code.
"signbit.c",
// Home-grown stuff.
"fabs.cpp",
]
@ -254,6 +254,7 @@ libm_common_cflags = [
"-D__BIONIC_NO_MATH_INLINES",
"-DFLT_EVAL_METHOD=0",
"-include freebsd-compat.h",
"-Werror",
"-Wno-missing-braces",
"-Wno-parentheses",
"-Wno-sign-compare",
@ -290,9 +291,10 @@ cc_library {
native_coverage: bionic_coverage,
sanitize: ["never"],
version_script: "libm.map",
multilib: {
lib32: {
srcs: ["fake_long_double.c"],
},
lib64: {
srcs: libm_ld128_src_files,
local_include_dirs: libm_ld_local_includes,
@ -308,23 +310,27 @@ cc_library {
arm: {
srcs: [
"arm/fenv.c",
"arm/sqrt.S",
"arm/floor.S",
],
exclude_srcs: [
// TODO: these require neon not available in arm
"upstream-freebsd/lib/msun/src/e_sqrt.c",
"upstream-freebsd/lib/msun/src/e_sqrtf.c",
"upstream-freebsd/lib/msun/src/s_floor.c",
],
armv7_a_neon: {
srcs: [
"arm/sqrt.S",
"arm/floor.S",
],
exclude_srcs: [
"upstream-freebsd/lib/msun/src/e_sqrt.c",
"upstream-freebsd/lib/msun/src/e_sqrtf.c",
"upstream-freebsd/lib/msun/src/s_floor.c",
],
},
instruction_set: "arm",
ldflags: ["-Wl,--hash-style=both"],
version_script: "libm.arm.map",
},
arm64: {
srcs: [
"arm64/fenv.c",
"arm64/ceil.S",
"arm64/fenv.c",
"arm64/fma.S",
"arm64/floor.S",
"arm64/lrint.S",
@ -333,6 +339,8 @@ cc_library {
"arm64/trunc.S",
],
exclude_srcs: [
"upstream-freebsd/lib/msun/src/e_sqrt.c",
"upstream-freebsd/lib/msun/src/e_sqrtf.c",
"upstream-freebsd/lib/msun/src/s_ceil.c",
"upstream-freebsd/lib/msun/src/s_ceilf.c",
"upstream-freebsd/lib/msun/src/s_fma.c",
@ -345,33 +353,163 @@ cc_library {
"upstream-freebsd/lib/msun/src/s_lrintf.c",
"upstream-freebsd/lib/msun/src/s_rint.c",
"upstream-freebsd/lib/msun/src/s_rintf.c",
"upstream-freebsd/lib/msun/src/e_sqrt.c",
"upstream-freebsd/lib/msun/src/e_sqrtf.c",
"upstream-freebsd/lib/msun/src/s_trunc.c",
"upstream-freebsd/lib/msun/src/s_truncf.c",
],
version_script: "libm.arm64.map",
},
mips: {
srcs: ["mips/fenv.c"],
version_script: "libm.mips.map",
},
mips64: {
srcs: ["mips/fenv.c"],
version_script: "libm.mips64.map",
},
x86: {
srcs: [
"i387/fenv.c",
"x86/sqrt.S",
"x86/sqrtf.S",
"x86/e_acos.S",
"x86/e_asin.S",
"x86/e_atan2.S",
"x86/e_cosh.S",
"x86/e_exp.S",
"x86/e_hypot.S",
"x86/e_log10.S",
"x86/e_log.S",
"x86/e_pow.S",
"x86/e_sinh.S",
"x86/libm_reduce_pi04l.S",
"x86/libm_sincos_huge.S",
"x86/libm_tancot_huge.S",
"x86/s_atan.S",
"x86/s_cbrt.S",
"x86/s_cos.S",
"x86/s_expm1.S",
"x86/s_log1p.S",
"x86/s_sin.S",
"x86/s_tanh.S",
"x86/s_tan.S",
],
exclude_srcs: [
"upstream-freebsd/lib/msun/src/e_acos.c",
"upstream-freebsd/lib/msun/src/e_asin.c",
"upstream-freebsd/lib/msun/src/e_atan2.c",
"upstream-freebsd/lib/msun/src/e_cosh.c",
"upstream-freebsd/lib/msun/src/e_exp.c",
"upstream-freebsd/lib/msun/src/e_hypot.c",
"upstream-freebsd/lib/msun/src/e_log.c",
"upstream-freebsd/lib/msun/src/e_log10.c",
"upstream-freebsd/lib/msun/src/e_pow.c",
"upstream-freebsd/lib/msun/src/e_sinh.c",
"upstream-freebsd/lib/msun/src/e_sqrt.c",
"upstream-freebsd/lib/msun/src/e_sqrtf.c",
"upstream-freebsd/lib/msun/src/s_atan.c",
"upstream-freebsd/lib/msun/src/s_cbrt.c",
"upstream-freebsd/lib/msun/src/s_cos.c",
"upstream-freebsd/lib/msun/src/s_expm1.c",
"upstream-freebsd/lib/msun/src/s_log1p.c",
"upstream-freebsd/lib/msun/src/s_sin.c",
"upstream-freebsd/lib/msun/src/s_tan.c",
"upstream-freebsd/lib/msun/src/s_tanh.c",
],
sse4_1: {
srcs: [
"x86/ceil.S",
"x86/ceilf.S",
"x86/floor.S",
"x86/floorf.S",
"x86/trunc.S",
"x86/truncf.S",
],
exclude_srcs: [
"upstream-freebsd/lib/msun/src/s_ceil.c",
"upstream-freebsd/lib/msun/src/s_ceilf.c",
"upstream-freebsd/lib/msun/src/s_floor.c",
"upstream-freebsd/lib/msun/src/s_floorf.c",
"upstream-freebsd/lib/msun/src/s_trunc.c",
"upstream-freebsd/lib/msun/src/s_truncf.c",
],
},
local_include_dirs: ["i387"],
srcs: ["i387/fenv.c"],
// Clang has wrong long double sizes for x86.
clang: false,
ldflags: ["-Wl,--hash-style=both"],
version_script: "libm.x86.map",
},
x86_64: {
srcs: ["amd64/fenv.c"],
srcs: [
"amd64/fenv.c",
"x86_64/sqrt.S",
"x86_64/sqrtf.S",
"x86_64/e_acos.S",
"x86_64/e_asin.S",
"x86_64/e_atan2.S",
"x86_64/e_cosh.S",
"x86_64/e_exp.S",
"x86_64/e_hypot.S",
"x86_64/e_log10.S",
"x86_64/e_log.S",
"x86_64/e_pow.S",
"x86_64/e_sinh.S",
"x86_64/s_atan.S",
"x86_64/s_cbrt.S",
"x86_64/s_cos.S",
"x86_64/s_expm1.S",
"x86_64/s_log1p.S",
"x86_64/s_sin.S",
"x86_64/s_tanh.S",
"x86_64/s_tan.S",
],
exclude_srcs: [
"upstream-freebsd/lib/msun/src/e_acos.c",
"upstream-freebsd/lib/msun/src/e_asin.c",
"upstream-freebsd/lib/msun/src/e_atan2.c",
"upstream-freebsd/lib/msun/src/e_cosh.c",
"upstream-freebsd/lib/msun/src/e_exp.c",
"upstream-freebsd/lib/msun/src/e_hypot.c",
"upstream-freebsd/lib/msun/src/e_log.c",
"upstream-freebsd/lib/msun/src/e_log10.c",
"upstream-freebsd/lib/msun/src/e_pow.c",
"upstream-freebsd/lib/msun/src/e_sinh.c",
"upstream-freebsd/lib/msun/src/e_sqrt.c",
"upstream-freebsd/lib/msun/src/e_sqrtf.c",
"upstream-freebsd/lib/msun/src/s_atan.c",
"upstream-freebsd/lib/msun/src/s_cbrt.c",
"upstream-freebsd/lib/msun/src/s_cos.c",
"upstream-freebsd/lib/msun/src/s_expm1.c",
"upstream-freebsd/lib/msun/src/s_log1p.c",
"upstream-freebsd/lib/msun/src/s_sin.c",
"upstream-freebsd/lib/msun/src/s_tan.c",
"upstream-freebsd/lib/msun/src/s_tanh.c",
],
sse4_1: {
srcs: [
"x86_64/ceil.S",
"x86_64/ceilf.S",
"x86_64/floor.S",
"x86_64/floorf.S",
"x86_64/trunc.S",
"x86_64/truncf.S",
],
exclude_srcs: [
"upstream-freebsd/lib/msun/src/s_ceil.c",
"upstream-freebsd/lib/msun/src/s_ceilf.c",
"upstream-freebsd/lib/msun/src/s_floor.c",
"upstream-freebsd/lib/msun/src/s_floorf.c",
"upstream-freebsd/lib/msun/src/s_trunc.c",
"upstream-freebsd/lib/msun/src/s_truncf.c",
],
},
// Clang has wrong long double sizes for x86.
clang: false,
version_script: "libm.x86_64.map",
},
},

View File

@ -22,14 +22,19 @@ LOCAL_SRC_FILES := \
upstream-freebsd/lib/msun/bsdsrc/b_tgamma.c \
upstream-freebsd/lib/msun/src/catrig.c \
upstream-freebsd/lib/msun/src/catrigf.c \
upstream-freebsd/lib/msun/src/e_acos.c \
upstream-freebsd/lib/msun/src/e_acosf.c \
upstream-freebsd/lib/msun/src/e_acosh.c \
upstream-freebsd/lib/msun/src/e_acoshf.c \
upstream-freebsd/lib/msun/src/e_asin.c \
upstream-freebsd/lib/msun/src/e_asinf.c \
upstream-freebsd/lib/msun/src/e_atan2.c \
upstream-freebsd/lib/msun/src/e_atan2f.c \
upstream-freebsd/lib/msun/src/e_atanh.c \
upstream-freebsd/lib/msun/src/e_atanhf.c \
upstream-freebsd/lib/msun/src/e_cosh.c \
upstream-freebsd/lib/msun/src/e_coshf.c \
upstream-freebsd/lib/msun/src/e_exp.c \
upstream-freebsd/lib/msun/src/e_expf.c \
upstream-freebsd/lib/msun/src/e_fmod.c \
upstream-freebsd/lib/msun/src/e_fmodf.c \
@ -37,6 +42,7 @@ LOCAL_SRC_FILES := \
upstream-freebsd/lib/msun/src/e_gammaf.c \
upstream-freebsd/lib/msun/src/e_gammaf_r.c \
upstream-freebsd/lib/msun/src/e_gamma_r.c \
upstream-freebsd/lib/msun/src/e_hypot.c \
upstream-freebsd/lib/msun/src/e_hypotf.c \
upstream-freebsd/lib/msun/src/e_j0.c \
upstream-freebsd/lib/msun/src/e_j0f.c \
@ -48,10 +54,13 @@ LOCAL_SRC_FILES := \
upstream-freebsd/lib/msun/src/e_lgammaf.c \
upstream-freebsd/lib/msun/src/e_lgammaf_r.c \
upstream-freebsd/lib/msun/src/e_lgamma_r.c \
upstream-freebsd/lib/msun/src/e_log10.c \
upstream-freebsd/lib/msun/src/e_log10f.c \
upstream-freebsd/lib/msun/src/e_log2.c \
upstream-freebsd/lib/msun/src/e_log2f.c \
upstream-freebsd/lib/msun/src/e_log.c \
upstream-freebsd/lib/msun/src/e_logf.c \
upstream-freebsd/lib/msun/src/e_pow.c \
upstream-freebsd/lib/msun/src/e_powf.c \
upstream-freebsd/lib/msun/src/e_remainder.c \
upstream-freebsd/lib/msun/src/e_remainderf.c \
@ -59,7 +68,10 @@ LOCAL_SRC_FILES := \
upstream-freebsd/lib/msun/src/e_rem_pio2f.c \
upstream-freebsd/lib/msun/src/e_scalb.c \
upstream-freebsd/lib/msun/src/e_scalbf.c \
upstream-freebsd/lib/msun/src/e_sinh.c \
upstream-freebsd/lib/msun/src/e_sinhf.c \
upstream-freebsd/lib/msun/src/e_sqrt.c \
upstream-freebsd/lib/msun/src/e_sqrtf.c \
upstream-freebsd/lib/msun/src/imprecise.c \
upstream-freebsd/lib/msun/src/k_cos.c \
upstream-freebsd/lib/msun/src/k_cosf.c \
@ -72,13 +84,17 @@ LOCAL_SRC_FILES := \
upstream-freebsd/lib/msun/src/k_tanf.c \
upstream-freebsd/lib/msun/src/s_asinh.c \
upstream-freebsd/lib/msun/src/s_asinhf.c \
upstream-freebsd/lib/msun/src/s_atan.c \
upstream-freebsd/lib/msun/src/s_atanf.c \
upstream-freebsd/lib/msun/src/s_carg.c \
upstream-freebsd/lib/msun/src/s_cargf.c \
upstream-freebsd/lib/msun/src/s_cargl.c \
upstream-freebsd/lib/msun/src/s_cbrt.c \
upstream-freebsd/lib/msun/src/s_cbrtf.c \
upstream-freebsd/lib/msun/src/s_ccosh.c \
upstream-freebsd/lib/msun/src/s_ccoshf.c \
upstream-freebsd/lib/msun/src/s_ceil.c \
upstream-freebsd/lib/msun/src/s_ceilf.c \
upstream-freebsd/lib/msun/src/s_cexp.c \
upstream-freebsd/lib/msun/src/s_cexpf.c \
upstream-freebsd/lib/msun/src/s_cimag.c \
@ -89,6 +105,7 @@ LOCAL_SRC_FILES := \
upstream-freebsd/lib/msun/src/s_conjl.c \
upstream-freebsd/lib/msun/src/s_copysign.c \
upstream-freebsd/lib/msun/src/s_copysignf.c \
upstream-freebsd/lib/msun/src/s_cos.c \
upstream-freebsd/lib/msun/src/s_cosf.c \
upstream-freebsd/lib/msun/src/s_cproj.c \
upstream-freebsd/lib/msun/src/s_cprojf.c \
@ -107,10 +124,15 @@ LOCAL_SRC_FILES := \
upstream-freebsd/lib/msun/src/s_erff.c \
upstream-freebsd/lib/msun/src/s_exp2.c \
upstream-freebsd/lib/msun/src/s_exp2f.c \
upstream-freebsd/lib/msun/src/s_expm1.c \
upstream-freebsd/lib/msun/src/s_expm1f.c \
upstream-freebsd/lib/msun/src/s_fdim.c \
upstream-freebsd/lib/msun/src/s_finite.c \
upstream-freebsd/lib/msun/src/s_finitef.c \
upstream-freebsd/lib/msun/src/s_floor.c \
upstream-freebsd/lib/msun/src/s_floorf.c \
upstream-freebsd/lib/msun/src/s_fma.c \
upstream-freebsd/lib/msun/src/s_fmaf.c \
upstream-freebsd/lib/msun/src/s_fmax.c \
upstream-freebsd/lib/msun/src/s_fmaxf.c \
upstream-freebsd/lib/msun/src/s_fmin.c \
@ -119,11 +141,16 @@ LOCAL_SRC_FILES := \
upstream-freebsd/lib/msun/src/s_frexpf.c \
upstream-freebsd/lib/msun/src/s_ilogb.c \
upstream-freebsd/lib/msun/src/s_ilogbf.c \
upstream-freebsd/lib/msun/src/s_llrint.c \
upstream-freebsd/lib/msun/src/s_llrintf.c \
upstream-freebsd/lib/msun/src/s_llround.c \
upstream-freebsd/lib/msun/src/s_llroundf.c \
upstream-freebsd/lib/msun/src/s_log1p.c \
upstream-freebsd/lib/msun/src/s_log1pf.c \
upstream-freebsd/lib/msun/src/s_logb.c \
upstream-freebsd/lib/msun/src/s_logbf.c \
upstream-freebsd/lib/msun/src/s_lrint.c \
upstream-freebsd/lib/msun/src/s_lrintf.c \
upstream-freebsd/lib/msun/src/s_lround.c \
upstream-freebsd/lib/msun/src/s_lroundf.c \
upstream-freebsd/lib/msun/src/s_modf.c \
@ -134,6 +161,8 @@ LOCAL_SRC_FILES := \
upstream-freebsd/lib/msun/src/s_nextafterf.c \
upstream-freebsd/lib/msun/src/s_remquo.c \
upstream-freebsd/lib/msun/src/s_remquof.c \
upstream-freebsd/lib/msun/src/s_rint.c \
upstream-freebsd/lib/msun/src/s_rintf.c \
upstream-freebsd/lib/msun/src/s_round.c \
upstream-freebsd/lib/msun/src/s_roundf.c \
upstream-freebsd/lib/msun/src/s_scalbln.c \
@ -142,10 +171,15 @@ LOCAL_SRC_FILES := \
upstream-freebsd/lib/msun/src/s_signgam.c \
upstream-freebsd/lib/msun/src/s_significand.c \
upstream-freebsd/lib/msun/src/s_significandf.c \
upstream-freebsd/lib/msun/src/s_sin.c \
upstream-freebsd/lib/msun/src/s_sinf.c \
upstream-freebsd/lib/msun/src/s_tan.c \
upstream-freebsd/lib/msun/src/s_tanf.c \
upstream-freebsd/lib/msun/src/s_tanh.c \
upstream-freebsd/lib/msun/src/s_tanhf.c \
upstream-freebsd/lib/msun/src/s_tgammaf.c \
upstream-freebsd/lib/msun/src/s_trunc.c \
upstream-freebsd/lib/msun/src/s_truncf.c \
upstream-freebsd/lib/msun/src/w_cabs.c \
upstream-freebsd/lib/msun/src/w_cabsf.c \
upstream-freebsd/lib/msun/src/w_cabsl.c \
@ -236,37 +270,6 @@ LOCAL_SRC_FILES += \
# -----------------------------------------------------------------------------
LOCAL_SRC_FILES_arm += \
arm/fenv.c \
upstream-freebsd/lib/msun/src/e_acos.c \
upstream-freebsd/lib/msun/src/e_asin.c \
upstream-freebsd/lib/msun/src/e_atan2.c \
upstream-freebsd/lib/msun/src/e_cosh.c \
upstream-freebsd/lib/msun/src/e_exp.c \
upstream-freebsd/lib/msun/src/e_hypot.c \
upstream-freebsd/lib/msun/src/e_log.c \
upstream-freebsd/lib/msun/src/e_log10.c \
upstream-freebsd/lib/msun/src/e_pow.c \
upstream-freebsd/lib/msun/src/e_sinh.c \
upstream-freebsd/lib/msun/src/s_atan.c \
upstream-freebsd/lib/msun/src/s_cbrt.c \
upstream-freebsd/lib/msun/src/s_ceil.c \
upstream-freebsd/lib/msun/src/s_ceilf.c \
upstream-freebsd/lib/msun/src/s_cos.c \
upstream-freebsd/lib/msun/src/s_fma.c \
upstream-freebsd/lib/msun/src/s_fmaf.c \
upstream-freebsd/lib/msun/src/s_floorf.c \
upstream-freebsd/lib/msun/src/s_expm1.c \
upstream-freebsd/lib/msun/src/s_llrint.c \
upstream-freebsd/lib/msun/src/s_llrintf.c \
upstream-freebsd/lib/msun/src/s_log1p.c \
upstream-freebsd/lib/msun/src/s_lrint.c \
upstream-freebsd/lib/msun/src/s_lrintf.c \
upstream-freebsd/lib/msun/src/s_rint.c \
upstream-freebsd/lib/msun/src/s_rintf.c \
upstream-freebsd/lib/msun/src/s_sin.c \
upstream-freebsd/lib/msun/src/s_tan.c \
upstream-freebsd/lib/msun/src/s_tanh.c \
upstream-freebsd/lib/msun/src/s_trunc.c \
upstream-freebsd/lib/msun/src/s_truncf.c \
# s_floor.S requires neon instructions.
ifdef TARGET_2ND_ARCH
@ -276,17 +279,16 @@ arch_variant := $(TARGET_ARCH_VARIANT)
endif
# Use the C version on armv7-a since it doesn't support neon instructions.
ifeq ($(arch_variant),armv7-a)
LOCAL_SRC_FILES_arm += \
upstream-freebsd/lib/msun/src/e_sqrt.c \
upstream-freebsd/lib/msun/src/e_sqrtf.c \
upstream-freebsd/lib/msun/src/s_floor.c \
else
ifneq ($(arch_variant),armv7-a)
LOCAL_SRC_FILES_arm += \
arm/sqrt.S \
arm/floor.S \
LOCAL_SRC_FILES_EXCLUDE_arm += \
upstream-freebsd/lib/msun/src/e_sqrt.c \
upstream-freebsd/lib/msun/src/e_sqrtf.c \
upstream-freebsd/lib/msun/src/s_floor.c \
endif
# -----------------------------------------------------------------------------
@ -301,64 +303,30 @@ LOCAL_SRC_FILES_arm64 += \
arm64/rint.S \
arm64/sqrt.S \
arm64/trunc.S \
upstream-freebsd/lib/msun/src/e_acos.c \
upstream-freebsd/lib/msun/src/e_asin.c \
upstream-freebsd/lib/msun/src/e_atan2.c \
upstream-freebsd/lib/msun/src/e_cosh.c \
upstream-freebsd/lib/msun/src/e_exp.c \
upstream-freebsd/lib/msun/src/e_hypot.c \
upstream-freebsd/lib/msun/src/e_log.c \
upstream-freebsd/lib/msun/src/e_log10.c \
upstream-freebsd/lib/msun/src/e_pow.c \
upstream-freebsd/lib/msun/src/e_sinh.c \
upstream-freebsd/lib/msun/src/s_atan.c \
upstream-freebsd/lib/msun/src/s_cbrt.c \
upstream-freebsd/lib/msun/src/s_cos.c \
upstream-freebsd/lib/msun/src/s_expm1.c \
upstream-freebsd/lib/msun/src/s_log1p.c \
upstream-freebsd/lib/msun/src/s_sin.c \
upstream-freebsd/lib/msun/src/s_tan.c \
upstream-freebsd/lib/msun/src/s_tanh.c \
LOCAL_SRC_FILES_EXCLUDE_arm64 += \
upstream-freebsd/lib/msun/src/e_sqrt.c \
upstream-freebsd/lib/msun/src/e_sqrtf.c \
upstream-freebsd/lib/msun/src/s_ceil.c \
upstream-freebsd/lib/msun/src/s_ceilf.c \
upstream-freebsd/lib/msun/src/s_fma.c \
upstream-freebsd/lib/msun/src/s_fmaf.c \
upstream-freebsd/lib/msun/src/s_floor.c \
upstream-freebsd/lib/msun/src/s_floorf.c \
upstream-freebsd/lib/msun/src/s_llrint.c \
upstream-freebsd/lib/msun/src/s_llrintf.c \
upstream-freebsd/lib/msun/src/s_lrint.c \
upstream-freebsd/lib/msun/src/s_lrintf.c \
upstream-freebsd/lib/msun/src/s_rint.c \
upstream-freebsd/lib/msun/src/s_rintf.c \
upstream-freebsd/lib/msun/src/s_trunc.c \
upstream-freebsd/lib/msun/src/s_truncf.c \
# -----------------------------------------------------------------------------
# mips
# -----------------------------------------------------------------------------
libm_mips_arch_files := \
mips/fenv.c \
upstream-freebsd/lib/msun/src/e_acos.c \
upstream-freebsd/lib/msun/src/e_asin.c \
upstream-freebsd/lib/msun/src/e_atan2.c \
upstream-freebsd/lib/msun/src/e_cosh.c \
upstream-freebsd/lib/msun/src/e_exp.c \
upstream-freebsd/lib/msun/src/e_hypot.c \
upstream-freebsd/lib/msun/src/e_log.c \
upstream-freebsd/lib/msun/src/e_log10.c \
upstream-freebsd/lib/msun/src/e_pow.c \
upstream-freebsd/lib/msun/src/e_sinh.c \
upstream-freebsd/lib/msun/src/e_sqrt.c \
upstream-freebsd/lib/msun/src/e_sqrtf.c \
upstream-freebsd/lib/msun/src/s_atan.c \
upstream-freebsd/lib/msun/src/s_cbrt.c \
upstream-freebsd/lib/msun/src/s_ceil.c \
upstream-freebsd/lib/msun/src/s_ceilf.c \
upstream-freebsd/lib/msun/src/s_cos.c \
upstream-freebsd/lib/msun/src/s_fma.c \
upstream-freebsd/lib/msun/src/s_fmaf.c \
upstream-freebsd/lib/msun/src/s_floor.c \
upstream-freebsd/lib/msun/src/s_floorf.c \
upstream-freebsd/lib/msun/src/s_expm1.c \
upstream-freebsd/lib/msun/src/s_llrint.c \
upstream-freebsd/lib/msun/src/s_llrintf.c \
upstream-freebsd/lib/msun/src/s_log1p.c \
upstream-freebsd/lib/msun/src/s_lrint.c \
upstream-freebsd/lib/msun/src/s_lrintf.c \
upstream-freebsd/lib/msun/src/s_rint.c \
upstream-freebsd/lib/msun/src/s_rintf.c \
upstream-freebsd/lib/msun/src/s_sin.c \
upstream-freebsd/lib/msun/src/s_tan.c \
upstream-freebsd/lib/msun/src/s_tanh.c \
upstream-freebsd/lib/msun/src/s_trunc.c \
upstream-freebsd/lib/msun/src/s_truncf.c \
LOCAL_SRC_FILES_mips += $(libm_mips_arch_files)
LOCAL_SRC_FILES_mips64 += $(libm_mips_arch_files)
@ -368,14 +336,6 @@ LOCAL_SRC_FILES_mips64 += $(libm_mips_arch_files)
# -----------------------------------------------------------------------------
LOCAL_SRC_FILES_x86 += \
i387/fenv.c \
upstream-freebsd/lib/msun/src/s_fma.c \
upstream-freebsd/lib/msun/src/s_fmaf.c \
upstream-freebsd/lib/msun/src/s_llrint.c \
upstream-freebsd/lib/msun/src/s_llrintf.c \
upstream-freebsd/lib/msun/src/s_lrint.c \
upstream-freebsd/lib/msun/src/s_lrintf.c \
upstream-freebsd/lib/msun/src/s_rint.c \
upstream-freebsd/lib/msun/src/s_rintf.c \
x86/sqrt.S \
x86/sqrtf.S \
x86/e_acos.S \
@ -400,6 +360,28 @@ LOCAL_SRC_FILES_x86 += \
x86/s_tanh.S \
x86/s_tan.S \
LOCAL_SRC_FILES_EXCLUDE_x86 += \
upstream-freebsd/lib/msun/src/e_acos.c \
upstream-freebsd/lib/msun/src/e_asin.c \
upstream-freebsd/lib/msun/src/e_atan2.c \
upstream-freebsd/lib/msun/src/e_cosh.c \
upstream-freebsd/lib/msun/src/e_exp.c \
upstream-freebsd/lib/msun/src/e_hypot.c \
upstream-freebsd/lib/msun/src/e_log.c \
upstream-freebsd/lib/msun/src/e_log10.c \
upstream-freebsd/lib/msun/src/e_pow.c \
upstream-freebsd/lib/msun/src/e_sinh.c \
upstream-freebsd/lib/msun/src/e_sqrt.c \
upstream-freebsd/lib/msun/src/e_sqrtf.c \
upstream-freebsd/lib/msun/src/s_atan.c \
upstream-freebsd/lib/msun/src/s_cbrt.c \
upstream-freebsd/lib/msun/src/s_cos.c \
upstream-freebsd/lib/msun/src/s_expm1.c \
upstream-freebsd/lib/msun/src/s_log1p.c \
upstream-freebsd/lib/msun/src/s_sin.c \
upstream-freebsd/lib/msun/src/s_tan.c \
upstream-freebsd/lib/msun/src/s_tanh.c \
ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
LOCAL_SRC_FILES_x86 += \
x86/ceil.S \
@ -409,8 +391,7 @@ LOCAL_SRC_FILES_x86 += \
x86/trunc.S \
x86/truncf.S \
else
LOCAL_SRC_FILES_x86 += \
LOCAL_SRC_FILES_EXCLUDE_x86 += \
upstream-freebsd/lib/msun/src/s_ceil.c \
upstream-freebsd/lib/msun/src/s_ceilf.c \
upstream-freebsd/lib/msun/src/s_floor.c \
@ -425,14 +406,6 @@ endif
# -----------------------------------------------------------------------------
LOCAL_SRC_FILES_x86_64 += \
amd64/fenv.c \
upstream-freebsd/lib/msun/src/s_fma.c \
upstream-freebsd/lib/msun/src/s_fmaf.c \
upstream-freebsd/lib/msun/src/s_llrint.c \
upstream-freebsd/lib/msun/src/s_llrintf.c \
upstream-freebsd/lib/msun/src/s_lrint.c \
upstream-freebsd/lib/msun/src/s_lrintf.c \
upstream-freebsd/lib/msun/src/s_rint.c \
upstream-freebsd/lib/msun/src/s_rintf.c \
x86_64/sqrt.S \
x86_64/sqrtf.S \
x86_64/e_acos.S \
@ -454,6 +427,28 @@ LOCAL_SRC_FILES_x86_64 += \
x86_64/s_tanh.S \
x86_64/s_tan.S \
LOCAL_SRC_FILES_EXCLUDE_x86_64 += \
upstream-freebsd/lib/msun/src/e_acos.c \
upstream-freebsd/lib/msun/src/e_asin.c \
upstream-freebsd/lib/msun/src/e_atan2.c \
upstream-freebsd/lib/msun/src/e_cosh.c \
upstream-freebsd/lib/msun/src/e_exp.c \
upstream-freebsd/lib/msun/src/e_hypot.c \
upstream-freebsd/lib/msun/src/e_log.c \
upstream-freebsd/lib/msun/src/e_log10.c \
upstream-freebsd/lib/msun/src/e_pow.c \
upstream-freebsd/lib/msun/src/e_sinh.c \
upstream-freebsd/lib/msun/src/e_sqrt.c \
upstream-freebsd/lib/msun/src/e_sqrtf.c \
upstream-freebsd/lib/msun/src/s_atan.c \
upstream-freebsd/lib/msun/src/s_cbrt.c \
upstream-freebsd/lib/msun/src/s_cos.c \
upstream-freebsd/lib/msun/src/s_expm1.c \
upstream-freebsd/lib/msun/src/s_log1p.c \
upstream-freebsd/lib/msun/src/s_sin.c \
upstream-freebsd/lib/msun/src/s_tan.c \
upstream-freebsd/lib/msun/src/s_tanh.c \
ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
LOCAL_SRC_FILES_x86_64 += \
x86_64/ceil.S \
@ -463,8 +458,7 @@ LOCAL_SRC_FILES_x86_64 += \
x86_64/trunc.S \
x86_64/truncf.S \
else
LOCAL_SRC_FILES_x86_64 += \
LOCAL_SRC_FILES_EXCLUDE_x86_64 += \
upstream-freebsd/lib/msun/src/s_ceil.c \
upstream-freebsd/lib/msun/src/s_ceilf.c \
upstream-freebsd/lib/msun/src/s_floor.c \

View File

@ -272,8 +272,8 @@ LIBC {
*;
};
LIBC_PRIVATE { # arm x86 mips
global: # arm x86 mips
LIBC_PRIVATE { # arm mips
global: # arm mips
___Unwind_Backtrace; # arm
___Unwind_ForcedUnwind; # arm
___Unwind_RaiseException; # arm
@ -354,7 +354,6 @@ LIBC_PRIVATE { # arm x86 mips
__lesf2; # arm
__ltdf2; # arm
__ltsf2; # arm
__muldc3; # arm x86 mips
__muldf3; # arm
__nedf2; # arm
__nesf2; # arm
@ -376,4 +375,4 @@ LIBC_PRIVATE { # arm x86 mips
_Unwind_VRS_Pop; # arm
_Unwind_VRS_Set; # arm
restore_core_regs; # arm
} LIBC; # arm x86 mips
} LIBC; # arm mips

View File

@ -271,8 +271,8 @@ LIBC {
*;
};
LIBC_PRIVATE { # arm x86 mips
global: # arm x86 mips
LIBC_PRIVATE { # arm mips
global: # arm mips
___Unwind_Backtrace; # arm
___Unwind_ForcedUnwind; # arm
___Unwind_RaiseException; # arm
@ -353,7 +353,6 @@ LIBC_PRIVATE { # arm x86 mips
__lesf2; # arm
__ltdf2; # arm
__ltsf2; # arm
__muldc3; # arm x86 mips
__muldf3; # arm
__nedf2; # arm
__nesf2; # arm
@ -375,4 +374,4 @@ LIBC_PRIVATE { # arm x86 mips
_Unwind_VRS_Pop; # arm
_Unwind_VRS_Set; # arm
restore_core_regs; # arm
} LIBC; # arm x86 mips
} LIBC; # arm mips

View File

@ -272,11 +272,10 @@ LIBC {
*;
};
LIBC_PRIVATE { # arm x86 mips
global: # arm x86 mips
LIBC_PRIVATE { # arm mips
global: # arm mips
__fixdfdi; # arm mips
__fixsfdi; # arm mips
__fixunsdfdi; # arm mips
__fixunssfdi; # arm mips
__muldc3; # arm x86 mips
} LIBC; # arm x86 mips
} LIBC; # arm mips

View File

@ -272,7 +272,3 @@ LIBC {
*;
};
LIBC_PRIVATE { # arm x86 mips
global: # arm x86 mips
__muldc3; # arm x86 mips
} LIBC; # arm x86 mips

View File

@ -9,12 +9,12 @@ LOCAL_SRC_FILES := \
dlfcn.cpp \
linker.cpp \
linker_allocator.cpp \
linker_sdk_versions.cpp \
linker_block_allocator.cpp \
linker_libc_support.c \
linker_mapped_file_fragment.cpp \
linker_memory.cpp \
linker_phdr.cpp \
linker_sdk_versions.cpp \
linker_utils.cpp \
rt.cpp \

View File

@ -16,12 +16,10 @@
#include "linker.h"
#include <dlfcn.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <android/dlext.h>
#include <android/api-level.h>
#include <bionic/pthread_internal.h>
@ -70,8 +68,7 @@ void android_update_LD_LIBRARY_PATH(const char* ld_library_path) {
static void* dlopen_ext(const char* filename, int flags,
const android_dlextinfo* extinfo, void* caller_addr) {
ScopedPthreadMutexLocker locker(&g_dl_mutex);
soinfo* caller = find_containing_library(caller_addr);
soinfo* result = do_dlopen(filename, flags, extinfo, caller);
soinfo* result = do_dlopen(filename, flags, extinfo, caller_addr);
if (result == nullptr) {
__bionic_format_dlerror("dlopen failed", linker_get_error_buffer());
return nullptr;
@ -89,70 +86,32 @@ void* dlopen(const char* filename, int flags) {
return dlopen_ext(filename, flags, nullptr, caller_addr);
}
void* dlsym(void* handle, const char* symbol) {
extern android_namespace_t* g_anonymous_namespace;
void* dlsym_impl(void* handle, const char* symbol, const char* version, void* caller_addr) {
ScopedPthreadMutexLocker locker(&g_dl_mutex);
#if !defined(__LP64__)
if (handle == nullptr) {
__bionic_format_dlerror("dlsym library handle is null", nullptr);
return nullptr;
}
#endif
if (symbol == nullptr) {
__bionic_format_dlerror("dlsym symbol name is null", nullptr);
void* result;
if (!do_dlsym(handle, symbol, version, caller_addr, &result)) {
__bionic_format_dlerror(linker_get_error_buffer(), nullptr);
return nullptr;
}
soinfo* found = nullptr;
const ElfW(Sym)* sym = nullptr;
return result;
}
void* dlsym(void* handle, const char* symbol) {
void* caller_addr = __builtin_return_address(0);
soinfo* caller = find_containing_library(caller_addr);
return dlsym_impl(handle, symbol, nullptr, caller_addr);
}
if (handle == RTLD_DEFAULT || handle == RTLD_NEXT) {
sym = dlsym_linear_lookup(symbol, &found, caller, handle);
} else {
sym = dlsym_handle_lookup(reinterpret_cast<soinfo*>(handle), &found, symbol);
}
if (sym != nullptr) {
unsigned bind = ELF_ST_BIND(sym->st_info);
if ((bind == STB_GLOBAL || bind == STB_WEAK) && sym->st_shndx != 0) {
return reinterpret_cast<void*>(found->resolve_symbol_address(sym));
}
__bionic_format_dlerror("symbol found but not global", symbol);
return nullptr;
} else {
__bionic_format_dlerror("undefined symbol", symbol);
return nullptr;
}
void* dlvsym(void* handle, const char* symbol, const char* version) {
void* caller_addr = __builtin_return_address(0);
return dlsym_impl(handle, symbol, version, caller_addr);
}
int dladdr(const void* addr, Dl_info* info) {
ScopedPthreadMutexLocker locker(&g_dl_mutex);
// Determine if this address can be found in any library currently mapped.
soinfo* si = find_containing_library(addr);
if (si == nullptr) {
return 0;
}
memset(info, 0, sizeof(Dl_info));
info->dli_fname = si->get_realpath();
// Address at which the shared object is loaded.
info->dli_fbase = reinterpret_cast<void*>(si->base);
// Determine if any symbol in the library contains the specified address.
ElfW(Sym)* sym = si->find_symbol_by_address(addr);
if (sym != nullptr) {
info->dli_sname = si->get_string(sym->st_name);
info->dli_saddr = reinterpret_cast<void*>(si->resolve_symbol_address(sym));
}
return 1;
return do_dladdr(addr, info);
}
int dlclose(void* handle) {
@ -177,6 +136,34 @@ uint32_t android_get_application_target_sdk_version() {
return get_application_target_sdk_version();
}
bool android_init_namespaces(const char* public_ns_sonames,
const char* anon_ns_library_path) {
ScopedPthreadMutexLocker locker(&g_dl_mutex);
bool success = init_namespaces(public_ns_sonames, anon_ns_library_path);
if (!success) {
__bionic_format_dlerror("android_init_namespaces failed", linker_get_error_buffer());
}
return success;
}
android_namespace_t* android_create_namespace(const char* name, const char* ld_library_path,
const char* default_library_path, uint64_t type,
const char* permitted_when_isolated_path) {
void* caller_addr = __builtin_return_address(0);
ScopedPthreadMutexLocker locker(&g_dl_mutex);
android_namespace_t* result = create_namespace(caller_addr, name, ld_library_path,
default_library_path, type,
permitted_when_isolated_path);
if (result == nullptr) {
__bionic_format_dlerror("android_create_namespace failed", linker_get_error_buffer());
}
return result;
}
// name_offset: starting index of the name in libdl_info.strtab
#define ELF32_SYM_INITIALIZER(name_offset, value, shndx) \
{ name_offset, \
@ -203,11 +190,11 @@ static const char ANDROID_LIBDL_STRTAB[] =
// 00000000001 1111111112222222222 3333333333444444444455555555556666666666777 777777788888888889999999999
// 01234567890 1234567890123456789 0123456789012345678901234567890123456789012 345678901234567890123456789
"erate_phdr\0android_dlopen_ext\0android_set_application_target_sdk_version\0android_get_application_tar"
// 0000000000111111
// 0123456789012345
"get_sdk_version\0"
// 0000000000111111 111122222222223333333333 4444444444555555555566666 6666677
// 0123456789012345 678901234567890123456789 0123456789012345678901234 5678901
"get_sdk_version\0android_init_namespaces\0android_create_namespace\0dlvsym\0"
#if defined(__arm__)
// 216
// 272
"dl_unwind_find_exidx\0"
#endif
;
@ -229,8 +216,11 @@ static ElfW(Sym) g_libdl_symtab[] = {
ELFW(SYM_INITIALIZER)(111, &android_dlopen_ext, 1),
ELFW(SYM_INITIALIZER)(130, &android_set_application_target_sdk_version, 1),
ELFW(SYM_INITIALIZER)(173, &android_get_application_target_sdk_version, 1),
ELFW(SYM_INITIALIZER)(216, &android_init_namespaces, 1),
ELFW(SYM_INITIALIZER)(240, &android_create_namespace, 1),
ELFW(SYM_INITIALIZER)(265, &dlvsym, 1),
#if defined(__arm__)
ELFW(SYM_INITIALIZER)(216, &dl_unwind_find_exidx, 1),
ELFW(SYM_INITIALIZER)(272, &dl_unwind_find_exidx, 1),
#endif
};
@ -247,18 +237,20 @@ static ElfW(Sym) g_libdl_symtab[] = {
// Note that adding any new symbols here requires stubbing them out in libdl.
static unsigned g_libdl_buckets[1] = { 1 };
#if defined(__arm__)
static unsigned g_libdl_chains[] = { 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0 };
static unsigned g_libdl_chains[] = { 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0 };
#else
static unsigned g_libdl_chains[] = { 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0 };
static unsigned g_libdl_chains[] = { 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0 };
#endif
static uint8_t __libdl_info_buf[sizeof(soinfo)] __attribute__((aligned(8)));
static soinfo* __libdl_info = nullptr;
extern android_namespace_t g_default_namespace;
// This is used by the dynamic linker. Every process gets these symbols for free.
soinfo* get_libdl_info() {
if (__libdl_info == nullptr) {
__libdl_info = new (__libdl_info_buf) soinfo("libdl.so", nullptr, 0, RTLD_GLOBAL);
__libdl_info = new (__libdl_info_buf) soinfo(&g_default_namespace, "libdl.so", nullptr, 0, RTLD_GLOBAL);
__libdl_info->flags_ |= FLAG_LINKED;
__libdl_info->strtab_ = ANDROID_LIBDL_STRTAB;
__libdl_info->symtab_ = g_libdl_symtab;

View File

@ -25,12 +25,49 @@ struct LinkedListEntry {
T* element;
};
// ForwardInputIterator
template<typename T>
class LinkedListIterator {
public:
LinkedListIterator() : entry_(nullptr) {}
LinkedListIterator(const LinkedListIterator<T>& that) : entry_(that.entry_) {}
explicit LinkedListIterator(LinkedListEntry<T>* entry) : entry_(entry) {}
LinkedListIterator<T>& operator=(const LinkedListIterator<T>& that) {
entry_ = that.entry_;
return *this;
}
LinkedListIterator<T>& operator++() {
entry_ = entry_->next;
return *this;
}
T* operator*() {
return entry_->element;
}
bool operator==(const LinkedListIterator<T>& that) const {
return entry_ == that.entry_;
}
bool operator!=(const LinkedListIterator<T>& that) const {
return entry_ != that.entry_;
}
private:
LinkedListEntry<T> *entry_;
};
/*
* Represents linked list of objects of type T
*/
template<typename T, typename Allocator>
class LinkedList {
public:
typedef LinkedListIterator<T> iterator;
typedef T* value_type;
LinkedList() : head_(nullptr), tail_(nullptr) {}
~LinkedList() {
clear();
@ -127,7 +164,13 @@ class LinkedList {
} else {
p->next = next;
}
if (tail_ == e) {
tail_ = p;
}
Allocator::free(e);
e = next;
} else {
p = e;
@ -147,6 +190,24 @@ class LinkedList {
return nullptr;
}
iterator begin() {
return iterator(head_);
}
iterator end() {
return iterator(nullptr);
}
iterator find(T* value) {
for (LinkedListEntry<T>* e = head_; e != nullptr; e = e->next) {
if (e->element == value) {
return iterator(e);
}
}
return end();
}
size_t copy_to_array(T* array[], size_t array_length) const {
size_t sz = 0;
for (LinkedListEntry<T>* e = head_; sz < array_length && e != nullptr; e = e->next) {

Some files were not shown because too many files have changed in this diff Show More