Commit graph

17038 commits

Author SHA1 Message Date
Treehugger Robot
931be5a64d Merge "Clean up <uchar.h> and <wctype.h> transitive includes." 2016-07-27 18:44:07 +00:00
Christopher Ferris
af8be4ebbc Merge "More kernel header cleanup." 2016-07-27 17:56:55 +00:00
Elliott Hughes
0fe88858f0 Clean up <uchar.h> and <wctype.h> transitive includes.
Bug: http://b/30367366
Change-Id: I63212a34c54ca07223a15aa5be4da3bdc6aa38a8
2016-07-27 10:45:05 -07:00
Treehugger Robot
61bd7cb6e9 Merge changes I0262eed9,Iba9ee03a
* changes:
  Add a temporary hack to work around __NDK_FPABI__.
  Remove _GNU_SOURCE guard on tmpnam.
2016-07-27 00:30:30 +00:00
Dan Albert
3e6929dad5 Add a temporary hack to work around __NDK_FPABI__.
Test: make checkbuild
Bug: http://b/27533932
Change-Id: I0262eed91b10b0dd5fe27a61fb8f35b3c062280e
2016-07-26 16:28:30 -07:00
Dan Albert
c1020754c2 Remove _GNU_SOURCE guard on tmpnam.
This shouldn't be guarded by _GNU_SOURCE. external/opencv3 expects
P_tmpdir to be available.

http://pubs.opengroup.org/onlinepubs/009695399/functions/tmpnam.html

Test: make checkbuild
Change-Id: Iba9ee03aec6e712356b571f7165ed1809e6227fe
2016-07-26 16:28:30 -07:00
Treehugger Robot
9f326a2d60 Merge "Remove #pragma GCC visibility." 2016-07-25 23:48:07 +00:00
Elliott Hughes
7b737e43f8 Remove #pragma GCC visibility.
We have better control over visibility now.

Bug: http://b/24767418
Change-Id: Ifa9a1e5af4bd4217db08422050908770247b3b69
2016-07-25 15:57:02 -07:00
Elliott Hughes
e656a3acaf Merge "Stop #define'ing __func__ and __restrict." 2016-07-25 22:32:56 +00:00
Elliott Hughes
f6495c78a8 Stop #define'ing __func__ and __restrict.
__STDC_VERSION__ isn't defined for __cplusplus, so we've been removing
such checks. Some got missed.

Stop defining __func__ and just use the __PRETTY_FUNCTION__ GCC extension
in <assert.h>. Also fix the #if there so that C++ gets __assert2 rather
than __assert, and rewrite the cast to work with -I rather than -isystem.

Also remove __restrict and just always use the __restrict GCC extension.

Add a trivial test for <assert.h>.

Bug: http://b/30353757
Change-Id: Ie49bb417976293d3a9692b516e28fe3c0ae0a6d9
Test: ran bionic unit tests.
2016-07-25 11:13:47 -07:00
Treehugger Robot
557b3a1194 Merge "Remove bionic's now-unused UniquePtr." 2016-07-23 03:51:20 +00:00
Treehugger Robot
0cdd0d4e63 Merge "Remove unnecessary 'extern's." 2016-07-23 03:47:18 +00:00
Elliott Hughes
1291e50173 Remove bionic's now-unused UniquePtr.
Change-Id: Id77dbdd6d4255ae8317449725ef093be9422407f
2016-07-22 19:52:46 -07:00
Elliott Hughes
3b2096a9d6 Remove unnecessary 'extern's.
Change-Id: Iba2b3fb6ff88e504f1657b915120ae43d58a1e03
2016-07-22 18:57:12 -07:00
Treehugger Robot
7101c48f20 Merge "Always include <sys/cdefs.h>." 2016-07-23 01:48:21 +00:00
Elliott Hughes
203e13d97d Always include <sys/cdefs.h>.
I made a mistake caught by code review earlier, so let's try to be
safer by default.

This patch also moves all our "forwarding" headers to the guardless
just-include-the-other-thing style that we usually use. (Where we
have a comment explaining where the header comes from, I've kept
that.)

Change-Id: I37342cf5e2563c6a269b2ba61a697069b1c7913b
2016-07-22 17:01:54 -07:00
Elliott Hughes
767e8147d7 Merge "Remove __BIONIC_LEGACY_INLINE." 2016-07-23 00:01:08 +00:00
Josh Gao
8778d64d5c Remove __BIONIC_LEGACY_INLINE.
Don't use the same declaration to declare both static and non-static
functions, to make life easier for versioner.

(Also, remove __BIONIC_LEGACY_INLINE from two functions in termios.h
that weren't actually legacy inlines.)

Bug: http://b/30170081
Change-Id: Ibb73377d77a2b4cee016289b7c46a01452e45fae
2016-07-22 15:52:55 -07:00
Dimitry Ivanov
12ba7e51d9 Merge "Add sanity checks for e_shentsize and e_shstrndx" 2016-07-22 22:44:53 +00:00
Elliott Hughes
420d02c56d Merge "Make it possible to build bionic with -I instead of -isystem." 2016-07-22 21:35:02 +00:00
Elliott Hughes
5470c18361 Make it possible to build bionic with -I instead of -isystem.
Various things:

* work around -Wnullability-completeness.
* use C++ casts in C++ and C casts in C.
* stop using attributes clang doesn't support (such as `warning`).
* remove duplicate definitions of XATTR_CREATE and XATTR_REPLACE.

Change-Id: I07649e46275b28a23ca477deea119fe843999533
2016-07-22 13:12:53 -07:00
Dimitry Ivanov
c73eec159f Add sanity checks for e_shentsize and e_shstrndx
This helps us avoid situations when malformed elf-files
are mistakenly loaded, - which might result in unexpected
behavior.

Bug: http://b/30166532
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: Idd6b4fa20e1d69a9f8d8391ba69c724d930fee51
2016-07-22 12:53:28 -07:00
Christopher Ferris
5956b4e314 More kernel header cleanup.
Modify the generate script to add a new option and copy the types.h
arm header file since it's not currently being created properly. Also
manually generate the arm types.h uapi header since it's not being
properly generated right now.

Modify both generate scripts to delete the target directories before
adding the files to handle moved/deleted header files.

Move the common/scsi headers into android and delete the common
directory. Change the scripts to reflect this change.

Update the scsi headers since they've been modified in upstream kernels.

Bug: 30072483

Change-Id: Ia43d4b238b6a041350d60cc30184ecbd4829d7d5
2016-07-22 12:21:25 -07:00
Treehugger Robot
4f62c5b311 Merge changes I7718b1ba,I648adc35
* changes:
  Only initialize the global stack protector once.
  Make getpid work before TLS has been initialized.
2016-07-22 19:20:58 +00:00
Treehugger Robot
237366867a Merge "Only define sa_family_t once." 2016-07-22 00:28:19 +00:00
Elliott Hughes
508d292f8d Only define sa_family_t once.
Change-Id: Icf700910c836d22c8a27ad026ec8af11697edd5a
2016-07-21 16:38:43 -07:00
Treehugger Robot
91f33cd5ae Merge "Treat "persist.sys.timezone" as being a Java-format timezone." 2016-07-21 08:06:33 +00:00
Elliott Hughes
3e3f4a51b8 Treat "persist.sys.timezone" as being a Java-format timezone.
POSIX and Java disagree about the sign in a timezone string like "GMT+3".
This means that if you set "persist.sys.timezone" to such a string, native
code and Java code disagree about what time it is. Resolve this by
translating to POSIX form for native code.

Bug: http://b/25463955
Change-Id: I7c08c459dd8514348a12ce419edcbfbfe8f6d327
Test: manually tested with setprop and date.
2016-07-20 17:23:54 -07:00
Dimitry Ivanov
823e32e30d Merge "Pass argc/argv/envp to dso constructors" 2016-07-21 00:08:46 +00:00
Dimitry Ivanov
5543746934 Pass argc/argv/envp to dso constructors
The glibc implementation of the loader passes argc/argv/envp
to all elf constructors. This change makes bionic linker
behave in the same way.

Bug: http://b/30145768
Change-Id: I1c65c42aa5305a5b133c64b5748205bbde869e0e
Test: run bionic-unit-tests --gtest_filter=dl*:Dl*
2016-07-20 16:10:19 -07:00
Evgenii Stepanov
a9fbaee593 Merge "Align-up and randomize shared libraries." 2016-07-20 20:31:41 +00:00
Christopher Ferris
fe280773ed Merge "Move/remove android only kernel uapi headers." 2016-07-20 18:03:48 +00:00
Evgenii Stepanov
d13e9a603f Align-up and randomize shared libraries.
This change implements the following property:
  Any 2**N aligned memory region on size 2**N contains no more than one DSO.

The value N can be configured, with 16 or 18 looking like a good choice.
Additionally, DSOs are loaded at random page-aligned address inside these large
regions.

This change has dual purpose:
1. Larger values of N allow a lot more compact CFI shadow implementation.
   See change I14dfea630de468eb5620e7f55f92b1397ba06217.
   For example, CFI shadow for the system_server process has the following size (RSS, KB):
   152 for N = 12, 32 for N = 16, 16 for N = 18.
2. Extra randomization is good for security.

This change does not result in extra RAM usage, because everything is still page-aligned.
It does result in a bit more VM fragmentation because of the gaps between shared libraries.
As it turns out, this fragmentation is barely noticeable because the kernel creates new mapping
at the highest possible address, and we do enough small mappings to almost completely fill the
gaps (ex. in the Zygote the gaps are filled with .ttf file mappings and thread stacks).

I've measured VM fragmentation as the sum of all VM gaps (unmapped regions) that are larger
than 1MB according to /proc/$PID/maps. On aosp_angler-userdebug, the numbers are (in GB):

                |   N = 12  |  N = 18
system_server   |   521.9   |  521.1
zygote64        |   522.1   |  521.3
zygote32        |   2.55    |  2.55
mediaserver     |   4.00    |  4.00

Change-Id: Ia6df840dd409c82837efd1f263be420d9723c84a
2016-07-19 18:18:22 -07:00
Treehugger Robot
d941f72e75 Merge "Expand the testing docs slightly." 2016-07-19 21:57:27 +00:00
Treehugger Robot
9af76f9b48 Merge "Remove __LIBC_ABI_PUBLIC__." 2016-07-19 21:48:25 +00:00
Elliott Hughes
20758d58dd Expand the testing docs slightly.
Change-Id: I4b172eefd8f456a62b24520a9f04f500a1d6bc85
2016-07-19 14:09:10 -07:00
Elliott Hughes
f47514dd99 Remove __LIBC_ABI_PUBLIC__.
We have much better control over visibility now, so we don't need to
pollute the headers with cruft.

Bug: http://b/24767418
Change-Id: I349f4c3bc30102477375ad9f80926e560c7c1d8b
2016-07-19 13:56:46 -07:00
Christopher Ferris
d6e8b8ca56 Move/remove android only kernel uapi headers.
Move all of the uapi kernel headers that are only found in the android
kernel, and are still used by the tree into their own directory.

Delete all of these files that are not used.

Also, delete binder.h from the linux directory since it already exists
in the linux/android directory.

Bug: 30072483
Change-Id: I879f16e366f7670b8be3546b0a9cf9567fce6526
2016-07-19 12:43:56 -07:00
Treehugger Robot
061cf180db Merge "Add a test for a known kernel bug." 2016-07-19 17:52:03 +00:00
Treehugger Robot
20de9ef5bd Merge "Don't declare SYS_* constants for unavailable __NR_* constants." 2016-07-18 20:39:10 +00:00
Elliott Hughes
d2f725eaed Don't declare SYS_* constants for unavailable __NR_* constants.
Bug: https://code.google.com/p/android/issues/detail?id=215853
Change-Id: Iaaa3ce888deb8d032208bf636b7badaed6a72d30
2016-07-18 12:48:39 -07:00
Treehugger Robot
cf85fd5fd5 Merge "Convert linker from Android.mk to Android.bp" 2016-07-15 22:31:13 +00:00
Treehugger Robot
098d8ef5b2 Merge "Put the legacy stdio fds back for pre-M." 2016-07-15 21:33:00 +00:00
Treehugger Robot
730fa648c2 Merge "Add an alias for _CTYPE_N." 2016-07-15 20:56:01 +00:00
Colin Cross
97f0aefe59 Convert linker from Android.mk to Android.bp
Change-Id: Ibf7da301defb2fd7e24fb3f4cd2e967a8f376497
2016-07-15 13:39:29 -07:00
Dan Albert
32c79c279d Put the legacy stdio fds back for pre-M.
Change-Id: I2e397b04cba2969b9f9a3767b9b2fd12a289fcd2
2016-07-15 12:54:14 -07:00
Dan Albert
77bd6073fb Add an alias for _CTYPE_N.
gnustl is using this. It would be easy to change gnustl to *not* use
it for Android, but we've had this in released NDKs for years now so
we probably need this anyway.

Change-Id: I398a550664bf4ccbd9ea54f53c65428293a599a4
2016-07-15 12:54:05 -07:00
Yabin Cui
a24a2476d0 Merge "Force pthread_cond_timedwait_relative_np using CLOCK_MONOTONIC." 2016-07-15 01:29:28 +00:00
Treehugger Robot
1e4a945f27 Merge "Fix clean mma in bionic" 2016-07-15 00:52:37 +00:00
Elliott Hughes
4a253496b8 Add a test for a known kernel bug.
Bug: http://b/27265969
Change-Id: I981cb6a91015bd17d362987ed12c8ca638987c5b
2016-07-14 17:07:17 -07:00