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
When __cxa_thread_atexit_impl.cpp is compiled with clang on arm64,
Android cannot boot up.
BUG: 25662915
Change-Id: If997b544f43e956172ce605d86fe147d42fd39e0
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
The mremap definition was incorrect (unsigned long instead of int) and
it was missing the optional new_address parameter.
Change-Id: Ib9d0675aaa098c21617cedc9b2b8cf267be3aec4
This moves the generic arm/arm64/x86 settings into the main makefiles
and makes the rest of them derivatives. This better aligns with how
soong handles arch/cpu variants.
Also updates the Android.bp to make it consistent with the make
versions.
Change-Id: I5a0275d992bc657459eb6fe1697ad2336731d122
Rewrite inet_addr and inet_network in terms of inet_aton, and reimplement
that to include all the missing error checks.
Bug: http://b/24754503
Change-Id: I5dfa971c87201968985a0894df419f0fbf54768a
This is quite a large patch because we haven't updated for some time,
but the good news is that upstream is now thread-safe so a lot of our
changes go away in this update and the remaining diff is a lot smaller.
(Note that our whitespace still doesn't match upstream. I use diff -wub
to compare. Upstream doesn't even really have a consistent style. New
code seems to be two spaces, old code tabs.)
From the intervening changelogs (eliding the changes that only affected
the tools, which we don't use):
2014a:
An uninitialized-storage bug in 'localtime' has been fixed.
(Thanks to Logan Chien.)
2014b:
'zic' and 'localtime' no longer reject locations needing four
transitions per year for the forseeable future. (Thanks to Andrew
Main (Zefram).)
2014c:
<None>
2014d:
<None>
2014e:
<None>
2014f:
'localtime', 'mktime', etc. now use much less stack space if
ALL_STATE is defined. (Thanks to Elliott Hughes for reporting the
problem.)
Some lint has been removed when using GCC_DEBUG_FLAGS with GCC
4.9.0.
2014g:
Unless NETBSD_INSPIRED is defined to 0, the tz library now
supplies functions for creating and using objects that represent
time zones. The new functions are tzalloc, tzfree, localtime_rz,
mktime_z, and (if STD_INSPIRED is also defined) posix2time_z and
time2posix_z. They are intended for performance: for example,
localtime_rz (unlike localtime_r) is trivially thread-safe without
locking. (Thanks to Christos Zoulas for proposing NetBSD-inspired
functions, and to Alan Barrett and Jonathan Lennox for helping to
debug the change.)
If THREAD_SAFE is defined to 1, the tz library is now thread-safe.
Although not needed for tz's own applications, which are single-threaded,
this supports POSIX better if the tz library is used in multithreaded apps.
Some crashes have been fixed when zdump or the tz library is given
invalid or outlandish input.
The tz library no longer mishandles leap seconds on platforms with
unsigned time_t in time zones that lack ordinary transitions after 1970.
The tz code now attempts to infer TM_GMTOFF and TM_ZONE if not
already defined, to make it easier to configure on common platforms.
Define NO_TM_GMTOFF and NO_TM_ZONE to suppress this.
Unless the new macro UNINIT_TRAP is defined to 1, the tz code now
assumes that reading uninitialized memory yields garbage values
but does not cause other problems such as traps.
If TM_GMTOFF is defined and UNINIT_TRAP is 0, mktime is now
more likely to guess right for ambiguous time stamps near
transitions where tm_isdst does not change.
If HAVE_STRFTIME_L is defined to 1, the tz library now defines
strftime_l for compatibility with recent versions of POSIX.
Only the C locale is supported, though. HAVE_STRFTIME_L defaults
to 1 on recent POSIX versions, and to 0 otherwise.
tzselect -c now uses a hybrid distance measure that works better
in Africa. (Thanks to Alan Barrett for noting the problem.)
The C source code now ports to NetBSD when GCC_DEBUG_FLAGS is used,
or when time_tz is defined.
When HAVE_UTMPX_H is set the 'date' command now builds on systems
whose <utmpx.h> file does not define WTMPX_FILE, and when setting
the date it updates the wtmpx file if _PATH_WTMPX is defined.
This affects GNU/Linux and similar systems.
For easier maintenance later, some C code has been simplified,
some lint has been removed, and the code has been tweaked so that
plain 'make' is more likely to work.
The C type 'bool' is now used for boolean values, instead of 'int'.
The long-obsolete LOCALE_HOME code has been removed.
The long-obsolete 'gtime' function has been removed.
2014h:
The tz library's localtime and mktime functions now set tzname to a value
appropriate for the requested time stamp, and zdump now uses this
on platforms not defining TM_ZONE, fixing a 2014g regression.
(Thanks to Tim Parenti for reporting the problem.)
The tz library no longer sets tzname if localtime or mktime fails.
An access to uninitalized data has been fixed.
(Thanks to Jörg Richter for reporting the problem.)
When THREAD_SAFE is defined, the code ports to the C11 memory model.
A memory leak has been fixed if ALL_STATE and THREAD_SAFE are defined
and two threads race to initialize data used by gmtime-like functions.
(Thanks to Andy Heninger for reporting the problems.)
2014i:
The time-related library functions now set errno on failure,
and some crashes in the new tzalloc-related library functions
have been fixed. (Thanks to Christos Zoulas for reporting
most of these problems and for suggesting fixes.)
If USG_COMPAT is defined and the requested time stamp is
standard time, the tz library's localtime and mktime functions
now set the extern variable timezone to a value appropriate
for that time stamp; and similarly for ALTZONE, daylight
saving time, and the altzone variable. This change is a
companion to the tzname change in 2014h, and is designed to
make timezone and altzone more compatible with tzname.
The tz library's functions now set errno to EOVERFLOW if they
fail because the result cannot be represented. ctime and
ctime_r now return NULL and set errno when a time stamp is out
of range, rather than having undefined behavior.
Some bugs associated with the new 2014g functions have been
fixed. This includes a bug that largely incapacitated the new
functions time2posix_z and posix2time_z. (Thanks to Christos
Zoulas.) It also includes some uses of uninitialized
variables after tzalloc. The new code uses the standard type
'ssize_t', which the Makefile now gives porting advice about.
2014j:
<None>
2015a:
tzalloc now scrubs time zone abbreviations compatibly with the way
that tzset always has, by replacing invalid bytes with '_' and by
shortening too-long abbreviations.
2015b:
Fix integer overflow bug in reference 'mktime' implementation.
(Problem reported by Jörg Richter.)
Allow -Dtime_tz=time_t compilations, and allow -Dtime_tz=... libraries
to be used in the same executable as standard-library time_t functions.
(Problems reported by Bradley White.)
2015c:
<None>
2015d:
<None>
2015e:
<None>
2015f:
<None>
2015g:
localtime no longer mishandles America/Anchorage after 2037.
(Thanks to Bradley White for reporting the bug.)
On hosts with signed 32-bit time_t, localtime no longer mishandles
Pacific/Fiji after 2038-01-16 14:00 UTC.
The localtime module allows the variables 'timezone', 'daylight',
and 'altzone' to be in common storage shared with other modules,
and declares them in case the system <time.h> does not.
(Problems reported by Kees Dekker.)
On platforms with tm_zone, strftime.c now assumes it is not NULL.
This simplifies the code and is consistent with zdump.c.
(Problem reported by Christos Zoulas.)
Change-Id: I9eb0a8323cb8bd9968fcfe612dc14f45aa3b59d2
Kati won't override something set with :=, only ?=.
Note that the actually reveals that our coverage build has been broken
for... some time. The issue is that we have static libraries built
with clang and others built with gcc linked into the same .so. If we
use both libclang_rt.profile and libgcov together, we get duplicate
symbol errors. If we only use one or the other, we don't have all the
symbols we need.
This will be fixed once chh's TLS stuff makes it into our clang and we
can start building libc_thread_atexit_impl with clang.
Change-Id: I45d0f2e558a881ad8be71088102320724ced8fe5
Unfortunately --exclude-libs (now passed globally) clobbers our
version script, so we have to prevent the build system from using this
flag.
Bug: http://b/24166967
Change-Id: I33c766d399c418fdc17983c8c0a56608d463201e
Reuse the top bits of _JB_SIGFLAG field previously used to store a
boolean to store a cookie that's validated by [sig]longjmp to make it
harder to use as a ROP gadget. Additionally, encrypt saved registers
with the cookie so that an attacker can't modify a register's value to
a specific value without knowing the cookie.
Bug: http://b/23942752
Change-Id: Id0eb8d06916e89d5d776bfcaa9458f8826717ba3
Reports of devices not booting with a build range including
this patch. Reverting while I investigate.
This reverts commit 96dd2b6e85.
Bug: 23470962
Change-Id: I056f1d8668f52d31412868975f2143249fc7e8f0
These are just based on the read/pread{,64} implementations with the
function calls and error messages adjusted as appropriate. The only
difference is that the buffer parameters are const.
Change-Id: Ida1597a903807f583f230d74bcedffdb7b24fcf6
A __size_mul_overflow utility is used to take advantage of the checked
overflow intrinsics in Clang and GCC (>= 5). The fallback for older
compilers is the optimized but less than ideal overflow checking pattern
used in OpenBSD.
Change-Id: Ibb0d4fd9b5acb67983e6a9f46844c2fd444f7e69
The __libc_init_tls function in libc_init_common.cpp takes a reference
to a local variable so it ends up being protected. Since this happens
before TLS and the stack guard value are initialized, it breaks.
The libc_init_common code needs to be compiled with -fno-stack-protector
and can then be merged into libc_bionic.
Change-Id: Ie95ea2ff533d4af1cfad1c9bc59e49f20a8e119d
Clang/llvm x86_64 configuration of long double is still
incompatible with gcc.
https://llvm.org/bugs/show_bug.cgi?id=23897
BUG: 21899249
Change-Id: I47fd6d0ce2daa84ae0035e7885a4d90e4c3056f7
A continuation of commit 2825f10b7f.
Add O_PATH compatibility support for flistxattr(). This allows
a process to list out all the extended attributes associated with
O_PATH file descriptors.
Change-Id: Ie2285ac7ad2e4eac427ddba6c2d182d41b130f75
These are the problems fixed in this CL:
- The ndk_cruft.cpp file was not compiled for 64 bit.
- Some files where not compiled for libc_bionic.a due to a missing
patch-up-arch-specific-flags call.
- The libc_bionic_ndk.a patch up call was using bionic src, not
the bionic_ndk_src_files.
- Move mmap.cpp to the ndk src list where it was before because of
the above errors.
Bug: 21640784
Change-Id: I31e97bc8bf347c8e584cc17aa4b984a7d122b298
Support O_PATH file descriptors when handling fgetxattr and fsetxattr.
This avoids requiring file read access to pull extended attributes.
This is needed to support O_PATH file descriptors when calling
SELinux's fgetfilecon() call. In particular, this allows the querying
and setting of SELinux file context by using something like the following
code:
int dirfd = open("/path/to/dir", O_DIRECTORY);
int fd = openat(dirfd, "file", O_PATH | O_NOFOLLOW);
char *context;
fgetfilecon(fd, &context);
This change was motivated by a comment in
https://android-review.googlesource.com/#/c/152680/1/toys/posix/ls.c
Change-Id: Ic0cdf9f9dd0e35a63b44a4c4a08400020041eddf
All arch-arm and arch-arm64 .S files were compiled
by gcc with and without this patch. The output object files
were identical. When compiled with llvm and this patch,
the output files were also identical to gcc's output.
BUG: 18061004
Change-Id: I458914d512ddf5496e4eb3d288bf032cd526d32b