Commit graph

34093 commits

Author SHA1 Message Date
Pirama Arumuga Nainar
7b89be78f4 Move __libc_int0x80 to an assembly file
Bug: http://b/157081822

If __libc_int0x80 is in a C/C++ file, Clang's coverage instrumentation
adds instructions to count the number of times it gets executed [1].
With coverage instrumentation, __libc_sysinfo, used on 32-bit x86, is
initialized to the wrong value, causing dl.preinit_system_calls to fail.

Moving the function to an assembly file leaves __libc_sysinfo properly
initialized.

[1] We could change clang so it doesn't instrument functions marked
__attribute__((naked)) as a followup.

Test: `m CLANG_COVERAGE=true NATIVE_COVERAGE_PATHS=bionic` and run
bionic-unit-tests

Change-Id: I73558253512392d345de8d5b66d38bb14b308fdf
2021-02-18 09:52:59 -08:00
Elliott Hughes
332065d57e Merge "Fix/update notices." 2021-02-17 17:51:06 +00:00
Mathew Inwood
ede54420ba Merge "Set updatable=false explicitly." 2021-02-17 09:55:07 +00:00
Rupert Shuttleworth
9432c923b1 Merge "Mark cc_library_headers targets as being bp2build_available." 2021-02-17 08:57:19 +00:00
Bob Badour
22801c7c8d Merge "Revert "[LSC] Add LOCAL_LICENSE_KINDS to bionic"" 2021-02-17 01:59:45 +00:00
Rupert Shuttleworth
592ef756a0 Merge "Mark ldd as executable for Bazel builds to work." 2021-02-17 01:34:29 +00:00
Elliott Hughes
aa8db1b9d1 Fix/update notices.
Auto-generate NOTICE files for all the directories, and for each one
individually rather than mixing libc and libm together.

Test: N/A
Change-Id: I7e251194a8805c4ca78fcc5675c3321bcd5abf0a
2021-02-16 15:06:50 -08:00
Elliott Hughes
51166f4f56 Merge "Rename __ANDROID_UNGUARDED_AVAILABILITY__ -> __ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__." 2021-02-16 21:26:12 +00:00
Elliott Hughes
5e44c22ebf Revert "[LSC] Add LOCAL_LICENSE_KINDS to bionic"
This reverts commit 48d43034d7.

Reason for revert: bionic is multiple projects, not just one.

Change-Id: Ib31e1bb8888cc85c6e7736c4e2a1d4652fd23935
2021-02-16 20:02:47 +00:00
Rupert Shuttleworth
a4583b7af3 Mark ldd as executable for Bazel builds to work.
Test: bazel build ...
Change-Id: I15f23804ab1ef44cc0a68b66c408dd88366f8098
2021-02-16 15:28:25 +00:00
Mathew Inwood
f11ce9a175 Set updatable=false explicitly.
Currently, this is the default so this is a no-op,
But the default is changing to true.

Bug: 180375550
Test: Treehugger
Change-Id: I74cfd805958687a4c1e43eded31fb0e6583c1482
2021-02-16 14:45:45 +00:00
Rupert Shuttleworth
fd64868a92 Mark cc_library_headers targets as being bp2build_available.
Test: build/bazel/scripts/bp2build-sync.sh write.
Change-Id: I78a491d20779f50757b55c8e5305b588bf613839
2021-02-16 03:39:20 +00:00
Treehugger Robot
f4ac74d9b4 Merge "[LSC] Add LOCAL_LICENSE_KINDS to bionic" 2021-02-15 23:21:48 +00:00
Bob Badour
48d43034d7 [LSC] Add LOCAL_LICENSE_KINDS to bionic
Added SPDX-license-identifier-Apache-2.0 to:
  libdl/Android.bp
  tools/versioner/src/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  benchmarks/Android.bp
  libc/malloc_debug/Android.bp
  libc/system_properties/Android.bp
  linker/Android.bp
  tests/Android.bp
  tests/libs/Android.bp
  tests/libs/Android.build.dlext_testzip.mk
  tests/make_fortify_compile_test.mk

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-ISC SPDX-license-identifier-MIT
    legacy_notice legacy_unencumbered
to:
  Android.bp
  libc/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-ISC SPDX-license-identifier-MIT
    legacy_unencumbered
to:
  tools/Android.bp
  tools/versioner/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-MIT legacy_unencumbered
to:
  libm/Android.bp

Added SPDX-license-identifier-Apache-2.0 legacy_unencumbered
to:
  libc/tools/Android.bp

Added SPDX-license-identifier-BSD
to:
  benchmarks/linker_relocation/Android.bp
  benchmarks/spawn/Android.bp
  libc/async_safe/Android.bp
  libc/malloc_hooks/Android.bp
  libfdtrack/Android.bp
  tests/headers/Android.bp
  tests/headers/posix/Android.bp

Added legacy_notice
to:
  apex/Android.bp
  benchmarks/linker_relocation/gen/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I76cad00578b9b99180ee5dd1e04b4646d5c5fedf
2021-02-12 17:51:24 -08:00
Elliott Hughes
a37b18133d Rename __ANDROID_UNGUARDED_AVAILABILITY__ -> __ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__.
Also reduce some of the duplication in the macros.

Bug: http://b/179067538
Test: treehugger
Change-Id: I81ab341731b0faad6c7c5f00037feff8576abafb
2021-02-11 12:56:39 -08:00
Ryan Prichard
ef0ec82684 Merge "Revert "Disable signal frame unwinding tests on arm64"" 2021-02-10 23:31:31 +00:00
Elliott Hughes
8460308d11 Merge "Make fd overflow an abort." 2021-02-10 16:28:34 +00:00
Ryan Prichard
cdace2f227 Revert "Disable signal frame unwinding tests on arm64"
This reverts commit 315969a67e.

Reason for revert: r407598b has llvm.org/D90898, which should fix the test.

Change-Id: I466e2122a700ba4df9160b57a5d3c94867472615
2021-02-10 07:08:18 +00:00
Elliott Hughes
d3915c7b53 Make fd overflow an abort.
On LP32, just abort if we're asked to handle an fd that's too big for
the `short` field in `struct FILE`. This is unreachable anyway because
the ulimit is 32Ki, and this will make issues far more noticeable if we
ever do increase that limit (which seems unlikely for LP32 devices).

Also rename __finit() to __FILE_init() to match __FILE_close().

Test: treehugger
Change-Id: I5db4d6c4529a1f558aff135b4dea071d73666be5
2021-02-09 17:13:09 -08:00
Treehugger Robot
8d1f9c2c3b Merge "Mark sh_binary target as being bp2build_available." 2021-02-09 16:29:55 +00:00
Rupert Shuttleworth
344b8da46a Mark sh_binary target as being bp2build_available.
Test: build/bazel/scripts/bp2build-sync.sh write.
Change-Id: I8e8c3c95aa2c7ff6d7db3d92291f224bdf7cf255
2021-02-09 11:53:36 +00:00
Elliott Hughes
6d5662d22a Merge "Fix freopen() where the path is null." 2021-02-08 20:07:12 +00:00
Treehugger Robot
3990193d7f Merge "Remove obsolete cpp_std: "experimental"." 2021-02-08 19:02:52 +00:00
Treehugger Robot
b0e9906c3a Merge "Mark //bionic filegroups/genrules as bp2build_available." 2021-02-08 18:14:20 +00:00
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
Jingwen Chen
d6a3b780de Mark //bionic filegroups/genrules as bp2build_available.
Test: GENERATE_BAZEL_FILES=true m nothing && build/bazel/scripts/bp2build-sync.sh write && bazel build //bionic/...
Change-Id: Ie3e0092a3a03ddc6228a9191e5b78ab206072dde
2021-02-08 01:44:35 -05: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
Elliott Hughes
f9cfecf3d4 Fix freopen() where the path is null.
This has been in the standard since C99, but we've never supported it
before. It's apparently used by SPIRV-Tools.

I tried implementing this the other way (with fcntl(2)) first, but
eventually realized that that's more complicated and gives worse
results. This implementation assumes that /proc is mounted, but so much
of libc relies on that at this point that I don't think there's any
realistic case where the fcntl(2) implementation would be preferable,
and there are many where it's not.

The fact that no-one's mentioned this until now suggests that it's not a
heavily used feature anyway.

I've also replaced AssertCloseOnExec() with a CloseOnExec()
boolean-valued function instead, because it's really annoying getting
assertion failures that don't point you at the test line in question,
and instead point to some common helper code.

Test: treehugger
Change-Id: Ia2e53bf2664a4f782581042054ecd492830e2aed
2021-02-04 17:01:55 -08: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