Commit graph

29501 commits

Author SHA1 Message Date
Treehugger Robot
e1276ba538 Merge "pwd/grp: fix pwd _r reentrancy, new tests, clean up" 2019-05-21 18:29:33 +00:00
Christopher Ferris
03345ed54a Merge "Keep .debug_frame on arm 32." 2019-05-21 18:09:08 +00:00
Dmytro Chystiakov
bb88e283e3 Merge "Limit threads in pthread_leak#detach for low power devices." am: f8813d14aa
am: 31892ad6b2

Change-Id: Ibf1c2f0128ec109b3ff6de28bbdf0afa10f5d029
2019-05-20 21:48:33 -07:00
Dmytro Chystiakov
31892ad6b2 Merge "Limit threads in pthread_leak#detach for low power devices."
am: f8813d14aa

Change-Id: I31c857f880261bb2b46498b60003a2e4a6473adb
2019-05-20 21:08:16 -07:00
Treehugger Robot
f8813d14aa Merge "Limit threads in pthread_leak#detach for low power devices." 2019-05-21 02:15:30 +00:00
Christopher Ferris
e9d253cc28 [automerger skipped] Merge "Temporarily disable unwind through signal test." am: dcc855456e
am: daa23b5279 -s ours
am skip reason: change_id Iafc227d972a7783e94c701d73078c9570cea288e with SHA1 fe0fbcff7f is in history

Change-Id: If4b0d7089cf7e96ab411b2cbf04d6279572e05ac
2019-05-20 16:39:26 -07:00
Christopher Ferris
daa23b5279 Merge "Temporarily disable unwind through signal test."
am: dcc855456e

Change-Id: I881e198921407babd64f9aa87d20be8146a62974
2019-05-20 14:36:33 -07:00
Christopher Ferris
dcc855456e Merge "Temporarily disable unwind through signal test." 2019-05-20 20:15:13 +00:00
Christopher Ferris
24f97eb27b Update to kernel headers to v5.1.3.
Test: Builds and boots taimen.
Test: Ran bionic unit tests.
Change-Id: Ieaca8709d568f075df8cac60c9da2c0ed1916963
2019-05-20 12:58:13 -07:00
Christopher Ferris
035988ffb4 Temporarily disable unwind through signal test.
On cf_x86_phone-userdebug, both of the unwind through signal
tests fail. This has been failing forever, but seems to have suddenly
become an issue, so disable while I try to figure out why this is happening.

Bug: 132763120

Test: Ran on emulator and verified tests are skipped.
Change-Id: Iafc227d972a7783e94c701d73078c9570cea288e
Merged-In: Iafc227d972a7783e94c701d73078c9570cea288e
(cherry picked from commit d424fafbce)
(cherry picked from commit fe0fbcff7f)
2019-05-20 12:33:09 -07:00
Christopher Ferris
0c0f6fb293 Keep .debug_frame on arm 32.
The arm exidx unwind information can be sparse and clang is producing
functions that cannot be properly represented. The .debug_frame includes
extra unwind information that covers the cases that are not complete, so
do not remove it. For example, the __strchr_chk function has a push
in the middle of the function, so any crash before that instruction will
not unwind properly.

This does increase the size of libc.so, but only by about 80,000 bytes.

Bug: 132992102

Test: Verified the .debug_frame exists in libc.so only for arm32.
Test: Used the unwind_reg_info to verify that __str_chk gets proper
Test: unwind info. Also use unwind_reg_info on some assembler functions
Test: to make sure that there is no overlapping information.
Change-Id: If9a6de15b3adf08a93c4563da8c89846e4dd059b
2019-05-17 17:52:51 -07:00
Colin Cross
b9667b51a8 Export some symbols for vendor libmemunreachable
Add the malloc symbols used by libmemunreachable to the VNDK, and
make libc_malloc_debug_backtrace vendor_available.

Bug: 132302484
Test: m checkbuild
Change-Id: Ide555195afa084c13eaeaf0eab6ff90787b5f2d0
2019-05-17 14:26:31 -07:00
Christopher Ferris
e732449c7c Temporarily disable unwind through signal test.
am: fe0fbcff7f

Change-Id: I888bdb87deacf136d64d63c44448fc54fdf2cfa6
2019-05-17 11:57:19 -07:00
Jiyong Park
a4c454be4d Merge "Don't resolve already resolved paths when parsing ld.config.txt" am: 72aafad950
am: 073c259287

Change-Id: I811314f9a3659ff007eabfca4f5e8ef817f3fe66
2019-05-17 00:25:41 -07:00
Peter Collingbourne
21abeb2d54 Merge "Add bootstrap directory to bootstrap linker's search path." am: 8bb97d7781
am: 64db1aec2b

Change-Id: I0cb0d4a79dfeef0cdf82b87e44292dee090a2791
2019-05-17 00:23:31 -07:00
Jiyong Park
073c259287 Merge "Don't resolve already resolved paths when parsing ld.config.txt"
am: 72aafad950

Change-Id: Iba213a946cc411781a1661e74bc887e93c9c310e
2019-05-16 22:17:11 -07:00
Peter Collingbourne
64db1aec2b Merge "Add bootstrap directory to bootstrap linker's search path."
am: 8bb97d7781

Change-Id: I160f40e11d854dd635fcc523517954e2bfcaf323
2019-05-16 21:19:50 -07:00
Treehugger Robot
72aafad950 Merge "Don't resolve already resolved paths when parsing ld.config.txt" 2019-05-17 04:15:41 +00:00
Peter Collingbourne
8bb97d7781 Merge "Add bootstrap directory to bootstrap linker's search path." 2019-05-17 02:26:29 +00:00
Jiyong Park
341b61e694 Don't resolve already resolved paths when parsing ld.config.txt
When parsing ld.config.txt, paths in *.search.paths properties are
resolved using resolved_paths(). This is causing a number of newfstatat
system calls during a process start-up and is contributing about 3.6%
of the entire linker initialization time.

Optimize the overhead by not resolving already resolved paths; resolved
paths are cached.

Bug: 132348336
Test: strace -C -e newfstatat ls shows the number of the syscalls is
reduced from 131 to 99
Test: simpleperf record --call-graph fp -f 10000000 -o /data/perf.data ls
simpleperf report -g -i /data/perf.data
shows percentage of get_paths() from 2.9% to 2.5%

Change-Id: I79823255a89f6e2a63b80c74e6768850276ab536
2019-05-17 10:09:13 +09:00
Peter Collingbourne
ea11be0cc8 Add bootstrap directory to bootstrap linker's search path.
A proposed set of changes:
https://android-review.googlesource.com/q/topic:"no-dup-hwasans"

will cause the HWASAN runtime to be moved from /system/lib64 to
/system/lib64/bootstrap. This causes a problem in the case where libc is built
with HWASAN but init is not built with HWASAN. In this case, libc.so will have
a DT_NEEDED dependency on the HWASAN runtime but init will not. Currently,
init and other bootstrap executables arrange to load bootstrap libraries by
setting rpath, but rpath only has an effect on libraries directly depended
on by the main executable, not libraries indirectly depended on by it. This
means that the loading of the HWASAN runtime will fail.

Instead of relying on rpath to find the bootstrap libraries, modify the
bootstrap linker so that it searches the bootstrap library directory after
searching the rpath.

Change-Id: I297be32e04ecd316ee12b8e694588e1249e2bb89
2019-05-16 16:10:41 -07:00
Haibo Huang
e78b4c8b72 Merge "libc: import ARM strcmp from newlib" am: b43f0b7993
am: 68bf5131e0

Change-Id: I88b93aef95df6f7cc1b79bda0f9bba2959366b7d
2019-05-16 14:49:19 -07:00
Christopher Ferris
fe0fbcff7f Temporarily disable unwind through signal test.
On cf_x86_phone-userdebug, both of the unwind through signal
tests fail. This has been failing forever, but seems to have suddenly
become an issue, so disable while I try to figure out why this is happening.

Bug: 132763120

Test: Ran on emulator and verified tests are skipped.
Change-Id: Iafc227d972a7783e94c701d73078c9570cea288e
Merged-In: Iafc227d972a7783e94c701d73078c9570cea288e
(cherry picked from commit d424fafbce)
2019-05-16 14:25:57 -07:00
Haibo Huang
68bf5131e0 Merge "libc: import ARM strcmp from newlib"
am: b43f0b7993

Change-Id: Ia2107c80513f244a246e5c6879f75fd5521487c3
2019-05-16 13:35:53 -07:00
Haibo Huang
b43f0b7993 Merge "libc: import ARM strcmp from newlib" 2019-05-16 19:28:11 +00:00
Vic Yang
d8bef67153 Staticlly allocate string buffers for realpath_fd()
Creating two huge buffers with std::vector, as it is now, is very
expensive, because it ends up being satisfied with mmap()/munmap().
Instead, we statically allocate a large string buffer while resizing
the other one to be a smaller and more appropriate size so that it can
be placed on the stack.

Note that this does mean that we increase linker data segment by 4KB
and that increases the overall system memory usage by about 400KB.
However, since that additional page is mostly zeroed with only some
ASCII text, it should be fairly easy to compress when it's swapped out
to ZRAM.

Test: Run with strace and observe no mmap/munmap around readlinkat().
Test: Measure average linker time of starting cameraserver on a Go
      device and see ~3% speed-up.
Bug: 132783386

Change-Id: I600cc7a92be316ef67440a9a28c05d18de229f6c
2019-05-16 12:10:10 -07:00
Jake Weinstein
bff53b2617 libc: import ARM strcmp from newlib
* Current version is also based on newlib, but an older revision

* The Krait and A9 specific changes no longer seem relevant, so
  let's use A15 directly.

Tested on OnePlus 3 (MSM8996):

Before (Krait strcmp):
                                       iterations      ns/op
BM_string_strcmp/8                          1000k         24    0.322 GiB/s
BM_string_strcmp/64                           20M        123    0.519 GiB/s
BM_string_strcmp/512                           2M        920    0.556 GiB/s
BM_string_strcmp/1024                       1000k       1818    0.563 GiB/s
BM_string_strcmp/8Ki                         200k      14405    0.569 GiB/s
BM_string_strcmp/16Ki                        100k      28762    0.570 GiB/s
BM_string_strcmp/32Ki                         50k      57526    0.570 GiB/s
BM_string_strcmp/64Ki                         10k     114959    0.570 GiB/s

After:
                                       iterations      ns/op
BM_string_strcmp/8                          1000k         28    0.284 GiB/s
BM_string_strcmp/64                           20M        107    0.596 GiB/s
BM_string_strcmp/512                           2M        800    0.639 GiB/s
BM_string_strcmp/1024                       1000k       1579    0.649 GiB/s
BM_string_strcmp/8Ki                         200k      12469    0.657 GiB/s
BM_string_strcmp/16Ki                        100k      24931    0.657 GiB/s
BM_string_strcmp/32Ki                         50k      49843    0.657 GiB/s
BM_string_strcmp/64Ki                         20k      99635    0.658 GiB/s

Test: bionic-benchmarks BM_string_memcmp
Change-Id: Icb3bfb0a381bcc1e10885ca5e9547842c3f620d7
2019-05-16 04:37:26 +00:00
Tom Cherry
c57c5bdb7f pwd/grp: fix pwd _r reentrancy, new tests, clean up
getpwnam_r() and getpwuid_r() clobber the storage used by getpwnam()
and getpwuid().  This isn't likely to be a big issue, but since we do
this right for the group functions, fix this as well as add a test.
Both use more space in buf than is actually required, but well below
their sysconf() suggested values, so we accept that to keep the code
concise.

Add tests for dealing with unaligned input buffers, particularly for
getgrnam_r() and getgrgid_r(), as they require alignment but this
wasn't being tested.

Refactor common initialization code for both passwd and group state
structs.

Remove extraneous null pointer checks; the values they were testing
were offsets of a previous pointer, so guaranteed to never actually be
null.  If the underlying pointer is actually null, we're beyond repair
anyway, so accept that we'll crash.

Test: pwd/grp unit tests

Change-Id: I60c4d00e9ab3cf55daf8314c5029fd914025b696
2019-05-15 15:49:34 -07:00
Josh Gao
22b8efc6e6 Merge "Annotate no_return and returns_twice functions." am: 93f79a1a5b
am: 3d64506c02

Change-Id: I27fea3a775a2a85bc19be74688c79227c0c80d63
2019-05-15 14:06:28 -07:00
Josh Gao
3d64506c02 Merge "Annotate no_return and returns_twice functions."
am: 93f79a1a5b

Change-Id: I0e77cc78696f7dcf91f63220422a1d7c5088d51b
2019-05-15 13:59:11 -07:00
Josh Gao
93f79a1a5b Merge "Annotate no_return and returns_twice functions." 2019-05-15 20:26:46 +00:00
Xin Li
a1fecddd68 [automerger skipped] DO NOT MERGE - Merge pi-platform-release (PPRL.190505.001) into stage-aosp-master
am: c3cfb94466 -s ours
am skip reason: subject contains skip directive

Change-Id: I2a38d079e78b18b825932da0f62583bd5faa9922
2019-05-13 17:41:50 -07:00
Xin Li
c3cfb94466 DO NOT MERGE - Merge pi-platform-release (PPRL.190505.001) into stage-aosp-master
Bug: 132622481
Change-Id: Ie8ba6a818bbe0d9d982624eb5e8cd9cb618827b1
2019-05-13 15:38:40 -07:00
Josh Gao
3403315521 Annotate no_return and returns_twice functions.
When building the bionic tests, we use -fno-builtins, which turns off
clang's recognition of vfork as a magical function that can return
twice. Explicitly annotate our returns_twice functions to ensure that
we generate correct code even in -fno-builtins (and while we're at it,
annotate the no_return functions as well, so we generate faster code).

Bug: http://b/131856005
Test: treehugger
Change-Id: I465f8042a965f0c7c03caa5f17af67deea8f5d9d
2019-05-13 13:17:51 -07:00
Elliott Hughes
d4452aef52 Merge "bionic_tests_zipalign: don't explicitly specify no prefix/suffix." am: 235ccfd19b
am: 36f53ef0eb

Change-Id: I30e77313cc602c0537e29df2637f0baad80f6d77
2019-05-10 18:52:59 -07:00
Elliott Hughes
36f53ef0eb Merge "bionic_tests_zipalign: don't explicitly specify no prefix/suffix."
am: 235ccfd19b

Change-Id: I2849e9c6374785e03c5d9d85d39e6ed957ec013e
2019-05-10 18:47:54 -07:00
Treehugger Robot
235ccfd19b Merge "bionic_tests_zipalign: don't explicitly specify no prefix/suffix." 2019-05-11 01:22:26 +00:00
Elliott Hughes
be6c641141 bionic_tests_zipalign: don't explicitly specify no prefix/suffix.
Bug: http://b/129068177
Test: treehugger
Change-Id: If061ba04a0b3396898b6150d8fb1a8c27abb03f8
2019-05-10 16:59:13 -07:00
Dmytro Chystiakov
a339233629 Limit threads in pthread_leak#detach for low power devices.
This patch decreases created threads to 90 (instead of 100)
on devices with 2 cores CPU. This test can fail with timeout
on such devices.

Bug: b/129924384
Test: Run CtsBionic module on 2 core device with command
	"run cts -m CtsBionicTestCases"

Change-Id: Ic770006a324748d7d6dfbe8d4fb301e21e494ff9
Signed-off-by: Dmytro Chystiakov <dmytro.chystiakov@intel.com>
2019-05-10 16:44:49 -07:00
Elliott Hughes
3fea5e0d66 Merge "linker: support ldd(1)-like behavior via --list." am: 96babde2e4
am: 4d00ebc652

Change-Id: I950bb9e4783ec811c882ffc74e40b8fd9b46b97b
2019-05-10 08:52:01 -07:00
Elliott Hughes
4d00ebc652 Merge "linker: support ldd(1)-like behavior via --list."
am: 96babde2e4

Change-Id: Icc8ece4ed2f58ad4265c53b7c0a8c3cc78bc2356
2019-05-10 08:45:52 -07:00
Elliott Hughes
96babde2e4 Merge "linker: support ldd(1)-like behavior via --list." 2019-05-10 15:35:24 +00:00
Elliott Hughes
90f96b9f48 linker: support ldd(1)-like behavior via --list.
Given that we have both linker and linker64, I didn't really want to have
to have ldd and ldd64, so this change just adds the --list option to the
linkers and a shell script wrapper "ldd" that calls the appropriate
linker behind the scenes.

Test: adb shell linker --list `which app_process32`
Test: adb shell linker64 --list `which date`
Test: adb shell ldd `which app_process32`
Test: adb shell ldd `which date`
Change-Id: I33494bda1cc3cafee54e091f97c0f2ae52d1f74b
2019-05-09 22:12:17 -07:00
George Burgess IV
18e111caf9 Merge "tests: use clang's -verify instead of FileCheck" am: af68f04e44
am: c67f59fd15

Change-Id: If74a631fca9b73a470ae178e41062f296885cd9a
2019-05-09 15:34:42 -07:00
George Burgess IV
c67f59fd15 Merge "tests: use clang's -verify instead of FileCheck"
am: af68f04e44

Change-Id: I5fe492fe0ad838a91792b7d259c1e30ea2792de7
2019-05-09 14:26:39 -07:00
George Burgess IV
af68f04e44 Merge "tests: use clang's -verify instead of FileCheck" 2019-05-09 20:29:27 +00:00
Christopher Ferris
9cc0dad542 [automerger skipped] Merge "Add removed platform functions used by apps." am: 8106319006
am: e4a24f0fa2 -s ours
am skip reason: change_id Ib1ea3a37b3729f9bcc2739c5f3a584ea8f66d200 with SHA1 235f35a266 is in history

Change-Id: I9fbd8ec75b945468f64fa1d9da652777403c03fb
2019-05-08 20:26:28 -07:00
Christopher Ferris
e4a24f0fa2 Merge "Add removed platform functions used by apps."
am: 8106319006

Change-Id: I624bb17ac4cf12678ea1d110f0a349b2f45714ad
2019-05-08 19:30:58 -07:00
Christopher Ferris
8106319006 Merge "Add removed platform functions used by apps." 2019-05-09 01:09:21 +00:00
Christopher Ferris
c130abddae Merge "Add removed platform functions used by apps." into qt-dev
am: 51ad27180b

Change-Id: I1a143ab32bd0f064d77844b4435afa1e614df132
2019-05-08 16:11:31 -07:00