Commit graph

1759 commits

Author SHA1 Message Date
Christopher Ferris
9ce28844db Update to v4.19 kernel headers.
Test: Builds and boots.
Change-Id: I99a9ed79666e143b47f02ca4e59eed94f69b7e4a
(cherry picked from commit a981e2e52e)
2018-10-30 09:21:16 -07:00
Logan Chien
90856af78b Merge changes I70ea4b23,Iedcfe36b,I3f21fc71,Ie99c0eef
* changes:
  libc: Match header annotations to version script
  versioner: Build SymbolDatabase from version scripts
  versioner: Add 28 to version list
  libc: Add default __STRING implementation
2018-10-26 01:33:06 +00:00
Logan Chien
25bcf59cb3 libc: Match header annotations to version script
According to `libc.map.txt`, `pselect64()` was introduced since API
level 28. This commit adds the annotations to `sys/select.h`.

Bug: 113263746
Test: ./bionic/tools/versioner/run_tests.py
Change-Id: I70ea4b23cef92857f1654cebb660e0219238fc95
2018-10-25 14:54:44 +08:00
Elliott Hughes
6032c38fb3 Merge "Add getloadavg(3)." 2018-10-24 16:31:21 +00:00
Christopher Ferris
8daea556e9 Comment the M_PURGE option.
Test: Compiles.
Change-Id: Ib9e6f9a3f4b57a930a1ec5c149d273663f97a443
2018-10-23 13:43:48 -07:00
Elliott Hughes
2d0b28bc0d Add getloadavg(3).
Lets us build ninja with bionic.

Bug: N/A
Test: ran tests
Change-Id: I97eef1247d794b58a2b9aee4851551632e5a4e48
2018-10-23 11:23:00 -07:00
Logan Chien
aede30d316 libc: Add default __STRING implementation
This commit defines a default `__STRING()` definition.  There should be
a default definition because the unit test cases of versioner will
include `android/versioning.h` directly.  We cannot include
`sys/cdefs.h` in `android/versioning.h` either because that will lead to
circular inclusion.

Bug: 113263746
Test: ./bionic/tools/versioner/run_tests.py
Change-Id: Ie99c0eef4414fd687347baf3a2d295468877464f
2018-10-23 21:47:34 +08:00
Tim Murray
ac578f2587 malloc: add M_PURGE mallopt flag
Add a new mallopt flag that purges any pending decaying pages.

Test: boots and works
bug 117795621

Change-Id: Ib250ae2b705b6a368c1efb801d6a7be54e075acb
(cherry pciekd from commit 5083e833a6)
2018-10-22 16:25:28 -07:00
Florian Mayer
f7f71e3c7b Add RT signal to load heapprofd library.
Tests: Ran malloc_debug_unit_tests
Tests: Flashed to walleye, sent signal, observed
  "Unable to open shared library: heapprofd.so".

Change-Id: Ia8ce216837e29e3edbda8789ca28023d53fa1fda
2018-10-18 21:38:06 +01:00
Elliott Hughes
eb61430374 Don't #define __ANDROID_NDK__ for the platform build!
Caused an ODR violation trying to build current ToT of toybox.

Bug: N/A
Test: can successfully build code with `#ifdef __ANDROID_NDK__`
Change-Id: Ia80b8889b267779ee01f6257744e1794db0ebc65
2018-10-17 14:27:36 -07:00
Elliott Hughes
82ab481123 Add _SC_UIO_MAXIOV as a synonym for _SC_IOV_MAX.
glibc and musl both have these as synonyms for one another, so we may
as well do the same and get backwards compatibility on old OS releases.

Bug: N/A
Test: ran tests
Change-Id: I6bf38ea446560e1b11022ff539f07eb67c157049
2018-10-09 13:56:06 -07:00
Elliott Hughes
00dda09c08 <sys/param.h>: pollute the namespace with <endian.h>.
glibc does, and autoconf relies on that for its AC_C_BIGENDIAN test.

Bug: N/A
Test: N/A
Change-Id: I3acaaf0d7a69e8ed4e64239e4fe7f21c7001e717
2018-10-05 14:54:48 -07:00
Elliott Hughes
dd6763a6c6 Another round of documentation.
Bug: N/A
Test: N/A
Change-Id: I1b818fbb36ddd6d084dee56828290c2717a0c9b0
2018-10-04 16:35:13 -07:00
Elliott Hughes
b177085ce7 Add reallocarray(3).
Originally a BSD extension, now in glibc too. We've used it internally
for a while.

(cherry-pick of e4b13f7e3ca68edfcc5faedc5e7d4e13c4e8edb9.)

Bug: http://b/112163459
Test: ran tests
Change-Id: I813c3a62b13ddb91ba41e32a5a853d09207ea6bc
Merged-In: I813c3a62b13ddb91ba41e32a5a853d09207ea6bc
2018-09-26 14:24:18 -07:00
Josh Gao
5fa9df8efc fdsan: add type for libziparchive's ZipArchive.
Test: debuggerd `pidof system_server` | grep " fd "
Change-Id: I6a9a4306ecffe3899e4cc7285a0eb33efaa62616
2018-09-18 13:23:31 -07:00
Josh Gao
d527cf1f99 fdsan: add types for Java sockets.
Test: art/tools/run-libcore-tests.sh
Change-Id: If61211bc4ae225c3f89db989a167f9dc4fce375a
2018-09-17 17:31:58 -07:00
Elliott Hughes
ce934e3d9b Add android_get_device_api_level.
Bug: http://b/113615412
Test: ran tests
Change-Id: I0a7ae336c96c9ed6543b6935cbc242d14d4a4a67
2018-09-06 14:19:46 -07:00
Josh Gao
ab6a0802af fdsan: add type for ART's FdFile.
Bug: http://b/113558485
Test: none
Change-Id: I9bc874d8689cc54563f2a5878d324b27ad85060e
2018-08-30 17:37:52 -07:00
Elliott Hughes
222ce95c8a Remove ARM/MIPS fenv duplication.
Bug: http://b/32709207
Test: ran tests
Change-Id: I58d354e9f8b1e6023427ba271bf39e4e24b7f8ab
2018-08-30 09:26:43 -07:00
Treehugger Robot
003521af47 Merge "Document the set*id functions." 2018-08-28 22:52:31 +00:00
Treehugger Robot
6ef10547e9 Merge "Accept NULL for fds parameter in poll." 2018-08-28 22:41:25 +00:00
Chih-Hung Hsieh
4be542629a Accept NULL for fds parameter in poll.
* Some callers, e.g. external/curl/lib/select.c, do
  poll(NULL, 0, ...) and get clang-diagnostic-nonnull check error.

Test: build with WITH_TIDY=1
Bug: 111850071
Change-Id: I7ea433d185cb84011a954f05964181b5518febd4
2018-08-28 14:20:15 -07:00
Josh Gao
cd524ca71f Merge changes from topic "fdsan_abort_msg"
* changes:
  fdsan: provide abort message in warning tombstones.
  Implement pthread_sigqueue.
  Stringify api_level in <android/versioning.h>.
  Delete archaic pre-ANSI C support.
2018-08-28 20:20:21 +00:00
Treehugger Robot
ec247245de Merge changes from topic "bionic_fdsan_java"
* changes:
  fdsan: make the tag type values sequential.
  fdsan: expose functions to get and interpret tags.
2018-08-28 20:17:59 +00:00
Elliott Hughes
9c6017778b Document the set*id functions.
In particular, document the fact that they only affect the calling thread
on Android.

Bug: http://b/13134174
Test: ran tests
Change-Id: Ica6af451400d47e24358f59495ded63b2110eb8b
2018-08-28 12:17:20 -07:00
Treehugger Robot
24107698b4 Merge "Add fdsan owner type for sqlite." 2018-08-28 00:16:34 +00:00
Josh Gao
726b63f725 Implement pthread_sigqueue.
Bug: http://b/112770187
Test: bionic-unit-tests
Change-Id: I03382cd5df2490b2e87265dba9007e2cb1b14cd2
2018-08-27 16:48:17 -07:00
Josh Gao
f3aa3007e3 Stringify api_level in <android/versioning.h>.
Make it so that we can use __ANDROID_API_<letter>__ constants in
__INTRODUCED_IN macros.

Test: treehugger
Change-Id: I0929c01e23e58f51d12f73200e1daf5ef484ea5d
2018-08-27 16:48:17 -07:00
Josh Gao
1dc2503e1a Delete archaic pre-ANSI C support.
Test: treehugger
Change-Id: I02e7887a18d947e657f32760d57e58f8b3295fd8
2018-08-27 16:48:15 -07:00
Elliott Hughes
062eac88b5 <sys/socket.h>: add constant for kernel TLS.
Bug: N/A
Test: builds
Change-Id: I53e8dde1131fec781bee5371c03d4eb54cab9722
2018-08-27 11:27:06 -07:00
Elliott Hughes
4b9379c889 Merge "Start documenting libc." 2018-08-24 17:16:53 +00:00
Josh Gao
c1b4476808 fdsan: make the tag type values sequential.
In retrospect, allocating tag types from both ends will just make the
future creation of user-defined tags harder, because constants that are
introduced, and then used in previous versions might collide with
user-defined tags. Move all of the tag values to the front, so that we
can allocate from the end to minimize this.

Test: bionic_unit_tests
Change-Id: I5063adf8301b1063bd4931a6ce8b70dfe2411efd
2018-08-23 23:10:52 -07:00
Josh Gao
27cc4bc414 Add fdsan owner type for sqlite.
Test: none
Change-Id: Ib331d108e7e0431250eba3609f3557d8e4665aba
2018-08-23 23:10:52 -07:00
Josh Gao
b6b3a1d4f9 fdsan: expose functions to get and interpret tags.
Make it easier to write tests in users of fdsan by exposing functions
to allow users to get and interpret the tags.

Test: bionic_unit_tests
Change-Id: Iafa9bcaeb5e4db230f3dfec6f483274f34602694
2018-08-23 23:10:52 -07:00
Elliott Hughes
462e90cf4d Start documenting libc.
Bug: N/A
Test: N/A
Change-Id: I17345cb72a5ffc3af1688cf5874589cfb1e1fea0
2018-08-23 11:03:17 -07:00
Treehugger Robot
780cc6b189 Merge "Folks are starting to need a placeholder name for Q." 2018-08-22 20:11:19 +00:00
Elliott Hughes
cf97d7f121 Folks are starting to need a placeholder name for Q.
Better to just have one place to update...

Bug: N/A
Test: builds
Change-Id: If7135d26f498b0841f9ae505bf6ca3ed05767345
2018-08-22 10:50:29 -07:00
Elliott Hughes
99d54656bd Add PR_SET_VMA and PR_SET_VMA_ANON_NAME to <sys/prctl.h>.
We've copied & pasted these to too many places. And if we're going to
have another go at upstreaming these, that's probably yet another reason
to have the *values* in just one place. (Even if upstream wants different
names, we'll likely keep the legacy names around for a while for source
compatibility.)

Bug: http://b/111903542
Test: ran tests
Change-Id: I8ccc557453d69530e5b74f865cbe0b458c84e3ba
2018-08-22 10:36:23 -07:00
Elliott Hughes
b7b2884a21 Merge "Reland "Retire GCC FORTIFY."" 2018-08-08 15:26:37 +00: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
Treehugger Robot
3bf897e12d Merge "Update to FreeBSD libm r336665." 2018-07-25 20:11:28 +00:00
Treehugger Robot
439bb1d048 Merge "Fixup an out of date comment." 2018-07-24 23:09:57 +00:00
Tom Cherry
0fe2203309 Fixup an out of date comment.
Test: n/a
Change-Id: Ieb5d18d479becb8c92cbf71a8bb7cd67f7c27dba
2018-07-24 13:34:34 -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
0d1a8a5b0b Reland "Retire GCC FORTIFY."
This reverts commit 4dbe8fc22f.

The angler/bullhead builds are now dead, so this can go in.

Bug: https://issuetracker.google.com/74404306
Change-Id: I130cdcd6375b6125cb8a1e63a4a540b0dbe41ceb
2018-07-24 19:36:51 +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
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
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
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
Josh Gao
f6e5b58260 Introduce api to track fd ownership in libc.
Add two functions to allow objects that own a file descriptor to
enforce that only they can close their file descriptor.

Use them in FILE* and DIR*.

Bug: http://b/110100358
Test: bionic_unit_tests
Test: aosp/master boots without errors
Test: treehugger
Change-Id: Iecd6e8b26c62217271e0822dc3d2d7888b091a45
2018-07-19 14:28:54 -07:00