Also clean up the implementation of all the pty functions, add tests,
and fix the stub implementations of ttyname(3) and ttyname_r(3).
Bug: https://code.google.com/p/android/issues/detail?id=58888
(cherry picked from commit 4916706cfe590eb06c9b5bd4bd402ce056034d51)
Change-Id: I5cb7a1c17b156456e4c4818e65f256eb8d045424
bionic_systrace.h contains an implementation of tracing that
can be used with systrace.py and its associated viewer. pthread_mutex
now uses this tracing to track pthread_mutex contention, which can be
enabled by using the "bionic" command line option to systrace.
Bug: 15116468
(cherry picked from commit a406ee6d5f616192e9a13afad6ac6a9969814fc1)
Change-Id: Ic98fc303689fe9384974150d0d258c50806a55e4
This doesn't require us to change any of the syscall implementations
because (a) the LP32 ones have sizeof(int) == sizeof(long) anyway,
which is how we never noticed this bug before and (b) the LP64 ones
all use a 64-bit register for the result (and for the syscall number
too).
Bug: https://code.google.com/p/android/issues/detail?id=73952
Bug: 16568314
(cherry picked from commit 21972b61ec0572395c5684eebc6cc7b3a4c9e3be)
Change-Id: Ifbc424be29e5650ec72a24df25dd35f24fdd5b3c
It seemed like a clever trick to use the internal log message formatting
code in syslog(3), but on reflection that means you can't (for example)
format floating point numbers. This patch switches us over to using good
old vsnprintf(3), even though that requires us to jump through a few hoops.
There's no obvious way to unit test this, so I wrote a little program and
ran that.
Bug: 14292866
Change-Id: I9c83500ba9cbb209b6f496067a91bf69434eeef5
This also brings our copy of strftime.c much closer to upstream, though
we still have several GNU extensions and hacks to deal with Android32's
broken time_t.
Bug: 15765976
(cherry picked from commit 39d903aea901cd29a4eef3a82c2dbda59b5bc292)
Change-Id: Ie278d3e976b7adc77bad5ce795dd4899cfbf3648
Linker now calls init functions for itself.
(cherry picked from commit 4151ea73b75e274d1ff80b42d9d457a783208516)
Change-Id: I3300fe22de8ad8466a5b1c2d551429769a42852d
On 32-bit MIPS, 64-bit atomic ops are achieved through locks.
So allow the test to fail for atomic_intmax_t on 32-bit MIPS.
(cherry picked from commit f1837377d215a6eda294b6ac7552b226deee91ce)
Change-Id: I973d999c31c9ab89b5a7b709beff6486b93408f2
I've also added insque(3) and remque(3) (from NetBSD because the OpenBSD
ones are currently broken for non-circular lists).
I've not added the three hash table functions that should be in this header
because they operate on a single global hash table and thus aren't likely
to be useful.
Bug: https://code.google.com/p/android/issues/detail?id=73719
(cherry picked from commit 3e424d0a241f8ae5194514dabc4ad899f5a5416d)
Change-Id: I5882a6b48c80fea8ac6b9c27e7b9de10b202b4ff
Save and restore floating point registers via 64-bit
load/stores when possible. Use assembler's builtin macro
ops to generate pairs of 32-bit load/stores on Mips I cpus.
Some cpus or FR modes have only 16 even-numbered dp fp regs.
This is exposed by _MIPS_FPSET, defined by existing compilers.
(cherry picked from commit dd37251c473e1483faba0fd5aaf30e7a55582e8a)
Change-Id: Ibd43653701a363a77af85121d3cbd229d132a06a
PR_GET_DUMPABLE is used by an application to indicate whether or
not core dumps / PTRACE_ATTACH should work.
Security sensitive applications often set PR_SET_DUMPABLE to 0 to
disable core dumps, to avoid leaking sensitive memory to persistent
storage. Similarly, they also set PR_SET_DUMPABLE to zero to prevent
PTRACE_ATTACH from working, again to avoid leaking the contents
of sensitive memory.
Honor PR_GET_DUMPABLE when connecting to debuggerd. If an application
has said it doesn't want its memory dumped, then we shouldn't
ask debuggerd to dump memory on its behalf.
FORTIFY_SOURCE tests: Modify the fortify_source tests to set
PR_SET_DUMPABLE=0. This reduces the total runtime of
/data/nativetest/bionic-unit-tests/bionic-unit-tests32 from approx
53 seconds to 25 seconds. There's no need to connect to debuggerd
when running these tests.
Bug: 16513137
(cherry picked from commit be0e43b77676338fd5e6a82c9cc2b6302d579de2)
Change-Id: I6e1a9bce564e94fc19893d639b15f38c549cabfa
The change that added this support causes a cpu hard lock on one
device. This code clearly isn't at fault, but disabling it to
unblock until we can find a real fix.
Bug: 16484311
Change-Id: I33834dc49d959ae403b10d2c7cad12ae2950f772
Explicitly tell 32-bit links that they are doing 32-bit links.
This is needed when using united 32-bit and 64-bit toolchains.
This is harmless when using older separate 32-only toolchains.
(cherry picked from commit f541650828f75b3dab22c9c0caab845be78b80fc)
Change-Id: I8df0ee7d36c6409458e18bea4e0e8b132edf77dc
The getentropy_linux.c is lightly modified to build on Android, but we're now
completely in sync with upstream OpenBSD's arc4random implementation.
(cherry picked from commit 2b67d7dee09852789d9ac7d8972ed6cdb2c18430)
Change-Id: Icc939b5fa2fcac3e15ff93735d2d34f67e9bb149
Since we don't have syslogd on Android and you can't run one on a non-rooted
device, it's more useful if syslog output just goes to the regular Android
logging system.
Bug: 14292866
(cherry picked from commit 3ad8ecb64e9dd5614169232b84a93eb3b8aa32d7)
Change-Id: I3038855ca4f22532bf6d2c45d3f8028b866975f9
Some platform code is apparently compiled with switches that do
not support char16_t and char32_t. This caused stdatomic.h to fail
to compile. This CL makes stdatomic.h usable in those environments.
(cherry picked from commit 8b002362d996859ebfc8588d6859a9a79203dc27)
Change-Id: Ie5a17f20b8b545c97128d00605b4eabd2a6bfe3e
prctl shouldn't be in <unistd.h>.
(cherry picked from commit 9c07aee83b4ebbf2dba8e23d6896683187b9724e)
Change-Id: I70cda886fbf4d58d82dc70adaa981506ebff9949
To avoid any issues calling malloc related routines, use mmap/munmap.
Specifically, this avoids any problems when this is compiled into a
malloc debug shared library.
(cherry picked from commit 6425327c3278137d153b8a7505f97d2f5f058d49)
Change-Id: If43d12b2c588c9abcbfbbd2c53702cdac7695a73
Also remove __bionic_name_mem which has exactly one caller, and is only
ever expected to be used in this one place.
(cherry picked from commit d7453860a6b06e7d4a960c20792ce6f0b6cc5f3a)
Change-Id: I26b7638609e9d4eaf4f21ae29721ea27d4176702
Also, fix incorrect path to some tools.
(cherry picked from commit ea271fdf2671707ed29bc6b564f544d2489115ff)
Change-Id: Ie93cbc84b9a46d622b0b462a33bed0ee129992cb
Had intended to remove this one before submitting the locale changes,
but forgot. It isn't a standard ctype function, so we don't need it.
Change-Id: Ie9c09fa6c61b1101b5992fa06da30e373a0c6bf7
There were two bugs here:
- For 64 bit values, this did not properly round up.
- The macro rounded to the power of 2 less than value, not to the power
of 2 greater than value.
(cherry picked from commit 27047faf283cb9d3d025a984cd9934fd2c404407)
Change-Id: Idf1ec67854e1eb423704e599ae1c6b674d36618d
Code developed for glibc or older versions of bionic might expect more
randomness than the BSD implementation provides.
Bug: 15829381
(cherry picked from commit 76c241b091b4d9d9a9237d40e814e52ce2917f47)
Change-Id: If721b3f16efdb21cb67df5ec5034c0ba905bd029