Commit graph

21139 commits

Author SHA1 Message Date
George Burgess IV
31e5a35f3d libc: fix typo in __RENAME macro
Apparently __strncpy_real redirects to strcpy instead of strncpy for GCC
builds. This is bad, and it confused a project compiled by GCC that uses
strcpy.

I audited all of the FORTIFY-related __RENAMEs both manually and with a
script I hacked together; they all look correct aside from this one.

FWIW, with the cleaned up clang FORTIFY, lots of the `void foo()
__RENAME(foo)` will just become `void foo()` if this last thing I'm
working on gets through review.

Bug: 35329524
Test: Previously broken project now seems to work. Bullhead and Ryu
both build + boot.

Change-Id: Ib18ee3535ae31eb7e8ae846dc012f9b64cac80bf
2017-04-19 18:46:44 +00:00
Treehugger Robot
7b37fa9384 Merge "Move bionic_systrace.cpp over to CachedProperty." 2017-04-18 17:56:07 +00:00
Elliott Hughes
5dc0565c1b Merge "Remove unused elf_machdep.h cruft." 2017-04-18 04:16:05 +00:00
Treehugger Robot
fe56b52b23 Merge "Document DT_RUNPATH support." 2017-04-18 01:00:22 +00:00
Treehugger Robot
57e7a0d853 Merge "Un-deprecated __system_property_find_nth." 2017-04-17 23:45:57 +00:00
Elliott Hughes
901601b48e Remove unused elf_machdep.h cruft.
Also add a few missing include guards.

Bug: N/A
Test: builds
Change-Id: I9557303c81a4b11d430112528def038ecb5562a9
2017-04-17 16:25:09 -07:00
Elliott Hughes
d6f91ce85f Document DT_RUNPATH support.
Bug: http://b/37328826
Test: N/A
Change-Id: Ia220f7f519e3cdd6193faff3b58d598505d4d0cf
2017-04-17 16:01:23 -07:00
Elliott Hughes
438e01940b Un-deprecated __system_property_find_nth.
Netflix was using this, and looking the header file, although
__system_property_find_nth has been available since the beginning of time,
__system_property_foreach only appeared in 16. So anyone who wants to run
on pre-JellyBean devices would want to use __system_property_find_nth.

It's pretty much a one-liner in terms of __system_property_foreach anyway,
so it doesn't cost us anything to keep it.

Also restore slightly better tests than we originally removed.

Bug: http://b/36566667
Test: ran tests
Change-Id: Id268c2c2e848da17bb0a5a5420af234d9dcb829a
2017-04-17 14:53:07 -07:00
Elliott Hughes
e4ddb3c587 Move bionic_systrace.cpp over to CachedProperty.
This is the last bionic caller that was manually trying to cache
property values.

Bug: N/A
Test: builds and boots
Change-Id: Id66c0a05d8448f08c39dbf7189241e75615d44b4
2017-04-17 14:12:25 -07:00
Treehugger Robot
661a2ed9df Merge "Link to the public post about clang FORTIFY." 2017-04-17 17:09:42 +00:00
Elliott Hughes
ef2b2fe99e Link to the public post about clang FORTIFY.
Bug: N/A
Test: builds
Change-Id: I1c2040fdd3c3bbe61a8adfc1f414fce50087a1b8
2017-04-16 08:50:58 -07:00
Treehugger Robot
9852fba985 Merge "Avoid "D linker : (null)" with debug.ld.all for dlerror." 2017-04-15 22:30:58 +00:00
Elliott Hughes
295082b3af Avoid "D linker : (null)" with debug.ld.all for dlerror.
We only want to know when dlerror is actually set. The previous change
to this logic moved it so that we only show actual updates to dlerror,
not every string that might end up in dlerror's output. This change
ignores cases where we're _clearing_ dlerror (which happens on every
call to dlerror).

Bug: http://b/37287938
Test: ran tests
Change-Id: I0c30ee199dc76d9aea165c1d90f694ead488518b
2017-04-15 09:11:15 -07:00
Treehugger Robot
e4e69a174a Merge "Report the right error code from PropertyServiceConnection()" 2017-04-15 00:18:31 +00:00
Elliott Hughes
8d61f27757 Merge "Fix incorrect check." 2017-04-14 22:14:45 +00:00
Tom Cherry
be4232be84 Report the right error code from PropertyServiceConnection()
We're currently reporting errno from the clean up call to close(),
which is much less interesting than the failing connect() call that
precedes it.  This change reports errno from the connect() call
instead.

Bug: 36249702
Test: Boot bullhead, bionic unit tests
Test: Fake bad end point and see relevant error returned
Change-Id: Icadec463f50cd0a2a2faa08f049a7996cd32786f
2017-04-14 14:41:10 -07:00
Christopher Ferris
35dfaa89de Fix incorrect check.
Bug: 37347846

Test: No error on data +%s
Change-Id: I7e88ea842af29ce4a366c25a3f79c09b63a25004
2017-04-14 12:58:56 -07:00
Christopher Ferris
da08de89b4 Merge "libc: ARM: Add 32-bit Kryo memcpy" 2017-04-14 16:00:01 +00:00
Treehugger Robot
e8a328058d Merge "Address review comments on the bionic tzdata loader." 2017-04-14 05:43:47 +00:00
Treehugger Robot
10f32d9c17 Merge "Restore __system_property_find_nth version" 2017-04-13 19:26:03 +00:00
Jake Weinstein
04d99df80d libc: ARM: Add 32-bit Kryo memcpy
* Memcpy is based on Scorpion due to Qualcomm's
  128-bit cache line size optimizations.

* PLDOFFSET and PLDSIZE are from the ARM64 Kryo memcpy routine.

Below are the results of the benchmark, tested on a OnePlus 3 with MSM8996.

Before:
BM_string_memcpy/8                          1000k          8    0.934 GiB/s
BM_string_memcpy/64                         1000k         11    5.785 GiB/s
BM_string_memcpy/512                        1000k         25   19.918 GiB/s
BM_string_memcpy/1024                         50M         42   23.938 GiB/s
BM_string_memcpy/8Ki                          10M        473   17.291 GiB/s
BM_string_memcpy/16Ki                          5M        565   28.976 GiB/s
BM_string_memcpy/32Ki                       1000k       1105   29.631 GiB/s
BM_string_memcpy/64Ki                       1000k       2194   29.864 GiB/s

After:
BM_string_memcpy/8                          1000k          6    1.145 GiB/s
BM_string_memcpy/64                         1000k          7    8.560 GiB/s
BM_string_memcpy/512                        1000k         18   27.370 GiB/s
BM_string_memcpy/1024                         50M         33   30.340 GiB/s
BM_string_memcpy/8Ki                          10M        266   30.770 GiB/s
BM_string_memcpy/16Ki                          5M        553   29.599 GiB/s
BM_string_memcpy/32Ki                       1000k       1121   29.219 GiB/s
BM_string_memcpy/64Ki                       1000k       2208   29.678 GiB/s

Test: make otapackage
Test: Ran bionic unit tests on Pixel device. Verified memcpy wins on
Test: Pixel device.

Change-Id: Id7a9c37ef75a306dd5cf8d374d79d0fe83f8a3ba
2017-04-13 11:18:56 -07:00
Dimitry Ivanov
b63ed1d2b9 Restore __system_property_find_nth version
Moving this to LIBC_DEPRECATED caused compatibility
problems for some apps.

Bug: http://b/36566667
Test: launch app and check that it does not crash
Change-Id: I470f916ef818ff62ff5391b3a0c86dd44c1e8cd0
(cherry picked from commit 2167e74f16)
2017-04-13 11:18:53 -07:00
Christopher Ferris
f568ccd34a Merge "libc: use Cortex-A7/A53 memset on Kryo" 2017-04-13 17:45:54 +00:00
Treehugger Robot
a8f9c8069e Merge "Add seccomp blacklist, and exclude swap functions" 2017-04-13 15:09:47 +00:00
Jake Weinstein
4d114f9e21 libc: use Cortex-A7/A53 memset on Kryo
Tested on OnePlus 3 with MSM8996

Before (Krait):
BM_string_memset/8                          1000k          7    1.071 GiB/s
BM_string_memset/64                         1000k          9    6.720 GiB/s
BM_string_memset/512                        1000k         19   26.699 GiB/s
BM_string_memset/1024                       1000k         29   34.214 GiB/s
BM_string_memset/8Ki                          10M        184   44.302 GiB/s
BM_string_memset/16Ki                          5M        351   46.656 GiB/s
BM_string_memset/32Ki                          5M        686   47.744 GiB/s
BM_string_memset/64Ki                       1000k       1355   48.342 GiB/s

After (A7/A53):
BM_string_memset/8                          1000k          7    1.017 GiB/s
BM_string_memset/64                         1000k          7    8.039 GiB/s
BM_string_memset/512                        1000k         13   37.976 GiB/s
BM_string_memset/1024                       1000k         21   47.595 GiB/s
BM_string_memset/8Ki                          10M        150   54.354 GiB/s
BM_string_memset/16Ki                         10M        285   57.336 GiB/s
BM_string_memset/32Ki                          5M        555   59.016 GiB/s
BM_string_memset/64Ki                       1000k       1097   59.720 GiB/s

Test: make otapackage
Test: Verified this wins in all dimensions on a Pixel device.

Change-Id: I4cb72cc0363877de7c41d6f991149fda42fd0b4b
2017-04-12 14:58:29 -07:00
Elliott Hughes
a01cbaa87d Address review comments on the bionic tzdata loader.
Bug: N/A
Test: ran tests
Change-Id: Ia7e27a2f93fe814e46b0912ce358b72651192173
2017-04-12 14:06:29 -07:00
Paul Lawrence
3dd3d55af2 Add seccomp blacklist, and exclude swap functions
Bug: 37253880
Test: Make sure device boots
      Run pylint on genseccomp.py, test_genseccomp.py
      Run test_genseccomp.py
      Run new CTS test
      cts-tradefed run cts -m CtsSecurityTestCases -t android.security.cts.SeccompTest

Change-Id: I833a5364a1481d65173e77654da1798dc45a3f9d
2017-04-12 19:34:33 +00:00
Treehugger Robot
2be8013027 Merge "Move libc_logging.cpp over to CachedProperty." 2017-04-12 19:02:14 +00:00
Treehugger Robot
735f41afc4 Merge "The workaround for apps using older version of soinfos" 2017-04-12 18:41:27 +00:00
Treehugger Robot
21d4a9ac6b Merge "Move localtime.c over to CachedProperty." 2017-04-12 18:15:53 +00:00
Dimitry Ivanov
d3a07e84a7 The workaround for apps using older version of soinfos
Skip the check for accessibility in the case soinfo
does not have primary/secondary namespaces associated
with them.

Bug: http://b/37191433
Test: start an app from http://b/37191433 make sure it does not crash on lunch
Change-Id: Id4c0bdab4dfc6bc8a33fc275d71e325518e0759f
(cherry picked from commit 97b4c5f264)
2017-04-12 10:37:31 -07:00
Treehugger Robot
faf7f3542a Merge "'make bionic-unit-tests' now builds all the required binaries" 2017-04-12 07:54:04 +00:00
Treehugger Robot
ff82ce8746 Merge "Remove the useless lock from CachedProperty." 2017-04-12 05:59:57 +00:00
Elliott Hughes
a98aa56f33 Remove the useless lock from CachedProperty.
Also document that the caller should provide locking at an
appropriate scope.

Bug: N/A
Test: ran tests
Change-Id: Ib84802fd8b9dbe69f98feab80edef05549a3f73e
2017-04-11 17:23:37 -07:00
Dan Willemsen
53a9bcdcf5 Merge "Mark CRT objects as vendor available" 2017-04-12 00:06:52 +00:00
Dan Willemsen
230a7a44ce Mark CRT objects as vendor available
This will build separate copies of the CRT for vendor vs system when
BOARD_VNDK_VERSION is set. We'll be able to change crtbrand / etc as
needed with #ifdef __ANDROID_VNDK__ and similar.

Bug: 36426473
Bug: 36079834
Test: Put #ifdef __ANDROID_VNDK__ into crtbrand.S, see changes
Change-Id: I7db0cccfe94d144f072e7cef23832884f3c066f0
2017-04-12 00:06:47 +00:00
Treehugger Robot
d517ac2dcd Merge "Don't let missing Treble property context files affect errno." 2017-04-11 23:48:57 +00:00
Dimitry Ivanov
4bd3542767 'make bionic-unit-tests' now builds all the required binaries
Test: make
Change-Id: Ie2f5dffaa4a09eba6714ced8ab0043fd7446bee5
2017-04-11 16:15:32 -07:00
Christopher Ferris
94f58b2f0c Merge "Fix missing parse_open_file method." 2017-04-11 23:14:56 +00:00
Elliott Hughes
87ff82466c Move libc_logging.cpp over to CachedProperty.
Bug: N/A
Test: ran tests
Change-Id: I50f9065799e783df961e1275a4cda671fcf0fd32
2017-04-11 15:18:38 -07:00
Elliott Hughes
0e8616a37a Move localtime.c over to CachedProperty.
Since localtime.c is C, this entails pulling our code out into its own
C++ file, which we should probably have done years ago anyway.

Bug: N/A
Test: ran tests, and manually tested via Settings
Change-Id: Ifc787a553e8f739a87641a2d35321aca40a47286
2017-04-11 14:44:51 -07:00
Elliott Hughes
7ade61cae2 Don't let missing Treble property context files affect errno.
User code on a non-treble device was starting with errno == ENOENT rather
than 0 because of this treble support:

  openat(AT_FDCWD, "/property_contexts", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
  faccessat(AT_FDCWD, "/system/etc/selinux/plat_property_contexts", R_OK) = -1 ENOENT (No such file or directory)

This caused us to fail some toybox tests by reporting bogus errno values
where errno should have been left unset:

  PASS: date -d @0
  FAIL: date -d @0x123
  echo -ne '' | TZ=UTC date -d @0x123 2>&1
  --- expected
  +++ actual
  @@ -1 +1 @@
  -date: bad date '@0x123'
  +date: bad date '@0x123': No such file or directory
  PASS: date -d 06021234
  PASS: date -d 060212341982
  FAIL: date -d 123
  echo -ne '' | TZ=UTC date -d 123 2>&1
  --- expected
  +++ actual
  @@ -1 +1 @@
  -date: bad date '123'
  +date: bad date '123': No such file or directory
  PASS: date -d 1110143115.30
  PASS: date -d 111014312015.30
  PASS: date Unix time missing @

Bug: http://b/37248982
Test: ran tests
Change-Id: Iacf08c89dbe207ec53a7837e6ac7f78f5541ef35
2017-04-11 13:38:36 -07:00
Alessio Balsini
93d4f8b2fa Fix missing parse_open_file method.
gensyscalls.py was failing to execute because of a missing "self"
keyword when calling parse_open_file.

Test: manual test running gensyscalls.py.

Change-Id: I78db2cba704c5ca56a730019e36601a7ccd069f8
2017-04-11 18:27:29 +02:00
Treehugger Robot
6c0468bba7 Merge "Remove .(ll)ndk suffix from (ll)ndk_library" 2017-04-11 16:19:16 +00:00
Dan Willemsen
51a9bf1673 Remove .(ll)ndk suffix from (ll)ndk_library
Soong handles these automatically now.

Bug: 33241851
Test: Android-aosp_arm.mk is the same before/after
Test: build.ninja is the same before/after
Test: build-aosp_arm.ninja is the same before/after
Merged-In: Ibfe4cf5db732d9007b1cc12dbc523c427de1b23d
Change-Id: Ibfe4cf5db732d9007b1cc12dbc523c427de1b23d
2017-04-11 15:15:30 +00:00
Treehugger Robot
f17048bfb8 Merge "Send developers straight to the text relocation docs." 2017-04-11 06:07:07 +00:00
Elliott Hughes
763f6e108a Send developers straight to the text relocation docs.
It's been years since we allowed text relocations, but I had a developer
ask me how to fix them at last week's O Developer Day. They'd never seen
our docs, so let's try to fix that for anyone else who's still confused...

Bug: N/A
Test: builds
Change-Id: I9202a7b0a3f024041b646c43c87585f4fab22d09
2017-04-10 16:41:52 -07:00
Christopher Ferris
bdbab30e32 Merge "Refactor Config from a struct to a class." 2017-04-10 19:49:38 +00:00
Dan Willemsen
df244d876a Merge "Add LLNDK stub libraries for the VNDK" 2017-04-07 21:21:32 +00:00
Treehugger Robot
a07033e0dc Merge "versioner: fix LLVM assertion failure." 2017-04-06 23:35:52 +00:00