Commit graph

34067 commits

Author SHA1 Message Date
Elliott Hughes
a988ed65e4 Remove obsolete cpp_std: "experimental".
This is why I prefer being specific...

Test: treehugger
Change-Id: Ia2f2f5a2a4499df8ab4041c573b0ef78aecbaf3c
2021-02-08 09:25:35 -08:00
Treehugger Robot
eca47e72ef Merge "Mark bionic-stress-test as not unit tests as it run forever" 2021-02-05 05:28:23 +00:00
Chih-hung Hsieh
3118dc1c0f Merge "Add -Wno-ignored-pragmas." 2021-02-05 02:48:12 +00:00
Julien Desprez
11874f8f99 Mark bionic-stress-test as not unit tests as it run forever
This timed out the invocation when trying to run all cc_test, excluding it from unit tests.

Change-Id: I67758d5e49b607b7c10052bc193d885d9123bedf
Test: presubmit
Bug: 179092189
2021-02-05 00:52:20 +00:00
Chih-Hung Hsieh
444e2f69e9 Add -Wno-ignored-pragmas.
* https://reviews.llvm.org/D90316 changed warning on
  FENV_ACCESS pragma from unknown to ignored.
  Existing -Wno-unknown-pragmas cannot suppress the new
  -Wignored-pragmas.

Bug: 178516148
Test: make with WITH_TIDY=1
Change-Id: I783feef35324ef43946efca844cd944410875bfa
2021-02-04 23:51:53 +00:00
Chih-hung Hsieh
78ad991425 Merge "Fix "deprecated instruction in IT block" warning" 2021-02-04 19:41:06 +00:00
Dan Albert
a843e42092 Merge changes I486e54a1,Idda7161b,Iaf6b6b6a
* changes:
  Convert generate-NOTICE.py to Python 3, fix name.
  Convert genfunctosyscallnrs to Python 3.
  Convert gensecomp.py to Python 3.
2021-02-04 06:38:45 +00:00
Chih-Hung Hsieh
5cb4d9cef9 Fix "deprecated instruction in IT block" warning
Bug: 179266557
Test: make with new clang compiler
Change-Id: I963609861659cbb2be8ed467654109938185c747
2021-02-03 20:54:52 -08:00
Dan Albert
ffa5cbeb86 Convert generate-NOTICE.py to Python 3, fix name.
Python module names should be lower case and not use hyphens (the
former is a convention, the latter is a requirement for importable
modules).

Also updates the shell script to always use Python 3 so we don't need
to maintain Python 2 compatibility.

Test: repo upload, in both a python 2 and python 3 virtualenv
Bug: None
Change-Id: I486e54a12686b4e528dc6c9c47af5c7a52a7b790
2021-02-03 17:26:59 -08:00
Dan Albert
1dffb86205 Convert genfunctosyscallnrs to Python 3.
Test: treehugger
Test: pytest libc/tools
Bug: None
Change-Id: Idda7161bbd2e2f351e0750874dc4d766ef98cc2b
2021-02-03 16:32:10 -08:00
Elliott Hughes
bc6999f1c4 Convert gensecomp.py to Python 3.
The genseccomp tests haven't been run since at least 2018. Deleted the
ones that are testing APIs that no longer exist or have been
refactored to take very different inputs.

Test: treehugger
Test: pytest tools
Bug: None
Change-Id: Iaf6b6b6a2e922b181a457a74eb4b5abe90425dfb
2021-02-03 16:15:17 -08:00
Jingwen Chen
0e2b00b96a Merge "Move gensseccomp and genfunctosyscallnrs next to their sources." 2021-02-03 22:59:43 +00:00
Jingwen Chen
ca36633eba Move gensseccomp and genfunctosyscallnrs next to their sources.
This is a manual refactoring to ensure that the modules respect package boundaries for input files.

Test: m gensseccomp genfunctosyscallnrs
Change-Id: I8ca6cbe85a50e41bfe874a899653c2309c59a822
2021-02-02 07:24:24 -05:00
Ryan Prichard
15ade069b1 Merge changes from topic "builtins-exported"
* changes:
  Use exported variants of arm32/x86 builtins
  Fix -Wl,--exclude-libs typo: x86->i686
2021-02-02 00:30:03 +00:00
Mitch Phillips
bfa3688606 Merge "[MemInit] Remove old API, introduce new MemInit API." 2021-02-01 23:32:24 +00:00
Treehugger Robot
d8154a813d Merge "Fix __VERSIONER_NO_GUARD cases for availability." 2021-02-01 22:50:30 +00:00
Dan Albert
eae41f8eeb Fix __VERSIONER_NO_GUARD cases for availability.
libc++ still depends on these being declared even if they are
unavailable. This results in a worse error message (a link error
rather than a compiler diagnostic) if these functions end up being
used, but without the decl headers like libc++'s math.h can't be
included because it refers to an undeclared function.

For the cases where weak symbols aren't being used, don't annotate
these functions with their availability information.

Also need to avoid using __builtin_available for this case because the
NDK doesn't have __isOSVersionAtLeast yet.

__ANDROID_UNGUARDED_AVAILABILITY__ is being used as a proxy for
"building for the NDK" here because we don't have a good signal for
that which works for both the NDK proper and the NDK-in-the-platform
case.

Test: imported into the NDK, built and tested NDK
Bug: None
Change-Id: I9ef3e19a8fa083bca0be47b80dfef7ba52a94866
2021-02-01 12:53:22 -08:00
Treehugger Robot
c09fe61889 Merge "Sync libm with upstream FreeBSD." 2021-01-29 20:07:15 +00:00
Ryan Prichard
c22562ce6f Use exported variants of arm32/x86 builtins
For backwards compatibility (e.g. with old apps), arm32 libc.so and
libm.so export some of the builtins. On 32-bit x86, libc.so also
exports some of the builtins.

The non-exported variant of the builtins will eventually have hidden
symbols but doesn't currently because D93431 hasn't been merged into
our toolchain yet. See:
 - https://reviews.llvm.org/D93431
 - I44ec79728db92c089e2f39823c35b6f97d24c1ab in toolchain/llvm_android

Bug: http://b/153025717
Test: bionic unit tests
Change-Id: Ic489cb06a07ef61412502fc65a21b0cf630c11ed
2021-01-28 15:42:37 -08:00
Ryan Prichard
ef1478765d Fix -Wl,--exclude-libs typo: x86->i686
These lines shouldn't actually matter, because the DSOs are using
version scripts to allow-list exported symbols.

Bug: none
Test: bionic unit tests
Change-Id: I39d3df8c4f8053624f862b3c6994e30c693e928c
2021-01-28 15:41:47 -08:00
Chih-hung Hsieh
f700de5f53 Merge "Do not run clang-tidy with fortify tests." 2021-01-27 22:57:07 +00:00
Treehugger Robot
cdebaffea4 Merge "[MTE] Change scudo init order to get correct PROT_MTE pages." 2021-01-27 21:09:27 +00:00
Chih-Hung Hsieh
247892e0dc Do not run clang-tidy with fortify tests.
* When clang-tidy is called, its checks
  gave different diagnostic messages.

Bug: 178534530
Test: mm with WITH_TIDY=1
Change-Id: I5eec8239d5531f88caefca3c4032f9764deb9e09
2021-01-27 12:28:20 -08:00
Treehugger Robot
e91aebd4fe Merge "Increase leniancy in an inherently flaky test." 2021-01-26 23:19:14 +00:00
Elliott Hughes
bac0ebbf90 Sync libm with upstream FreeBSD.
Upstream SHA 78599c32efed3247d165302a1fbe8d9203e38974.

Test: treehugger
Change-Id: Ib103d211315e320df89a6f0bcb30cd8ba67dd603
2021-01-26 14:19:25 -08:00
Elliott Hughes
82c3c11c18 Increase leniancy in an inherently flaky test.
The example in the bug was 6ms instead of 5ms. Try 10ms?

Bug: http://b/178437652
Test: treehugger
Change-Id: I192d602fa4f3499cbf072507245543d0435c5329
2021-01-26 11:31:29 -08:00
Edgar Arriaga
cf81e7ca6a Merge changes from topic "proc_madvise_framework"
* changes:
  Add bionic headers for process_madvise
  Add a flag to distinguish shared VMAs
2021-01-26 19:29:37 +00:00
Mitch Phillips
9cad8424ff [MemInit] Remove old API, introduce new MemInit API.
Introduces new heap-zero-init API. We've realised that it's better to be
able to individually control MTE and heap zero-init. Having
heap-zero-init not be controllable without affecting MTE affects our
ability to turn off heap-zero-init in zygote-forked applications.

Bug: 135772972
Test: On FVP: atest -s localhost:5555 malloc#zero_init \
Test: malloc#disable_mte heap_tagging_level
Change-Id: I8c6722502733259934c699f4f1269eaf1641a09f
2021-01-25 15:19:31 -08:00
Elliott Hughes
69d44fd55b Merge "PAC/BTI: no need to keep using hint." 2021-01-25 18:30:20 +00:00
Elliott Hughes
82d0cf50dc Merge "[libc] Change literal value in macro" 2021-01-25 18:28:27 +00:00
Elliott Hughes
3e1d5563b6 PAC/BTI: no need to keep using hint.
The toolchain is new enough that should be able to use the actual
instructions now...

Test: treehugger
Change-Id: I30aafcdc5386268344c40dc6cc9a22caf591915a
2021-01-25 08:49:01 -08:00
Tamas Petz
ebfba5f8c1 [libc] Change literal value in macro
"#" there is incorrect: macro parameter is expected following a hashmark.

Test: build libc with -mbranch-protection=standard
Change-Id: Ib8e7ddf260b4cdbd36246cc70f69970f33dee200
2021-01-25 11:54:25 +01:00
Ryan Prichard
ee16c724f9 Merge "Ensure same order of global group members in all NS's" 2021-01-22 23:48:49 +00:00
Ryan Prichard
058eb8fa4e Ensure same order of global group members in all NS's
During "step 1" of find_libraries, the linker finds the transitive
closure of dependencies, in BFS order. As it finds each library, it
adds the library to its primary namespace (so that, if some other
library also depends on it, find_loaded_library_by_soname can find the
library in the process of being loaded).

LD_PRELOAD libraries are automatically marked DF_1_GLOBAL, and any
DF_1_GLOBAL library is added to every linker namespace. Previously,
this secondary namespace registration happened after step 1. The result
is that across different namespaces, the order of libraries could vary.
In general, a namespace's primary members will all appear before
secondary members. This is undesirable for libsigchain.so, which we
want to have appear before any other non-preloaded library.

Instead, when an soinfo is added to its primary namespace, immediately
add it to all the other namespaces, too. This ensures that the order of
soinfo objects is the same across namespaces.

Expand the dl.exec_with_ld_config_file_with_ld_preload and
dl.exec_with_ld_config_file tests to cover the new behavior. Mark
lib1.so DF_1_GLOBAL and use a "foo" symbol to mimic the behavior of a
signal API interposed by (e.g.) libsigchain.so and a ASAN preload.

Test: bionic unit tests
Bug: http://b/143219447
Change-Id: I9fd90f6f0d14caf1aca6d414b3e9aab77deca3ff
2021-01-22 03:27:43 -08:00
Elliott Hughes
7032fec142 Merge "Remove a tautological #if guard." 2021-01-22 00:01:55 +00:00
Elliott Hughes
370e963dec Remove a tautological #if guard.
Test: treehugger
Change-Id: Idc144c663f8bf10eec93f80f3dfedf73a095a42b
2021-01-21 14:40:49 -08:00
Jiyong Park
7cff764f3c Merge changes from topic "future_symbol"
* changes:
  crtbegin_static is built with min_sdk_version: "current"
  Guard __libc_current_sigrtmin/max with __builtin_available
  __INTRODUCED_IN macros add the availability attribute
2021-01-21 16:33:05 +00:00
Mitch Phillips
347b01b583 [MTE] Change scudo init order to get correct PROT_MTE pages.
scudo_malloc_* for fill contents in __libc_init_scudo calls scudo's
initializers. We haven't told Scudo whether we want MTE-capable (i.e.
mapped with PROT_MTE) size class regions yet, which happens in
SetDefaultHeapTaggingLevel. This can lead to inconsistent mappings,
where processes without ELF notes get the base region with PROT_MTE
(which is undesirable because the performance implications are not
known).

Make sure that scudo is informed of whether regions need to be mapped
PROT_MTE or not by hoising the tagging level up.

Bug: 135772972
Bug: 172365548
Test: On FVP - 'adb shell MEMTAG_OPTIONS=off sanitizer-status' should
have no PROT_MTE mappings (validation by looking for no 'mt' under
'VmFlags:' in /proc/smaps').

Change-Id: Idad64479c4a9459cb40dd211fe942437f8ca16fd
2021-01-20 12:45:07 -08:00
Colin Cross
d65b31fad6 Merge "Don't set native_bridge_supported: true for ndk libraries" 2021-01-20 17:49:36 +00:00
Ryan Prichard
fcd9c78534 Merge "Switch libc.so and linker to prebuilt LLVM libunwind" 2021-01-20 00:10:58 +00:00
Colin Cross
d9a9622c31 Don't set native_bridge_supported: true for ndk libraries
Native bridge modules will never compile against stubs, remove
native_bridge_supported: true.

Test: m checkbuild
Change-Id: I0eb93fe1a2c3f6ca34ce4dab17edda8807132ce8
2021-01-19 14:58:25 -08:00
Elliott Hughes
ac78394a5a Merge "Inline call_array for clearer stack traces." 2021-01-19 22:21:08 +00:00
Elliott Hughes
01be44d2f8 Inline call_array for clearer stack traces.
No-one seems to understand that a crash in a random .so from call_array()
in the linker isn't a linker bug. They _seem_ to understand (or at least
claim to) when we explain that this is just the linker calling their ELF
constructors --- despite the fact that the caller of call_array() is
call_constructors().

One experiment we can try though is to inline call_array() to elide that
frame from the crash dumps. I do also wonder whether renaming
call_constructors() to call_elf_constructors() would help/hinder/make no
difference. For now I'm leaning toward "hinder" because I suspect most
people don't understand "ELF constructor" and C++ folks at least will
probably be influenced in a not wholly incorrect direction when they
hear "constructor" (whereas "ELF constructor" might mislead them back in
the direction of "strange linker magic, not my fault" again)...

(The reformatting is clang-format's decision, not mine.)

Test: treehugger
Change-Id: I65ab95ceb2e988fd053c48c66f51afba17ccfa61
2021-01-19 09:47:50 -08:00
Treehugger Robot
edec069bb6 Merge "Remove the now-unnecessary android_mallopt() options." 2021-01-16 06:29:41 +00:00
Elliott Hughes
73366636e1 Remove the now-unnecessary android_mallopt() options.
These are available from mallopt() now, and all callers have been
switched over.

Bug: http://b/135772972
Test: treehugger
Change-Id: I90c7a7573b261c27001a2dfd4589b23861ad613b
2021-01-15 18:08:25 -08:00
Ryan Prichard
9f72aae9e3 Merge "Disable signal frame unwinding tests on arm64" 2021-01-15 23:02:20 +00:00
Edgar Arriaga
128ef8e981 Add bionic headers for process_madvise
Test: atest bionic-unit-tests-static
Bug: 173258203
Change-Id: I396945b95de364055b87cc53321aed4fad4ebc70
2021-01-14 19:34:40 -08:00
Edgar Arriaga
d02148c31a Add a flag to distinguish shared VMAs
This flag is required to filter out shared VMAs when compacting memory
using process_madvise.

Test: atest bionic-unit-tests-static
Bug: 173258203

Change-Id: I01fc0cc614b03128a5a9b0a6c8c5c2d829b701f9
2021-01-14 19:34:39 -08:00
Jiyong Park
268a60019d crtbegin_static is built with min_sdk_version: "current"
crtbegin_static is used by static exectuables which are guaranteed to be
with the latest library regardless of their target API level.

This change is in fact not a regression as crtbegin_static has been
built with __ANDROID_API__=10000 before
I645e6bb1234c27ae0a69b7b87a59206cfd350744 when __ANDROID_API__ tracked
sdk_version, not min_sdk_version. sdk_version was not set for crtbegin_*
objects and therefore the default "current" was (incorrectly) used.

With this change, we are recovering the original behavior for the static
variant, while the building of the dynamic variant becomes more correct
- it's now with __ANDROID_API__=16.

Without this change, several static executables fail to build as 1)
crtbegin_static for them is built with __ANDROID_API__=16 and 2)
libc_init_common.cpp uses pthread_atfork which is available only after
API level 23. We hit undefined symbol error when linking.

Bug: 134795810
Test: m

Change-Id: I1430e57302951df33530ea0ae91b0d7a0609bf3d
2021-01-15 10:40:51 +09:00
Jiyong Park
bb19208d66 Guard __libc_current_sigrtmin/max with __builtin_available
The two APIs were added for the API level 21 and beyond. Currently, its
existence is tested using the null check which is done regardless of the
min sdk version of the compilation unit. (which in turn required us to
mark the API symbol weak regardless of the min sdk version.)

Now, we have a better way of testing the API availability;
__builtin_available. The null check is replaced with the call to the
compiler-provided macro which determines if the code is running in a
version of OS where the API is known to exist.

Bug: 150860940
Bug: 134795810
Test: m
Change-Id: Ib96c78f8d3cc71d7e755d1eab86051517bbbcc44
2021-01-15 10:40:51 +09:00