Commit graph

25464 commits

Author SHA1 Message Date
Luis Hector Chavez
fa09b3c754 seccomp: Generate the policy files at compile time
This change avoids having to run the genseccomp.py script every time a
policy file is edited, and instead generates these files at
compile-time.

Bug: None
Test: m
Test: find out/soong/ -name x86_64_global_policy.cpp  # Shows files
Test: generated policies are equivalent to original policies
Change-Id: I12461fe0c5fb02c008c1b2503fbb994b8aa2f56b
2018-08-06 11:10:25 -07:00
Treehugger Robot
ea6aff66fa Merge "genseccomp.py: Add a way to better find the clang prebuilt" 2018-08-04 02:54:36 +00:00
Treehugger Robot
7245c08265 Merge "fdsan: improve errors some more." 2018-08-04 00:14:46 +00:00
Treehugger Robot
594e594f05 Merge "Remove old workaround for unloading unversioned soinfo" 2018-08-03 23:25:53 +00:00
Josh Gao
08b7a4008f fdsan: improve errors some more.
Add handling for all 4 cases of failure of exchange_owner_tag. Also,
mask off and sign extend the type byte of the owner tag, and add a
test for that.

Test: bionic_unit_tests
Change-Id: Ic7c49f0ee5498623f05c49b5b4cd055db48a4b9f
2018-08-03 15:03:41 -07:00
Ryan Prichard
006d137d0d Remove old workaround for unloading unversioned soinfo
This code path is/was a workaround for poorly-behaved apps. AFAIK it isn't
needed anymore.

The (needed != nullptr) condition should have been (needed == nullptr), so
rather than unload a library, it tends to do nothing instead. If it can't
find the library, it would segfault.

Bug: http://b/112154263
Test: /data/nativetest/bionic-unit-tests/bionic-unit-tests
Test: /data/nativetest/linker-unit-tests/linker-unit-tests32
Test: apply patch to pi-dev, verify that apps from b/72143978 still work
Change-Id: Ic598cb3dcead9f88005764a9b8746ed6b35f5f38
2018-08-03 13:50:29 -07:00
Yi Kong
35bb46188c Merge "Modernize codebase by replacing NULL with nullptr" 2018-08-03 20:07:44 +00:00
Treehugger Robot
d7d5c9778d Merge "seccomp: Allow readlink(2) in x86_64 for UBSan's sake" 2018-08-03 20:03:36 +00:00
Luis Hector Chavez
fd3f6d7126 genseccomp.py: Add a way to better find the clang prebuilt
This change makes it possible to invoke this tool without having to
fiddle with the path.

Bug: None
Test: ./bionic/libc/tools/genseccomp.py  # Succeeded
Change-Id: Ib24d70abc973fe774cda4209e46a5b66ae7617be
2018-08-03 12:57:21 -07:00
Treehugger Robot
e2cab6422a Merge "Start using libarm-optimized-routines in libm." 2018-08-03 17:48:33 +00:00
Luis Hector Chavez
ef1a34c85d seccomp: Allow readlink(2) in x86_64 for UBSan's sake
This change allows the use of readlink(2) so that UBSan can work
correctly on x86_64.

Bug: 111999822
Test: CtsWrapWrapDebugTestCases
Change-Id: I7f3013c712e3e41567a0d8e1bbb9d378c04b4433
2018-08-03 10:36:02 -07:00
Yi Kong
32bc0fcf69 Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.

Test: m
Bug: 68236239
Change-Id: I5b4123bc6709641315120a191e36cc57541349b2
2018-08-02 18:09:44 -07:00
Christopher Ferris
65f82092a1 Merge "Add doc about verifying libc assembler routines." 2018-08-02 19:27:05 +00:00
Christopher Ferris
af455ac83d Add doc about verifying libc assembler routines.
Test: NA
Change-Id: Ic3576f9c063a11d5c3f5fdb093b4d9dd2a1f5dd7
2018-08-01 20:17:28 -07:00
Treehugger Robot
7fe9001364 Merge "Move android-changes-for-ndk-developers.md into docs/." 2018-08-01 23:05:37 +00:00
Treehugger Robot
3227c90edb Merge "Our prebuilt host glibc is new enough to remove a workaround." 2018-08-01 21:16:27 +00:00
Elliott Hughes
bc46fb86d0 Start using libarm-optimized-routines in libm.
Bug: N/A
Test: ran tests
Change-Id: I4a7a6e1c0d8b23741b4e9a15b181a430af47d8f5
2018-08-01 13:27:00 -07:00
Elliott Hughes
1975196c87 Move android-changes-for-ndk-developers.md into docs/.
(But keep a symbolic link so we don't break the web.)

Bug: N/A
Test: N/A
Change-Id: Ib0c8ef80cb4b6836a465d897ffe6d78e11f09f46
2018-08-01 13:07:17 -07:00
Elliott Hughes
b652e9ab4d Our prebuilt host glibc is new enough to remove a workaround.
Bug: N/A
Test: builds
Change-Id: Ib91a106ddc15aa93f0dc3c85bc1a17eaeb49ab0f
2018-08-01 12:26:17 -07:00
Treehugger Robot
78b4a82d7d Merge "linker: find AT_BASE using AT_PHDR/AT_PHNUM" 2018-07-31 21:01:49 +00:00
Treehugger Robot
b0c8a01de1 Merge "Use LIBC_Q for LIBC_PRIVATE / LIBC_PLATFORM" 2018-07-31 09:32:46 +00:00
Treehugger Robot
5a535d6781 Merge "Fix arm32/64 dynamic TLS relocations" 2018-07-31 09:31:35 +00:00
Ryan Prichard
6fdfd92e56 Use LIBC_Q for LIBC_PRIVATE / LIBC_PLATFORM
Bug: none
Test: run bionic unit tests
Change-Id: I59794597db9cbd23c917498e5e82296a379c8fb5
2018-07-31 00:17:02 -07:00
Ryan Prichard
c1c8a188b2 Fix arm32/64 dynamic TLS relocations
arm32: Add a relocation for TLS descriptors (e.g. gcc's
-mtls-dialect=gnu2).

arm64: Add all the dynamic TLS relocations.

Two of the relocations here are obsolete:

 - ARM documents R_ARM_SWI24 as an obsolete static relocation without
   saying what it did. It's been replaced by R_ARM_TLS_DESC, a dynamic
   relocation. We could probably remove it, but I left it because arm32
   is old, and I see the macro in other libc's. It's probably analogous
   to R_ARM_THM_SWI8, which is also an obsolete relocation reserved for
   a future dynamic relocation.

 - I couldn't find any ARM documentation at all for
   R_AARCH64_TLS_DTPREL32. It seems to have been part of three
   relocations:

    - R_AARCH64_TLS_DTPREL32 1031
    - R_AARCH64_TLS_DTPMOD32 1032
    - R_AARCH64_TLS_TPREL32 1033

Bug: b/78026329
Test: run bionic unit tests
Change-Id: I5e7432f6e3e906152dc489be5e812fd8defcbafd
2018-07-30 23:49:19 -07:00
Ryan Prichard
9729f35922 linker: find AT_BASE using AT_PHDR/AT_PHNUM
When the linker is invoked directly, rather than as an interpreter for a
real program, the AT_BASE value is 0. To find the linker's base address,
the linker currently relies on the static linker populating the target of
a RELA relocation with an offset rather than leaving it zero. (With lld,
it will require a special flag, --apply-dynamic-relocs.)

Instead, do something more straightforward: the linker already finds the
executable's base address using its PHDR table, so do the same thing when
the linker is run by itself.

Bug: http://b/72789859
Test: boots, run linker/linker64 by itself
Change-Id: I4da5c346ca164ea6f4fbc011f8c3db4e6a829456
2018-07-26 20:31:47 -07:00
Treehugger Robot
3bf897e12d Merge "Update to FreeBSD libm r336665." 2018-07-25 20:11:28 +00:00
Treehugger Robot
17b2add514 Merge "remove bionic-compile-time-tests-g++" 2018-07-25 02:47:28 +00:00
Treehugger Robot
3e98d88823 Merge "fdsan: improve diagnostics." 2018-07-25 00:40:29 +00:00
Treehugger Robot
439bb1d048 Merge "Fixup an out of date comment." 2018-07-24 23:09:57 +00:00
Tom Cherry
576f525302 Merge "Add recovery_available: true to libseccomp_policy" 2018-07-24 23:04:21 +00:00
Treehugger Robot
077f7f130f Merge "Use the FreeBSD __CONCAT." 2018-07-24 21:52:23 +00:00
Tom Cherry
a06c49c37f Add recovery_available: true to libseccomp_policy
Init needs this in order to be built in Android.bp

Test: build

Change-Id: I0ce67a3c84cf476b28be039b9c9b345bc381de7b
2018-07-24 13:36:59 -07:00
Tom Cherry
0fe2203309 Fixup an out of date comment.
Test: n/a
Change-Id: Ieb5d18d479becb8c92cbf71a8bb7cd67f7c27dba
2018-07-24 13:34:34 -07:00
Sajid Dalvi
6fc8dc203e remove bionic-compile-time-tests-g++
make checkbuild gives the following error:
bionic/tests/fortify_filecheck_diagnostics_test.cpp:1:0: error: unknown value 'cortex-a55' for -mcpu

The error is because we have a clang to support the new architecture,
but not a corresponding GCC. It is not trivial to filter out an invalid
CPU, and since there is no platform code built with GCC any more, its
better to remove bionic-compile-time-tests-g++

Bug: 74404306
Test: builds
Change-Id: I6aa181c652abeef782fec6380dfadd066140b8b9
2018-07-24 12:49:50 -07:00
Elliott Hughes
7763ab4bcb Use the FreeBSD __CONCAT.
We had the NetBSD __CONCAT macro, despite the fact that our only callers
are FreeBSD code. The FreeBSD libm changes in FreeBSD r336665 require
the FreeBSD implementation rather than the NetBSD one.

Unfortunately for me, that libm code is built in the NDK build too,
where it's built against the NDK's <sys/cdefs.h>. So I need to update
__CONCAT first before I can update the libm code.

Bug: http://b/111710419
Test: ran tests
Change-Id: I70e76e4caab2929c939bfb7009df9fe79d26806a
2018-07-24 12:45:58 -07:00
Elliott Hughes
758051f058 Merge "Revert "Retire GCC FORTIFY."" 2018-07-24 19:35:27 +00:00
Elliott Hughes
4dbe8fc22f Revert "Retire GCC FORTIFY."
This reverts commit 067bdc9546.

The angler/bullhead builds still use GCC, so I'll wait until they're turned down.

Bug: https://issuetracker.google.com/74404306
Change-Id: I777b08dd6ab5250d532b4b5cc56e9a790c13db20
2018-07-24 18:54:16 +00:00
Treehugger Robot
85e84f1117 Merge "Retire GCC FORTIFY." 2018-07-24 18:08:33 +00:00
Elliott Hughes
ab52807685 Update to FreeBSD libm r336665.
This reverts commit 253a830631 and moves
us forward to a revision that contains fixes for the problem with the
previous attempt.

This also makes sincos(3)/sincosf(3)/sincosl(3) available to `_BSD_SOURCE`
as well as `_GNU_SOURCE`.

The new FreeBSD libm code requires the FreeBSD `__CONCAT` macro, and all
our existing callers are FreeBSD too, so update that.

There's also an assumption that <complex.h> drags in <math.h> which isn't
true for us, so work around that with `-include` in the makefile. This
then causes clang to recognize a bug -- returning from a void function --
in our fake (LP32) sincosl(3), so fix that too.

Bug: http://b/111710419
Change-Id: I84703ad844f8afde6ec6b11604ab3c096ccb62c3
Test: ran tests
2018-07-24 10:36:00 -07:00
Josh Gao
fe380887c8 fdsan: improve diagnostics.
Generate a tombstone instead of just a log message when warning. Also,
don't use async_safe_fatal_va_list when we're not calling abort, as
this will permanently set the abort message.

Test: bionic_unit_tests
Test: setprop debug.fdsan warn; crasher fdsan_file
Change-Id: I2fe271da9004c8fd1f50ad3d8280be254eeaf656
2018-07-23 18:36:16 -07:00
Elliott Hughes
067bdc9546 Retire GCC FORTIFY.
NDK r18 (which removes GCC) is about to ship. We don't need this any more.

The immediate motivation for removing this right now is that the test
fails whenever we add Clang-only flags to the build system.

While we're here, clean up <stdatomic.h> too.

Bug: https://issuetracker.google.com/74404306
Test: ran tests
Change-Id: Iaad5d634d1ba76f0b6f19ad32cc27b2533771a4a
2018-07-23 17:22:58 -07:00
Treehugger Robot
94ab04c17a Merge "libm: add tests that would have caught the recent regression." 2018-07-23 23:30:11 +00:00
Elliott Hughes
505ecd6909 libm: add tests that would have caught the recent regression.
Bug: http://b/111710419
Test: ran tests
Change-Id: I00ec8ef24fb4c2cfef7c9cef311bbd6c755993e1
2018-07-23 14:25:36 -07:00
Treehugger Robot
ee213170db Merge "Revert "Update to FreeBSD libm r336523."" 2018-07-21 21:13:21 +00:00
Andreas Gampe
253a830631 Revert "Update to FreeBSD libm r336523."
This reverts commit f86ee10278.

Incorrect result for fmodf(3.0f, 0f) = 1.0f breaks ART tests.

Bug: 111710419
Test: art/test/testrunner/testrunner.py -b -t 436-rem-float --target
Change-Id: I7eae68fb92740db33415d16418447bcbbd98ecba
2018-07-21 12:23:03 -07:00
Treehugger Robot
1d79043430 Merge "Mark fdsan functions as __attribute__((weak))." 2018-07-20 23:09:27 +00:00
Josh Gao
e899e798b8 Mark fdsan functions as __attribute__((weak)).
Make it so that users can check for availability of fdsan at runtime.

Bug: http://b/110100358
Test: treehugger
Test: make libjnitest
Change-Id: Ief3054161f3e255d048370975f7dd90cf7ad3687
2018-07-20 13:51:28 -07:00
Treehugger Robot
170540398a Merge "Update to FreeBSD libm r336523." 2018-07-20 20:21:33 +00:00
Treehugger Robot
402ca1130b Merge "Introduce api to track fd ownership in libc." 2018-07-19 23:43:37 +00:00
Elliott Hughes
f86ee10278 Update to FreeBSD libm r336523.
This includes an ld128 powl, plus the clog* and cpow* families.

Also teach the NOTICE generator to strip SPDX-License-Identifier lines.

Bug: N/A
Test: ran tests
Change-Id: Ic8289d1253666a19468a4088884cf7540f1ec66d
2018-07-19 16:17:06 -07:00