Commit graph

25445 commits

Author SHA1 Message Date
Treehugger Robot
67267589ba Merge "Reimplement popen(3)/pclose(3)." 2018-07-11 22:02:13 +00:00
Elliott Hughes
3012b9636b Remove workarounds for old versions of clang and GCC.
Bug: N/A
Test: ran tests
Change-Id: I89d224c743f5113771de41c74161a7a5ccad05e4
2018-07-11 13:18:29 -07:00
Elliott Hughes
468efc80da Reimplement popen(3)/pclose(3).
pclose(3) is now an alias for fclose(3). We could add a FORTIFY check
that you use pclose(3) if and only if you used popen(3), but there seems
little value to that when we can just do the right thing.

This patch also adds the missing locking to _fwalk --- we need to lock
both the global list of FILE*s and also each FILE* we touch. POSIX says
that "The popen() function shall ensure that any streams from previous
popen() calls that remain open in the parent process are closed in the
new child process", which we implement via _fwalk(fclose) in the child,
but we might want to just make *all* popen(3) file descriptors O_CLOEXEC
in all cases.

Ignore fewer errors in popen(3) failure cases.

Improve popen(3) test coverage.

Bug: http://b/72470344
Test: ran tests
Change-Id: Ic937594bf28ec88b375f7e5825b9c05f500af438
2018-07-11 12:15:26 -07:00
Treehugger Robot
47c859c91b Merge "Remove bionic test's dependency on gtest internal." 2018-07-11 00:38:27 +00:00
Haibo Huang
83b6379783 Remove bionic test's dependency on gtest internal.
It is wrong to depend on internal ABI. And in the new version, they
explicitly disabled that.
b3d9be5c1d

Test: run test
Change-Id: I194a1e9417df2c52872b6eca6b61fb392e07cd29
2018-07-10 15:45:31 -07:00
Treehugger Robot
f0296f35f6 Merge "Include uchar.h only for bionic" 2018-07-10 00:42:25 +00:00
Haibo Huang
e2228cb64a Merge "Change args to int64_t" 2018-07-09 20:32:31 +00:00
Christopher Ferris
bcff244134 Merge "Update to v4.17.3 kernel headers." 2018-07-09 19:23:00 +00:00
Pirama Arumuga Nainar
6c0eab9c5b Include uchar.h only for bionic
Bug: http://b/111265772

uchar.h is not available in the glibc used for the host.  Since Bionic's
stdatomic.h is also used for the host (via a copy in prebuilts/clang)
guard the include with a check for __BIONIC__.

Also replace the check for C11 around definition of
atomic_char_{16,32}_t with a check for __BIONIC__.  While we're here,
check if __cplusplus is defined before checking its value.  This avoids
a potential -Wundef warning.

Test: Build
Change-Id: Icb62150d978703175b78d8ad12b42cf98b424b9a
2018-07-09 12:03:23 -07:00
Elliott Hughes
07a7c9b316 Merge "Fix some long-standing UTF-8 bugs." 2018-07-09 18:27:31 +00:00
Bernie Innocenti
57fe8130af Merge "bionic: Convert res_send.c to poll()" 2018-07-09 02:46:44 +00:00
Haibo Huang
d5ee4c5fb7 Change args to int64_t
The new benchmark framework uses int64_t for args.

Related benchmark change:
9913418d32 (diff-b9f55422dc0bd52759c6aaa25c305bb0R757)

Upgrade benchmark framework:
https://android-review.googlesource.com/c/platform/external/google-benchmark/+/714118

Test: compile and run bionic benchmark
Change-Id: I1b81c853c28abbead1816bf0be7a20a35e036619
2018-07-07 04:14:22 +00:00
Elliott Hughes
402c762fc9 Fix some long-standing UTF-8 bugs.
We we incorrectly rejecting U+fffe and U+ffff, and incorrectly accepting
characters above U+10ffff (see https://tools.ietf.org/html/rfc3629
section 12 for that restriction).

Bug: http://lists.landley.net/pipermail/toybox-landley.net/2017-September/009146.html
Test: ran tests
Test: also ran the exhaustive test from that email thread
Change-Id: I8ae8e41cef01b02933bd4f653ee07791932b79a5
2018-07-06 17:18:05 -07:00
Treehugger Robot
1d7c04c20a Merge "pthread_barrier_init: add a test for the count == 0 EINVAL case." 2018-07-06 23:21:24 +00:00
Elliott Hughes
463faada00 pthread_barrier_init: add a test for the count == 0 EINVAL case.
The code was already correct, but we didn't have a test.

Bug: N/A
Test: ran tests
Change-Id: Ie63cbcfbfc2f2df6270aae98f0f4add484d210bc
2018-07-06 14:34:49 -07:00
Bernie Innocenti
b664724525 bionic: Convert res_send.c to poll()
Bug: 5854418
Test: adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Test: manually:
    - flash and boot device
    - connect to wifi
    - launch WebView and resolv a few domains
Change-Id: I7b488e6d061d99a8a3c4bba69c2ac8609257eb6a
2018-07-05 11:39:09 +09:00
Tom Cherry
50acae8f2a Merge "Reland "Remove a check for AIDs in the OEM range."" 2018-06-29 23:08:37 +00:00
Tom Cherry
4cddb00d6f Reland "Remove a check for AIDs in the OEM range."
There may be vendor extensions to the system image which would need to
use these IDs.

This reverts commit 41986a013a.

Bug: 110856218
Test: these tests
2018-06-29 10:39:43 -07:00
Treehugger Robot
363eac0bab Merge "linker: improve "bad ELF magic" error." 2018-06-28 01:03:11 +00:00
Treehugger Robot
cc9fa92694 Merge "<sys/un.h>: add SUN_LEN." 2018-06-27 22:59:52 +00:00
Elliott Hughes
a897151426 linker: improve "bad ELF magic" error.
Include what we actually saw.

Bug: http://b/79463184
Test: ran tests
Change-Id: Id5f8aa3ab94b411ea839b0a1ada9beda9053a10f
2018-06-27 14:39:06 -07:00
Treehugger Robot
a2389a01bc Merge "<netinet/ip_icmp.h>: ensure struct icmphdr is available." 2018-06-27 21:17:59 +00:00
Christopher Ferris
76a1d45599 Update to v4.17.3 kernel headers.
Test: Builds, boots on a walleye.
Change-Id: I389d8b61ec00ea309e38d1b1a2e0dace48c21edb
2018-06-27 14:12:29 -07:00
Elliott Hughes
e7d185f59e <sys/un.h>: add SUN_LEN.
Also used by lldb.

Bug: N/A
Test: ran tests
Change-Id: I4c2aa60e7a3d8c691742c12ebde142d9438bf60f
2018-06-27 14:08:48 -07:00
Elliott Hughes
e5a5eec5e5 <netinet/ip_icmp.h>: ensure struct icmphdr is available.
Needed to build toybox ping.

Bug: N/A
Test: ran tests
Change-Id: Ifd0f0ccbb8351c6a0ece526b050778fd02e984bf
2018-06-27 12:29:06 -07:00
Treehugger Robot
6747bd1631 Merge "Set __bionic_asm_align to 16 for arm64" 2018-06-26 21:22:31 +00:00
Adhemerval Zanella
37d4e67bb0 Set __bionic_asm_align to 16 for arm64
As for others targets, it is better to align function text by minimim
cacheline size.  This patch changes arm __bionic_asm_align to 16.

Test: bionic tests on aarch64.
Change-Id: Ib121663c65493d33d6803e2c5139d247a8cae858
2018-06-26 15:58:52 -03:00
Treehugger Robot
92c6f7ee90 Merge "Remove relocation_packer." 2018-06-25 18:22:00 +00:00
Treehugger Robot
41e22b86cf Merge "bionic: Remove libc/Android.mk file" 2018-06-25 10:03:00 +00:00
Elliott Hughes
386ae3aff6 Remove relocation_packer.
We'll be using the lld built-in relocation packing going forward.

Bug: http://b/110715614
Test: builds
Change-Id: Ib3c086b642b8e3ab1dac022c0edef3b91665e477
2018-06-22 15:52:27 -07:00
Elliott Hughes
cff9dfacdc Merge "Don't emit warning on missing directories" 2018-06-21 21:16:25 +00:00
Jiyong Park
d3c08f28a3 Don't emit warning on missing directories
Some directories (e.g., /product/bin, etc.) in ld.config.txt may
not exist in some devices. Since many of them are optional directories,
don't emit warning when realpath() gives ENOENT for the paths.

Test: m -j
Change-Id: Ic4fa7db05bde53d3aa5df47291e83b4cdc09aa1f
2018-06-22 00:59:23 +09:00
Treehugger Robot
23f86f4f34 Merge "Resolve paths of dir.${section} if possible" 2018-06-21 05:05:17 +00:00
Treehugger Robot
90a20cd28d Merge "Add sinf/cosf/sincosf benchmark" 2018-06-21 02:05:27 +00:00
Treehugger Robot
3e637de184 Merge "Add logf and log2f benchmark" 2018-06-20 23:34:19 +00:00
Treehugger Robot
52a7e7e1bc Merge "Add powf benchmark" 2018-06-20 21:47:45 +00:00
Treehugger Robot
5fbda0ddb4 Merge "Add expf and exp2f benchmark" 2018-06-20 19:43:06 +00:00
Ryan Prichard
bcea0e2afd Call __emutls_unregister_key on dlclose
We want to delay the emutls pthread key deletion to keep
__thread/thread_local variables working as long as possible.

Currently, emutls has its own __attribute__((destructor)) function that
deletes its pthread key. That function runs even on process exit, and it
can run before other destructor functions and before C++ static object
destructors.

Move the destructor function to crtbegin_so.c, where an
__attribute__((destructor)) function is only called on dlclose. Use a
priority 0 destructor, which runs after every destructor with a default or
greater priority value.

__emutls_unregister_key will still run before destructor functions of
DT_NEEDED solibs. It also still leaks memory (both the emutls arrays and
each emutls object).

Bug: b/80453944
Test: manual
Change-Id: I6789bcf168415ab8badf2f64687c6a0136c5c917
2018-06-19 13:22:36 -07:00
Treehugger Robot
a03fbbd37b Merge "Mark bionic-loader-test-libs-target as a phony rule" 2018-06-19 15:10:30 +00:00
Adhemerval Zanella
7871ca1075 Add sinf/cosf/sincosf benchmark
Similar to expf/exp2f, this patch add two benchmarks for sinf, cosf, and
sincosf: one which measures thoughput as default and one which measures
latency.

The input in 512 random value divided in 8 ranges:

  1. 0.0 <= x < 0.1
  2. 0.1 <= x < 0.7
  3. 0.7 <= x < 3.1
  4. -3.1 <= x < 3.1
  5. 3.3 <= x < 33.3
  6. 100.0 <= x < 1000.0
  7. 1e6 <= x < 1e32
  8. 1e32 < x < FLT_MAX

Test: ran 32-bit and 64-bit x86 tests on host
Change-Id: I92bc2f1fac911c573c5122911d08ca590311578a
2018-06-19 11:34:54 -03:00
Adhemerval Zanella
ff5a353112 Add logf and log2f benchmark
Similar to expf/exp2f, this patch add two benchmarks for logf and log2f:
one which measures thoughput and one which measures latency.

The input data is based on a reduced trace based on 2.8 billion samples
extracted from specpu2017 521.wrf_r benchmark.

Test: ran 32-bit and 64-bit x86 tests on host
Change-Id: If4fbd7eb3d40f8e155935149a82f162b222d5506
2018-06-19 11:34:54 -03:00
Adhemerval Zanella
872c8b5133 Add powf benchmark
As for expf/exp2f benchmark, this patch add two benchmark for powf:
one which measures thoughput and one which measures latency.

The input data is based on a reduced trace from 2.3 billion samples
extracted from specpu2017 521.wrf_r benchmark.

Test: ran 32-bit and 64-bit x86 tests on host
Change-Id: Id8943d90dd5452146e55fb75708daaf7bf0e25fa
2018-06-19 11:34:54 -03:00
Adhemerval Zanella
357f6c1b47 Add expf and exp2f benchmark
This patch add two benchmarks for both expf and exp2f, one which
measures thoughput, as default, and one which measures latency. The
latency benchmark works by creating a dependency on the previous
iteration and with a zero multiply to avoid changing the input value.

The input is based on a reduced trace based on 2.4 billion samples
extracted from specpu2017 521.wrf_r benchmark.

Test: ran 32-bit and 64-bit x86 tests on host
Change-Id: Ic0d40cc4977dd6875fb7431146fc38ea0e6e0bc2
2018-06-19 11:34:54 -03:00
Dan Willemsen
901055eec7 Mark bionic-loader-test-libs-target as a phony rule
This essentially was phony before, but it wasn't marked as such. Mark it
so that we can turn on some more sanity checks in the build.

Test: Fewer warnings when --warn_real_to_phony is enabled for kati
Change-Id: I5f02b291ca01141dea75977df8b5ef9630917eb2
2018-06-18 20:23:14 -07:00
Inseob Kim
216323bd84 Resolve paths of dir.${section} if possible
Some devices place some of their partitions under /system. If the linker
resolves that paths, verboseness of ld.config.txt will be reduced as we
don't need to add both /system/{partition} and /{partition}.

Bug: http://b/80422611
Test: m -j, boot on taimen, atest
Change-Id: I6b712170bb89229b764026e2cc517c426e6e6063
2018-06-18 19:16:34 +09:00
Bernie Innocenti
0912d76b96 bionic: Remove libc/Android.mk file
Since there are no longer any Android.mk files in subdirs, the
top-level one can go.

Test: m
Change-Id: Ifc51545fc82a5eaa0801babd3ede20d911f1b9c3
2018-06-18 05:22:15 +00:00
Christopher Ferris
520ad0cae8 Merge "Change heap dump format slightly." 2018-06-15 21:36:42 +00:00
Christopher Ferris
2e1a40a203 Change heap dump format slightly.
Bump the version from v1.1 to v1.2 and add a build fingerprint line.

Update the heap dump documentation to match the new format and reflect
what made it in P and what made it in Q.

Update the unit tests for this change.

Add -O0 to unit test code to make it easier to debug.

Add an external function that can be used by the framework code
so that there is only one way to dump the heap.

Bug: 110095681

Test: Ran unit tests.
Test: Did a dump of a real process and verified fingerprint.
Test: Did a dump of a process without malloc debug enabled.
Change-Id: I769a476cbeaf4c85c5d75bd6d6385f0e3add948c
Merged-In: I769a476cbeaf4c85c5d75bd6d6385f0e3add948c
(cherry picked from commit c84a2a2601)
2018-06-15 12:29:13 -07:00
Treehugger Robot
2583b0adb2 Merge changes from topic "sharedlib_in_recovery"
* changes:
  dynamic linker is running for init
  Build recovery variant of the dynamic linker
2018-06-13 23:14:29 +00:00
Treehugger Robot
79d8ecb9fb Merge "Remove valgrind workarounds." 2018-06-13 00:30:28 +00:00