The problem is that time_t is signed, and the original code relied on the
fact that (X + c < X) in case of overflow for c >= 0. Unfortunately, this
condition is only guaranteed by the standard for unsigned arithmetic, and
the gcc 4.4.0 optimizer did completely remove the corresponding test from
the code. This resulted in a missing boundary check, and an infinite loop.
The problem is solved by testing explicitely for TIME_T_MIN and TIME_T_MAX
in the loop that uses this.
Also fix increment_overflow and long_increment_overflow which were buggy
for exactly the same reasons.
Note: a similar fix is needed for system/core/libcutils
Merge commit '9e74f697e0178a0e9b6133a2b270cc7fed9920bf' into eclair-plus-aosp
* commit '9e74f697e0178a0e9b6133a2b270cc7fed9920bf':
libc: add void to clock() function prototype
ARMv6 onwards. These architectures provide the load-linked, store-conditional pair of ldrex/strex whose use
is recommended in place of 'swp'. Also, the description of the 'swp' instruction in the ARMv6 reference
manual states that the swap operation does not include any memory barrier guarantees.This fix attempts to
address these issues by providing an atomic swap implementation using ldrex/strex under _ARM_HAVE_LDREX_STREX
macro. This Fix is verified on ST Ericsson's U8500 platform and Submitted on behalf of a third-party:
Surinder-pal SINGH from STMicroelectronics.
Main differences from original code:
1. now log channel for LOG_ID_MAIN may exist even if LOG_ID_RADIO
facility failed.
2. __write_to_log_null() now acts as always successful function.
3. it's more simplier to add new logging channels now
ammended commit fixes my typo on line 130
Merge commit '3773d35eb98e22b5edab4d82fb72bdf86ff80494'
* commit '3773d35eb98e22b5edab4d82fb72bdf86ff80494':
Make the DNS resolver accept domain names with an underscore.
More precisely, this accepts domain labels with an underscore in
the middle (i.e. not at the start or the end of the label). This
is needed to perform complex CNAME chain resolution in certain
VPN networks.
Some libc changes were preventing the initialization call from being made.
The basic problem appears to be that libc_init_common.c is only built once,
and it's only built for the non-debug libc.
Merge commit 'ef0bd1857041ffde069cf52138aaf22c1af7130e'
* commit 'ef0bd1857041ffde069cf52138aaf22c1af7130e':
Pass the elfdata pointer in a slot of the temporary TLS area.
This allows libc.so to run the C runtime initializer as soon as the
dynamic linker loads the shared library, i.e. before any other initializers
(e.g. static C++ constructors in other shared libraries the executable depends
on).
This also removes the bug where the initializers from the executable itself
were run twice: once by the dynamic linker, and another time by __libc_init
as defined by libc_init_dynamic.c
This is needed to properly initialize the C runtime when libc.so
is loaded by the dynamic linker.
Move the temporary TLS setup before the first system call, just
in case something really horrible happens, we won't crash when
trying to write an error code in 'errno'
Remove the broken TLS_SLOT_THREAD_ID setup. First, this slot
should normally receive the address of a pthread_internal_t,
not a kernel thread identifier. Second, it is never used by
the linker anyway.
Also remove an obsolete comment.
Merge commit 'c4eee3765bf9dd81ff055e70ff7daa83a3926d2a'
* commit 'c4eee3765bf9dd81ff055e70ff7daa83a3926d2a':
Prevent a crash in the memory leak checker (which happened in chk_free())
Simplify the code a little, removing un-necessary mutex locks/unlocks.
Provide slightly better diagnostic message in case of corruption.
Use snprintf/strlcat instead of sprintf/strcat
Merge commit '09baf4e881c78e67c7849aa81432ceb34e72e913'
* commit '09baf4e881c78e67c7849aa81432ceb34e72e913':
Add Glibc-compatible macro aliases for the nanosecond time accessors in stat structure
Merge commit '3ddc15e10a6f5690e53e729c0da2c42f0eb944d1'
* commit '3ddc15e10a6f5690e53e729c0da2c42f0eb944d1':
Add new clean header for PPP on PPTP (VPN)
Merge commit '3a654b1e04d4275ae315cfe1b196998acf10052c'
* commit '3a654b1e04d4275ae315cfe1b196998acf10052c':
Revert "Fix the C library initialization to avoid calling static C++ constructors twice."
Merge commit '03eabfe65e1e2c36f4d26c78a730fa19a3bdada3'
* commit '03eabfe65e1e2c36f4d26c78a730fa19a3bdada3':
Fix the C library initialization to avoid calling static C++ constructors twice.
The problem was due to the fact that, in the case of dynamic executables,
the dynamic linker calls the DT_PREINIT_ARRAY, DT_INIT and DT_INIT_ARRAY
constructors when loading shared libraries and dynamic executables,
*before* calling the executable's entry point (i.e. arch-$ARCH/bionic/crtbegin_dynamic.c)
which in turns call __libc_init() in libc.so, as defined by bionic/libc_init_dynamic.c
The latter did call these constructors array again, mistakenly.
The patch also updates the documentation of many related functions.
Also adds a new section to linker/README.TXT explaining restrictions on
C library usage.
The patch has been tested on a Dream for stability issues with
proprietary blobs:
- H264 decoding works
- Camera + Video recording works
- GPS works
- Sensors work
The tests in system/extra/tests/bionic/libc/common/test_static_cpp_mutex.cpp has been
run and shows the static C++ constructor being called only once.
Merge commit '49e55332784b82f7112ee7c1ea3c176c9dc32d7a'
* commit '49e55332784b82f7112ee7c1ea3c176c9dc32d7a':
libc: Add an intermediate version of the static libc without malloc
Removes a lot of redundant code, and reorganizes the file. We first
setup all the comomn variables we may need, and then define the
actual libraries that need to be generated.
Signed-off-by: Dima Zavin <dima@android.com>
Merge commit 'cdb68bf8ce26448cfe173d86f1c074e167c3420f'
* commit 'cdb68bf8ce26448cfe173d86f1c074e167c3420f':
Fix getservent() so that it returns s_port in network byte order.
Merge commit '5c106fcaa5b9d0a3ebeb2e8cdca589129d6a7ebd'
* commit '5c106fcaa5b9d0a3ebeb2e8cdca589129d6a7ebd':
Fix __eabi_atexit() implementation, as well as a bug in the BSD-originated __cxa_finalize() implementation
* changes:
Fix __eabi_atexit() implementation, as well as a bug in the BSD-originated __cxa_finalize() implementation This patch uses "#if ANDROID" instead of "#if 1" in the __cxa_finalize() fix
Merge commit 'd386afcc41e92c96778d9b1a498199f48fa2d4aa'
* commit 'd386afcc41e92c96778d9b1a498199f48fa2d4aa':
revert to previous implementation of __aeabi_atexit() since the new one seems to crash a static ICU String destructor.
Merge commit '3e16f84fcad103c97a2df4a58948835277043569'
* commit '3e16f84fcad103c97a2df4a58948835277043569':
Fix __aeabi_atexit to call __cxa_atexit properly. This function is defined by the C++ ABI for ARM document.
the issue is that the BSD implementation doesn't accept a call like:
getaddrinfo(SERVER_NAME, "9999", NULL, &res);
because if will reject a numerical string in the second parameter if no hints are explicitely
provided. This technically doesn't violate POSIX but might make porting Linux software a bit
difficult. For more details see:
http://groups.google.com/group/android-ndk/browse_thread/thread/818ab9c53f24c87
also comment debugging printf() calls which shouldn't be there.
Merge commit '85a01ffba337b123436f57eba4daae38c7c90d1e'
* commit '85a01ffba337b123436f57eba4daae38c7c90d1e':
Add the domain search list for VPN connection.
* changes:
Add the domain search list for VPN connection. The current solution is to read the net.dns.search property, and expand the list during the resolve initialization. In the future, we could implement search list per process.
Merge commit 'd2c9dcc9265e66f6432ec39dcc7378b944449e60'
* commit 'd2c9dcc9265e66f6432ec39dcc7378b944449e60':
libc: Replace a reference to TARGET_BUILD_TYPE with DEBUG_BIONIC_LIBC
The current solution is to read the net.dns.search property,
and expand the list during the resolve initialization. In the
future, we could implement search list per process.
Update: refine the code accordingly.
Update: remove unnecessary code.
Update: remove the unused variable.