Commit graph

10016 commits

Author SHA1 Message Date
Dan Albert
938a8008a6 Fix mbsrtowcs(3) src param for finished string.
A mistake I made while cleaning this up the first time through.
mbstrtowcs(3) sets the src param to null if it finishes the string.

Change-Id: I6263646e25d9537043b7025fd1dd6ae195f365e2
(cherry picked from commit b6cc8e00cd)
2014-08-06 13:00:54 -07:00
Elliott Hughes
00a8344ae8 Merge "Workaround b/16818336 which fails build under aggressive inlining." into lmp-dev 2014-08-06 17:14:55 +00:00
Dehao Chen
7aa27e1c1a Workaround b/16818336 which fails build under aggressive inlining.
Change-Id: Ifcd596714c427a2ec39502b9c0af9082ded91884
2014-08-05 18:09:01 -07:00
Paul Jensen
7a5f0952a2 Merge "Revert most of "Cleanup: Delete dead code."" into lmp-dev 2014-08-05 00:19:02 +00:00
Elliott Hughes
59b0933e6d Explain how wcswcs ended up in ndk_cruft.cpp.
(cherry picked from commit 1628eb1d43)

Change-Id: I335b35038781d0426b3647727e6c4f22c83e187b
2014-08-06 10:58:17 -07:00
Paul Jensen
1544eae56e Revert most of "Cleanup: Delete dead code."
This reverts most of commit 2582f02a01.
The DNS cache flushing code needs to be called when routes change.

Change-Id: I5b04121bc428cc6a2e136b6c3269c395bfb4981f
bug:16549455
2014-08-06 13:38:16 -04:00
Dmitriy Ivanov
db7a17d4ff Revert "Revert "Fix dlsym(3) to do breadth first search.""
This reverts commit 1b1966d944.

Change-Id: I05d6d3481aaf8f3e260d2e5e950248519a1d347f
2014-08-04 23:39:22 +00:00
Dmitriy Ivanov
1b1966d944 Revert "Fix dlsym(3) to do breadth first search."
This reverts commit 422106a24d.

Change-Id: I9e26a6933d10eb30438b521450f2010997ca5aee
2014-08-04 16:38:57 +00:00
Christopher Ferris
61833de613 Fix memchr with a zero length.
The memchr implementation for 64 bit fails if these conditions occur:

- The buffer is 32 byte aligned.
- The buffer contains the character in the first byte.
- The count sent in is zero.

The function should return NULL, but it's not.

Bug: 16676625

(cherry picked from commit e03e1eac0b)

Change-Id: Ie4cca2c445127a0936ee2b96651a8e7204fbaffd
2014-07-30 16:33:11 -07:00
Elliott Hughes
4f76469e88 Implement <sys/fsuid.h>.
(cherry picked from commit 79310994d2)

Change-Id: I47688273691e5c95e5e9302eba254ccaaaad40ca
2014-07-30 16:18:03 -07:00
Duane Sand
cd54195262 [MIPSR6] Use C-coded string ops on mips32r6/mips64r6
The existing assembler code uses deprecated lwl/lwr/swl/swr ops.
Replacing those with misalignment-forgiving lw/sw ops may
involve careful performance tuning.

(cherry picked from commit bc5a3ec6df)

Change-Id: I35167da27f2d406339b7f24b4a1fb270c87bc12e
2014-07-30 15:17:12 -07:00
Elliott Hughes
11bf8a3025 Only wipe TLS for user-supplied stacks.
Bug: 16667988

(cherry picked from commit 40a5217448)

Change-Id: I7550fa47b76e643323aa3e2a53529e393c829e47
2014-07-30 14:56:34 -07:00
Christopher Ferris
c701e5b335 Use libunwindbacktrace for debug malloc code.
Create a method of disabling the debug allocation code paths so that
it's possible to use the libunwindbacktrace library without any
modifications.

Use this path to create and destroy the maps for the process. It's not
stricly necessary in the init code since the symbols are not modified
until after the initialize calls.

Also, remove the debug_XXX source files that doesn't need to be in libc.so.

Fix the maps reading code since it was completely broken for 64 bit.

Bug: 16408686

(cherry picked from commit 861c0ef37b)

Change-Id: I04445f0cf9a1e85172b64d57df92eb7939ce2332
2014-07-29 19:30:09 -07:00
Elliott Hughes
1242f7eb67 Remove declarations for things that don't exist.
The <grp.h> ones prevent gdb from building out of the box.

(cherry picked from commit f4c1a36a45)

Change-Id: I6958f2f1731de8c03df20b383decd414b78100aa
2014-07-29 17:48:01 -07:00
Elliott Hughes
f6aa17798c Merge "Revert "Added a bionic systrace class and tracing to pthread_mutex.cpp."" into lmp-dev 2014-07-29 21:36:00 +00:00
Elliott Hughes
26c1420fbb Revert "Added a bionic systrace class and tracing to pthread_mutex.cpp."
This reverts commit a09fe118b1.

Change-Id: Ia2eb07b57a25dc2ac76fecc0925efb2bed998156
2014-07-29 23:52:29 +00:00
Dan Albert
e872c9239a Merge "en_US.UTF-8 is also supported." into lmp-dev 2014-07-29 21:36:00 +00:00
Dan Albert
7149362d33 en_US.UTF-8 is also supported.
Change-Id: Ic35fad3596dc5e24ee8ae35543a274a471f27bb2
(cherry picked from commit 1abb8bd21d)
2014-07-29 14:20:47 -07:00
Dan Albert
d0a80a927f There is no _MIN for unsigned types.
Change-Id: I49c38e51197b750210bdbf28c9cf6db30452a206
(cherry picked from commit ee7f1b5946)
2014-07-29 14:20:37 -07:00
Dan Albert
4e58609587 Fix mbsrtowcs(3)'s handling of len parameter.
The len parameter is a _maximum_ length. The previous code was treating
it as an exact length, causing the following typical call to fail:

    mbsrtowcs(out, &in, sizeof(out), state); // sizeof(out) > strlen(in)

Change-Id: I48e474fd54ea5f122bc168a4d74bfe08704f28cc
(cherry picked from commit 6b55ba54ef)
2014-07-29 14:20:31 -07:00
Dan Albert
1dd1b88bde __libc_fatal should print a newline to stderr.
Change-Id: I088dc880d7488a65beac8cda95f530f3db41f112
(cherry picked from commit 97e31dedf0)
2014-07-29 14:20:15 -07:00
Elliott Hughes
2ea0a58e01 Fix linkage of grantpt(3).
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 4916706cfe)

Change-Id: I5cb7a1c17b156456e4c4818e65f256eb8d045424
2014-07-29 10:48:34 -07:00
Brigid Smith
a09fe118b1 Added a bionic systrace class and tracing to pthread_mutex.cpp.
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 a406ee6d5f)

Change-Id: Ic98fc303689fe9384974150d0d258c50806a55e4
2014-07-29 09:41:44 -07:00
Dmitriy Ivanov
1a5db57d5a Fix mips/mips64 build
Add _start entry label to mips/mips64 linker begin.S

(cherry picked from commit ed48534718)

Change-Id: Id1b6bb3258f3bfbe3b7ec9491a977f56e44bed14
2014-07-28 22:00:01 -07:00
Dmitriy Ivanov
5febb0da6f Fix 'adb shell /system/bin/linker' crash
Bug: https://code.google.com/p/android/issues/detail?id=63174

(cherry picked from commit efe13832dc)

Change-Id: I43629e4a14870f67abc2dd5ff2e3040c47b2168d
2014-07-28 16:50:44 -07:00
Elliott Hughes
2be1be47aa Revert "Add a hack to <stdlib.h> until we can fix libvpx."
This reverts commit 3fb5097a7e.
libvpx is now fixed.

Bug: 15598056
Change-Id: Icca974e667f92206505f484bd291726eb0150f68
2014-07-28 16:16:38 -07:00
Elliott Hughes
78e4f8fed2 syscall(3)'s return type should be long.
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 21972b61ec)

Change-Id: Ifbc424be29e5650ec72a24df25dd35f24fdd5b3c
2014-07-28 15:39:24 -07:00
Elliott Hughes
b1b60c30bf Use vsnprintf(3) in syslog(3).
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
2014-07-28 09:33:00 -07:00
Elliott Hughes
c1a6a72560 Remove localtime_tz and strftime_tz.
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 39d903aea9)

Change-Id: Ie278d3e976b7adc77bad5ce795dd4899cfbf3648
2014-07-25 17:28:52 -07:00
Elliott Hughes
708c112054 Start hiding "private/bionic_time.h".
Bug: 15765976

(cherry picked from commit 905e6d58aa)

Change-Id: Ic7435308e8b521886f42ac7bf59531924921ea67
2014-07-25 15:24:57 -07:00
Dan Albert
9379ce694d Merge "There is no _MIN for unsigned types." into lmp-dev 2014-07-25 21:16:23 +00:00
Dan Albert
a1a813da81 Merge "Fix mbsrtowcs(3)'s handling of len parameter." into lmp-dev 2014-07-28 22:45:16 +00:00
Dan Albert
8db0ce7050 Merge "__libc_fatal should print a newline to stderr." into lmp-dev 2014-07-25 21:16:23 +00:00
Dmitriy Ivanov
422106a24d Fix dlsym(3) to do breadth first search.
dlsym(3) with handle != RTLD_DEFAULT|RTLD_NEXT performs
  breadth first search through the dependency tree.

Bug: 16653281

(cherry picked from commit aa0f2bdbc2)

Change-Id: I0ba8c2034ab341f8a279cdb4e2e7e47f1aef7897
2014-07-29 15:02:15 -07:00
Dmitriy Ivanov
6554996948 Fix global variable initialization for linker
Linker now calls init functions for itself.

(cherry picked from commit 4151ea73b7)

Change-Id: I3300fe22de8ad8466a5b1c2d551429769a42852d
2014-07-24 16:49:36 -07:00
Raghu Gandham
34b258dd69 [MIPS] Fix atomic_is_lock_free test for mips32.
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 f1837377d2)

Change-Id: I973d999c31c9ab89b5a7b709beff6486b93408f2
2014-07-24 16:22:02 -07:00
Elliott Hughes
b902641d73 Implement twalk(3), add unit tests.
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 3e424d0a24)

Change-Id: I5882a6b48c80fea8ac6b9c27e7b9de10b202b4ff
2014-07-24 15:14:06 -07:00
Duane Sand
5ade7e3f6b [MIPS] Drop soft-fp targets
(cherry picked from commit ba23bd0a40)

Change-Id: Ica09192c2760d38ceebc14e23a5d3ba94c20764c
2014-07-24 11:17:55 -07:00
Duane Sand
c86950cb3f [MIPSR6] setjmp supports mips32r6 and FP64A/FPXX reg models
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 dd37251c47)

Change-Id: Ibd43653701a363a77af85121d3cbd229d132a06a
2014-07-23 21:04:20 -07:00
Christopher Ferris
bc74ecfaf5 HACK: Disable syslog going to android log.
Bug: 14292866

Change-Id: I3adc448dbacfeecd32508ddccf27be3aa653e466
2014-07-23 18:08:09 -07:00
Nick Kralevich
92d8b2320a debuggerd: if PR_GET_DUMPABLE=0, don't ask for dumping
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 be0e43b776)

Change-Id: I6e1a9bce564e94fc19893d639b15f38c549cabfa
2014-07-23 16:07:33 -07:00
Colin Cross
49fbec6d9a HACK: remove %m support from printf.
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
2014-07-23 14:56:20 -07:00
Elliott Hughes
4126c12961 Fix belated review comments on syslog change.
Bug: 14292866

(cherry picked from commit afe6360627)

Change-Id: I8e3cc6b37b2539e51a27261ffb5d6e58266ce11d
2014-07-23 13:11:15 -07:00
Elliott Hughes
2aa142ffb2 Fix generate-NOTICE to cope better with BSD __COPYRIGHT macros.
(cherry picked from commit 5d2f86f363)

Change-Id: Iddf22c8d9ff7a4d1205d37bb58c6235af681d795
2014-07-23 11:36:21 -07:00
Elliott Hughes
4ac83fad3c Fix a couple of bugs in generate-NOTICE and regenerate the NOTICE files.
(cherry picked from commit 3758a244cf)

Change-Id: I6ffb83b4a7b7746b095205c664cf025a72ead179
2014-07-23 09:39:40 -07:00
Elliott Hughes
3ff6d95a9b Remove the unused swab.S.
(cherry picked from commit ca70453e84)

Change-Id: I4dc13de0bdeb7abb3bd47b0397546ad7d1f11d49
2014-07-22 20:43:55 -07:00
Duane Sand
5d7775c6df [MIPS] Allow united mipsel and mips64el gcc toolchain
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 f541650828)

Change-Id: I8df0ee7d36c6409458e18bea4e0e8b132edf77dc
2014-07-22 19:41:49 -07:00
Sreeram Ramachandran
2582f02a01 Cleanup: Delete dead code.
Bug: 15413389
Change-Id: I315468832ef18ffc84174e54774ab63b86d284dc
2014-07-22 11:24:17 -07:00
Elliott Hughes
6209c81d40 Use upstream OpenBSD's arc4random.
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 2b67d7dee0)

Change-Id: Icc939b5fa2fcac3e15ff93735d2d34f67e9bb149
2014-07-21 19:17:15 -07:00
Elliott Hughes
b76613627d Rewrite syslog(3) to use Android logging.
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 3ad8ecb64e)

Change-Id: I3038855ca4f22532bf6d2c45d3f8028b866975f9
2014-07-21 18:55:04 -07:00