Commit graph

9831 commits

Author SHA1 Message Date
Raman Tenneti
afe44cc483 Merge "Revert "Revert "Make system property reads wait-free""" 2019-11-12 20:43:29 +00:00
Raman Tenneti
b481a2e743 Revert "Revert "Make system property reads wait-free""
This reverts commit de39d9242a.

Reason for revert: This revert is not needed

Change-Id: I34af8e5d75c724f6c4066fafbfc6bc7d58377601
2019-11-12 20:41:55 +00:00
Raman Tenneti
de39d9242a Revert "Make system property reads wait-free"
This reverts commit 0cf90556de.

Reason for revert: Device boot failures - 144355953

Change-Id: Icd4fc8c7a1d06d688a6d37e6f1c1aa45563f711b
2019-11-12 18:24:06 +00:00
jaishank
2e50fa7cf8 Optimized L2 Cache value for Intel(R) Core Architectures.
Performance Gain:
AnTuTu             - 4.80%
3D Mark Sling Shot - 3.47%
BaseMarkGPU        - 5.51%
GeekBench          - 3.19%

Test: ./tests/run-on-host.sh 64

Change-Id: I6122835a3f5fd97cc291623d1062fe25843a2d93
Signed-off-by: jaishank <jaishankar.rajendran@intel.com>
2019-11-12 15:58:34 +00:00
Daniel Colascione
0cf90556de Make system property reads wait-free
Right now, when we read a system property, we first (assuming we've
already looked up the property's prop_info) read the property's serial
number; if we find that the low bit (the dirty bit) in the serial
number is set, we futex-wait for that serial number to become
non-dirty. By doing so, we spare readers from seeing partially-updated
property values if they race with the property service's non-atomic
memcpy to the property value slot. (The futex-wait here isn't
essential to the algorithm: spinning while dirty would suffice,
although it'd be somewhat less efficient.)

The problem with this approach is that readers can wait on the
property service process, potentially causing delays due to scheduling
variance. Property reads are not guaranteed to complete in finite time
right now.

This change makes property reads wait-free and ensures that they
complete in finite time in all cases. In the new approach, we prevent
value tearing by backing up each property we're about to modify and
directing readers to the backup copy if they try to read a property
with the dirty bit set.

(The wait freedom is limited to the case of readers racing against
*one* property update. A writer can still delay readers by rapidly
updating a property --- but after this change, readers can't hang due
to PID 1 scheduling delays.)

I considered adding explicit atomic access to short property values,
but between binary compatibility with the existing property database
and the need to carefully handle transitions of property values
between "short" (compatible with atomics) and "long" (incompatible
with atomics) length domains, I figured the complexity wasn't worth it
and that making property reads wait-free would be adequate.

Test: boots
Bug: 143561649
Change-Id: Ifd3108aedba5a4b157b66af6ca0a4ed084bd5982
2019-11-11 11:17:00 -08:00
Nick Desaulniers
97c43095b9 bionic: libc: remove -Wimplicit-fallthrough
aosp/144287300 set it to a global cppflag.

The compiler upgrade can now check for this warning in C code.

This patch should be reverted once the BSD sources with instances of
-Wimplicit-fallthrough have been fixed.

Remove it from cflags, so that it's not re-enabled for C code until
fixed.

Bug: 139945549
Bug: 144287300
Test: mm
Change-Id: Ieca0d5b41634636477392e5209a41807f9b44bd4
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2019-11-11 10:49:10 -08:00
Treehugger Robot
ffad55954b Merge "Stop using __out as a name." 2019-11-08 23:25:19 +00:00
Elliott Hughes
f38e8ca149 Stop using __out as a name.
libc++ poisons `__out` because it's #defined on Windows. Rather than
hack libc++, let's just avoid that name. "src" and "dst" are far more
widely used than "in" and "out" for this purpose anyway.

Test: treehugger
Change-Id: I0db9997fd5f06f626dbf0ee967b52145395466b4
2019-11-08 13:51:12 -08:00
Christopher Ferris
6f517cd7a1 Rename iterate to malloc_iterate internally.
I have no idea why I used the iterate name internally which is
completely unlike every other function name. Change this to match
everyone else so that it's now malloc_iterate everywhere.

This is probably the last chance to change this before mainline
modules begin, so make everything consistent.

Test: Compiles, unit tests passes.
Change-Id: I56d293377fa0fe1a3dc3dd85d6432f877cc2003c
2019-11-08 11:49:14 -08:00
George Burgess IV
2fead5fd89 Merge "Revert "fortify: allow diagnostics without run-time checks"" 2019-11-07 07:10:38 +00:00
George Burgess IV
f359548bf1 Revert "fortify: allow diagnostics without run-time checks"
This reverts commit d7e11b8853.

Reason for revert: Breaks aosp_x86_64-eng. Will look into it and
unbreak when it's not almost midnight. :)

Change-Id: I21f76efe4d19c70d0b14630e441376d359a45b49
2019-11-07 07:07:38 +00:00
Treehugger Robot
d1dcb72882 Merge "fortify: allow diagnostics without run-time checks" 2019-11-07 01:34:11 +00:00
Christopher Ferris
7a3a5d8cd7 Merge "Fix allocations escaping malloc debug." 2019-11-06 23:31:33 +00:00
Christopher Ferris
ff88fb0d3a Fix allocations escaping malloc debug.
When using a FILE object for some malloc debug functions, calling
fprintf will trigger an allocation to be put in the object. The problem
is that these allocations were not allocated by the malloc debug
wrapper and they get freed during the fclose as if they are malloc
debug allocation. In most cases, the code will detect the bad pointer
and leak the memory, but it might also cause a crash.

The fix is to avoid using fprintf so that no allocations are made
in the object that survive and need to be freed in the fclose call.

Change the MallocXmlElem.h to use a file decsriptor not a FILE object.

Add new unit and system tests to detect this case.

Bug: 143742907

Test: Ran unit and system tests.
Test: Ran bionic unit tests.
Change-Id: I524392de822a29483aa5be8f14c680e70033eba2
2019-11-06 10:42:42 -08:00
Elliott Hughes
d9585a2196 Merge "android_getaddrinfo_proxy: fix memory leak on failure." 2019-11-06 17:31:14 +00:00
Treehugger Robot
b450a7f426 Merge "search.h: add doc comments." 2019-11-06 03:58:32 +00:00
Ryan Prichard
249757bae2 Use ifuncs in the linker
Using ifuncs allows the linker to select faster versions of libc functions
like strcmp, making linking faster.

The linker continues to first initialize TLS, then call the ifunc
resolvers. There are small amounts of code in Bionic that need to avoid
calling functions selected using ifuncs (generally string.h APIs). I've
tried to compile those pieces with -ffreestanding. Maybe it's unnecessary,
but maybe it could help avoid compiler-inserted memset calls, and maybe
it will be useful later on.

The ifuncs are called in a special early pass using special
__rel[a]_iplt_start / __rel[a]_iplt_end symbols. The linker will encounter
the ifuncs again as R_*_IRELATIVE dynamic relocations, so they're skipped
on the second pass.

Break linker_main.cpp into its own liblinker_main library so it can be
compiled with -ffreestanding.

On walleye, this change fixes a recent 2.3% linker64 start-up time
regression (156.6ms -> 160.2ms), but it also helps the 32-bit time by
about 1.9% on the same benchmark. I'm measuring the run-time using a
synthetic benchmark based on loading libandroid_servers.so.

Test: bionic unit tests, manual benchmarking
Bug: none
Merged-In: Ieb9446c2df13a66fc0d377596756becad0af6995
Change-Id: Ieb9446c2df13a66fc0d377596756becad0af6995
(cherry picked from commit 772bcbb0c2)
2019-11-05 13:37:51 -08:00
Elliott Hughes
4aef93acff android_getaddrinfo_proxy: fix memory leak on failure.
The shadowing of `ai` meant that the freeaddrinfo() call outside the
loop would never see anything but NULL.

Bug: https://issuetracker.google.com/143928781
Test: treehugger
Change-Id: I1bf137f7933201eb8024603bfd569ff7bbc7f9b7
2019-11-05 12:42:14 -08:00
Johan Harvyl
89b09198b9 Close descriptor in ScopeFd destructor
The underlying descriptor is supposed to be closed when the ScopedFd
goes out of scope but due to a typo in reset() that never happens.

This change was inspired by an earlier implementation of ScopedFd in:
04dc91ae7 Load library using file handle.

Issue: 143918215
Test: Manual (verify fd usage on device)
Change-Id: I5664fa82d3e732113732e34a7ae6df3ca79d3cee
2019-11-05 12:20:23 +01:00
Elliott Hughes
a468123fa4 search.h: add doc comments.
Also remove the __INTRODUCED_IN(16)s, since we don't support anything
lower than 16.

Test: treehugger
Change-Id: I2cbd023d211a0f0ddf27251071caa29839c671a8
2019-11-04 13:59:12 -08:00
Elliott Hughes
590bdbe6e9 Merge "Header improvements." 2019-11-04 21:58:20 +00:00
Elliott Hughes
b361e68d34 Header improvements.
Remove some __INTRODUCED_IN(16)s, since we don't support anything lower
than 16, so that's a no-op. And add the missing doc comments to those
headers while we're there.

Test: treehugger
Change-Id: I0328c530675564f0f1124bd483da05ad06df3507
2019-11-01 16:47:46 -07:00
George Burgess IV
d7e11b8853 fortify: allow diagnostics without run-time checks
In configs like ASAN, we can't use _chk functions. This CL builds off of
previous work to allow us to still emit diagnostics in conditions like
these.

Wasn't 100% sure what a good test story would look like here. Opinions
appreciated.

Bug: 141267932
Test: checkbuild on internal-master
Change-Id: I8d4f77d7b086a8128a18a0a0389243d7fa05b00f
2019-11-01 16:25:55 -07:00
Peter Collingbourne
e99912f2eb Define ANDROID_EXPERIMENTAL_MTE if the product variable experimental_mte is enabled.
This will activate code in bionic that uses the experimental MTE
userspace interface.

Bug: 135772972
Change-Id: I9ac641b9528de5376cdb920bee0e900a1b1fa9c2
2019-11-01 15:37:00 -07:00
Treehugger Robot
d753895f10 Merge "Pass -ffreestanding when compiling ifunc resolvers." 2019-11-01 21:18:30 +00:00
Elliott Hughes
6cb70ad776 Add the ScopedFd that we've never quite gotten around to.
This is actually for the new change I'm working on, but let's retrofit
it first to separate any bugs in these changes from those in the new
change...

Test: treehugger
Change-Id: I890aeb61f9792810a77ad0da3f9674c9cc5db7bb
2019-10-31 21:16:18 -07:00
Peter Collingbourne
36a56440e0 Pass -ffreestanding when compiling ifunc resolvers.
This flag prevents the compiler from inserting calls to libc functions in
the ifunc resolver code, which will definitely cause problems if the libc
function is itself an ifunc, but other calls that use the PLT may also be
affected, since libc may not have been fully resolved yet. As it turns out,
newer versions of clang will insert calls to memcmp in the body of the
init_cpu_variant() function in arch-arm/dynamic_function_dispatch.cpp.

Change-Id: I91f18d450835adc4b74565e9f48d5834f594a0c4
2019-10-31 17:21:17 -07:00
Elliott Hughes
ffded19346 qsort.c: take an upstream FreeBSD change.
r334928 | kib | 2018-06-10 10:54:44 -0700 (Sun, 10 Jun 2018) | 16 lines

  libc qsort(3): stop aliasing.

  Qsort swap code aliases the sorted array elements to ints and longs in
  order to do swap by machine words.  Unfortunately this breaks with the
  full code optimization, e.g. LTO.

  See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83201 which seems to
  reference code directly copied from libc/stdlib/qsort.c.

  PR: 228780
  Reported by:  mliska@suse.cz
  Reviewed by:  brooks
  Sponsored by: The FreeBSD Foundation
  MFC after:  2 weeks
  Differential revision:  https://reviews.freebsd.org/D15714

Test: treehugger
Change-Id: Iac608b13bbf8a2dcb48c935a7871c0d2f05bff79
2019-10-30 12:02:44 -07:00
Elliott Hughes
8ccf486695 Merge "Clean up some obsolete NetBSD portability cruft." 2019-10-30 17:21:25 +00:00
Elliott Hughes
80c99e30c0 Merge "Clean up some obsolete OpenBSD portability cruft." 2019-10-30 17:20:58 +00:00
Elliott Hughes
5951fcbd3f Merge "Clean up some obsolete FreeBSD portability cruft." 2019-10-30 16:38:45 +00:00
Elliott Hughes
888903aa8a Merge "Take a couple of wcs MTE patches from upstream FreeBSD." 2019-10-30 14:44:25 +00:00
Elliott Hughes
d1f1e41d8c Merge "Take a getopt_long() patch from upstream FreeBSD." 2019-10-30 14:43:15 +00:00
Peter Collingbourne
e1ab123dd3 Merge "Add arm64 string.h function implementations for use with hardware supporting MTE." 2019-10-30 04:42:53 +00:00
Elliott Hughes
5c5152bff5 Clean up some obsolete OpenBSD portability cruft.
Test: treehugger
Change-Id: Ic76a55cf28b862d51fa3f96549eb99e992e72954
2019-10-29 19:59:28 -07:00
Elliott Hughes
5828ad7dfe Clean up some obsolete NetBSD portability cruft.
Test: treehugger
Change-Id: I9197e6ebcaec6811ff5ee12e4d2e7a14c2881f64
2019-10-29 19:58:17 -07:00
Elliott Hughes
c996c73f76 Clean up some obsolete FreeBSD portability cruft.
Test: treehugger
Change-Id: I86ddeb64c7b8bda80633f063fd70fddd2ac113ed
2019-10-29 19:49:19 -07:00
Peter Collingbourne
900d07d6a1 Add arm64 string.h function implementations for use with hardware supporting MTE.
As it turns out, our "generic" arm64 implementations of certain string.h
functions are not actually generic, since they will eagerly read memory
possibly outside of the bounds of an MTE granule, which may lead to a segfault
on MTE-enabled hardware. Therefore, move the implementations into a "default"
directory and use ifuncs to select between them and a new set of "mte"
implementations, conditional on whether the hardware and kernel support MTE.

The MTE implementations are currently naive implementations written in C
but will later be replaced with a set of optimized assembly implementations.

Bug: 135772972
Change-Id: Ife37c4e0e6fd60ff20a34594cc09c541af4d1dd7
2019-10-29 16:18:31 -07:00
Elliott Hughes
89c4e4a43e Take a couple of wcs MTE patches from upstream FreeBSD.
r293856 | brooks | 2016-01-13 13:50:08 -0800 (Wed, 13 Jan 2016) | 10 lines

  Avoid reading pass the end of the source buffer when it is not NUL
  terminated.

  If this buffer is adjacent to an unmapped page or a version of C with
  bounds checked is used this may result in a crash.

  PR:		206178
  Submitted by:	Alexander Cherepanov <cherepan@mccme.ru>
  MFC after:	1 week

and

  r293855 | brooks | 2016-01-13 13:49:01 -0800 (Wed, 13 Jan 2016) | 10 lines

  Avoid reading pass the end of the source buffer when it is not NUL
  terminated.

  If this buffer is adjacent to an unmapped page or a version of C with
  bounds checked is used this may result in a crash.

  PR:		206177
  Submitted by:	Alexander Cherepanov <cherepan@mccme.ru>
  MFC after:	1 week

Test: treehugger
Change-Id: I3f7b9e6d0648574d2836f7721dfe47c1bae146de
2019-10-29 20:10:59 +00:00
Elliott Hughes
5b4b58aad4 Take a getopt_long() patch from upstream FreeBSD.
r342757 | kevans | 2019-01-03 19:13:24 -0800 (Thu, 03 Jan 2019) | 19 lines

  getopt_long(3): fix case of malformed long opt

  When presented with an arg string like '-l-', getopt_long will successfully
  parse out the 'l' short option, then proceed to match '--' against the first
  longopts entry as it later does a strncmp with len=0. This latter bit is
  arguably another bug in itself, but presumably not a practical issue as all
  callers of parse_long_options are already doing the right thing (except this
  one pointed out).

  An opt string like '-l-' should be considered malformed and throw a bad
  argument rather than behaving as if '--' were passed. It cannot possibly do
  what the invoker expects, and it's probably the result of a typo (ls -l- a)
  rather than any intent.

  Reported by:	Tony Overfield <toverfield@yahoo.com>
  Reviewed by:	imp
  MFC after:	2 weeks
  Differential Revision:	https://reviews.freebsd.org/D18616

Test: treehugger
Change-Id: I593713bc35d70eb1975c9d7587528f2b3f9731af
2019-10-29 20:09:49 +00:00
Elliott Hughes
d310125a68 Take a quick_exit() patch from upstream FreeBSD.
r325389 | kib | 2017-11-04 03:52:58 -0700 (Sat, 04 Nov 2017) | 7 lines

  C++17 requires quick_exit(3) to be async-signal safe.

  Make it safe, and update man page with the useful information.

  Sponsored by: The FreeBSD Foundation
  MFC after:  1 week

Test: treehugger
Change-Id: Idf84b1f1e360c031b0e39d5f6e80d17308db1940
2019-10-29 13:07:42 -07:00
Peter Collingbourne
609d6ec416 Merge "Adopt GNU calling convention for ifunc resolvers." 2019-10-29 17:19:33 +00:00
Elliott Hughes
dbe72ca7a1 Merge "sleep/usleep: switch to trivial implementations." 2019-10-29 14:48:20 +00:00
Elliott Hughes
ca3f8e4901 sleep/usleep: switch to trivial implementations.
Upstream keeps rearranging the deckchairs for these, so let's just
switch to the [roughly] one-liners rather than track that...

Test: treehugger
Change-Id: If655cf7a7f316657de44d41fadd43a8c55ee6f23
2019-10-28 22:25:02 -07:00
Peter Collingbourne
e949195f64 Adopt GNU calling convention for ifunc resolvers.
In order for an ifunc resolver to detect the presence of certain CPU features,
access to getauxval(AT_HWCAP) or getauxval(AT_HWCAP2) may be required. In order
for getauxval() to work, it needs to access the pointer to the auxiliary vector
stored by the linker in the libc shared globals data structure. Accessing the
shared globals requires libc to call the __libc_shared_globals() function
exported by the linker. However, in order to call this function, libc must
be fully relocated, which is not guaranteed to be the case at the point when
ifunc resolvers are called.

glibc solves this problem by passing the values of getauxval(AT_HWCAP)
(and getauxval(AT_HWCAP2) on aarch64) as arguments to the ifunc resolver.
Since this seems to be not only the most straightforward way to solve the
problem but also improves our compatibility with glibc, we adopt their
calling convention.

This change is ABI compatible with old resolvers because the arguments are
passed in registers, so the old resolvers will simply ignore the new arguments.

Bug: 135772972
Change-Id: Ie65bd6e7067f0c878df3d348c815fda61dc12de2
2019-10-28 20:20:29 -07:00
Elliott Hughes
ccea6934fe Take a bunch of trivial SPDX changes from upstream FreeBSD.
Test: treehugger
Change-Id: I2242d47e5ee4e7aaa637e2e2933e0f88b1d05e77
2019-10-28 14:23:15 -07:00
Elliott Hughes
ed1b861d0d Merge "Remove __ANDROID_NDK__ from bionic, and document our #defines." 2019-10-16 16:37:05 +00:00
Treehugger Robot
0ace96d754 Merge "libc_malloc_[debug|hooks] are not available for platform" 2019-10-16 02:09:44 +00:00
Elliott Hughes
80e9f65c04 Remove __ANDROID_NDK__ from bionic, and document our #defines.
__ANDROID_NDK__ is moving into the NDK's <android/ndk-version.h>
instead.

Test: treehugger
Change-Id: I192016165a929547009d15dbcc30e8f6dad1ac88
2019-10-15 13:30:12 -07:00
Ryan Prichard
22a6a058c7 Move dl_unwind_find_exidx from libdl.a to libc.a
arm32 has two special APIs to find exidx exception handling info,
dl_unwind_find_exidx and __gnu_Unwind_Find_exdix. The two functions have
identical behavior and function prototypes. libgcc's arm32 unwinder calls
__gnu_Unwind_Find_exdix, whereas LLVM's libunwind previously called
__gnu_Unwind_Find_exdix, but switched to dl_unwind_find_exidx as a result
of three patches (D30306, D30681, D39468).

In Bionic, for dynamic linking, __gnu_Unwind_Find_exdix in libc.so calls
dl_unwind_find_exidx in libdl.so.

For static executables, though, __gnu_Unwind_Find_exdix in libc.a used the
__exidx_* symbols, while dl_unwind_find_exidx in libdl.a(libdl_static.o)
was a return-0 no-op.

To fix the LLVM unwinder, replace the no-op dl_unwind_find_exidx in
libdl.a with a real function in libc.a(exidx_static.o), and have the GNU
function call the dl function for more consistency with dynamic linking.

dl_iterate_phdr follows a similar pattern, where the function exists in
libc.a and libdl.so (not libc.so or libdl.a).

This change makes unwinding work with an updated libunwind_llvm on arm32,
and it helps to allow unwinding in static executables without libdl.a.

Bug: https://github.com/android/ndk/issues/1094
Bug: http://b/141485154
Test: NDK tests, bionic unit tests
Change-Id: Ieeeb9b39a0e28544e21f9afe6fe51ef10d7c828c
2019-10-14 16:34:12 -07:00
Elliott Hughes
e9ff762789 Merge "Reimplement the <ctype.h> is* functions." 2019-10-09 15:09:45 +00:00
Elliott Hughes
ee15585029 Merge "Restore __ANDROID_NDK__." 2019-10-09 15:09:35 +00:00
Elliott Hughes
9823c926b2 Restore __ANDROID_NDK__.
At heart a revert of "Don't #define __ANDROID_NDK__ for the platform build!",
which was commit eb61430374.

The original change was insufficiently motivated, and meant that the
NDK -- not just the platform -- no longer defines __ANDROID_NDK__. Which
then broke at least building toybox with NDK r19.

Change-Id: Ic616688e4d17d25714a9ef381269d7431deac9b0
2019-10-08 12:36:22 -07:00
Elliott Hughes
a4959aa6f8 Reimplement the <ctype.h> is* functions.
Following on from the towlower()/towupper() changes, add benchmarks for
most of <ctype.h>, rewrite the tests to cover the entire defined range
for all of these functions, and then reimplement most of the functions.

The old table-based implementation is mostly a bad idea on modern
hardware, with only ispunct() showing a significant benefit compared to
any other way I could think of writing it, and isalnum() a marginal but
still convincingly genuine benefit.

My new benchmarks make an effort to test an example from each relevant
range of characters to avoid, say, accidentally optimizing the behavior
of `isalnum('0')` at the expense of `isalnum('z')`.

Interestingly, clang is able to generate what I believe to be the
optimal implementations from the most readable code, which is
impressive. It certainly matched or beat all my attempts to be clever!

The BSD table-based implementations made a special case of EOF despite
having a `_ctype_` table that's offset by 1 to include EOF at index 0.
I'm not sure why they didn't take advantage of that, but removing the
explicit check for EOF measurably improves the generated code on arm and
arm64, so even the two functions that still use the table benefit from
this rewrite.

Here are the benchmark results:

arm64 before:
  BM_ctype_isalnum_n                 3.73 ns         3.73 ns    183727137
  BM_ctype_isalnum_y1                3.82 ns         3.81 ns    186383058
  BM_ctype_isalnum_y2                3.73 ns         3.72 ns    187809830
  BM_ctype_isalnum_y3                3.78 ns         3.77 ns    181383055
  BM_ctype_isalpha_n                 3.75 ns         3.75 ns    189453927
  BM_ctype_isalpha_y1                3.76 ns         3.75 ns    184854043
  BM_ctype_isalpha_y2                4.32 ns         3.78 ns    186326931
  BM_ctype_isascii_n                 2.49 ns         2.48 ns    275583822
  BM_ctype_isascii_y                 2.51 ns         2.51 ns    282123915
  BM_ctype_isblank_n                 3.11 ns         3.10 ns    220472044
  BM_ctype_isblank_y1                3.20 ns         3.19 ns    226088868
  BM_ctype_isblank_y2                3.11 ns         3.11 ns    220809122
  BM_ctype_iscntrl_n                 3.79 ns         3.78 ns    188719938
  BM_ctype_iscntrl_y1                3.72 ns         3.71 ns    186209237
  BM_ctype_iscntrl_y2                3.80 ns         3.80 ns    184315749
  BM_ctype_isdigit_n                 3.76 ns         3.74 ns    188334682
  BM_ctype_isdigit_y                 3.78 ns         3.77 ns    186249335
  BM_ctype_isgraph_n                 3.99 ns         3.98 ns    177814143
  BM_ctype_isgraph_y1                3.98 ns         3.95 ns    175140090
  BM_ctype_isgraph_y2                4.01 ns         4.00 ns    178320453
  BM_ctype_isgraph_y3                3.96 ns         3.95 ns    175412814
  BM_ctype_isgraph_y4                4.01 ns         4.00 ns    175711174
  BM_ctype_islower_n                 3.75 ns         3.74 ns    188604818
  BM_ctype_islower_y                 3.79 ns         3.78 ns    154738238
  BM_ctype_isprint_n                 3.96 ns         3.95 ns    177607734
  BM_ctype_isprint_y1                3.94 ns         3.93 ns    174877244
  BM_ctype_isprint_y2                4.02 ns         4.01 ns    178206135
  BM_ctype_isprint_y3                3.94 ns         3.93 ns    175959069
  BM_ctype_isprint_y4                4.03 ns         4.02 ns    176158314
  BM_ctype_isprint_y5                3.95 ns         3.94 ns    178745462
  BM_ctype_ispunct_n                 3.78 ns         3.77 ns    184727184
  BM_ctype_ispunct_y                 3.76 ns         3.75 ns    187947503
  BM_ctype_isspace_n                 3.74 ns         3.74 ns    185300285
  BM_ctype_isspace_y1                3.77 ns         3.76 ns    187202066
  BM_ctype_isspace_y2                3.73 ns         3.73 ns    184105959
  BM_ctype_isupper_n                 3.81 ns         3.80 ns    185038761
  BM_ctype_isupper_y                 3.71 ns         3.71 ns    185885793
  BM_ctype_isxdigit_n                3.79 ns         3.79 ns    184965673
  BM_ctype_isxdigit_y1               3.76 ns         3.75 ns    188251672
  BM_ctype_isxdigit_y2               3.79 ns         3.78 ns    184187481
  BM_ctype_isxdigit_y3               3.77 ns         3.76 ns    187635540

arm64 after:
  BM_ctype_isalnum_n                 3.37 ns         3.37 ns    205613810
  BM_ctype_isalnum_y1                3.40 ns         3.39 ns    204806361
  BM_ctype_isalnum_y2                3.43 ns         3.43 ns    205066077
  BM_ctype_isalnum_y3                3.50 ns         3.50 ns    200057128
  BM_ctype_isalpha_n                 2.97 ns         2.97 ns    236084076
  BM_ctype_isalpha_y1                2.97 ns         2.97 ns    236083626
  BM_ctype_isalpha_y2                2.97 ns         2.97 ns    236084246
  BM_ctype_isascii_n                 2.55 ns         2.55 ns    272879994
  BM_ctype_isascii_y                 2.46 ns         2.45 ns    286522323
  BM_ctype_isblank_n                 3.18 ns         3.18 ns    220431175
  BM_ctype_isblank_y1                3.18 ns         3.18 ns    220345602
  BM_ctype_isblank_y2                3.18 ns         3.18 ns    220308509
  BM_ctype_iscntrl_n                 3.10 ns         3.10 ns    220344270
  BM_ctype_iscntrl_y1                3.10 ns         3.07 ns    228973615
  BM_ctype_iscntrl_y2                3.07 ns         3.07 ns    229192626
  BM_ctype_isdigit_n                 3.07 ns         3.07 ns    228925676
  BM_ctype_isdigit_y                 3.07 ns         3.07 ns    229182934
  BM_ctype_isgraph_n                 2.66 ns         2.66 ns    264268737
  BM_ctype_isgraph_y1                2.66 ns         2.66 ns    264445277
  BM_ctype_isgraph_y2                2.66 ns         2.66 ns    264327427
  BM_ctype_isgraph_y3                2.66 ns         2.66 ns    264427480
  BM_ctype_isgraph_y4                2.66 ns         2.66 ns    264155250
  BM_ctype_islower_n                 2.66 ns         2.66 ns    264421600
  BM_ctype_islower_y                 2.66 ns         2.66 ns    264341148
  BM_ctype_isprint_n                 2.66 ns         2.66 ns    264415198
  BM_ctype_isprint_y1                2.66 ns         2.66 ns    264268793
  BM_ctype_isprint_y2                2.66 ns         2.66 ns    264419205
  BM_ctype_isprint_y3                2.66 ns         2.66 ns    264205886
  BM_ctype_isprint_y4                2.66 ns         2.66 ns    264440797
  BM_ctype_isprint_y5                2.72 ns         2.72 ns    264333293
  BM_ctype_ispunct_n                 3.52 ns         3.51 ns    198956572
  BM_ctype_ispunct_y                 3.38 ns         3.38 ns    201661792
  BM_ctype_isspace_n                 3.39 ns         3.39 ns    206896620
  BM_ctype_isspace_y1                3.39 ns         3.39 ns    206569020
  BM_ctype_isspace_y2                3.39 ns         3.39 ns    206564415
  BM_ctype_isupper_n                 2.76 ns         2.75 ns    254227134
  BM_ctype_isupper_y                 2.76 ns         2.75 ns    254235314
  BM_ctype_isxdigit_n                3.60 ns         3.60 ns    194418653
  BM_ctype_isxdigit_y1               2.97 ns         2.97 ns    236082424
  BM_ctype_isxdigit_y2               3.48 ns         3.48 ns    200390011
  BM_ctype_isxdigit_y3               3.48 ns         3.48 ns    202255815

arm32 before:
  BM_ctype_isalnum_n                 4.77 ns         4.76 ns    129230464
  BM_ctype_isalnum_y1                4.88 ns         4.87 ns    147939321
  BM_ctype_isalnum_y2                4.74 ns         4.73 ns    145508054
  BM_ctype_isalnum_y3                4.81 ns         4.80 ns    144968914
  BM_ctype_isalpha_n                 4.80 ns         4.79 ns    148262579
  BM_ctype_isalpha_y1                4.74 ns         4.73 ns    145061326
  BM_ctype_isalpha_y2                4.83 ns         4.82 ns    147642546
  BM_ctype_isascii_n                 3.74 ns         3.72 ns    186711139
  BM_ctype_isascii_y                 3.79 ns         3.78 ns    183654780
  BM_ctype_isblank_n                 4.20 ns         4.19 ns    169733252
  BM_ctype_isblank_y1                4.19 ns         4.18 ns    165713363
  BM_ctype_isblank_y2                4.22 ns         4.21 ns    168776265
  BM_ctype_iscntrl_n                 4.75 ns         4.74 ns    145417484
  BM_ctype_iscntrl_y1                4.82 ns         4.81 ns    146283250
  BM_ctype_iscntrl_y2                4.79 ns         4.78 ns    148662453
  BM_ctype_isdigit_n                 4.77 ns         4.76 ns    145789210
  BM_ctype_isdigit_y                 4.84 ns         4.84 ns    146909458
  BM_ctype_isgraph_n                 4.72 ns         4.71 ns    145874663
  BM_ctype_isgraph_y1                4.86 ns         4.85 ns    142037606
  BM_ctype_isgraph_y2                4.79 ns         4.78 ns    145109612
  BM_ctype_isgraph_y3                4.75 ns         4.75 ns    144829039
  BM_ctype_isgraph_y4                4.86 ns         4.85 ns    146769899
  BM_ctype_islower_n                 4.76 ns         4.75 ns    147537637
  BM_ctype_islower_y                 4.79 ns         4.78 ns    145648017
  BM_ctype_isprint_n                 4.82 ns         4.81 ns    147154780
  BM_ctype_isprint_y1                4.76 ns         4.76 ns    145117604
  BM_ctype_isprint_y2                4.87 ns         4.86 ns    145801406
  BM_ctype_isprint_y3                4.79 ns         4.78 ns    148043446
  BM_ctype_isprint_y4                4.77 ns         4.76 ns    145157619
  BM_ctype_isprint_y5                4.91 ns         4.90 ns    147810800
  BM_ctype_ispunct_n                 4.74 ns         4.73 ns    145588611
  BM_ctype_ispunct_y                 4.82 ns         4.81 ns    144065436
  BM_ctype_isspace_n                 4.78 ns         4.77 ns    147153712
  BM_ctype_isspace_y1                4.73 ns         4.72 ns    145252863
  BM_ctype_isspace_y2                4.84 ns         4.83 ns    148615797
  BM_ctype_isupper_n                 4.75 ns         4.74 ns    148276631
  BM_ctype_isupper_y                 4.80 ns         4.79 ns    145529893
  BM_ctype_isxdigit_n                4.78 ns         4.77 ns    147271646
  BM_ctype_isxdigit_y1               4.74 ns         4.74 ns    145142209
  BM_ctype_isxdigit_y2               4.83 ns         4.82 ns    146398497
  BM_ctype_isxdigit_y3               4.78 ns         4.77 ns    147617686

arm32 after:
  BM_ctype_isalnum_n                 4.35 ns         4.35 ns    161086146
  BM_ctype_isalnum_y1                4.36 ns         4.35 ns    160961111
  BM_ctype_isalnum_y2                4.36 ns         4.36 ns    160733210
  BM_ctype_isalnum_y3                4.35 ns         4.35 ns    160897524
  BM_ctype_isalpha_n                 3.67 ns         3.67 ns    189377208
  BM_ctype_isalpha_y1                3.68 ns         3.67 ns    189438146
  BM_ctype_isalpha_y2                3.75 ns         3.69 ns    190971186
  BM_ctype_isascii_n                 3.69 ns         3.68 ns    191029191
  BM_ctype_isascii_y                 3.68 ns         3.68 ns    191011817
  BM_ctype_isblank_n                 4.09 ns         4.09 ns    171887541
  BM_ctype_isblank_y1                4.09 ns         4.09 ns    171829345
  BM_ctype_isblank_y2                4.08 ns         4.07 ns    170585590
  BM_ctype_iscntrl_n                 4.08 ns         4.07 ns    170614383
  BM_ctype_iscntrl_y1                4.13 ns         4.11 ns    171495899
  BM_ctype_iscntrl_y2                4.19 ns         4.18 ns    165255578
  BM_ctype_isdigit_n                 4.25 ns         4.24 ns    165237008
  BM_ctype_isdigit_y                 4.24 ns         4.24 ns    165256149
  BM_ctype_isgraph_n                 3.82 ns         3.81 ns    183610114
  BM_ctype_isgraph_y1                3.82 ns         3.81 ns    183614131
  BM_ctype_isgraph_y2                3.82 ns         3.81 ns    183616840
  BM_ctype_isgraph_y3                3.79 ns         3.79 ns    183620182
  BM_ctype_isgraph_y4                3.82 ns         3.81 ns    185740009
  BM_ctype_islower_n                 3.75 ns         3.74 ns    183619502
  BM_ctype_islower_y                 3.68 ns         3.68 ns    190999901
  BM_ctype_isprint_n                 3.69 ns         3.68 ns    190899544
  BM_ctype_isprint_y1                3.68 ns         3.67 ns    190192384
  BM_ctype_isprint_y2                3.67 ns         3.67 ns    189351466
  BM_ctype_isprint_y3                3.67 ns         3.67 ns    189430348
  BM_ctype_isprint_y4                3.68 ns         3.68 ns    189430161
  BM_ctype_isprint_y5                3.69 ns         3.68 ns    190962419
  BM_ctype_ispunct_n                 4.14 ns         4.14 ns    171034861
  BM_ctype_ispunct_y                 4.19 ns         4.19 ns    168308152
  BM_ctype_isspace_n                 4.50 ns         4.50 ns    156250887
  BM_ctype_isspace_y1                4.48 ns         4.48 ns    155124476
  BM_ctype_isspace_y2                4.50 ns         4.50 ns    155077504
  BM_ctype_isupper_n                 3.68 ns         3.68 ns    191020583
  BM_ctype_isupper_y                 3.68 ns         3.68 ns    191015669
  BM_ctype_isxdigit_n                4.50 ns         4.50 ns    156276745
  BM_ctype_isxdigit_y1               3.28 ns         3.27 ns    214729725
  BM_ctype_isxdigit_y2               4.48 ns         4.48 ns    155265129
  BM_ctype_isxdigit_y3               4.48 ns         4.48 ns    155216846

I've also corrected a small mistake in the documentation for isxdigit().

Test: tests and benchmarks
Change-Id: I4a77859f826c3fc8f0e327e847886882f29ec4a3
2019-10-08 12:04:09 -07:00
George Burgess IV
57f01b91d7 Merge changes I13f94cdc,I2107ae65,I7dc10b56,I2037548c
* changes:
  libc: remove now-unused FORTIFY functions
  fortify: remove last uses of __bos_trivially_not*
  fortify(string): emit diagnostics regardless of API level
  fortify(fcntl): emit diagnostics regardless of API level
2019-10-08 17:12:58 +00:00
Treehugger Robot
aad91dcd1d Merge "Restrict the availability of the bionic libs" 2019-10-08 05:33:29 +00:00
George Burgess IV
23e6f0a900 libc: remove now-unused FORTIFY functions
As of I2037548cc2061e46c379931588194c21dfe234b4, these are no longer
used. Since they're new in R, we can remove them instead of keeping
backwards compat 'forever'. Take that opportunity now.

Bug: 141267932
Test: TreeHugger
Change-Id: I13f94cdcff6e75ad19b964be76445f113f79559b
2019-10-07 19:09:38 -07:00
George Burgess IV
3aedee9828 fortify: remove last uses of __bos_trivially_not*
Since we're using the gt/ge ones a lot now, having `not` versions
probably just adds to confusion. Swap out their remaining uses and
delete them.

Bug: 141267932
Test: m checkbuild on internal-master
Change-Id: I2107ae65007a4995e4fa23371fefe4db7547f43b
2019-10-07 16:18:44 -07:00
George Burgess IV
fd1ff4b2c8 fortify(string): emit diagnostics regardless of API level
Bug: 141267932
Test: m checkbuild on internal-master

Change-Id: I7dc10b56b667f8f2f2cd360b008d834af92a72e4
2019-10-07 16:18:44 -07:00
George Burgess IV
9349b9e51b fortify(fcntl): emit diagnostics regardless of API level
Bug: 141267932
Test: m checkbuild on internal-master

Change-Id: I2037548cc2061e46c379931588194c21dfe234b4
2019-10-07 16:18:41 -07:00
Evgenii Stepanov
b92d1c3a26 Block signals in pthread_create.
HWASan-instrumented code needs TLS_SLOT_SANITIZER set up to run, and
that is not done until the new thread calls __hwasan_thread_enter. Block
all signals until that time to prevent hwasan-instrumented signal
handlers running (and crashing) on the new thread.

Bug: 141893397
Test: seq 0 10000000 | xargs -n 1 -P 200 adb shell am instrument \
      -w -r -e command grant-all \
      com.android.permissionutils/.PermissionInstrumentation

(cherry picked from commit d181585dd5)

Change-Id: Id65fae836edcacdf057327ccf16cf0b5e0f9474a
2019-10-07 15:37:26 -07:00
Jiyong Park
f302cfb26b libc_malloc_[debug|hooks] are not available for platform
The libs are not available for platform. Thus removing
'//apex_available:platform' from the apex_available property. However,
since there are test modules that statically links the libs, we
exceptionally make the static variant of the libs available to the
platform.

Test: m
Test: mm under bionic does not create
out/target/product/<name>/system/lib[64]/libc_malloc_[debug|hooks].so

Change-Id: Ia6d473658c4231b04b5db511f9dacbbdf0f207b0
2019-10-07 15:52:21 +09:00
Jiyong Park
e87e0dcbae Restrict the availability of the bionic libs
The bionic libs are now restricted to be in the runtime APEX and the
platform (for bootstrapping). It can still be referenced from other
APEXes but can't be included there.

Bug: 139870423
Test: m
Change-Id: I7f99eef27ccf75844ca5c9a7ea866496841b738f
2019-10-07 13:52:32 +09:00
Treehugger Robot
3e565bd7ee Merge "fortify(unistd): emit diagnostics regardless of API level" 2019-10-04 06:36:54 +00:00
Elliott Hughes
0e14c5a869 <unistd.h> __INTRODUCED_IN cleaup.
The NDK doesn't support anything older than API level 16, so remove some
more clutter.

Test: builds
Change-Id: If257a27841396af001b089b7ae0fbd8c3e0128e4
2019-10-03 20:35:38 -07:00
George Burgess IV
da8d30f357 fortify(unistd): emit diagnostics regardless of API level
Bug: 141267932
Test: m checkbuild on internal-master

Change-Id: I17ad1283cbedaec2ab070134320e1c5401d3e6a4
2019-10-03 20:30:02 -07:00
Treehugger Robot
3398552aa6 Merge "Remove __INTRODUCED_IN for obsolete API levels." 2019-10-04 01:47:03 +00:00
Elliott Hughes
f106a391d3 Remove __INTRODUCED_IN for obsolete API levels.
The NDK only supports >= 16, so remove anything older than that to avoid
giving the misleading impression that such old targets are still
supported.

(This change doesn't touch <unistd.h>. I'll follow up with that once the
outstanding FORTIFY changes to that file are in.)

Test: builds
Change-Id: I6cc6ecdb99fe228a4afa71f78e5fd45309ba9786
2019-10-03 16:09:04 -07:00
Christopher Ferris
b8a95e2186 Update to kernel headers v5.3.2.
Test: Builds and run unit tests on taimen/cuttlefish.
Change-Id: I6ebd8f179d159ac974555e8edca588083e8081b3
2019-10-03 10:59:32 -07:00
Elliott Hughes
3d6cf766be Merge "<sys/select.h>: add docs, and a warning against using select()." 2019-10-03 00:47:25 +00:00
Treehugger Robot
40ef00f039 Merge "fortify(stdio): emit diagnostics regardless of API level" 2019-10-03 00:36:22 +00:00
Elliott Hughes
cfac8d0074 <sys/select.h>: add docs, and a warning against using select().
Test: N/A
Change-Id: I596d63f2c8039434e2b8023eefb944da5c4bbb40
2019-10-02 14:13:54 -07:00
Christopher Ferris
e55e5eef8a Make it easy to switch between scudo and jemalloc.
Refactor some of the definitions to separate out all of the native
allocator pieces into one place that can be changed easily. This
should fix a few static libraries that appear to have accidentally
included jemalloc wrapper functions. For example, I verified that
libc_nomalloc.a no longer has references to any je_XXX functions.

Modify the bionic_libc_platform_headers to not include any libraries.
If this isn't updated, soong thinks there are cycles when used by
libscudo.

To enable scudo, change the libc_native_allocator_defaults defaults
from libc_jemalloc5_defaults to libc_scudo_defaults and comment out
the defaults: ["libc_scudo_wrapper_defaults"], line for the shared
library libc_scudo.

To do a final switch to scudo, it will be necessary to clean up
some code in other parts of the tree, but this allows a single cl
to enable or disable.

Bug: 137795072

Test: Builds with jemalloc or scudo with a small change.
Test: Ran bionic unit tests.
Change-Id: I07bb5432a0d2b2f405f92412e8d04fb9c9e51b31
Merged-In: I07bb5432a0d2b2f405f92412e8d04fb9c9e51b31
(cherry picked from commit ccff1b19ef)
2019-10-02 09:45:13 -07:00
George Burgess IV
113d6fa14e fortify(stdio): emit diagnostics regardless of API level
Bug: 141267932
Test: m checkbuild on internal-master

Change-Id: I875a072c74f578d4404576c5bb42fd8ea30ff68d
2019-09-30 13:00:36 -07:00
George Burgess IV
db87607524 fortify(poll): emit diagnostics regardless of API level
Bug: 141267932
Test: m checkbuild on internal-master

Change-Id: I5e147d28ec606c104b5905fd3d0c3fc197f0e4b8
2019-09-30 13:00:36 -07:00
George Burgess IV
bc37c5a8ce fortify(strings): emit diagnostics regardless of API level
Bug: 141267932
Test: m checkbuild on internal-master

Change-Id: Ief185320f93ec31f4d0a8035c450a7ab7b4e02b4
2019-09-30 13:00:35 -07:00
George Burgess IV
d0a0f72852 fortify(socket/stat): emit diagnostics regardless of API level
Bug: 141267932
Test: m checkbuild on internal-master

Change-Id: I7fe29184290e19ec080b204aa98d513ce59bc66b
2019-09-30 13:00:35 -07:00
Elliott Hughes
82ee3a08e2 Merge "Optimize tolower(3)/toupper(3) from <ctype.h>." 2019-09-30 18:49:51 +00:00
Christopher Ferris
d24c14d817 Merge "Make tls related header files platform accessible." 2019-09-30 16:15:33 +00:00
Elliott Hughes
1c8a2a99a7 Optimize tolower(3)/toupper(3) from <ctype.h>.
The tables in the BSD tolower/toupper are slower for ASCII than just
doing the bit twiddling.

We can't actually remove the tables on LP32, so move them into the
"cruft" we keep around for backwards compatibility (but remove them for
LP64 where they were never exposed).

I noticed that the new bit-twiddling tolower(3) was performing better
on arm64 than toupper(3). The 0xdf constant was requiring an extra MOV,
and there isn't a BIC that takes an immediate value. Since we've already
done the comparison to check that we're in the right range (where the
bit is always set), though, we can EOR 0x20 to get the same result as
the missing BIC 0x20 in just one instruction.

I've applied that same optimization to towupper(3) too.

Before:

  BM_ctype_tolower_n                 3.30 ns         3.30 ns    212353035
  BM_ctype_tolower_y                 3.31 ns         3.30 ns    211234204
  BM_ctype_toupper_n                 3.30 ns         3.29 ns    214161246
  BM_ctype_toupper_y                 3.29 ns         3.28 ns    207643473

  BM_wctype_towupper_ascii_n         3.53 ns         3.53 ns    195944444
  BM_wctype_towupper_ascii_y         3.48 ns         3.48 ns    199233248

After:

  BM_ctype_tolower_n                 2.93 ns         2.92 ns    242373703
  BM_ctype_tolower_y                 2.88 ns         2.87 ns    245365309
  BM_ctype_toupper_n                 2.93 ns         2.93 ns    243049353
  BM_ctype_toupper_y                 2.89 ns         2.89 ns    245072521

  BM_wctype_towupper_ascii_n         3.34 ns         3.33 ns    212951912
  BM_wctype_towupper_ascii_y         3.29 ns         3.29 ns    214651254

(Why do both the "y" and "n" variants speed up with the EOR
change? Because the compiler transforms the code so that we
unconditionally do the bit twiddling and then use CSEL to decide whether
or not to actually use the result.)

We also save 1028 bytes of data in the LP64 libc.so.

Test: ran the bionic benchmarks and tests
Change-Id: I7829339f8cb89a58efe539c2a01c51807413aa2d
2019-09-27 14:42:39 -07:00
Peter Collingbourne
4096cba7f8 Merge "Disable sanitization of crt objects." 2019-09-27 19:31:13 +00:00
Christopher Ferris
c5d3a4348a Make tls related header files platform accessible.
There are places in frameworks and art code that directly included
private bionic header files. Move these files to the new platform
include files.

This change also moves the __get_tls.h header file to tls.h and includes
the tls defines header so that there is a single header that platform
code can use to get __get_tls and the defines.

Also, simplify the visibility rules for platform includes.

Bug: 141560639

Test: Builds and bionic unit tests pass.
Change-Id: I9e5e9c33fe8a85260f69823468bc9d340ab7a1f9
Merged-In: I9e5e9c33fe8a85260f69823468bc9d340ab7a1f9
(cherry picked from commit 44631c919a)
2019-09-27 12:14:24 -07:00
Balaram Makam
0e670e26a2 ASCII fastpath for towupper and towlower.
This change elides unnecessary calls to __find_icu_symbol
for ASCII chars and improves PUBG mobile game loading time by 7% on
hikey620(Cortex-A53):

name                old time/op  new time/op  delta
PUBG_0.13.0_Launch   41.5s ± 2%   37.7s ± 3%  -9.24%  (p=0.008 n=5+5)

Below are the bionic benchmark results on a Pixel 2 XL for 64-bit,
showing a large speedup for ASCII and only a small slowdown for non-ASCII.

Before:

  BM_wctype_towlower_ascii_n         10.5 ns         10.4 ns     61973065
  BM_wctype_towlower_ascii_y         10.2 ns         10.2 ns     70158659
  BM_wctype_towlower_unicode_n       10.3 ns         10.3 ns     67719478
  BM_wctype_towlower_unicode_y       10.6 ns         10.5 ns     67841545
  BM_wctype_towupper_ascii_n         10.8 ns         10.8 ns     63456778
  BM_wctype_towupper_ascii_y         10.9 ns         10.9 ns     65116910
  BM_wctype_towupper_unicode_n       10.7 ns         10.7 ns     67463276
  BM_wctype_towupper_unicode_y       10.4 ns         10.4 ns     66467890

After:

  BM_wctype_towlower_ascii_n         3.35 ns         3.34 ns    205567652
  BM_wctype_towlower_ascii_y         3.30 ns         3.29 ns    214108746
  BM_wctype_towlower_unicode_n       10.9 ns         10.8 ns     65007743
  BM_wctype_towlower_unicode_y       10.6 ns         10.6 ns     63819060
  BM_wctype_towupper_ascii_n         3.53 ns         3.53 ns    195944444
  BM_wctype_towupper_ascii_y         3.48 ns         3.48 ns    199233248
  BM_wctype_towupper_unicode_n       11.1 ns         11.1 ns     62760216
  BM_wctype_towupper_unicode_y       11.0 ns         11.0 ns     61608872

Test: bionic unit tests on device
Test: bionic benchmarks on device
Signed-off-by: Balaram Makam <b.makam@samsung.com>
Change-Id: I77ab7efb66d7bcb35d00467663607535e5c1992f
2019-09-27 16:41:03 +00:00
Peter Collingbourne
7eb851c7da Disable sanitization of crt objects.
The accompanying soong change causes sanitize attributes to be allowed on
cc_object targets and propagates sanitize attributes into dependencies. This
is problematic for the crt objects in sanitizer builds because everything
depends on them including the sanitizer runtime, so a circular dependency
would otherwise be created. Furthermore, some of the code in these objects
runs before sanitizer initialization so it is unlikely that sanitizing them
would work anyway. Therefore, disable sanitization on these objects.

Change-Id: I25380dfc8eed5db34b034ba127a9d6b5674032fa
2019-09-26 12:16:06 -07:00
John Cater
e86e505b85 Fix gensyscalls.py to actually use the input argument provided in
bionic/libc/Android.bp.

Test: Built and tested bionic.
Change-Id: Ibb25990b2b1b5c18edfdaaab4f1593fa8d95f338
2019-09-26 15:02:04 -04:00
Evgeny Eltsin
8a18af52d9 Make more pthread functions weak for native bridge
These are using __pthread_internal_*.

Test: run bionic-unit-tests on cuttlefish
Change-Id: Idbb2503f03bd9f1f2a20fced34b734f573c1c0ad
2019-09-25 16:55:47 +02:00
Elliott Hughes
1db8fdb76e Merge "Remove global seccomp list." 2019-09-18 18:10:13 +00:00
Elliott Hughes
fa43309a59 Merge "ifuncs: start sharing." 2019-09-18 18:01:54 +00:00
Elliott Hughes
ae03b12925 Remove global seccomp list.
Never used, and incompatible with having bionic in a mainline module.

Test: builds
Change-Id: If377f66cc105fd3a1ec4d9c92330fa6a2d2c145c
2019-09-17 16:37:05 -07:00
Treehugger Robot
e6c3f0628c Merge "fortify: account for new clang diagnostics" 2019-09-17 20:11:51 +00:00
Elliott Hughes
a4c7876c01 ifuncs: start sharing.
We're going to have to add ifuncs to libm, and there will be some SVE
ones for arm64 soon too, so let's start sharing the absolute minimum...

Test: builds
Change-Id: Idbb9dd9477291ed3c15dc3902f65e593b766dfb9
2019-09-17 12:44:41 -07:00
George Burgess IV
36926f4ca8 fortify: account for new clang diagnostics
Clang recently grew its own diagnostics for memcpy and such. These are
generally higher-quality than what we can do with diagnose_if, since
clang is happy to include e.g., sizes of things per-callsite. Move to
those instead where applicable.

Bug: 131861088, 123644155
Test: blueline internal-master checkbuild; treehugger
Change-Id: I701f5a8b247ba2948ca47fdc60ff5198b564c03e
2019-09-16 12:48:04 -07:00
Christopher Ferris
2b0638ef29 Make bionic_malloc.h a platform header.
Instead of having platform directories directly include the
private header, create a platform header directory and export it.

Bug: 130763340

Test: Builds.
Change-Id: Ie0f092b3fe077a3de8b90266c0b28bfbc20d0dfa
Merged-In: Ie0f092b3fe077a3de8b90266c0b28bfbc20d0dfa
(cherry picked from commit 8f582ef2f8)
2019-09-16 12:27:33 -07:00
Ryan Prichard
85be9725c7 crtbegin: replace TPREL with R_*_NONE relocs
Bug: https://bugs.llvm.org/show_bug.cgi?id=41527
Test: bionic unit tests
Change-Id: Ia66c969b209c0f72d1e37573949f3fb59817ca71
2019-09-04 20:31:06 +00:00
Christopher Ferris
e2c10d8de0 Merge "Update to kernel headers v5.2.11." 2019-09-04 19:44:24 +00:00
Treehugger Robot
d0494b368e Merge "Test for ns_parserr() and got a heap-buffer-overflow" 2019-09-04 02:21:43 +00:00
Logan Chien
2fb9a03b9c Merge "versioner: Fix bzero/bcopy fortify" 2019-09-03 23:12:43 +00:00
Christopher Ferris
e892fd6b17 Update to kernel headers v5.2.11.
Test: Build and boots on taimen.
Test: Bionic unit tests all pass on taimen.
Change-Id: I80abb6f9abbff9ca20ce6c7c912a259b5ca86fa2
2019-09-03 15:56:49 -07:00
Elliott Hughes
37ff081e88 Merge "Support statvfs on API levels before 19." 2019-09-03 22:28:36 +00:00
Christopher Ferris
add3a4ae70 Merge "Add EFD_SEMAPHORE flag for eventfd." 2019-09-03 19:16:55 +00:00