Commit graph

7756 commits

Author SHA1 Message Date
Erik Kline
0e4cdff76b Don't flush the per-netid cache when adding nameservers.
This wasn't really necessary in the >= Lollipop architecture.

Test: netd_integration_test fails (fixing separately)
Bug: 32517984
Change-Id: I8115bfe913ae6609f64b55161a1c8e28ce2619cf
2016-12-02 04:28:43 +09:00
Elliott Hughes
cf922ff804 Merge "Clean up <sys/limits.h> a bit." 2016-12-01 03:08:44 +00:00
Elliott Hughes
68ddf5cad3 Merge "Abort harder." 2016-11-30 23:06:26 +00:00
Evgenii Stepanov
f347046f2d Merge changes Iade6a185,Iab3050bd
* changes:
  Cleanup: replace sanitize:never with address:false.
  Add __libc_arc4random_unlimited_entropy.
2016-11-30 21:34:05 +00:00
Treehugger Robot
f563ae89be Merge "Ship all the UAPI bits." 2016-11-30 19:43:30 +00:00
Treehugger Robot
04a3b24d7e Merge "Correct the return types of readv and writev." 2016-11-30 19:26:06 +00:00
Elliott Hughes
9af74907d1 Clean up <sys/limits.h> a bit.
<sys/limits.h> shouldn't even exist, but leave it in for backwards
compatibility.

Everything that seems legit moves to <limits.h>, though it still seems
like a lot of that ought to come from the compiler instead (there's even
an angry rant in the clang header to that effect).

Unfortunately, we've long exposed [a copy and paste of] the contents
of <float.h> from <limits.h> and <sys/limits.h>. This patch preserves
that for backwards compatibility, but at least switches us over to
using the real <float.h> instead.

Bug: http://b/32776472
Test: builds
Change-Id: I2d5b3b5237b3a0442195e99bb967c076ce484f35
2016-11-30 09:06:53 -08:00
Neil Fuller
fa1a85d003 Merge "Update timezone data to 2016j" 2016-11-30 11:16:38 +00:00
Elliott Hughes
4bf5522662 Abort harder.
Some PoS internal system can't cope with more than 4 stack frames,
so the fact that our abort(3) implementation takes 4 frames by itself
makes it useless.

Re-reading POSIX, it only says "behaves as if", so the previous
implementation chain wasn't mandatory and we can just go straight to
calling tgkill...

Before:

     #00 pc 0000000000069be4  /system/lib64/libc.so (tgkill+8)
     #01 pc 0000000000066d50  /system/lib64/libc.so (pthread_kill+64)
     #02 pc 0000000000028110  /system/lib64/libc.so (raise+24)
     #03 pc 000000000001d4ec  /system/lib64/libc.so (abort+52)

After:

     #00 pc 0000000000069bc8  /system/lib64/libc.so (tgkill+8)
     #01 pc 000000000001d4c8  /system/lib64/libc.so (abort+80)
     #02 pc 0000000000001494  /system/xbin/crasher64 (_ZL9do_actionPKc+872)
     #03 pc 00000000000010e0  /system/xbin/crasher64 (main+88)

This is less useful on 32-bit ARM because there there's an extra trampoline
from an assembler abort(3) implementation, so you'll still only get one
meaningful stack frame. But every other architecture will now get two!

But wait!

It turns out that the assembler hack isn't needed any more. Here we are
unwinding just fine all the way through the 32-bit ARM crasher:

Before (with direct call to tgkill but still using the assembler):

     #00 pc 00049e7c  /system/lib/libc.so (tgkill+12)
     #01 pc 00019c6f  /system/lib/libc.so (__libc_android_abort+50)
     #02 pc 000181f8  /system/lib/libc.so (abort+4)
     #03 pc 00001025  /system/xbin/crasher (_ZL9do_actionPKc+656)
     #04 pc 00017721  /system/lib/libc.so (__libc_init+48)
     #05 pc 00000b38  /system/xbin/crasher (_start+96)

After:

     #00 pc 00049e6c  /system/lib/libc.so (tgkill+12)
     #01 pc 00019c5f  /system/lib/libc.so (abort+50)
     #02 pc 00001025  /system/xbin/crasher (_ZL9do_actionPKc+656)
     #03 pc 00017721  /system/lib/libc.so (__libc_init+48)
     #04 pc 00000b38  /system/xbin/crasher (_start+96)

(As you can see, the fact that we see __libc_init rather than main was true
with the assembler stub too, so that's not a regression even if it does seem
odd...)

Bug: N/A
Test: ran crasher64
Change-Id: I9dd5b214c495604c8b502c7ec0de3631080d8c29
2016-11-29 22:02:25 -08:00
Treehugger Robot
609880c12f Merge "Fix getpriority/setpriority types." 2016-11-30 05:49:03 +00:00
Treehugger Robot
3b6b2f7c2d Merge "Fix return type of sync(2)." 2016-11-30 05:42:54 +00:00
Dan Willemsen
b99b6762b4 Merge "Enable libc/libdl/libm/linker for host bionic" 2016-11-30 05:32:06 +00:00
Josh Gao
585fc3e554 Add __libc_arc4random_unlimited_entropy.
Let the caller know when libc has an entropy source and arc4random is safe.
This is useful for the callers that want entropy, but don't absolutely need it.

Bug: http://b/27729263
Test: booted angler-userdebug w/ safestack
Change-Id: Iab3050bd19f23518e1676629573eebc656ba1090
2016-11-29 15:26:08 -08:00
Elliott Hughes
79a8f4b2c9 Fix return type of sync(2).
Bug: N/A
Test: builds
Change-Id: Ie93f1e8609baf2939c809f673b96248a384695ee
2016-11-29 15:16:08 -08:00
Elliott Hughes
8f0e42fda6 Fix getpriority/setpriority types.
Bug: N/A
Test: builds
Change-Id: Ica099bae04a0260871783452811a54672094ba4a
2016-11-29 15:14:11 -08:00
Elliott Hughes
bd734f0716 Merge "Use icu4c to implement <wctype.h>." 2016-11-29 23:05:31 +00:00
Josh Gao
753361a981 Correct the return types of readv and writev.
readv and writev should return ssize_t, not int.

Bug: none
Test: `m checkbuild` on bullhead
Change-Id: I934c2e8cb7bf76384b63cedfeab88e2f6b65971a
2016-11-29 14:26:15 -08:00
Dan Willemsen
7ec52b12ef Enable libc/libdl/libm/linker for host bionic
Disables debuggerd integration unless building for android.

Bug: 31559095
Test: Diff out/soong/build.ninja before/after, only change is moving
      linker's libdebuggerd_client static lib to the beginning of the
      list.
Test: lunch aosp_arm64-eng; mmma -j bionic
Change-Id: I62e725f7a9b98b7fe31637d0a835fd5846b0aff0
2016-11-29 21:09:05 +00:00
Elliott Hughes
a57ca0da69 Use icu4c to implement <wctype.h>.
Pretty useless, because the POSIX APIs are useless for actually
internationalization, but it lets us put this to bed for good.

Bug: http://b/18492914
Test: bionic tests
Change-Id: I4dd0aff66c44b5547039be3ffea806c865b9014a
2016-11-29 19:19:30 +00:00
Dan Albert
063e86ace8 Ship all the UAPI bits.
Test: make ndk
Bug: None
Change-Id: I24507846fb62b5844e06d7a424497a5ffc0357d1
2016-11-29 11:17:58 -08:00
Elliott Hughes
86841573ed Merge "Implement <langinfo.h>." 2016-11-29 19:16:09 +00:00
Neil Fuller
745e455565 Update timezone data to 2016j
IANA changes:

Briefly: Saratov, Russia moves from +03 to +04 on 2016-12-04.

  Changes to future time stamps

    Saratov, Russia switches from +03 to +04 on 2016-12-04 at 02:00.
    This hives off a new zone Europe/Saratov from Europe/Volgograd.
    (Thanks to Yuri Konotopov and Stepan Golosunov.)

  Changes to past time stamps

    The new zone Asia/Atyrau for Atyraū Region, Kazakhstan, is like
    Asia/Aqtau except it switched from +04/+05 to +05/+06 in spring
    1999, not fall 1994.  (Thanks to Stepan Golosunov.)

  Changes to past time zone abbreviations

    Asia/Gaza and Asia/Hebron now use "EEST", not "EET", to denote
    summer time before 1948.  The old use of "EET" was a typo.

Bug: 33136357
Change-Id: I6875bfa35b5d28839b6f4c3272fd9a1715b17aba
Test: CtsLibcoreTestCases / CtsBionicTestCases
2016-11-29 17:08:22 +00:00
Christopher Ferris
ecebb49ac6 Add cortex-a7 specific routines.
Test: Changed angler target to use cortex-a7 and I compiled.
Test: Booted this version on angler and ran bionic-unit-tests.

Change-Id: Ice7f6ea38a2569582161a8e659d7877918c1a45a
2016-11-28 12:49:36 -08:00
Wei Wang
ae693ad06c bionic: make NONBLOCK call to getrandom
By default getrandom() blocks if the entropy pool has not yet been initialized.
This will be an issue when init was first executed in some kernels.

This CL makes a check of getrandom readyness, by adding the GRND_NONBLOCK flag.
In such case, getrandom() does not block returns -1 with errno set to EAGAIN.

Test: on M/S devices
Bug: 33059407
Change-Id: I2a2ba8372a5e1c336852ba2ab77cdaac03c90389
2016-11-23 15:10:52 -08:00
Elliott Hughes
fc8e688c32 Implement <langinfo.h>.
POSIX locale only, as usual.

The GNU YESSTR and NOSTR extensions return the empty string in the C locale,
so I haven't bothered supporting them.

Bug: http://b/1401872
Test: bionic tests
Change-Id: I6846839e4f9f1812344ed5dce0b93f83c0c20eb3
2016-11-19 11:46:54 -08:00
Christopher Ferris
c2395be74a Merge "Enable malloc debug using environment variables" 2016-11-18 21:33:18 +00:00
Tamas Berghammer
ac81fe8657 Enable malloc debug using environment variables
Previously malloc debug can be enabled only using global settings
accessible to the root user only. This CL adds a new option to enable
it using environment variables making it possible to use it with pure
native (shell) applications on production builds (from shell user) and
prepares it for using it from logwrapper on production devices.

Remove the old environment variable and property since they are not
necessary.

Test: Enable malloc debug using environment variable and verify
Test: that it only affects the commands launched from the shell.
Test: Enable malloc debug using the property variable and verify
Test: that it affects all commands.
Test: Run all unit tests in 32 bit and 64 bit.
Change-Id: Iecb75a3471552f619f196ad550c5f41fcd9ce8e5
2016-11-17 13:13:27 -08:00
Christopher Ferris
a5c16983a6 Merge "Fix iswlower/iswupper." 2016-11-17 20:06:05 +00:00
Elliott Hughes
5bc78c8bcd Add and use constants for the Android API levels.
Test: bionic tests still pass
Change-Id: If1b619cfc9db1d3f5d91f14f2ace71058dca0c4a
2016-11-16 16:55:42 -08:00
Elliott Hughes
f76a21a185 Fix iswlower/iswupper.
The previous conditions were just plain wrong.

Test: bionic tests
Change-Id: Ia6d98207b1ff98ea4c6f619912e4bcdb8a7fdd24
2016-11-16 15:19:08 -08:00
Christopher Ferris
bd15515cfc Merge "Fix uninitialized variable usage." 2016-11-16 18:59:02 +00:00
Christopher Ferris
a19bc2d4ed Fix uninitialized variable usage.
If the dladdr call fails, then info.dli_fname will be unitialized.
Make sure that this can't happen.

Bug: 32907235

Test: Enabled malloc debug on an angler and verified that function names
Test: still work.
Change-Id: I738e66d9f37bce07bc4c10f1f9bac11fbfdae2c7
2016-11-16 10:55:20 -08:00
Wei Wang
0741d8d82d Fix getrandom syscall checking
Test: angler
Bug: 32838381
(cherry-picked from commit 46289b4c0211fc48d8719b385a7e56d765510ebd)

Change-Id: I102ffa26d7f39a8d3572b31f04b66ae31a9e752c
2016-11-15 16:53:37 -08:00
Colin Cross
d5aa03600e Merge "Don't pack relocations in libc.so" 2016-11-15 23:38:01 +00:00
Colin Cross
4ce94d297e Don't pack relocations in libc.so
Ic9125cc1bc4c9ba9eb20d030de72e3ce1fb86fa6 disabled relocation packing
in libc.so, but the flag was dropped when we switched to Android.bp
in Ib0ba2d28bff88483b505426ba61606da314e03ab.

Bug: 20645321
Bug: 20655855
Bug: 32750616
Test: builds
Test: inspect out/build-aosp_angler.ninja
Test: run app that crashes with packed libc.so
Change-Id: Ib0630f2e342afa543bb88303fec8f9695ac583e9
2016-11-15 15:35:31 -08:00
Elliott Hughes
f97b27a9c0 Merge "Differentiate the wctype functions we need to improve." 2016-11-15 19:04:25 +00:00
Treehugger Robot
b3321c9614 Merge changes I72d37b7c,I7d254a10,I2e967acf
* changes:
  versioner: use a virtual filesystem for input files.
  versioner: cache -cc1 flags generated by the clang Driver.
  versioner: refactor to use CompilerInstance directly.
2016-11-15 00:54:09 +00:00
Elliott Hughes
98c6688d64 Differentiate the wctype functions we need to improve.
Some of these are genuinely fine as-is.

Test: bionic tests still pass
Change-Id: Iab6d86d818dcc5857e7932a9effa04001195386f
2016-11-14 12:55:59 -08:00
Treehugger Robot
cd9ce19e9c Merge changes I7f32dc9f,I9d88ddb1
* changes:
  Revert "Revert "Attempt to use arc4random where getauxval(AT_RANDOM) is used.""
  Revert "Revert "Update getentropy_linux.c from upstream.""
2016-11-11 22:20:18 +00:00
Josh Gao
a170d9bfc5 Revert "Revert "Attempt to use arc4random where getauxval(AT_RANDOM) is used.""
This reverts commit 60d052dda6.

Bug: http://b/27729263
Change-Id: I7f32dc9f9a1f21fda3213f10da940821e1bdd63f
2016-11-10 17:02:45 -08:00
Josh Gao
98d655ce96 Revert "Revert "Update getentropy_linux.c from upstream.""
This reverts commit b3fbee449c.

Bug: http://b/27729263
Change-Id: I9d88ddb11466d203514ae805f4681c92e4b63c24
2016-11-10 17:02:37 -08:00
Josh Gao
16016df79f versioner: refactor to use CompilerInstance directly.
This will make it easier to switch over to a virtual filesystem,
which should drastically improve performance.

This also fixes an issue with warning/error reporting.

Bug: http://b/32748936
Test: python run_tests.py
Change-Id: I2e967acf75db29c95f3a03f4f94cccd22c367ad5
2016-11-09 13:50:07 -08:00
Dimitry Ivanov
8bfaac0f8a Merge "Eliminate deadlock in forked child due to delayed resetting mutex lock" 2016-11-08 20:59:42 +00:00
Elliott Hughes
bfc6ce6424 Merge "Remove bogus OPEN_MAX and CHILD_MAX constants." 2016-11-08 01:05:48 +00:00
Elliott Hughes
ff5f17bc8a Remove bogus OPEN_MAX and CHILD_MAX constants.
These are BSD-isms that don't make sense on Linux but do lead people astray.

Bug: http://b/32678775
Test: builds & boots
Change-Id: If6d3636f5f8d1b392b08c997dba2afde61b31fb6
2016-11-07 14:03:00 -08:00
Dan Albert
75097b1220 Add legacy inlines for fenv APIs.
Test: make native
      Copied into the NDK and ran ndk/checkbuild.py
Bug: None

Change-Id: I3d1e9317952ad23145a1f5221e347a16ebad4b0d
2016-11-07 13:12:38 -08:00
Treehugger Robot
2560a2703d Merge changes I660ddce6,Ic58d0481,I5d45aa72
* changes:
  Mark LIBC_DEPRECATED as platform-only.
  Remove _ZTV9type_info from the version script.
  Run genversion-scripts.py.
2016-11-07 19:12:38 +00:00
Christopher Ferris
9957485378 Merge "Fix cortex-a53 inclusion of files." 2016-11-07 16:42:55 +00:00
Elliott Hughes
a3ab8ebedd Merge "Fix format macros for fast16 and fast32 int types." 2016-11-07 16:33:35 +00:00
Neil Fuller
275659a0fd Merge "Update timezone data to 2016i." 2016-11-07 11:11:13 +00:00