Commit graph

17116 commits

Author SHA1 Message Date
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
Colin Cross
0e25b3425b Fix clean mma in bionic
Change-Id: If2410c5ff9c08372098e5ec831e33e4da0e04b30
2016-07-14 16:53:18 -07:00
Treehugger Robot
55653cc33b Merge "Convert bionic benchmarks and tests to Android.bp" 2016-07-14 21:05:27 +00:00
Treehugger Robot
d0e764f91e Merge "Fix typo in the comment" 2016-07-14 20:11:21 +00:00
Colin Cross
0393437b53 Merge "Convert malloc_debug from Android.mk to Android.bp" 2016-07-14 19:43:29 +00:00
Treehugger Robot
41933386c0 Merge "Move relocation_packer from Android.mk to Android.bp" 2016-07-14 19:34:48 +00:00
Colin Cross
2722ebb30b Convert bionic benchmarks and tests to Android.bp
The compile-time tests and a few custom libraries for dynamic linker
testing are still compiled in make.

Also converts the make rules to run tests on the host to shell scripts
in tests/run-on-host.sh and benchmarks/run-on-host.sh

Change-Id: I6f174b3a69d58c4ed74d29f4e79332d483681534
2016-07-14 12:30:12 -07:00
Dimitry Ivanov
ebe5af7536 Fix typo in the comment
Addressing review comment from change I11bc2567b0cff89f48699ec74015991fee5b137b

Change-Id: I5d479ef61421c86fae06167815aa0a2681d9142d
2016-07-14 11:15:44 -07:00
Dimitry Ivanov
51f64197ae Merge "linker: Improve elf-file validation" 2016-07-14 18:12:59 +00:00
Elliott Hughes
85f900d589 Merge "Support 32-bit ARM vdso." 2016-07-14 16:54:23 +00:00
Colin Cross
baa4899d38 Convert malloc_debug from Android.mk to Android.bp
Change-Id: I60ad376d222a92a29263c2804dcd1bd0d3c383d0
2016-07-14 09:07:56 -07:00
Colin Cross
d3b6bc7624 Move relocation_packer from Android.mk to Android.bp
Change-Id: I3d24f8513fe3ca19900705d4861ab797464e0930
2016-07-14 09:07:13 -07:00
Treehugger Robot
48cedda02a Merge "Fix dlext.ns_smoke test" 2016-07-14 00:22:34 +00:00
Dimitry Ivanov
0c9d30f3c8 linker: Improve elf-file validation
1. Make sure that the .dynamic section offset and size matches
   PT_DYNAMIC segment offset and filesz
2. No section offset can be 0

Bug: http://b/16548758
Bug: http://b/29637134
Change-Id: I11bc2567b0cff89f48699ec74015991fee5b137b
Test: Install and start the app from http://b/29637134
2016-07-13 17:06:36 -07:00
Dimitry Ivanov
3a6c6b3254 Fix dlext.ns_smoke test
Check for updated error_message

Change-Id: I0f0dd59a6deba016d37d0ccc80113b62db86c1c2
Test: adb shell bionic-unit-tests32/64 --gtest_filter=dlext.ns*
2016-07-13 16:28:20 -07:00
Yabin Cui
fe4a4d8f67 Force pthread_cond_timedwait_relative_np using CLOCK_MONOTONIC.
Previous patch changed pthread_cond_timedwait_relative_np to use
CLOCK_REALTIME, which causes app compatibility problem. So change
it back to CLOCK_MONOTONIC.

Bug: 30106240
Change-Id: I8e04058e92ede098f4f9f8d133f094001921441e
2016-07-13 16:08:48 -07:00
Dimitry Ivanov
cc55bd8313 Merge "Use trivial types to avoid calls to new for globals" 2016-07-13 18:45:01 +00:00
Dimitry Ivanov
f857211675 Use trivial types to avoid calls to new for globals
To avoid initialization ordering problem avoid constructing
non-trivial global objects for linker_logger.

This patch also adds explicit check for bloc_size_ on alloc

Change-Id: I2cb3b13a10b7fac1f52a20038af77266d3e1da96
2016-07-13 10:33:15 -07:00
Treehugger Robot
c8d5d2a524 Merge "linker: Enable debug logging via properties" 2016-07-12 22:27:19 +00:00
Dimitry Ivanov
b996d60493 linker: Enable debug logging via properties
This patch lets developers tune logging of dlopen/dlerror with
setting system property.

Note that for security purposes this option is disabled on user build
for non-debuggable apps.

For starters there are 3 debug options:
 dlerror - enables logging of all dlerrors
 dlopen - traces dlopen calls

To enable system-wide logging (works only for userdebug/eng builds)
use debug.ld.all property.

To enable logging for particular app use debug.ld.app.<appname> property.

Example: Running "adb shell setprop debug.ld.all dlerror,dlopen" will log all
dlerror message as well as trace all calls to dlopen.

Bug: http://b/29458203
Change-Id: I2392c80a795509e16fe5689d0500d18b99772a64
2016-07-12 14:22:13 -07:00
Elliott Hughes
4ce902c30e Support 32-bit ARM vdso.
Linux 4.1 added this.

Bug: http://b/19198045
Change-Id: I28be802ff403a61dd6733a001411b3ff05fef5a5
2016-07-12 13:55:51 -07:00
Colin Cross
7fd1e75e24 Merge "Rename Android.soong.mk to Android.mk" 2016-07-12 16:15:55 +00:00
Colin Cross
7f0e89fadd Rename Android.soong.mk to Android.mk
Soong is always on now, so we don't have to distinguish between
makefiles that should be ignored because Soong is handling them with an
Android.bp file, and makefiles that are still needed with Soong.  All
obsolete Android.mk files have been removed, rename all Android.soong.mk
files to Android.mk.

Change-Id: Ic0494e1800dec13a9f5714559cffe3a5ebe49418
2016-07-11 16:54:20 -07:00