Commit graph

8089 commits

Author SHA1 Message Date
Elliott Hughes
7827cf6cf2 Merge "Remove backwards compatibility for old system properties." am: 0c6f806b1d
am: 0f265255a6

Change-Id: Ia66376e579c4eaa92e177394fb5d442abb465e7f
2017-01-28 16:51:00 +00:00
Elliott Hughes
a29821bb45 glibc ipc64_perm __key compatibility.
glibc gives the `struct ipc64_perm` fields `key` and `seq` double-underscore
names. strace refers to the fields by those names, and there's no obvious
reason not to go along with this.

Bug: N/A
Test: built strace 4.15 with a hacked NDK
Change-Id: I8b2b0f75363349d99edaecda50fe897ee0fa0c65
2017-01-27 19:12:32 -08:00
Elliott Hughes
f8562c5f8f Remove backwards compatibility for old system properties.
No-one is directly upgrading from pre-K to O...

Also move more implementation details out of the header file.

Bug: http://b/33926793
Test: boots
Change-Id: I7a0936acbb1cea8a3b2cd6797ec53ba7e4a050f3
2017-01-27 16:19:59 -08:00
Christopher Ferris
fcbe1b780f Merge "Update to kernel headers v4.9.6." am: 6a9e0c8f15
am: 553293dd96

Change-Id: Id0c472fe933d57418539f5ac091bf2d9e88cc0cd
2017-01-27 21:17:10 +00:00
Sandeep Patil
34f0cfa3a8 property_contexts: split into platform and non-platform components
Bug: 33746484
Bug: 34370523
Test: Successfully boot with original service and property contexts.
Test: Successfully boot with split serivce and property contexts.
Test: Incremental build works on sailfish (reported in b/34370523)
Test: adb sideload works with aosp updater (reported in b/34370523)

Change-Id: Idf24856193032a8bc89ec384a72451e578a9d5ac
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-01-27 13:12:32 -08:00
Greg Hackmann
7518109063 bionic: move ADF uapi header out of bionic
ADF isn't a candidate for upstreaming and isn't (directly) usable from
unprivileged NDK code, so it makes more sense to keep video/adf.h as a
private header inside libadf, where it'll still be usable by HWC
implementations without shipping in the NDK.

libadf exports its entire include/ directory, so this shouldn't have any
impact on HWC implementations that already link against libadf.

Test: mmm system/core/adf/libadf
Test: /data/nativetest64/adf-unit-tests/adf-unit-tests (on Nexus 9)
Change-Id: I6573f539cfd7fc65433237d0b115b8b7b2728133
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2017-01-27 13:01:51 -08:00
Christopher Ferris
351a796d2d Update to kernel headers v4.9.6.
Test: Built arm/arm64/x86/x86_64 targets.
Change-Id: Id4d2711aaa96fe537f3726a0a89f2959e9cca34a
2017-01-27 10:49:48 -08:00
Christopher Ferris
edcde622eb Merge "Update to kernel headers v4.9.3." am: 00e388df4e
am: 16875896ac

Change-Id: I154ea1d11d0235270bd4dec2f6eebe0307fdff40
2017-01-27 17:56:59 +00:00
Christopher Ferris
00e388df4e Merge "Update to kernel headers v4.9.3." 2017-01-27 17:50:46 +00:00
Dimitry Ivanov
5e1dc58db9 Merge "Remove dependency on libc.a from the linker" am: 2ca556bb6e
am: 6fcea73028

Change-Id: I09fc09bfb149fd7b169bbc5cab1276b1aa7c8b76
2017-01-27 03:12:51 +00:00
Dimitry Ivanov
451909da31 Remove dependency on libc.a from the linker
Provide stub for unused but needed symbol __find_icu_symbol
which is not included to libc_nomalloc.a.

Test: mm and boot
Change-Id: I57ca09c990556d1d401e2f4a75bc49b61b4cd85d
2017-01-26 17:08:01 -08:00
Max Spector
4624ed5039 Merge "Adding kuser_helper on note to all arm32 binaries." am: 577a944200
am: 36c6ce26a2

Change-Id: I6af912a1f7e52574be15e64ec099459592dd1beb
2017-01-26 18:50:48 +00:00
Max Spector
577a944200 Merge "Adding kuser_helper on note to all arm32 binaries." 2017-01-26 18:43:40 +00:00
Stephen Hines
fbb7c0e765 Merge "Don't mark __res_params or android_net_context as packed." am: 0c45c7dc5e
am: 6776efa346

Change-Id: I6b83f36d0e344c9174f7fcdd210ceecbafdd3027
2017-01-26 07:24:57 +00:00
Treehugger Robot
0c45c7dc5e Merge "Don't mark __res_params or android_net_context as packed." 2017-01-26 07:13:21 +00:00
mspector
2e3d6a1d67 Adding kuser_helper on note to all arm32 binaries.
A kernel change is going in for 64bit arm to disable kuser_helper vector
pages for 32bit processes.  This change adds a special elf note to
all arm32 binaries built with bionic.  This note tells the kernel to
load the kuser_helper vector page for the process.

Bug: 33689037
Test: Manual - Phone boots, 32bit binaries have the notes, 64bit
binaries do not.
Change-Id: Ib8366e2a0810092b71381d57dee4bdaa56369a24
2017-01-25 17:33:05 -08:00
Christopher Ferris
6a9755d20a Update to kernel headers v4.9.3.
Test: Built arm, arm64, x86, x86_64 targets.
Test: Booted on angler, and ran bionic unit tests (32 bit and 64 bit).

Change-Id: I14a8dcbea11b41f83431eabed6590cd25af07b1d
2017-01-25 16:23:56 -08:00
Paul Lawrence
fe55c3ac41 Merge "Use trap not kill in seccomp filter" am: 6418f95ca2
am: b5a151a12d

Change-Id: Icae95f9dfd6f7b4ab7e5422ee8e1b103e9c62b61
2017-01-25 22:52:56 +00:00
Paul Lawrence
6418f95ca2 Merge "Use trap not kill in seccomp filter" 2017-01-25 22:46:06 +00:00
Stephen Hines
9935e0fcee Don't mark __res_params or android_net_context as packed.
Bug: http://b/31532493

These internal API structures are never actually used anywhere that
would change behavior because it is "packed", so it is safe to remove.

Test: Builds correctly with the latest toolchain.
Change-Id: I5431992d840777605be75ab91dc21158d6d22c26
2017-01-25 00:42:45 -08:00
Dimitry Ivanov
8dba8acd6e Do not send 0 byte string content. am: cafd355375
am: 6fd88344a5

Change-Id: If8fd7fac36d145cf6f611cc562ab5b5b345e33d9
2017-01-25 03:58:50 +00:00
Dimitry Ivanov
c809b7a43f Revert "Revert "Remove limit of system property name length"" am: 16b2a4de14
am: d91e7766ec

Change-Id: I19be17e5aec71182a9b83e3720e3fc3dd0cf5d0e
2017-01-25 03:58:46 +00:00
Dimitry Ivanov
cafd355375 Do not send 0 byte string content.
Trying to send even 0 bytes to closed socket leads to
broken pipe error. Sometimes property service is just
quick enough and closes the socket between send(valuelen)
and send(value) in the case where valuelen is 0.

Bug: http://b/34670529
Test: adb reboot 20 times and make sure phone service did not fail
Test: run bionic-unit-tests --gtest_filter=prop*
Change-Id: I96f90ca6fe1790614e7efd3015bffed1ef1e9040
2017-01-24 14:19:03 -08:00
Dimitry Ivanov
16b2a4de14 Revert "Revert "Remove limit of system property name length""
This reverts commit 489f58b5ea.
Bug: http://b/33926793
Bug: http://b/34670529
Test: Run bionic-unit-tests --gtest_filter=prop*

Change-Id: Id4e94652dc2310a21f5b7bd3af098bf79df3f380
2017-01-24 12:58:18 -08:00
Dimitry Ivanov
205bb70df8 Merge "Revert "Remove limit of system property name length"" am: 40250bb683
am: e3a684f858

Change-Id: Idbd449ff4c4990695a09badc53faab34470f3737
2017-01-24 20:07:38 +00:00
Dimitry Ivanov
40250bb683 Merge "Revert "Remove limit of system property name length"" 2017-01-24 20:00:44 +00:00
Paul Lawrence
3d9fc696a5 Use trap not kill in seccomp filter
Bug: 34647665
Test: Make sure boots, check that causing a seccomp failure creates a
      crash dump

Change-Id: I5ab2fe3e8322a3c38318c97d343834baa874af8d
2017-01-24 11:07:04 -08:00
Dimitry Ivanov
489f58b5ea Revert "Remove limit of system property name length"
This reverts commit 5c1ce278f3.
Bug: http://b/33926793
Bug: http://b/34670529

Change-Id: I0dc4a8ae55576c69b34b2958d8e664f7066b9c54
2017-01-24 18:39:04 +00:00
Vijay Venkatraman
ae161415fe Merge "Removed include log\logger.h from log_fake.cpp" am: f0b42ae973
am: 6529a136e7

Change-Id: I83bef9a2dca60c16ae8e850db01f4431099ab985
2017-01-24 17:42:50 +00:00
Vijay Venkatraman
f0b42ae973 Merge "Removed include log\logger.h from log_fake.cpp" 2017-01-24 17:36:09 +00:00
Dimitry Ivanov
eda500fdf9 Merge "Remove limit of system property name length" am: 440d6c7644
am: 87190c845e

Change-Id: I3ba27bdf237f750195ce4829bd5c6181f174000c
2017-01-24 02:58:21 +00:00
Vijay Venkatraman
191d2f3c99 Removed include log\logger.h from log_fake.cpp
Test: Compile malloc_debug_unit_tests
Change-Id: I635687016570ba52c571435b87d8e89f7f04d609
2017-01-23 18:56:53 -08:00
Dimitry Ivanov
5c1ce278f3 Remove limit of system property name length
This change introduces new __system_property_read_callback
method to use in place of deprecated __system_property_read
__system_property_set() and get() should just work but now
do not have limit on system property names.

Bug: http://b/33926793
Test: boot device, run adb shell propget
Test: boot device with old version of init (protocol v1)
Test: run bionic-unit-tests --gtest_filter=prop*
Change-Id: I619fb5a7e27a272aac30011579665f6160888bc7
2017-01-23 11:21:18 -08:00
Jaekyun Seok
d18aed7e8e Merge "Add props files for each partition" am: 7844b4c5db
am: 291192fb15

Change-Id: I6dd5a0cc06c8e5f7c5d8cb1177e24aba114bd8f2
2017-01-20 04:05:47 +00:00
Treehugger Robot
7844b4c5db Merge "Add props files for each partition" 2017-01-20 03:58:52 +00:00
Jaekyun Seok
dc94cf5cd8 Add props files for each partition
The following files will be added.
- /vendor/default.prop for default prop overrides from vendor
 partition.
- /odm/default.prop for default prop overrides from odm partition.
- /odm/build.prop for build prop overrides from odm partition.

Test: tested default/build prop files with enabling early mount, but
didn't test files of odm partition because odm partition doesn't
exist now.
Bug: 34116668
Change-Id: Ia99895a0afcdc522463d95b2f3e2841dcf2e3516
2017-01-20 09:59:26 +09:00
Paul Lawrence
b46ed1098d Merge "Add seccomp support library" am: ad3b3995e7
am: 9ef18d5752

Change-Id: I07efd9bf2dc2e9c040a51265d5be6d6e8ad5c779
2017-01-19 23:32:59 +00:00
Treehugger Robot
ad3b3995e7 Merge "Add seccomp support library" 2017-01-19 23:26:10 +00:00
Paul Lawrence
eabc352651 Add seccomp support library
Policy library which exports an autogenerated policy from SYSCALLS.TXT
blocking any other calls.

Test: Generate policy, install onto Sailfish, check boots, Chrome runs,
calls are blocked.
Bug: 32313202

Change-Id: Ib590704e50122f077eeae26561eb9b0a70386551
2017-01-19 13:38:47 -08:00
Evgenii Stepanov
992d012f80 Merge "Runtime support for CFI" am: 082bec5b41
am: adcec1585b

Change-Id: I4eafd03da458f1672991fe14dfa71667ae2bc686
2017-01-18 23:54:34 +00:00
Josh Gao
2562ae8215 Reserve a realtime signal for debuggerd. am: f8a6d4745d
am: 3d8c6aa3a1

Change-Id: I24d59d8b77a8df6658637ae44afc2af5bc109f5c
2017-01-18 23:42:24 +00:00
Evgenii Stepanov
082bec5b41 Merge "Runtime support for CFI" 2017-01-18 23:39:08 +00:00
Josh Gao
3d8c6aa3a1 Reserve a realtime signal for debuggerd.
am: f8a6d4745d

Change-Id: If7eced969434e50beec04625c905ef374cdcdfb1
2017-01-18 23:16:39 +00:00
Josh Gao
2d261e8e9e Merge changes from topic 'kill_debuggerd'
* changes:
  Rename libdebuggerd_client to libdebuggerd_handler.
  Reserve a realtime signal for debuggerd.
2017-01-18 23:04:09 +00:00
Evgenii Stepanov
0a3637d3eb Runtime support for CFI
Control Flow Integrity support in bionic.

General design:
http://clang.llvm.org/docs/ControlFlowIntegrityDesign.html#shared-library-support

This CL implements subsections "CFI Shadow" and "CFI_SlowPath" in the above document.

Bug: 22033465
Test: bionic device tests
Change-Id: I14dfea630de468eb5620e7f55f92b1397ba06217
2017-01-18 13:13:52 -08:00
Colin Cross
19b40c7e14 Merge "Declare dependency on android_filesystem_config.h" am: 2f238b32cd
am: 5b91973fb7

Change-Id: I4ede35c4deab0b6cbe59a958633ac89b4cee0204
2017-01-18 17:06:18 +00:00
Jorim Jaggi
abea8788e8 Revert "property_contexts: split into platform and non-platform components" am: e2f5ea14c5
am: 860a1db8fd

Change-Id: I98f7277d7f8e4f3eb6474ec62f82a80fbf63f1b4
2017-01-18 16:47:36 +00:00
Jorim Jaggi
860a1db8fd Revert "property_contexts: split into platform and non-platform components"
am: e2f5ea14c5

Change-Id: I9a794b93b077791ce46016cb9f8965a52c98b88e
2017-01-18 16:41:36 +00:00
Jorim Jaggi
e2f5ea14c5 Revert "property_contexts: split into platform and non-platform components"
This reverts commit 8213615461.

Change-Id: Id2982eafadc5d1c307b60c1f8abe78df8dc8b82e
2017-01-18 15:37:18 +00:00
Sandeep Patil
84ac3e4354 property_contexts: split into platform and non-platform components am: 8213615461
am: 045ba4b249

Change-Id: Ie92f9de186e3ff723e67ee17f4d6224569dee65f
2017-01-18 06:16:51 +00:00
Sandeep Patil
045ba4b249 property_contexts: split into platform and non-platform components
am: 8213615461

Change-Id: Ifa1bb1e295cef8ecf74a4a4702114a88f3e6859e
2017-01-18 06:12:19 +00:00
Colin Cross
35bbed8020 Declare dependency on android_filesystem_config.h
android_filesystem_config.h comes from a directory outside bionic/libc
so it can't be referenced directly, add it as a source file through
a filegroup module.

Bug: 34283327
Test: builds
Test: libc rebuilds after touch system/core/include/private/android_filesystem_config.h
Change-Id: I90f6b7b25b70842b8619d558074449f13e6e6b03
2017-01-17 18:31:33 -08:00
Josh Gao
f8a6d4745d Reserve a realtime signal for debuggerd.
Allocate __SIGRTMIN + 3 for triggering native stack dumps (like SIGQUIT
for Java processes).

Bug: http://b/30705528
Test: debuggerd_test
Change-Id: I81d622fba32a651555268a8a2ba6721c61c93a58
2017-01-17 13:55:18 -08:00
Elliott Hughes
c9e91d1a98 Merge "localtime_r(3) should act as if it calls tzset(3)." am: 1b2975d54b
am: e767a92c57

Change-Id: I16eed5cb28e1df287f748d0028f8198f2861b428
2017-01-12 23:28:04 +00:00
Elliott Hughes
1b2975d54b Merge "localtime_r(3) should act as if it calls tzset(3)." 2017-01-12 23:19:50 +00:00
Elliott Hughes
ea87716696 localtime_r(3) should act as if it calls tzset(3).
See code comment.

Bug: http://b/31339449
Test: ran tests & benchmarks
Change-Id: I6b6a63750ef41664dc4698207e6a53e77cc28cdf
2017-01-11 14:56:04 -08:00
Dimitry Ivanov
e24dc59591 Merge "Hide __system_property_add/update, deprecate find_nth" am: 907fcc98b2
am: ee062c3577

Change-Id: Ife3992252e7d979772126ee806fdd3f2957508a1
2017-01-11 02:08:21 +00:00
Treehugger Robot
907fcc98b2 Merge "Hide __system_property_add/update, deprecate find_nth" 2017-01-11 01:57:56 +00:00
Dimitry Ivanov
581b9f661b Hide __system_property_add/update, deprecate find_nth
These functions are supposed to be used only by the
property service.

__system_property_find_nth is deprecated and no longer part
of NDK. Call to this function will result in abort for apps
targeting Android O.

Bug: http://b/34114501
Test: bionic-unit-tests --gtest_filter=prop*
Change-Id: I9846965bf248e2ddf45cd7b293618245bbd87145
2017-01-10 13:41:27 -08:00
Christopher Ferris
08dacf8d7e Merge "Fix streaming(memcpy) performance on Cortex-A7" am: 0625beb270
am: 7373d2ed3d

Change-Id: I9c1bdbab92815d05cb5bfd01bc930cb9a1523a5f
2017-01-10 18:52:51 +00:00
Christopher Ferris
0625beb270 Merge "Fix streaming(memcpy) performance on Cortex-A7" 2017-01-10 18:41:15 +00:00
Elliott Hughes
80a477c4ea Revert "Revert "move android_ids into bionic"" am: 3f6eee9793
am: 45be5dfe98

Change-Id: I56b1f2a8c10310d4ac54b0cb8a18951be6ef8bba
2017-01-10 01:27:57 +00:00
Elliott Hughes
45be5dfe98 Revert "Revert "move android_ids into bionic""
am: 3f6eee9793

Change-Id: I6a65710f926a76e48705fa4594f479f5d48df068
2017-01-10 01:23:26 +00:00
Elliott Hughes
940d460f59 Merge "Revert "Revert "move android_ids into bionic""" 2017-01-10 01:15:30 +00:00
Sandeep Patil
8213615461 property_contexts: split into platform and non-platform components
Bug: 33746484
Test: Successfully boot with original service and property contexts.
Test: Successfully boot with split serivce and property contexts.

Change-Id: Id1acb8c4273c6f93396e8cf7a063571a2bf08786
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-01-09 16:34:14 -08:00
Elliott Hughes
7b1b019a71 Merge "Move to .md files for even trivial documentation." am: 39b6d59049
am: f561edeade

Change-Id: If984fd9b2ea3d66b871b484314e79a6994ca5d6a
2017-01-09 21:35:39 +00:00
Elliott Hughes
39b6d59049 Merge "Move to .md files for even trivial documentation." 2017-01-09 21:23:01 +00:00
Elliott Hughes
b0e8c565a6 Remove the global thread list.
Another release, another attempt to fix this bug.

This change affects pthread_detach, pthread_getcpuclockid,
pthread_getschedparam/pthread_setschedparam, pthread_join, and pthread_kill:
instead of returning ESRCH when passed an invalid pthread_t, they'll now SEGV.

Note that this doesn't change behavior as much as you might think: the old
lookup only held the global thread list lock for the duration of the lookup,
so there was still a race between that and the dereference in the caller,
given that callers actually need the tid to pass to some syscall or other,
and sometimes update fields in the pthread_internal_t struct too.

We can't check thread->tid against 0 to see whether a pthread_t is still
valid because a dead thread gets its thread struct unmapped along with its
stack, so the dereference isn't safe.

Taking the affected functions one by one:

* pthread_getcpuclockid and pthread_getschedparam/pthread_setschedparam
  should be fine. Unsafe calls to those seem highly unlikely.

* Unsafe pthread_detach callers probably want to switch to
  pthread_attr_setdetachstate instead, or using pthread_detach(pthread_self())
  from the new thread's start routine rather than doing the detach in the
  parent.

* pthread_join calls should be safe anyway, because a joinable thread won't
  actually exit and unmap until it's joined. If you're joining an
  unjoinable thread, the fix is to stop marking it detached. If you're
  joining an already-joined thread, you need to rethink your design.

* Unsafe pthread_kill calls aren't portably fixable. (And are obviously
  inherently non-portable as-is.) The best alternative on Android is to
  use pthread_gettid_np at some point that you know the thread to be alive,
  and then call kill/tgkill directly. That's still not completely safe
  because if you're too late, the tid may have been reused, but then your
  code is inherently unsafe anyway.

If we find too much code is still broken, we can come back and disable
the global thread list lookups for anything targeting >= O and then have
another go at really removing this in P...

Bug: http://b/19636317
Test: N6P boots, bionic tests pass
Change-Id: Ia92641212f509344b99ee2a9bfab5383147fcba6
2017-01-07 14:16:46 -08:00
Elliott Hughes
da7a0b105d Move to .md files for even trivial documentation.
So it's automatically displayed for folks browsing the source.

Bug: N/A
Test: N/A
Change-Id: I80e823415f1fb12ad8ce5348e926519b6e29580f
2017-01-07 12:47:28 -08:00
Nick Kralevich
0354990de8 Merge "Make /dev/__properties__ 0711" am: 11798bcc35
am: 7d7e4a6955

Change-Id: I417801d251da1d8740cc70a0f9142de7ca98a829
2017-01-06 22:03:21 +00:00
Nick Kralevich
bb59d47249 Make /dev/__properties__ 0711
Don't allow processes to read the contents of the directory
/dev/__properties__. This is an implementation detail of the properties
system that processes shouldn't be concerned with.

Test: Device boots and no problems reading individual properties.
Test: ls -la /dev/__properties__ fails
Change-Id: I00130fe4529525935654bff91e3cc59253b86e26
2017-01-06 12:07:20 -08:00
Josh Gao
07739bb921 Merge "Add declaration of tgkill to signal.h." am: d26267b8b9
am: f3847eb2d7

Change-Id: I334c6731594b92788fb6045107b34bc4a7182b68
2017-01-06 00:54:13 +00:00
Josh Gao
d3cfd26872 Add declaration of tgkill to signal.h.
Expose a useful function that we've had since Jelly Bean.

Bug: http://b/34111810
Test: TreeHugger
Change-Id: Iaf3097f224c09b533f36050cf21394ba148007ad
2017-01-05 15:15:12 -08:00
Chitti Babu Theegala
cbfdc7f905 Fix streaming(memcpy) performance on Cortex-A7
Stream-mode detection for L1 in A7-core is failing for
non cache-line-size (non 64 byte) aligned addresses.
This leads to destination data getting cached unnecessarily.
This A7 issue is confirmed by ARM

This issue is solved by aligning destination address to 64 byte before
entering the loop in memcpy routine.
Though we get lower score for micro_bench memcpy when L1 cache is bypassed,
it is desirable since it avoids unnecessary eviction of other process data
from L1 which is good for overall system performance.

Higher micro_bench memcpy numbers for < 64byte alignment shows good numbers
but this is at the cost of L1 cache pollution. During memcpy/memset,
unnecessary data is filled in L1 cache, this causes eviction of other
process data from L1.
For example during msmset(0), L1 cache gets filled with 0s which should be
avoided.

Additionally, there is another issue with cortex A7 that impacts performance
for all alignments / all Android Wear versions:
Store Buffer on A7 is 32 byte which limits the 32-byte back to back stores.
In the current implementation back to back 32bytes writes is causing CPU stalls.
This issue can be solved by interleaved Loads and Stores.
This helps in avoiding CPU stalls during memcpy by utilizing efficiently the
A7 internal load and store buffers.

Change-Id: Ie5f12f2bb5d86f627686730416279057e4f5f6d0
2016-12-19 15:11:43 -08:00
Jeff Sharkey
3ef6bb6ff1 Merge "Define range of GIDs for cached app data." am: 54891837a0
am: ce7c613609

Change-Id: I564b6d18344325ff1e801590790d3813de269ad4
2016-12-15 23:14:36 +00:00
Jeff Sharkey
54891837a0 Merge "Define range of GIDs for cached app data." 2016-12-15 21:46:30 +00:00
Elliott Hughes
e0bbb4882c Merge "Make the __stack_chk_fail message more searchable on the internets." am: a1d32f95c3
am: 153ebb4557

Change-Id: Ic74ce9166627c15df7792db5c3468844b2c2148f
2016-12-15 06:31:02 +00:00
Treehugger Robot
a1d32f95c3 Merge "Make the __stack_chk_fail message more searchable on the internets." 2016-12-15 06:15:41 +00:00
Elliott Hughes
0ff61f6d19 Make the __stack_chk_fail message more searchable on the internets.
Noticed while writing documentation:

  https://source.android.com/devices/tech/debug/

Bug: http://b/28746168
Test: crasher
Change-Id: Ied1c1b1c75a85a899f07e6927134b9bf91316fe4
2016-12-14 17:30:07 -08:00
Elliott Hughes
1c07ca873a Merge "Fix an obsolete comment." am: 1adb683447
am: 58646b53b7

Change-Id: Ia7254ff57a4f318bb0bed542ed09ba661e153f45
2016-12-14 22:07:30 +00:00
Elliott Hughes
bc94bb362d Fix an obsolete comment.
280236537e factored the pthread types out
so that they could be in both <sys/types.h> and <pthread.h>.

Bug: N/A
Test: builds
Change-Id: Ie649c938ec8be1c59a0e4ef777f425550f8d4539
2016-12-14 12:43:30 -08:00
Elliott Hughes
17217b8eec Merge "Update socket constants." am: cb0134d96e
am: 72f259ac6f

Change-Id: Ie45ea13d264f876939f95ac76a2bdba1b2331e53
2016-12-14 16:44:39 +00:00
Elliott Hughes
cb0134d96e Merge "Update socket constants." 2016-12-14 16:28:24 +00:00
Christopher Ferris
5fbb15f71c Merge "Update to kernel headers v4.8.14." am: f27e97956d
am: 3ec2701f0c

Change-Id: I91e4e095bae01675698e5514c00e19896055c51d
2016-12-13 23:53:47 +00:00
Elliott Hughes
3f6eee9793 Revert "Revert "move android_ids into bionic""
This reverts commit 77cb68d9f2.

Change-Id: Ibc9f775c4cd418be90fd8a6f192dd72ca5dff09a
2016-12-13 23:47:25 +00:00
Christopher Ferris
f27e97956d Merge "Update to kernel headers v4.8.14." 2016-12-13 23:40:01 +00:00
Elliott Hughes
8d76871438 Update socket constants.
This corresponds to Linux 4.10.

Bug: N/A
Test: builds
Change-Id: Ia7135c9fec181613b79726d1b16867133cdefd04
2016-12-13 15:29:58 -08:00
Christopher Ferris
19dfe0b4ba Merge "libc: ARM64: update memset/strlen/memcpy/memmove to newlib/cortex-strings" am: 8b3e812684
am: 24dae7f57c

Change-Id: I556841ceac287f0a02746f23e6a30c436d0143b9
2016-12-13 23:27:41 +00:00
Christopher Ferris
8b3e812684 Merge "libc: ARM64: update memset/strlen/memcpy/memmove to newlib/cortex-strings" 2016-12-13 23:11:27 +00:00
Elliott Hughes
211a4e9496 Merge "Remove BSD cruft from <pwd.h>." am: 9438a648eb
am: 6890799937

Change-Id: Icf01428e52890b3e08694c600242ef4be9097742
2016-12-13 23:07:51 +00:00
Elliott Hughes
9438a648eb Merge "Remove BSD cruft from <pwd.h>." 2016-12-13 22:55:06 +00:00
Jeff Sharkey
934bc86df3 Define range of GIDs for cached app data.
To support upcoming disk usage calculation optimizations, this change
creates a new GID for each app that will be used to mark its cached
data.  We're allocating these unique GIDs so that we can use
quotactl() to track cached data on a per-app basis.

Test: builds, boots, tests pass
Bug: 27948817
Change-Id: Ic00c39ccedc23d5d43988029e9921679126f8f2d
2016-12-13 14:22:55 -07:00
Christopher Ferris
49f525c47b Update to kernel headers v4.8.14.
Test: Built mips/arm/arm64/x86/x86_64. Built and booted angler.
Change-Id: Icedb035769d8a41a170a6f1ecd707113e332d8dd
2016-12-12 19:08:01 -08:00
Elliott Hughes
21b70e667d Remove BSD cruft from <pwd.h>.
Other C libraries don't have this, and it doesn't make sense on Android
anyway.

Bug: N/A
Test: builds
Change-Id: Iebc490698d620b5baec5f9a7ad5e1a0a1323d16c
2016-12-12 17:31:02 -08:00
Elliott Hughes
2e2a6f5323 Revert "move android_ids into bionic" am: 77cb68d9f2
am: 75b51ac14e

Change-Id: Iab214bff9b94f6f3f0a3ebc217794d85b5af5164
2016-12-13 00:52:23 +00:00
Elliott Hughes
75b51ac14e Revert "move android_ids into bionic"
am: 77cb68d9f2

Change-Id: I45d8098e38dd35fdf9b3d270ac4f26c3a7284971
2016-12-13 00:42:35 +00:00
Treehugger Robot
50ae6dde5b Merge "Revert "move android_ids into bionic"" 2016-12-13 00:31:25 +00:00
Elliott Hughes
77cb68d9f2 Revert "move android_ids into bionic"
This reverts commit 1a13db5b26.

Change-Id: I7f571b3a9d542694d16fb9cf1131ef9e59d330ea
2016-12-12 22:11:37 +00:00
William Roberts
00c5608a69 move android_ids into bionic am: 1a13db5b26
am: f3def87a05

Change-Id: I245c800f5581b193cdfcfa4d88305d9b1b56edd6
2016-12-10 00:25:33 +00:00
William Roberts
f3def87a05 move android_ids into bionic
am: 1a13db5b26

Change-Id: I12ac9a338503687fba3c43dcdd8a6c1a74cc99fe
2016-12-10 00:20:28 +00:00
Elliott Hughes
ded6c91acc Merge "move android_ids into bionic" 2016-12-10 00:13:05 +00:00
Elliott Hughes
940b4c521e Merge "Fix icu4c calling on x86." am: 227894a754
am: 5fb3a092d6

Change-Id: I1480a635c68ddd6abde7df5624a08010da49e6d6
2016-12-09 02:20:38 +00:00
Elliott Hughes
722d01a991 Fix icu4c calling on x86.
Some of the function pointer types were wrong, and x86 cares if you
say `int` when you meant `int8_t` (because it feels at liberty to
leave the top bits dirty and ignore them, both sides need to agree
which they're dealing with).

Also slightly improve the wcstoimax and wcstoumax tests, since my
investigation started there.

Bug: http://b/33451822
Test: tests pass on x86, arm, and arm64
Change-Id: I553193962f0cb993666f9f8e415990bba5b669e1
2016-12-08 15:16:37 -08:00
Elliott Hughes
8b114bde2d Check for bad packets in getaddrinfo.c's getanswer. am: 87c0dba7b1 am: dc0492ac4f am: f277bb86c6 am: 389e3e92e2 am: 0ffd7a5fb1 am: 0bf10a656b am: 2646bfc213
am: 9eea4e2864

Change-Id: I410415128a6b6f2d1c818d7b639d4cc45dc3ecd0
2016-12-08 21:27:19 +00:00
Elliott Hughes
9eea4e2864 Check for bad packets in getaddrinfo.c's getanswer. am: 87c0dba7b1 am: dc0492ac4f am: f277bb86c6 am: 389e3e92e2 am: 0ffd7a5fb1 am: 0bf10a656b
am: 2646bfc213

Change-Id: I539d424a1176d294e1c1201367f4fe786b345726
2016-12-08 21:22:17 +00:00
Elliott Hughes
2646bfc213 Check for bad packets in getaddrinfo.c's getanswer. am: 87c0dba7b1 am: dc0492ac4f am: f277bb86c6 am: 389e3e92e2 am: 0ffd7a5fb1
am: 0bf10a656b

Change-Id: I22e9e28194f3599e0792ec9d7d1145cb954b3287
2016-12-08 21:17:17 +00:00
Elliott Hughes
0bf10a656b Check for bad packets in getaddrinfo.c's getanswer. am: 87c0dba7b1 am: dc0492ac4f am: f277bb86c6 am: 389e3e92e2
am: 0ffd7a5fb1

Change-Id: I286e1860addc1ae571273d2b4a4e1359e990b6aa
2016-12-08 21:12:16 +00:00
Elliott Hughes
0ffd7a5fb1 Check for bad packets in getaddrinfo.c's getanswer. am: 87c0dba7b1 am: dc0492ac4f am: f277bb86c6
am: 389e3e92e2

Change-Id: Ie935c8491aa18867a5087ca4cf707eec318b85f6
2016-12-08 21:07:17 +00:00
Elliott Hughes
dc0492ac4f Check for bad packets in getaddrinfo.c's getanswer.
am: 87c0dba7b1

Change-Id: I3a09f86362797881b4e7cc0ee807d28addf7b342
2016-12-08 20:52:15 +00:00
Dimitry Ivanov
fc0d48078a loader: stop linking libdl/c/m into the loader
This is to prevent situations when libgcc.a calls into incorrect
implementation of dl_iterate_phdr.

Bug: http://b/27106625
Test: build && run bionic-unit-tests --getst_filter=dl*:Dl*
Change-Id: I4cba8c4a156f91f17ba3d95c39cb80f9b70c9d8f
2016-12-06 11:15:24 -08:00
Erik Kline
40d51f0d28 Remove all system properties references
Test: as follows
    - build
    - flash
    - runtest -x system/netd/tests/netd_integration_test.cpp
Bug: 33308258
Change-Id: I59526cb91e91b35a63ba6b413d444712568463e4
2016-12-05 12:45:10 +09:00
Treehugger Robot
f8b4ff4aa1 Merge "Remove obsolete #include and comment." 2016-12-05 00:01:34 +00:00
Elliott Hughes
6eb8fb5f86 Remove obsolete #include and comment.
Bug: http://b/33308258
Test: builds
Change-Id: Id6bbdae536a12134899fa57ea799f488d018db00
2016-12-02 17:51:56 -08:00
Treehugger Robot
14998554dd Merge "Don't flush the per-netid cache when adding nameservers." 2016-12-02 23:55:55 +00:00
Dan Albert
f634655e64 Fix wcsto* where strings begin with whitespace.
The libc++ tests caught this.

Test: adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
Bug: None
Change-Id: I14864e006f6cf9de3f96acac6aa3eb235894f2b1
2016-12-02 13:03:30 -08:00
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
William Roberts
1a13db5b26 move android_ids into bionic
Generate the android_ids array and include into the
build.

Test: The bionic is built and that core AIDs work as
expected with commands like chown, mkdir and init services
and builtins.
Bug: 27999086
Change-Id: Ib575bf85326c91801c5674db475dcb9cf44c00dc
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2016-11-30 12:54:08 -08: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
Jake Weinstein
372f19e9e2 libc: ARM64: update memset/strlen/memcpy/memmove to newlib/cortex-strings
* Bionic benchmarks results at the bottom

* This is a squash of the following commits:

libc: ARM64: optimize memset.

 This is an optimized memset for AArch64.  Memset is split into 4 main
 cases: small sets of up to 16 bytes, medium of 16..96 bytes which are
 fully unrolled.  Large memsets of more than 96 bytes align the
 destination and use an unrolled loop processing 64 bytes per
 iteration.  Memsets of zero of more than 256 use the dc zva
 instruction, and there are faster versions for the common ZVA sizes 64
 or 128.  STP of Q registers is used to reduce codesize without loss of
 performance.

Change-Id: I0c5b5ec5ab8a1fd0f23eee8fbacada0be08e841f

libc: ARM64: improve performance in strlen

Change-Id: Ic20f93a0052a49bd76cd6795f51e8606ccfbf11c

libc: ARM64: Optimize memcpy.

 This is an optimized memcpy for AArch64.  Copies are split into 3 main
 cases: small copies of up to 16 bytes, medium copies of 17..96 bytes
 which are fully unrolled.  Large copies of more than 96 bytes align
 the destination and use an unrolled loop processing 64 bytes per
 iteration.  In order to share code with memmove, small and medium
 copies read all data before writing, allowing any kind of overlap.  On
 a random copy test memcpy is 40.8% faster on A57 and 28.4% on A53.

Change-Id: Ibb9483e45bbc0e8ca3d5ce98a31c55dfd8a5ac28

libc: AArch64: Tune memcpy

* Further tuning for performance.

Change-Id: Id08eaab885f9743fa7575077924a947c1b88e4ff

libc: ARM64: optimize memmove for Cortex-A53

* Sadly does not work on Denver or Kryo, so can't go to generic

 This is an optimized memmove for AArch64.  All copies of up to 96
 bytes and all backward copies are done by the new memcpy.  The only
 remaining case is large forward copies which are done in the same way
 as the memcpy loop, but copying from the end rather than the start.

Tested on the Nextbit Robin with MSM8992 (Snapdragon 808):

Before
BM_string_memcmp/8                          1000k         27    0.286 GiB/s
BM_string_memcmp/64                           50M         20    3.053 GiB/s
BM_string_memcmp/512                          20M        126    4.060 GiB/s
BM_string_memcmp/1024                         10M        234    4.372 GiB/s
BM_string_memcmp/8Ki                        1000k       1726    4.745 GiB/s
BM_string_memcmp/16Ki                        500k       3711    4.415 GiB/s
BM_string_memcmp/32Ki                        200k       8276    3.959 GiB/s
BM_string_memcmp/64Ki                        100k      16351    4.008 GiB/s
BM_string_memcpy/8                          1000k         13    0.612 GiB/s
BM_string_memcpy/64                         1000k          8    7.187 GiB/s
BM_string_memcpy/512                          50M         38   13.311 GiB/s
BM_string_memcpy/1024                         20M         86   11.858 GiB/s
BM_string_memcpy/8Ki                           5M        620   13.203 GiB/s
BM_string_memcpy/16Ki                       1000k       1265   12.950 GiB/s
BM_string_memcpy/32Ki                        500k       2977   11.004 GiB/s
BM_string_memcpy/64Ki                        500k       8003    8.188 GiB/s
BM_string_memmove/8                         1000k         11    0.684 GiB/s
BM_string_memmove/64                        1000k         16    3.855 GiB/s
BM_string_memmove/512                         50M         57    8.915 GiB/s
BM_string_memmove/1024                        20M        117    8.720 GiB/s
BM_string_memmove/8Ki                          2M        853    9.594 GiB/s
BM_string_memmove/16Ki                      1000k       1731    9.462 GiB/s
BM_string_memmove/32Ki                       500k       3566    9.189 GiB/s
BM_string_memmove/64Ki                       500k       7708    8.501 GiB/s
BM_string_memset/8                          1000k         16    0.487 GiB/s
BM_string_memset/64                         1000k         16    3.995 GiB/s
BM_string_memset/512                          50M         37   13.489 GiB/s
BM_string_memset/1024                         50M         58   17.405 GiB/s
BM_string_memset/8Ki                           5M        451   18.160 GiB/s
BM_string_memset/16Ki                          2M        883   18.554 GiB/s
BM_string_memset/32Ki                       1000k       2181   15.022 GiB/s
BM_string_memset/64Ki                        500k       4563   14.362 GiB/s
BM_string_strlen/8                          1000k          8    0.965 GiB/s
BM_string_strlen/64                         1000k         16    3.855 GiB/s
BM_string_strlen/512                          20M         92    5.540 GiB/s
BM_string_strlen/1024                         10M        167    6.111 GiB/s
BM_string_strlen/8Ki                        1000k       1237    6.620 GiB/s
BM_string_strlen/16Ki                       1000k       2765    5.923 GiB/s
BM_string_strlen/32Ki                        500k       6135    5.341 GiB/s
BM_string_strlen/64Ki                        200k      13168    4.977 GiB/s

After
BM_string_memcmp/8                          1000k         21    0.369 GiB/s
BM_string_memcmp/64                         1000k         28    2.272 GiB/s
BM_string_memcmp/512                          20M        128    3.983 GiB/s
BM_string_memcmp/1024                         10M        234    4.375 GiB/s
BM_string_memcmp/8Ki                        1000k       1732    4.728 GiB/s
BM_string_memcmp/16Ki                        500k       3485    4.701 GiB/s
BM_string_memcmp/32Ki                        500k       7031    4.660 GiB/s
BM_string_memcmp/64Ki                        200k      14296    4.584 GiB/s
BM_string_memcpy/8                          1000k          5    1.458 GiB/s
BM_string_memcpy/64                         1000k          7    8.952 GiB/s
BM_string_memcpy/512                          50M         36   13.907 GiB/s
BM_string_memcpy/1024                         20M         80   12.750 GiB/s
BM_string_memcpy/8Ki                           5M        572   14.307 GiB/s
BM_string_memcpy/16Ki                       1000k       1165   14.053 GiB/s
BM_string_memcpy/32Ki                        500k       3141   10.430 GiB/s
BM_string_memcpy/64Ki                        500k       7008    9.351 GiB/s
BM_string_memmove/8                           50M          7    1.074 GiB/s
BM_string_memmove/64                        1000k          9    6.593 GiB/s
BM_string_memmove/512                         50M         37   13.502 GiB/s
BM_string_memmove/1024                        20M         80   12.656 GiB/s
BM_string_memmove/8Ki                          5M        573   14.281 GiB/s
BM_string_memmove/16Ki                      1000k       1168   14.018 GiB/s
BM_string_memmove/32Ki                      1000k       2825   11.599 GiB/s
BM_string_memmove/64Ki                       500k       6548   10.008 GiB/s
BM_string_memset/8                          1000k          7    1.038 GiB/s
BM_string_memset/64                         1000k          8    7.151 GiB/s
BM_string_memset/512                        1000k         29   17.272 GiB/s
BM_string_memset/1024                         50M         53   18.969 GiB/s
BM_string_memset/8Ki                           5M        424   19.300 GiB/s
BM_string_memset/16Ki                          2M        846   19.350 GiB/s
BM_string_memset/32Ki                       1000k       2028   16.156 GiB/s
BM_string_memset/64Ki                        500k       4514   14.517 GiB/s
BM_string_strlen/8                          1000k          7    1.120 GiB/s
BM_string_strlen/64                         1000k         16    3.918 GiB/s
BM_string_strlen/512                          50M         64    7.894 GiB/s
BM_string_strlen/1024                         20M        104    9.815 GiB/s
BM_string_strlen/8Ki                           5M        664   12.337 GiB/s
BM_string_strlen/16Ki                       1000k       1291   12.682 GiB/s
BM_string_strlen/32Ki                       1000k       2940   11.143 GiB/s
BM_string_strlen/64Ki                        500k       6440   10.175 GiB/s

Change-Id: I635bd2798a755256f748b2af19b1a56fb85a40c6
2016-11-28 19:35:12 +00: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
Christopher Ferris
c0f1f552f9 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
(cherry picked from commit a19bc2d4ed)
(cherry picked from commit b7f0267f0d)
2016-11-16 15:35:02 -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
87c0dba7b1 Check for bad packets in getaddrinfo.c's getanswer.
The near duplicate in gethnamaddr.c was already doing so (this fix
is basically copy and pasted from there, but with both copies modified
to avoid skirting undefined behavior).

Bug: http://b/32322088
Test: browser still works
Change-Id: Ied6662be567fb1bddc7ceb138cae1da77fb57976
(cherry picked from commit 27a4459d94)
2016-11-15 20:19:41 +00: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
Christopher Ferris
5bde25f61a Fix cortex-a53 inclusion of files.
I accidentally broken the cortex-a53 because it directly includes files
from cortex-a15. Rather than revert that part, just copy over the files
that are needed directly so we don't run into this in the future.

Test: Built the aosp_angler-userdebug target using cortex-a53 as the
Test: arm target. Then built the bionic unit tests and ran them on
Test: an angler.

Change-Id: Id89e240b31f94e99f5076e1de973a9344486ec35
2016-11-06 23:36:32 -08:00
Mingwei Shi
f6a21bfac5 Eliminate deadlock in forked child due to delayed resetting mutex lock
For some program implementation, the pattern like below, calling 
pthread_atfork to register atfork interfaces.

    pthread_atfork(&atfork_prepare, &atfork_parent, &atfork_child);

When the program is expected to reopen the shared library's handle 
inherited from parent in child process. Maybe, dlclose is called in 
atfork_child to release the shared library handle before reopen it. 
Then, dlclose will indrectly call _cxa_finalize and finaly call 
__unregister_atfork when dso is not NULL.

    atfork_child() -> dlclose() -> __on_dlclose() 
    	-> __cxa_finalize() -> __unregister_atfork(dso)

In __unregister_atfork, firstly, it try to hold the g_atfork_list_mutex 
lock to operate the g_atfork_list. Due to the registered atfork_child is
executed before resetting g_atfork_list_mutex lock in child, the child 
process will be blocked here because of deadlock.

Test: bionic-unit-tests32 --gtest_filter=pthread.pthread_atfork_child_with_dlclose 
without the fixing, the test will be timeout.

Change-Id: I35d3001682c836e0955d6d681bc5f9297fad0c7b
Signed-off-by: Mingwei Shi <mingwei.shi@intel.com>
Signed-off-by: Qiming Shi <qiming.shi@intel.com>
Signed-off-by: Chao Xie <chao.xie@intel.com>
2016-11-07 03:32:57 +00:00
Treehugger Robot
f41032a3e2 Merge "Set __get_thread()->tid as part of clone()." 2016-11-05 01:24:14 +00:00
Dan Albert
57e094f30a Remove _ZTV9type_info from the version script.
We broke this ABI in L:
https://android-review.googlesource.com/c/95071/.

This ABI break is now in over half of all devices, so it's more
correct to not have it than it is to have it. It's also worth noting
that this was only ever in ARM and MIPS; it was never in x86.

Test: make native
Bug: None
Change-Id: Ic58d048191f72d58fe72a2691bebbbfeda14bdf1
2016-11-04 16:51:45 -07:00
Dan Albert
832ccc2667 Run genversion-scripts.py.
I forgot to run this after adding NDK info to libstdc++.

Test: make native
Bug: None
Change-Id: I5d45aa7207b9eb548a233442aa0e3ab77d98baeb
2016-11-04 16:29:16 -07:00
Robert Sesek
e462117087 Set __get_thread()->tid as part of clone().
This was previously done only in fork() and pthread_create(), but this left raw
clone() with an invalid cached tid. Since the tid is used for pthread routines,
this led to unstable behavior after clone().

Test: ltp clone01 (see bug for more)
Test: mmma bionic/tests
Test: bionic-unit-tests-static --gtest_filter=*fork*:*clone*

Bug: 32612735
Bug: 32305649
Change-Id: I30eae5a8024b4c5da65476fcadfe14c6db35bb79
2016-11-04 16:57:20 -04:00
Neil Fuller
4c015e209d Update timezone data to 2016i.
IANA changes:

  Briefly: Cyprus split into two time zones on 2016-10-30, and Tonga
  reintroduces DST on 2016-11-06.

  Changes to future time stamps

    Pacific/Tongatapu begins DST on 2016-11-06 at 02:00, ending on
    2017-01-15 at 03:00.  Assume future observances in Tonga will be
    from the first Sunday in November through the third Sunday in
    January, like Fiji.  (Thanks to Pulu ʻAnau.)  Switch to numeric
    time zone abbreviations for this zone.

  Changes to past and future time stamps

    Northern Cyprus is now +03 year round, causing a split in Cyprus
    time zones starting 2016-10-30 at 04:00.  This creates a zone
    Asia/Famagusta.  (Thanks to Even Scharning and Matt Johnson.)

    Antarctica/Casey switched from +08 to +11 on 2016-10-22.
    (Thanks to Steffen Thorsen.)

  Changes to past time stamps

    Several corrections were made for pre-1975 time stamps in Italy.
    These affect Europe/Malta, Europe/Rome, Europe/San_Marino, and
    Europe/Vatican.

    First, the 1893-11-01 00:00 transition in Italy used the new UT
    offset (+01), not the old (+00:49:56).  (Thanks to Michael
    Deckers.)

    Second, rules for daylight saving in Italy were changed to agree
    with Italy's National Institute of Metrological Research (INRiM)
    except for 1944, as follows (thanks to Pierpaolo Bernardi, Brian
    Inglis, and Michael Deckers):

      The 1916-06-03 transition was at 24:00, not 00:00.

      The 1916-10-01, 1919-10-05, and 1920-09-19 transitions were at
      00:00, not 01:00.

      The 1917-09-30 and 1918-10-06 transitions were at 24:00, not
      01:00.

      The 1944-09-17 transition was at 03:00, not 01:00.  This
      particular change is taken from Italian law as INRiM's table,
      (which says 02:00) appears to have a typo here.  Also, keep the
      1944-04-03 transition for Europe/Rome, as Rome was controlled by
      Germany then.

      The 1967-1970 and 1972-1974 fallback transitions were at 01:00,
      not 00:00.

Bug: 32629043
Test: CtsIcuTestCases / CtsLibcoreTestCases / CtsBionicTestCases
Change-Id: Ica473348c063d2d0372b30ce6d184742db042c05
2016-11-04 16:23:47 +00:00
Christopher Ferris
aea8407ad5 Merge "Small cleanup of cortex-a15 code." 2016-11-03 22:40:16 +00:00
Treehugger Robot
42eb0b2555 Merge changes I751520a1,I5762e815
* changes:
  Add legacy inline for wait4.
  Revert "Add legacy inlines for locale aware APIs."
2016-11-02 19:56:10 +00:00
Christopher Ferris
fe1af1a64b Small cleanup of cortex-a15 code.
Remove new version of the cortex-a15 that caused a regression. We are never
going to revisit that code, and it is only confusing things.

Also remove the setting of MEMCPY_BASE and use the correct include
directly.

Test: Compiled angler with 32 bit arch as cortex-a15. Ran 32 bit bionic
Test: unit tests on angler.

Change-Id: I9372c01758fd7a596849c87b1a3f805bb477c94f
2016-11-01 14:28:22 -07:00
Dan Albert
e749abe9ab Add legacy inline for wait4.
This wasn't added to Android until android-18. Note that the reason
I'm adding an inline here even though I just reverted a bunch of
inlines in the previous commit is because this was an inline in the
legacy NDK headers. If it was in the old headers, it needs to be in
the unified headers. If it wasn't, it needs to be in
libandroid_support.

Test: ./tools/update_headers.py && make ndk && make native
      # Copied into working directory for unified headers NDK work.
      ndk/checkbuild.py
      ndk/run_tests.py --force-unified-headers
Bug: None

Change-Id: I751520a1df34b3edb5c59b4bd47170c4634a1883
2016-10-31 20:20:25 -07:00
Dan Albert
a3ce418ca6 Revert "Add legacy inlines for locale aware APIs."
We can't really add these to the unified headers yet since we're
still using the old headers as well, and libandroid_support needs to
work with both. These functions are already defined in
libandroid_support, so when using unified headers we'll get duplicate
definitions.

This was only going to be a temporary solution anyway. Instead we'll
just rely on libandroid_support (and eventually its rewrite) to handle
these.

This reverts commit 6576a3749b.

Test: ./tools/update_headers.py && make ndk && make native
      # Copied into working directory for unified headers NDK work.
      ndk/checkbuild.py
      ndk/run_tests.py --force-unified-headers
Bug: None

Change-Id: I5762e815e2030c89d7f2540df08dd67b6c2d10a5
2016-10-31 16:47:22 -07:00
Treehugger Robot
8c22ff76e2 Merge "Fix gettid() after clone()." 2016-10-29 02:09:56 +00:00
Treehugger Robot
9b908c8e36 Merge "Replace .align with .balign for clarity" 2016-10-28 17:23:49 +00:00
Robert Sesek
a4edf7a57c Fix gettid() after clone().
The tid is cached in the pthread_internal_t and is properly re-set after fork()
and pthread_create(). But after a plain clone() the value is stale from the
parent.

Test: mmma bionic/tests
Test: bionic-unit-tests-static --gtest_filter=*fork*:*clone*
Test: m checkbuild tests
Test: angler boots

Bug: 32305649
Change-Id: I026d416d1537484cd3e05c8493a35e5ed2acc8ed
2016-10-28 12:14:23 -04:00
Dimitry Ivanov
e6ee960aef Replace .align with .balign for clarity
Test: run bionic-unit-tests
Change-Id: Icb43cc47e41d58fe3cb71986e05b3134022f895c
2016-10-27 05:11:56 -07:00
Xiaolei Yu
eb596533e3 Fix format macros for fast16 and fast32 int types.
Also change original format test to cover all cases.

Test: bionic unit tests
Change-Id: I2995145562c02918e0b596c008e63459912447ab
2016-10-26 17:52:38 -07:00
Elliott Hughes
beb8796624 Use ENTRY_PRIVATE in __bionic_clone assembler.
Bug: N/A
Test: bionic tests
Change-Id: Ic651d628be009487a36d0b2e5bcf900b981b1ef9
2016-10-26 17:01:58 -07:00
Elliott Hughes
689ba18e11 Merge "_FILE_OFFSET_BITS=64's posix_fallocate should be posix_fallocate64." 2016-10-26 15:33:12 +00:00
Elliott Hughes
9bf2497c4a _FILE_OFFSET_BITS=64's posix_fallocate should be posix_fallocate64.
Bug: found when reproducing http://b/32331571
Test: "toybox fallocate -l 3m /data/local/tmp/new" on LP32
Change-Id: I4ec5835813b9556d824a12ad650bdf55698ea539
2016-10-25 14:13:32 -07:00
Neil Fuller
268b3d8878 Merge "Update timezone data to 2016h." 2016-10-25 08:28:11 +00:00
Treehugger Robot
e0baade272 Merge "Don't scan .swp files for copyright headers." 2016-10-25 04:43:20 +00:00
Elliott Hughes
4da06c0d64 Don't scan .swp files for copyright headers.
These are binary files, so that's not a good idea.

Bug: N/A
Test: N/A
Change-Id: If5e98df4bbbbac8a15a953be043df7d05c2b409a
2016-10-24 17:34:42 -07:00
Treehugger Robot
5e6eb761fc Merge "The default locale "" should be a UTF-8 locale." 2016-10-25 00:33:43 +00:00
Elliott Hughes
53de874c3c The default locale "" should be a UTF-8 locale.
"ls -q" (or "adb shell -tt ls") was mangling non-ASCII because mbrtowc
was returning multibyte characters as their individual bytes. This was
because toybox asks for "" rather than "C.UTF-8", and for some reason
we were interpreting that as "C" rather than "C.UTF-8".

Test: bionic tests, ls
Change-Id: Ic60e3b90cd5fe689e5489fad0d5d91062b9594ed
2016-10-24 14:50:31 -07:00
Elliott Hughes
dfb74c5f59 Minor copyright header unification.
Regenerating the NOTICE file the other day left me scratching my head at
various "how do they differ?" cases, resolved by this patch.

Test: N/A
Change-Id: I4230bfa1d7ec842a4b9fb8c73dd3b39443d74054
2016-10-24 12:57:55 -07:00
Neil Fuller
08bfe4f351 Update timezone data to 2016h.
IANA update relating to the data as follows:

The 2016h release of the tz code and data is available. Its primary
motivation is to update to the new rules for Palestine, where 2016g
becomes incorrect starting about four hours from now (sorry, we
didn't get much notice). More generally, the 2016h release reflects
the following changes, which were either circulated on the tz mailing
list or are relatively minor technical or administrative changes:

  Changes to future time stamps

    Asia/Gaza and Asia/Hebron end DST on 2016-10-29 at 01:00, not
    2016-10-21 at 00:00.  (Thanks to Sharef Mustafa.)  Predict that
    future fall transitions will be on the last Saturday of October
    at 01:00, which is consistent with predicted spring transitions
    on the last Saturday of March.  (Thanks to Tim Parenti.)

  Changes to past time stamps

    In Turkey, transitions in 1986-1990 were at 01:00 standard time
    not at 02:00, and the spring 1994 transition was on March 20, not
    March 27.  (Thanks to Kıvanç Yazan.)

  Changes to past and future time zone abbreviations

    Asia/Colombo now uses numeric time zone abbreviations like "+0530"
    instead of alphabetic ones like "IST" and "LKT".  Various
    English-language sources use "IST", "LKT" and "SLST", with no
    working consensus.  (Usage of "SLST" mentioned by Sadika
    Sumanapala.)

Bug: 32320380
Test: Ran CtsLibcoreTestCases, CtsBionicTestCases and ICU tests
Change-Id: I0286e7feac65f43518741d9ae18960e1adb888fb
2016-10-21 14:38:27 +01:00
Treehugger Robot
bd839d100d Merge changes from topic 'ndk-headers-licenses'
* changes:
  Add license to ndk_headers modules.
  One NOTICE file to rule them all.
2016-10-20 22:12:40 +00:00
Treehugger Robot
93a988debb Merge "Update our notice files as a pre-upload step." 2016-10-20 22:07:58 +00:00
Treehugger Robot
edecce3ac2 Merge "Fix stdin/stdout/stderr for pre-M." 2016-10-20 19:34:56 +00:00
Dan Albert
9259265fc2 Add license to ndk_headers modules.
Test: make ndk
Bug: None
Change-Id: I0e9a39def2be9cd81369843906f6d7c180d17045
2016-10-20 11:52:05 -07:00
Dan Albert
c30862fdbc One NOTICE file to rule them all.
Generate a single NOTICE file rather than one per library. All the
headers come from libc these days anyway.

Test: tools/update_notice.sh
Bug: None
Change-Id: I127da185fdabc2815042e19aea74c507ec108f46
2016-10-20 11:48:55 -07:00
Dan Albert
32d5592a69 Update our notice files as a pre-upload step.
Also updates the license files, since apparently they're out of date.

Test: repo upload --cbr .
Bug: None
Change-Id: Ic8d855a7ee5185c4933da699292868e02ef79531
2016-10-20 11:27:50 -07:00
Dan Albert
3037ea43fc Fix stdin/stdout/stderr for pre-M.
This wasn't an array of pointers, it was an array of structs.
Unfortunately we need a complete type to index into the struct for
stdin/stdout/stderr, so add a phony struct that matches the size and
alignment of `struct __sFILE`. This property is guaranteed by the
static_asserts in libc/bionic/struct_file_test.cpp.

Test: mma
Bug: http://b/30465923
Change-Id: I8ce851dd64a261703bb44f9b5cd23b7caff4dd68
2016-10-20 10:10:45 -07:00
Elliott Hughes
73c44a4738 Fix our _POSIX_* macros to declare barriers and spin locks.
We have these now.

Test: ran tests
Change-Id: Ie7b479061ecec19c8b35ea81e04debfd8323d94a
2016-10-19 09:28:21 -07:00
Elliott Hughes
22950687ee Fix ifaddrs error handling.
An NLMSG_ERROR packet includes an errno value that we should use. Also report
failures to create a socket immediately, rather than falling through to the
send and reporting EBADF.

Bug: http://b/32145516
Bug: http://b/31038971
Test: bionic ifaddr tests on ryu (with broken kernel) and flounder
Change-Id: I84c480c5b75077eb90d40426a9d66d7bffbd3d51
2016-10-14 14:35:26 -07:00
Elliott Hughes
da01fa620c Allocate all arc4random data on the same page.
Saves one dirty page per process.

Test: bionic unit tests, reboot, manual check of /proc/*/maps
Change-Id: Ibbcafa955d60e43f4cb735fa484c6868aa357cd5
2016-10-11 13:07:44 -07:00
Treehugger Robot
2c8a26d8bf Merge "Migrate libstdc++ to ndk_library." 2016-10-11 06:01:17 +00:00
Josh Gao
59bde2e8f4 Use STDERR_FILENO instead of opening /dev/stderr.
/dev/stderr is a symlink to /proc/self/fd/2, so this only has different
behavior when we're out of file descriptors, or when STDERR_FILENO is in
a different state (it's not at the end, it's not writable, etc.).

Test: mma
Change-Id: Ie99688d810218eca8482ff060373e88c4e001824
2016-10-07 13:21:03 -07:00
Dan Albert
df31aff4e9 Migrate libstdc++ to ndk_library.
Test: make checkbuild
Bug: http://b/30465923
Change-Id: I3b75b4e7fa652c83846c5978f9908e8b32d43aa7
2016-10-06 15:50:41 -07:00
Joachim Sauer
ba9734ffd5 Update timezone data to 2016g.
The 2016g release of the tz code and data is available. It reflects the
following changes, which were either circulated on the tz mailing list
or are relatively minor technical or administrative changes:

  Changes to future time stamps

    Turkey switched from EET/EEST (+02/+03) to permanent +03,
    effective 2016-09-07.  (Thanks to Burak AYDIN.)  Use "+03" rather
    than an invented abbreviation for the new time.

    New leap second 2016-12-31 23:59:60 UTC as per IERS Bulletin C 52.
    (Thanks to Tim Parenti.)

  Changes to past time stamps

    For America/Los_Angeles, spring-forward transition times have been
    corrected from 02:00 to 02:01 in 1948, and from 02:00 to 01:00 in
    1950-1966.

    For zones using Soviet time on 1919-07-01, transitions to UT-based
    time were at 00:00 UT, not at 02:00 local time.  The affected
    zones are Europe/Kirov, Europe/Moscow, Europe/Samara, and
    Europe/Ulyanovsk.  (Thanks to Alexander Belopolsky.)

  Changes to past and future time zone abbreviations

    The Factory zone now uses the time zone abbreviation -00 instead
    of a long English-language string, as -00 is now the normal way to
    represent an undefined time zone.

    Several zones in Antarctica and the former Soviet Union, along
    with zones intended for ships at sea that cannot use POSIX TZ
    strings, now use numeric time zone abbreviations instead of
    invented or obsolete alphanumeric abbreviations.  The affected
    zones are Antarctica/Casey, Antarctica/Davis,
    Antarctica/DumontDUrville, Antarctica/Mawson, Antarctica/Rothera,
    Antarctica/Syowa, Antarctica/Troll, Antarctica/Vostok,
    Asia/Anadyr, Asia/Ashgabat, Asia/Baku, Asia/Bishkek, Asia/Chita,
    Asia/Dushanbe, Asia/Irkutsk, Asia/Kamchatka, Asia/Khandyga,
    Asia/Krasnoyarsk, Asia/Magadan, Asia/Omsk, Asia/Sakhalin,
    Asia/Samarkand, Asia/Srednekolymsk, Asia/Tashkent, Asia/Tbilisi,
    Asia/Ust-Nera, Asia/Vladivostok, Asia/Yakutsk, Asia/Yekaterinburg,
    Asia/Yerevan, Etc/GMT-14, Etc/GMT-13, Etc/GMT-12, Etc/GMT-11,
    Etc/GMT-10, Etc/GMT-9, Etc/GMT-8, Etc/GMT-7, Etc/GMT-6, Etc/GMT-5,
    Etc/GMT-4, Etc/GMT-3, Etc/GMT-2, Etc/GMT-1, Etc/GMT+1, Etc/GMT+2,
    Etc/GMT+3, Etc/GMT+4, Etc/GMT+5, Etc/GMT+6, Etc/GMT+7, Etc/GMT+8,
    Etc/GMT+9, Etc/GMT+10, Etc/GMT+11, Etc/GMT+12, Europe/Kaliningrad,
    Europe/Minsk, Europe/Samara, Europe/Volgograd, and
    Indian/Kerguelen.  For Europe/Moscow the invented abbreviation MSM
    was replaced by +05, whereas MSK and MSD were kept as they are not
    our invention and are widely used.

  Changes to zone names

    Rename Asia/Rangoon to Asia/Yangon, with a backward compatibility link.
    (Thanks to David Massoud.)

Test: Ran CTS modules CtsLibcoreTestCases and CtsBionicTestCases.
Bug: 31848040
Change-Id: I4e9857616570ca9a540e27c109951ab265fea792
2016-10-04 09:52:58 +01:00
Elliott Hughes
4edd651ed3 Add missing O_CLOEXEC and TEMP_FAILURE_RETRY to localtime.c.
Follow-on change from http://b/31848040.

Test: *time* tests.
Change-Id: I3f1c9ce19b90f6f8c1ac6e0753e3fed0ff63c0b4
2016-10-03 16:46:33 -07:00
Elliott Hughes
fa8f1d0ab2 Fix tzdata loading.
Android uses one large file of tzdata, so the "read up to the maximum
possible length of a valid tzfile" code in upstream localtime.c is
broken: there is always data after the current tzfile (even the
last tzfile is followed by the zone.tab data). This patch passes the
exact length through to the read(2) call so we don't over-read, rather
than have to rewrite upstream code that measures back from the "end" of
the tzfile.

The old code failed the existing time.strftime_null_tm_zone test after
updating to tzdata2016g.

(cherry picked from commit 81c46fc10f)

Bug: http://b/31848040
Test: time.strftime_null_tm_zone
Change-Id: Iee059b5a8c051bd4952cfd80f02b00d83e489d5e
2016-10-03 16:37:26 -07:00
Elliott Hughes
81c46fc10f Fix tzdata loading.
Android uses one large file of tzdata, so the "read up to the maximum
possible length of a valid tzfile" code in upstream localtime.c is
broken: there is always data after the current tzfile (even the
last tzfile is followed by the zone.tab data). This patch passes the
exact length through to the read(2) call so we don't over-read, rather
than have to rewrite upstream code that measures back from the "end" of
the tzfile.

The old code failed the existing time.strftime_null_tm_zone test after
updating to tzdata2016g.

Bug: http://b/31848040
Test: time.strftime_null_tm_zone
Change-Id: Iee059b5a8c051bd4952cfd80f02b00d83e489d5e
2016-10-03 12:45:13 -07:00
Joachim Sauer
e131f6cf33 Update timezone data to 2016g.
The 2016g release of the tz code and data is available. It reflects the
following changes, which were either circulated on the tz mailing list
or are relatively minor technical or administrative changes:

  Changes to future time stamps

    Turkey switched from EET/EEST (+02/+03) to permanent +03,
    effective 2016-09-07.  (Thanks to Burak AYDIN.)  Use "+03" rather
    than an invented abbreviation for the new time.

    New leap second 2016-12-31 23:59:60 UTC as per IERS Bulletin C 52.
    (Thanks to Tim Parenti.)

  Changes to past time stamps

    For America/Los_Angeles, spring-forward transition times have been
    corrected from 02:00 to 02:01 in 1948, and from 02:00 to 01:00 in
    1950-1966.

    For zones using Soviet time on 1919-07-01, transitions to UT-based
    time were at 00:00 UT, not at 02:00 local time.  The affected
    zones are Europe/Kirov, Europe/Moscow, Europe/Samara, and
    Europe/Ulyanovsk.  (Thanks to Alexander Belopolsky.)

  Changes to past and future time zone abbreviations

    The Factory zone now uses the time zone abbreviation -00 instead
    of a long English-language string, as -00 is now the normal way to
    represent an undefined time zone.

    Several zones in Antarctica and the former Soviet Union, along
    with zones intended for ships at sea that cannot use POSIX TZ
    strings, now use numeric time zone abbreviations instead of
    invented or obsolete alphanumeric abbreviations.  The affected
    zones are Antarctica/Casey, Antarctica/Davis,
    Antarctica/DumontDUrville, Antarctica/Mawson, Antarctica/Rothera,
    Antarctica/Syowa, Antarctica/Troll, Antarctica/Vostok,
    Asia/Anadyr, Asia/Ashgabat, Asia/Baku, Asia/Bishkek, Asia/Chita,
    Asia/Dushanbe, Asia/Irkutsk, Asia/Kamchatka, Asia/Khandyga,
    Asia/Krasnoyarsk, Asia/Magadan, Asia/Omsk, Asia/Sakhalin,
    Asia/Samarkand, Asia/Srednekolymsk, Asia/Tashkent, Asia/Tbilisi,
    Asia/Ust-Nera, Asia/Vladivostok, Asia/Yakutsk, Asia/Yekaterinburg,
    Asia/Yerevan, Etc/GMT-14, Etc/GMT-13, Etc/GMT-12, Etc/GMT-11,
    Etc/GMT-10, Etc/GMT-9, Etc/GMT-8, Etc/GMT-7, Etc/GMT-6, Etc/GMT-5,
    Etc/GMT-4, Etc/GMT-3, Etc/GMT-2, Etc/GMT-1, Etc/GMT+1, Etc/GMT+2,
    Etc/GMT+3, Etc/GMT+4, Etc/GMT+5, Etc/GMT+6, Etc/GMT+7, Etc/GMT+8,
    Etc/GMT+9, Etc/GMT+10, Etc/GMT+11, Etc/GMT+12, Europe/Kaliningrad,
    Europe/Minsk, Europe/Samara, Europe/Volgograd, and
    Indian/Kerguelen.  For Europe/Moscow the invented abbreviation MSM
    was replaced by +05, whereas MSK and MSD were kept as they are not
    our invention and are widely used.

  Changes to zone names

    Rename Asia/Rangoon to Asia/Yangon, with a backward compatibility link.
    (Thanks to David Massoud.)

Test: Ran CTS modules CtsLibcoreTestCases and CtsBionicTestCases.
Bug: 31848040
Change-Id: I1e652ce2e428d44ba143e4ca9630fd2dc46087e4
2016-09-30 16:49:38 +01:00
Elliott Hughes
b81ade6203 Merge "Fix mbsnrtowcs where dst is null." 2016-09-30 15:41:40 +00:00
Treehugger Robot
83e9f36a11 Merge "Update escaping in Android.bp files" 2016-09-30 04:17:58 +00:00
Elliott Hughes
89e29ee485 Fix mbsnrtowcs where dst is null.
POSIX is its usual unintelligible self
(http://pubs.opengroup.org/onlinepubs/9699919799/functions/mbsrtowcs.html),
but the ISO C11 standard (7.29.6.4.1 paragraph 2) is pretty clear: *src
should change if and only if dst is non-null.

Bug: https://code.google.com/p/android/issues/detail?id=166381
Test: bionic tests
Change-Id: Ibc631cfa5b1bf4a6f56963feba9f0eea27b07984
2016-09-29 17:26:13 -07:00
Colin Cross
7b29495d0a Update escaping in Android.bp files
Strings like cflags in Android.bp files are parsed by blueprint,
written to build.ninja files, parsed by ninja, and then passed to
/bin/sh -c.  This had resulted in a combination of blueprint
(\"), ninja ($$), and shell (\$) escaping being necessary.

Soong has been updated to automatically handle ninja and shell
escaping, remove extra escaping from Android.bp files.

Bug: 31221587
Test: m -j
Change-Id: Ib58a51dee8d22296b69ec21768ba6a49dd60e980
2016-09-29 14:37:30 -07:00
Christopher Ferris
cc9e9933e1 Merge "Update documentation." 2016-09-29 17:28:39 +00:00
Christopher Ferris
ac66d16a52 Update documentation.
Fix the incorrect mention of when the zygote flag is set on a size.

Add information about how to use am dumpheap -n to dump the native
heap to a file.

Test: Documentation only change.

Change-Id: I82e810ee7ffffcf7506fb6fd9bcfdfb0465a48be
2016-09-28 14:54:06 -07:00
Elliott Hughes
95fa061678 Rename __pure, __pure2, and __purefunc.
These names were pretty misleading (aka "backwards"), so switch to the
same obvious names glibc uses.

Test: build.
Change-Id: Ia98c9dbbccd0820386116562347654e84669034a
2016-09-28 12:36:38 -07:00
Josh Gao
6cd9fb080c Fix warnings (and errors) in static inline headers.
Bug: http://b/31676510
Change-Id: Idcbc544e498f7e6bbe99c2bf7dc557a5681e96c4
Test: preupload hook
2016-09-23 14:34:03 -07:00
Dan Albert
6576a3749b Add legacy inlines for locale aware APIs.
Test: make checkbuild tests
Bug: http://b/31639993
Change-Id: Ic43d690dff3c6960d7826bd0b064640a3ea0e883
2016-09-22 00:44:37 -07:00
Dan Albert
3103f6d39e Add strtof_l and strtod_l.
libc++ needs these now. Add shims to match the others.

Test: make checkbuild tests
Bug: http://b/31639993
Change-Id: Ifec6c32099145d8d3d1a5639a4809e5e9f553c33
2016-09-22 00:44:37 -07:00
Nick Desaulniers
904460f749 Merge "bionic: tests: add test for fallocate FALLOC_FL_PUNCH_HOLE" 2016-09-21 22:30:31 +00:00
Elliott Hughes
53ad33b993 Merge "Remove remaining big-endian cruft." 2016-09-21 21:48:24 +00:00
Elliott Hughes
c351cbd7c0 Merge "Remove _KERNEL references from <machine/elf_machdep.h>." 2016-09-21 21:48:15 +00:00
Nick Desaulniers
09d900d50f bionic: tests: add test for fallocate FALLOC_FL_PUNCH_HOLE
Bug: 28760453
Change-Id: I1a58d19bf45eac5f930b0f649cf9b8c9046302f3
2016-09-21 09:24:50 -07:00
Dan Albert
f45d76a85b Match _Nonnull between char and wchar_t funcs.
The char versions of these functions have `_Nonnull` on these
parameters. Match it in the wide char versions. strxfrm_l also has
`__restrict` on its pointer arguments, I believe we've decided that's
something that shouldn't be proliferated...

Test: make checkbuild tests
Bug: None
Change-Id: Ie533e1af92b2a7c9df657073dbc4c345abf72473
2016-09-21 02:00:18 -07:00
Dan Albert
495ec92605 Add __ANDROID_API_FUTURE__.
Needed for checking conditions like `__ANDROID_API__ <
__ANDROID_API_FUTURE__` for providing inlines for things that have
not yet been included in any release.

Test: make checkbuild tests
Bug: None
Change-Id: Ibcddac5a538ede020a8cb65fca03194475121966
2016-09-21 01:08:44 -07:00
Elliott Hughes
42743f1e9e Merge "Fix some easy cases of __ANDROID__ versus __BIONIC__." 2016-09-17 16:40:59 +00:00
Elliott Hughes
497127711a Remove remaining big-endian cruft.
We'd removed most of it already, but a few bits and pieces were still lying
around.

Change-Id: I572a23eb15b9670d8d0f95586eca99ab0bdb4a1b
Test: mm.
2016-09-16 18:53:34 -07:00
Elliott Hughes
63da3dfb70 Remove _KERNEL references from <machine/elf_machdep.h>.
Test: mm.
Change-Id: I9dff708dd05d4f9e52ccdfde96e096553c873054
2016-09-16 18:46:53 -07:00
Elliott Hughes
a9209d7a0e Fix some easy cases of __ANDROID__ versus __BIONIC__.
We need to make a clearer distinction for bionic on the host. This patch
doesn't fully address things like "should host bionic try to talk to netd?"
for now, but is a step in the right direction.

Bug: http://b/31559095
Test: bionic tests.
Change-Id: I49812f8b75d9d78c4fd8a8ddf5df1201d63771d6
2016-09-16 18:27:07 -07:00
Josh Gao
81b4aadb48 Fix BYTE_ORDER check in <netinet/ip6.h>.
Neither BYTE_ORDER nor BIG_ENDIAN were being defined anywhere, so they
were defaulting to zero, leading to BIG_ENDIAN values being used.

Bug: http://b/31496165
Change-Id: Ic6089895f39b86e7762bdb5b7d5b01feb0d2fd17
2016-09-15 14:21:28 -07:00
Josh Gao
cb728e6f63 Fix instances of '#if __i386__'.
Triggers -Wundef, which is on in -Weverything.

Bug: http://b/31496165
Change-Id: Ie2241b19abd6257bebf68baa3ecc4de8066c722e
2016-09-15 14:21:28 -07:00
Josh Gao
b36efa4343 Fix instances of '#if __LP64__'.
Triggers -Wundef, which is on in -Weverything.

Bug: http://b/31496165
Change-Id: Ib06107073f7dd1d584c19c222d0430da9d35630b
2016-09-15 14:21:28 -07:00
Josh Gao
5622837301 Merge "Initialize main thread TLS before the global stack guard." 2016-09-15 19:28:56 +00:00
Dan Albert
bae16ef1bb Add missing uapi header module.
Test: make checkbuild tests
Bug: http://b/30465923
Change-Id: I4000a9f7aa7ede03dfe799cea7c890bd5dcda575
2016-09-14 17:16:33 -07:00
Dan Albert
a39f5d8b95 Make getpagesize inline static.
Needed to avoid multiple definition errors.

Test: make checkbuild tests
Bug: None
Change-Id: Ife83e89f5232e98d363e2b2edd7a353ed61c4836
2016-09-14 17:16:33 -07:00
Dan Albert
4238a35007 Add modules for NDK headers and libraries.
Test: make checkbuild
Bug: http://b/27533932
Change-Id: I285e483ba9fb80cc3baf0d025c85344e5b79a08b
2016-09-13 14:16:14 -07:00
Dan Albert
31d7037f2a Expose some more function decls.
Test: make checkbuild tests # for x86-eng this time
Bug: http://b/30465923
Change-Id: I98c5a8d09463e85ac22b05035c87edab04eaa200
2016-09-13 14:16:14 -07:00
Nikola Veljkovic
23f088cd74 [mips64] Fix ipc syscalls
Mips defines CONFIG_ARCH_WANT_IPC_PARSE_VERSION for both 32 and 64-bit.
See arch/mips/Kconfig. Other supported arches do it for 32-bit only.
This translates in having to pass IPC_64 flag for mips32 and mips64.
We use __mips__ to pass the flag, which is also defined for both 32 and
64-bit.

Change fixes bionic smoke tests (sys_msg, sys_sem, sys_shm) for mips64.

Test: bionic-unit-tests --gtest_filter="sys_*.smoke"
Change-Id: I918e4ffafd2002bb3e62ee252406746778100031
2016-09-09 12:24:04 +02:00
Treehugger Robot
572791e027 Merge changes Id513b72a,I92cd0116,I62393b58,I90ac2224,I527f88ac
* changes:
  Provide fake definitions for libstdc++.
  Provide static inlines for in6addr things.
  Provide an inline __cmsg_nxthdr.
  Correct more fortify availability guards.
  Move strncpy fortify into android-21.
2016-09-09 01:13:27 +00:00
Dan Albert
cb0b14385b Provide fake definitions for libstdc++.
libstdc++ needs to be able to `using ::foo` these in the various C++
wrapper headers for the C library. The NDK long ago added fake
definitions. We need to keep the same.

Test: make checkbuild
Bug: http://b/30465923
Change-Id: Id513b72a59eafcc823080631e07b21290d5e3b24
2016-09-08 16:13:28 -07:00
Dan Albert
69b26542de Provide static inlines for in6addr things.
mdnsresponder needs these and is built against a very old API level
since it is used in gmscore. The legacy NDK headers defined these
inline.

Test: make checkbuild
Bug: http://b/30465923
Change-Id: I92cd0116b3bde47e748ba648eaba94a7a3e3523e
2016-09-08 16:13:28 -07:00
Dan Albert
11f0e10c49 Provide an inline __cmsg_nxthdr.
This was defined as an inline in the legacy NDK headers. Keep that
here until we can get it into libandroid_support.

Test: make checkbuild
Bug: http://b/30465923
Change-Id: I62393b58e4fba3bc7337cc5ecf4ae1590b0e9917
2016-09-08 16:13:28 -07:00
Dan Albert
2990404206 Correct more fortify availability guards.
Test: make checkbuild
Bug: http://b/30465923
Change-Id: I90ac222483ecd39f1e7cc358babfb64e305cffcb
2016-09-08 16:13:27 -07:00
Elliott Hughes
2fc14a97e0 Don't use an anonymous label in arm's __bionic_clone.
All the other architectures name this label. Copy them.

(Following discussion of d30bc9e74b8ff3afceac973d334023564e64dbd2.)

Bug: https://llvm.org/bugs/show_bug.cgi?id=30308
Change-Id: I4f20163f569041180d87c79ce6ed856b70704271
2016-09-08 14:11:28 -07:00
Dan Albert
e5dd632e43 Move strncpy fortify into android-21.
__strncpy_chk2 wasn't added until android-21.

Test: make checkbuild
Bug: None
Change-Id: I527f88aca55ef5010e12ece18abbdce3d54ce252
2016-09-08 13:08:47 -07:00