Commit graph

8225 commits

Author SHA1 Message Date
Paul Lawrence
7c6f83e79e Merge "Expand whitelist"
am: c7dde49ab0

Change-Id: I22c6b772900c0aac068ca857cc3aa17310407795
2017-03-03 21:08:08 +00:00
Paul Lawrence
e6daf3f34a Expand whitelist
Bug: 35917228
Test: App now runs fine with setenforce 0
Change-Id: I039385e5d0e5105ec337c62dd098dd1662442a2e
2017-03-03 11:19:08 -08:00
Elliott Hughes
926add1593 Generate both static and shared libseccomp_policy.
Also switch to Android.bp

Bug: N/A
Test: builds
Change-Id: I33697a40b30d071f8d07aa33e1fb2b0c6e8a9f6d
2017-03-02 18:57:44 -08:00
Christopher Ferris
15d3fef0da Refactor the kernel update scripts.
The previous versions of the scripts did a lot of redundant changes
and were hard to follow.

I rewrote most of update_all.py so that it's clear about what's going on.

I updated clean_header.py to change the cleanupFile function so that
there is no magic about where the destination file is going to wind up.
Now the caller specifies the final location.

I updated utils.py so that if you are trying to do an update in one
location, but your lunch target is from another location, it causes
an error.

Bug: 35726570

Change-Id: Ic5a44d90c2774a627eecde34c0c403bc925a497c
Test: Ran the updater and verified it works properly.
Test: Verified that doing an update in one tree to another tree
Test: fails.
2017-03-02 15:21:42 -08:00
Paul Lawrence
892bbc7cbd Merge "Expand whitelist"
am: 5faa3166ce

Change-Id: I1a7ea74631e8fb72550d44639d307d18ee041dd6
2017-03-02 18:54:31 +00:00
Paul Lawrence
5faa3166ce Merge "Expand whitelist" 2017-03-02 18:48:47 +00:00
Paul Lawrence
7b4e7c4d55 Expand whitelist
Bug: 35906875
Test: Device boots, app runs further and fails with different error
Change-Id: I8df40ff85f8248504bca9a048510153970b31716
2017-03-02 18:48:13 +00:00
Victor Khimenko
869aed6b0f Merge "Stop using __system_property_area__"
am: 9e10b7fa44

Change-Id: I2b3add48f5d5e41e250a1024dab6fd8411447416
2017-03-01 21:51:00 +00:00
Victor Khimenko
4a92ffd302 Stop using __system_property_area__
Apparently that "backdoor" is no longer needed - the proper way is
to reinitialize properties:
    https://android-review.googlesource.com/#/c/181794/24/tests/system_properties_test.cpp

Also removes mentions of libnativehelper test (it no longer uses
__system_property_area__) and removes useless "extern" declaration
(actual use was removed long ago).

Test: refactoring CL, existsing tests still pass

BUG=21852512
BUG=34114501

Change-Id: I2223cab2fcb671ea180ad4470a7aba5c9cd20bd8
2017-03-01 20:43:42 +01:00
Dimitry Ivanov
536d0341d7 Merge "Revert "Revert "Revert "Make libc.so global""""
am: ebceea8e85

Change-Id: I12848c7afa25fbe7b42946a1586f7a78e8af2464
2017-03-01 00:41:42 +00:00
Dimitry Ivanov
ebceea8e85 Merge "Revert "Revert "Revert "Make libc.so global"""" 2017-03-01 00:39:06 +00:00
Dimitry Ivanov
4021909162 Revert "Revert "Revert "Make libc.so global"""
This reverts commit 2a4d892c7f.

Bug: http://b/35417197
Bug: http://b/35338922
Bug: http://b/35700074
Test: manual
Change-Id: Ib99d23d46664f3efa5be70213aa093b505e38775
2017-02-28 21:05:34 +00:00
Paul Lawrence
9e82ae1fb1 Merge "Move seccomp policy to bionic"
am: d9e52fed2a

Change-Id: I4bf75eaebe4adacabda2c2b4cd8047b1103e6016
2017-02-28 15:41:01 +00:00
Treehugger Robot
d9e52fed2a Merge "Move seccomp policy to bionic" 2017-02-28 15:36:08 +00:00
Dan Albert
ce9b4eb5da Merge "Fix pre-L MB_CUR_MAX."
am: ca1fda834f

Change-Id: Ib6f2b309be4ce297577174fd0de8e624d37d37e2
2017-02-27 22:30:09 +00:00
Treehugger Robot
ca1fda834f Merge "Fix pre-L MB_CUR_MAX." 2017-02-27 22:22:27 +00:00
Paul Lawrence
dfe8434a62 Move seccomp policy to bionic
Test: Built and checked booted
Change-Id: Iaec1265fe5a55c4df90ab9e45b010ef36faf6bba
2017-02-27 12:42:39 -08:00
Christopher Ferris
8b2654c1ef Merge "Update to kernel headers v4.10."
am: 5f41ce25c6

Change-Id: Ib466db6c56b442ac29b56878d19a4c926acf4911
2017-02-27 20:16:53 +00:00
Christopher Ferris
5f41ce25c6 Merge "Update to kernel headers v4.10." 2017-02-27 20:09:54 +00:00
Paul Lawrence
d2df74f5e0 Merge "Revert "Move seccomp policy to bionic""
am: c712aedb0c

Change-Id: I6e95b0579d749e898ef2933fe1fd92c81b28ad8c
2017-02-27 16:46:00 +00:00
Paul Lawrence
c712aedb0c Merge "Revert "Move seccomp policy to bionic"" 2017-02-27 16:39:12 +00:00
Paul Lawrence
98a53b7c74 Revert "Move seccomp policy to bionic"
This reverts commit 06a32206c5.

Reverting build-breaking change

Change-Id: Ib3698bca8f905033a9c7f22bc2fa9f7e7bf75873
2017-02-27 16:36:18 +00:00
Paul Lawrence
b499944442 Merge "Move seccomp policy to bionic"
am: d0ceac6441

Change-Id: Ia0dfc453985313ae5a098bbe5512a1b1aad741a3
2017-02-27 16:14:30 +00:00
Paul Lawrence
d0ceac6441 Merge "Move seccomp policy to bionic" 2017-02-27 16:09:39 +00:00
Dimitry Ivanov
2317d87e5f Merge "libc: __system_property_set uses writev to write atomically"
am: 3246b9d8ae

Change-Id: Ica033823bfed9851dfe693a4e079023bc41848a6
2017-02-25 02:13:42 +00:00
Dimitry Ivanov
c1231fbf0b Merge "Move __system_property_*_serial back to LIBC"
am: bf04e3c00d

Change-Id: I7bd2ab0a5ee0fbcf2ed2d3f87c1658ca6ba42af6
2017-02-25 02:07:13 +00:00
Treehugger Robot
3246b9d8ae Merge "libc: __system_property_set uses writev to write atomically" 2017-02-25 02:06:19 +00:00
Dimitry Ivanov
b876babd04 Move __system_property_*_serial back to LIBC
Bug: http://b/35764972
Bug: http://b/34114501
Test: make
Change-Id: Ibbda0107d07c432110a0633de03259e39480fde4
2017-02-24 16:11:14 -08:00
Dimitry Ivanov
6391e1a44d libc: __system_property_set uses writev to write atomically
__system_property_set sometimes produces broken_pipe error
when trying to write a property.

This change improves error messages and uses writev() instead
of sequence of send() calls.

Bug: http://b/35381074
Test: bionic-unit-tests --gtest_filter=prop*
Change-Id: I7a5b169c015db4e6b720370e58662de8206d1086
2017-02-24 14:00:04 -08:00
Paul Lawrence
06a32206c5 Move seccomp policy to bionic
Test: Built and checked booted

Change-Id: If777eed75d5280c7a390399261e97125c04767b2
2017-02-24 12:52:19 -08:00
Dimitry Ivanov
52c122cc7f Merge "Hide internal __system_property_* functions"
am: 5927b04ce7

Change-Id: Ibcb9bd8b5df6d5e5815886b10482ea6fde6213bd
2017-02-24 19:16:12 +00:00
Dimitry Ivanov
5927b04ce7 Merge "Hide internal __system_property_* functions" 2017-02-24 19:11:13 +00:00
Hans Boehm
226d38c69e Merge "Replace cxa_guard fences with acquire loads"
am: 5d0c1fcc8b

Change-Id: I0fe209d4075b3afbff03938cfa4bf5690ba60c23
2017-02-24 18:58:11 +00:00
Hans Boehm
5d0c1fcc8b Merge "Replace cxa_guard fences with acquire loads" 2017-02-24 18:50:35 +00:00
Elliott Hughes
37ae2185c2 Merge "Use <linux/eventpoll.h> to implement <sys/epoll.h>."
am: 77463d81e6

Change-Id: I563a5c0723fd4e9b0fbcea1aec73614e92b6381d
2017-02-24 16:59:03 +00:00
Elliott Hughes
77463d81e6 Merge "Use <linux/eventpoll.h> to implement <sys/epoll.h>." 2017-02-24 16:55:25 +00:00
Elliott Hughes
893fd97cdc Use <linux/eventpoll.h> to implement <sys/epoll.h>.
Bug: https://github.com/android-ndk/ndk/issues/302
Test: builds
Change-Id: Ia3074326a128c38f2488e342c028cc030801cfd9
2017-02-23 17:26:24 -08:00
Paul Lawrence
fadce724ee Merge "Expand whitelist"
am: 9eba112c3c

Change-Id: I43b0344fef5e56ccb53a0147ea0aab2a82f3fcb6
2017-02-23 23:58:30 +00:00
Treehugger Robot
9eba112c3c Merge "Expand whitelist" 2017-02-23 23:54:34 +00:00
Dimitry Ivanov
41a3a6f3cf Hide internal __system_property_* functions
Bug: http://b/34114501
Test: bionic-unit-tests --gtest_filter=prop*
Change-Id: I1fc57b4ced6aaf841aad64e12e7696d25c2e027b
2017-02-23 14:20:13 -08:00
Dan Albert
99f88aed64 Merge "Add legacy inlines for more termios stuff."
am: 9dbfd8ad7f

Change-Id: I3a493b5ad47ecac27e09f21fa1821851cac31083
2017-02-23 22:05:22 +00:00
Treehugger Robot
9dbfd8ad7f Merge "Add legacy inlines for more termios stuff." 2017-02-23 22:01:10 +00:00
Dan Albert
cea81d0552 Merge "Revert "Run the versioner as part of the build.""
am: 7f24a4f556

Change-Id: I46566a05914a13ad8492acebd6c76107df0b51a4
2017-02-23 21:45:14 +00:00
Dan Albert
7f24a4f556 Merge "Revert "Run the versioner as part of the build."" 2017-02-23 21:36:49 +00:00
Dan Albert
69c7562f59 Revert "Run the versioner as part of the build."
This reverts commit 45715b2a88.

Reason for revert: Darwin sucks

Change-Id: I004dd7fa5e14a43ffe04ace2f5a06341df61b8cd
2017-02-23 21:30:35 +00:00
Dan Albert
21ea50673a Merge "Run the versioner as part of the build."
am: bd15a909b5

Change-Id: I6fb0081b43f1287cc0ea82e156df9efb1faf2288
2017-02-23 21:11:22 +00:00
Dan Albert
bd15a909b5 Merge "Run the versioner as part of the build." 2017-02-23 21:06:47 +00:00
Paul Lawrence
0b2486a324 Expand whitelist
Bug: 35217603
Test: App no longer triggers seccomp exceptions when launched
Change-Id: I8ea904640a2f14c67a075e593067327407766220
2017-02-23 13:04:39 -08:00
Paul Lawrence
aff297e3f7 Merge "Autogenerate single policy from syscalls and whitelist"
am: b2a74cda90

Change-Id: Iaebc4930e1685570a7daee6bf62719115f909108
2017-02-23 20:40:21 +00:00
Treehugger Robot
b2a74cda90 Merge "Autogenerate single policy from syscalls and whitelist" 2017-02-23 20:27:45 +00:00
Hans Boehm
963daed780 Replace cxa_guard fences with acquire loads
This seemed to be the only place in bionic where a fence on a
performance-critical path could be easily replaced by a stronger
load/store order constraint. Do so.

On x86 this should generate the same code either way. Based on
microbenchmarks of the relevant ARM instructions, this is currently
performance-neutral in this kind of context. But in the future, the
newly generated acquire loads should give us a performance benefit.

Test: Booted AOSP
Change-Id: I7823e11d6ae4fd58e0425244c293262e2320fd81
2017-02-23 11:50:58 -08:00
Dan Albert
4473e34acb Add legacy inlines for more termios stuff.
Test: make checkbuild # with my versioner-in-build patches
Bug: https://github.com/android-ndk/ndk/issues/302
Change-Id: Ib00b5dadf23592d101486b4f2188285ec03c9e2a
2017-02-23 11:09:32 -08:00
Dan Albert
45715b2a88 Run the versioner as part of the build.
Running this periodically and checking in the results is not working
out, since the result is just that I'm having to spend a lot of time
cleaning up the headers every time I need to update them in the NDK.

Run the versioner as part of the build instead. This way bionic
header changes behave like the rest of the NDK headers and will
affect NDK builds in the platform *immediately*.

Remove the preupload hook for the versioner since it's part of the
normal build now.

The versioner's dependencies directory needs to be moved because
soong won't let us try to do things outside our module's directory
(in this case libc).

Unfortunately this means we need to build the versioner for Darwin,
because we now need it to perform a platform build.

Test: make checkbuild
Bug: None
Change-Id: Icdab8a962354d9e945072dc3f806baea376c8db4
2017-02-23 11:07:04 -08:00
Paul Lawrence
7ea4090c65 Autogenerate single policy from syscalls and whitelist
Bug: 35392119
Bug: 34465958
Test: Check boots and same syscalls are blocked as before

Change-Id: I9efa97032c59aebbbfd32e6f0d2d491f6254f0a2
2017-02-23 10:46:56 -08:00
Josh Gao
b2ce5a49f2 Merge "Allocate thread local buffers in __init_tls."
am: 7009f40e52

Change-Id: I11737e4ea95f517d71f4b08051f67b218c0f2c6c
2017-02-23 03:30:22 +00:00
Josh Gao
5e2285d3cc Allocate thread local buffers in __init_tls.
Thread local buffers were using pthread_setspecific for storage with
lazy initialization. pthread_setspecific shares TLS slots between the
linker and libc.so, so thread local buffers being initialized in a
different order between libc.so and the linker meant that bad things
would happen (manifesting as snprintf not working because the
locale was mangled)

Bug: http://b/20464031
Test: /data/nativetest64/bionic-unit-tests/bionic-unit-tests
      everything passes
Test: /data/nativetest/bionic-unit-tests/bionic-unit-tests
      thread_local tests are failing both before and after (KUSER_HELPERS?)
Test: /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
      no additional failures
Change-Id: I9f445a77c6e86979f3fa49c4a5feecf6ec2b0c3f
2017-02-22 16:05:03 -08:00
Elliott Hughes
39cacfe03f Merge "Add timeout support to __system_property_wait."
am: c9a840ac76

Change-Id: Ifaa6521599c8d36386cee6e980d0e10a7a6c1ef9
2017-02-22 01:47:53 +00:00
Treehugger Robot
c9a840ac76 Merge "Add timeout support to __system_property_wait." 2017-02-22 01:43:31 +00:00
Elliott Hughes
145e1f2ec7 Merge "Downgrade the special case of pthread_t(0) to a warning."
am: 2cb4fb033f

Change-Id: If4f963995645b9d57666d0cef0661aa96d8aa2a1
2017-02-22 00:42:11 +00:00
Dan Albert
5c15b8cf43 Fix pre-L MB_CUR_MAX.
The default locale is POSIX, not C.UTF-8. POSIX explicitly states
that MB_CUR_MAX is 1 for the POSIX locale:

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdlib.h.html

Test: Made change in the NDK, built libc++ against it, ran NDK libc++
      tests.
Bug: None

Change-Id: Ic2f6f96aa4a7f20d619030f41323831d01002715
2017-02-21 15:56:37 -08:00
Christopher Ferris
48af7cb2e2 Update to kernel headers v4.10.
Test: Built angler, booted on angler, ran bionic unit tests.
Change-Id: Ia24511e74106116ea84b44ab724865ec492de8f9
2017-02-21 14:42:34 -08:00
Elliott Hughes
40c885a4d1 Add timeout support to __system_property_wait.
Bug: http://b/35201172
Test: ran tests
Change-Id: I3a78813bf3cd50d1b308ecb3c742f923606c0cc4
2017-02-21 14:36:24 -08:00
Elliott Hughes
6ce686c48b Downgrade the special case of pthread_t(0) to a warning.
So far this is the only issue we've hit in vendor code, and we've hit
it several times already. Rather than try to fix bullhead (the current
problem), let's just admit that the special case of 0 is a lot less
worrying.

Also fix the test expectations to correspond to the new abort message.

Bug: http://b/35455349 (crashes on 0)
Bug: http://b/35622944 (tests)
Test: ran tests
Change-Id: Iec57011fa699a954ebeaec151db2193e36d1ef35
2017-02-21 14:21:43 -08:00
Elliott Hughes
4ba10084c2 Merge "Fix a comment in the pthread_cond_t implementation."
am: 4085423525

Change-Id: Iaf8f9accf72bca7aa90cbda76014cde5683f1204
2017-02-19 05:23:49 +00:00
Elliott Hughes
b66a0038ca Fix a comment in the pthread_cond_t implementation.
Bug: http://b/34592766
Test: N/A
Change-Id: I341f837dca52865ae5f8fe9ff50ba8999e297179
2017-02-18 16:35:36 -08:00
Dimitry Ivanov
27af19d87c Merge "Revert "Revert "Make libc.so global"""
am: ff3197bcc2

Change-Id: I645c686c7803c46627959caf0d47a03cb5387029
2017-02-18 00:24:46 +00:00
Treehugger Robot
ff3197bcc2 Merge "Revert "Revert "Make libc.so global""" 2017-02-18 00:18:26 +00:00
Dimitry Ivanov
2a4d892c7f Revert "Revert "Make libc.so global""
This reverts commit 65236d43e8.

Bug: http://b/35417197
Bug: http://b/35338922
Test: vogar --classpath out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/classes.jack  --mode=device --variant=X32 dalvik.system.JniTest#testGetSuperclass
Change-Id: Ibf3bb7396e7d11ebe95e2f9267d0fc4af3fbe8c5
2017-02-17 22:38:22 +00:00
Dan Albert
f44528fd2b Merge "Cleanup now that we don't need __NDK_FPABI__."
am: 4731fbd6e0

Change-Id: I62dc4eaefc95d2875cb6ba383d24a2c449005d60
2017-02-17 22:13:05 +00:00
Treehugger Robot
4731fbd6e0 Merge "Cleanup now that we don't need __NDK_FPABI__." 2017-02-17 21:11:27 +00:00
Elliott Hughes
e92111b79c Merge "Include the pthread_t in the "bad pthread_t" fatal abort." am: ce958d7e5c
am: 2caaf22e1d

Change-Id: I9330d5b8f57fcf78a2ad98d394f017686333923d
2017-02-17 20:51:04 +00:00
Dan Albert
4c78ca7e3c Cleanup now that we don't need __NDK_FPABI__.
Test: tools/update_headers.sh && make checkbuild
Bug: None
Change-Id: I1b9986c4d7d5da349a8ad394e8fcf64b87c89fdf
2017-02-17 11:08:53 -08:00
Elliott Hughes
3fed6ff847 Include the pthread_t in the "bad pthread_t" fatal abort.
Also reword the message to be stronger.

Bug: http://b/35455349
Test: manual
Change-Id: I8f34fd42f3b635c95a7b921645a016fb303ce3ad
2017-02-17 10:27:45 -08:00
Josh Gao
f1d42d6acd Merge "Add __libc_format_buffer_va_list." am: fec0e015ce
am: 33b9640132

Change-Id: I6848c4ef176cd04daa8ca1d1799aa69f1a00678d
2017-02-16 03:53:33 +00:00
Josh Gao
fec0e015ce Merge "Add __libc_format_buffer_va_list." 2017-02-16 03:42:53 +00:00
Dimitry Ivanov
401384c3de Merge "Unify linker files under one license (BSD)" am: 10a441bfcd
am: a368dd9dbf

Change-Id: Ic3da42612438aad889c916092e0293be89b9c340
2017-02-16 02:28:28 +00:00
Josh Gao
273991cead Add __libc_format_buffer_va_list.
Bug: http://b/35367169
Test: m
Change-Id: I133f231d3b93bdef56d06497679320a89c7188a9
2017-02-15 16:10:37 -08:00
Dimitry Ivanov
bcc4da9b75 Unify linker files under one license (BSD)
Historically we had part of the linker licensed under BSD and
another part under Apache 2 license. This commit makes all the
linker code licensed under BSD license.

Test: m
Change-Id: I11b8163ae75966b5768d3fe992679de376106515
2017-02-15 15:35:33 -08:00
Dan Albert
4587ac034b Merge changes I9d06ea8a,I2d157024 am: 606ba2762e
am: cec0e2f9b1

Change-Id: I224d0d121716b0bee40478d3011a2f625248300a
2017-02-15 19:26:57 +00:00
Treehugger Robot
606ba2762e Merge changes I9d06ea8a,I2d157024
* changes:
  Fixup API level guards for new fortify functions.
  Guard the GNU strerror_r with an API check.
2017-02-15 19:14:50 +00:00
Daniel Micay
63e9cd65f3 Merge "add fortified implementations of send/sendto" am: c54937b972
am: 0a4fb394c8

Change-Id: Ib9ba3836fa2f197388a4659906b2b0664a497098
2017-02-15 18:38:56 +00:00
Treehugger Robot
c54937b972 Merge "add fortified implementations of send/sendto" 2017-02-15 18:26:50 +00:00
Dan Albert
9c2094f3c5 Fixup API level guards for new fortify functions.
Test: tools/update_headers.sh && make checkbuild
Bug: None
Change-Id: I9d06ea8a5ee9dc27d957f59e6e84150651ed1c76
2017-02-14 22:22:13 -08:00
Dan Albert
8b154b1e82 Guard the GNU strerror_r with an API check.
The deprecated headers have always had only the POSIX definition
available (and it's always been available). With the unified headers
as they are now, we actually make it unavailable for C++ users (C++
implies _GNU_SOURCE) targeting below M. Adding this guard means that
pre-M users will still at least get the POSIX one.

It's not great that moving to M as your target API will actually
change the signature of your strerror_r, but I don't see a better
option here (not until we have the compatibility library, anyway).

Test: make checkbuild
Bug: None
Change-Id: I2d15702467533a826c4ec10fd973ee929d2b562a
2017-02-14 19:29:31 -08:00
Daniel Micay
95b59c520b add fortified implementations of send/sendto
Bug: None
Test: Bullhead builds+boots; CtsBionicTestCases passes.
Change-Id: I2f137a100f679f7f2145d84b2f29ddd3e96a36ae
2017-02-14 15:50:28 -08:00
Nick Kralevich
98aad56070 Merge "Add details on why AT_SYMLINK_NOFOLLOW is dangerous" am: 7b52454084
am: 42969056d0

Change-Id: Ic71a202f3c64f36e1d80af7f2fa64cf72d020626
2017-02-14 23:13:36 +00:00
Treehugger Robot
7b52454084 Merge "Add details on why AT_SYMLINK_NOFOLLOW is dangerous" 2017-02-14 23:08:13 +00:00
Dimitry Ivanov
0379c92138 Merge "Revert "Make libc.so global"" am: e7ea7612f9
am: 028e306731

Change-Id: If09db33cbb36328f99753b41dac2ced87f79f0a1
2017-02-14 22:54:35 +00:00
Treehugger Robot
e7ea7612f9 Merge "Revert "Make libc.so global"" 2017-02-14 22:40:58 +00:00
Nick Kralevich
125f1c0f22 Add details on why AT_SYMLINK_NOFOLLOW is dangerous
The comment isn't helpful as-is. Provide some clarifying information.

Test: code compiles. No functional changes.
Change-Id: I5267e0bc68857fdc8a4b3384a2a1b0d37693ee6e
2017-02-14 12:55:15 -08:00
Elliott Hughes
daa5c8afa9 Merge "Be more strict about using invalid pthread_ts." am: 0370905502
am: a18e9f88c8

Change-Id: Ie74df14b7772a0f14f9b20fa3c58d6455e55e42d
2017-02-14 19:06:18 +00:00
Dimitry Ivanov
65236d43e8 Revert "Make libc.so global"
This reverts commit 879177c9e1.

Bug: http://b/26833548
Change-Id: I23e0b34777d18e369063185da14c57994807da29
2017-02-14 19:03:26 +00:00
Elliott Hughes
0370905502 Merge "Be more strict about using invalid pthread_ts." 2017-02-14 18:32:18 +00:00
Elliott Hughes
520814a223 Merge "Add __system_property_wait and return the serial in __system_property_read_callback." am: ade3be476f
am: c9df674347

Change-Id: I62ca9f6f84cfb91875a6b5d9cf4aa47fb4299655
2017-02-14 03:54:22 +00:00
Treehugger Robot
ade3be476f Merge "Add __system_property_wait and return the serial in __system_property_read_callback." 2017-02-14 03:48:26 +00:00
Elliott Hughes
11859d467c Be more strict about using invalid pthread_ts.
Another release, another attempt to remove the global thread list.

But this time, let's admit that it's not going away. We can switch to using
a read/write lock for the global thread list, and to aborting rather than
quietly returning ESRCH if we're given an invalid pthread_t.

This change affects pthread_detach, pthread_getcpuclockid,
pthread_getschedparam/pthread_setschedparam, pthread_join, and pthread_kill:
instead of returning ESRCH when passed an invalid pthread_t, if you're
targeting O or above, they'll abort with the message "attempt to use
invalid pthread_t".

Note that this doesn't change behavior as much as you might think: the old
lookup only held the global thread list lock for the duration of the lookup,
so there was still a race between that and the dereference in the caller,
given that callers actually need the tid to pass to some syscall or other,
and sometimes update fields in the pthread_internal_t struct too.

(This patch replaces such users with calls to pthread_gettid_np, which
at least makes the TOCTOU window smaller.)

We can't check thread->tid against 0 to see whether a pthread_t is still
valid because a dead thread gets its thread struct unmapped along with its
stack, so the dereference isn't safe.

Taking the affected functions one by one:

    * pthread_getcpuclockid and pthread_getschedparam/pthread_setschedparam
      should be fine. Unsafe calls to those seem highly unlikely.

    * Unsafe pthread_detach callers probably want to switch to
      pthread_attr_setdetachstate instead, or using
      pthread_detach(pthread_self()) from the new thread's start routine
      rather than doing the detach in the parent.

    * pthread_join calls should be safe anyway, because a joinable thread
      won't actually exit and unmap until it's joined. If you're joining an
      unjoinable thread, the fix is to stop marking it detached. If you're
      joining an already-joined thread, you need to rethink your design.

    * Unsafe pthread_kill calls aren't portably fixable. (And are obviously
      inherently non-portable as-is.) The best alternative on Android is to
      use pthread_gettid_np at some point that you know the thread to be
      alive, and then call kill/tgkill directly.

      That's still not completely safe because if you're too late, the tid
      may have been reused, but then your code is inherently unsafe anyway.

Bug: http://b/19636317
Test: ran tests
Change-Id: I0372c4428e8a7f1c3af5c9334f5d9c25f2c73f21
2017-02-13 17:59:29 -08:00
Elliott Hughes
a0d374d587 Add __system_property_wait and return the serial in __system_property_read_callback.
In order to implement android::base::WaitForProperty well, we need a way to
wait not for *any* property to change (__system_property_wait_any), but to
specifically wait for the property represented by a given `prop_info` to
change.

The android::base::WaitForProperty implementation, like attempts to cache
system properties in the past, also needs a way to keep serials and values
in sync, but the existing functions don't provide a cheap way to get a
consistent snapshot. Change the __system_property_read_callback callback's
type to include the serial corresponding to the given value.

Add a test, slightly clean up some of the existing tests (and name them to
include the names of the functions they're testing, in our usual style).

Bug: http://b/35201172
Test: ran tests
Change-Id: Ibc8ebe2e88eef1e333a1bd3dd7f68135f1ba7fb5
2017-02-13 13:30:10 -08:00
Dimitry Ivanov
eb108f8e0d Merge "Make libc.so global" am: 5b74e9b2f5
am: 96a8cfcd09

Change-Id: I04bfd1c0165b5ff9f4af16511031f66393902be9
2017-02-13 20:38:25 +00:00
Treehugger Robot
5b74e9b2f5 Merge "Make libc.so global" 2017-02-13 20:29:52 +00:00
George Burgess IV
20c5fe3a2b Merge "Match __bos0 to __pass_object_size0 in FORTIFY" am: 572b1dde03
am: ae80a17b4f

Change-Id: I27b09cb45c33858a2a42df4fecedeace024f1cf0
2017-02-13 19:50:22 +00:00
Dimitry Ivanov
879177c9e1 Make libc.so global
This is a way to avoid loading multiple libc.so
when non-default namespace search path includes
/system/lib. This is used by some art tests.

Bug: http://b/26833548
Test: m -j32 test-art-target-run-test-004-JniTest
Change-Id: I919d3a0560bd3c9ac19df21a235641a667f0f017
2017-02-13 10:05:17 -08:00
George Burgess IV
156d5a8ae9 Match __bos0 to __pass_object_size0 in FORTIFY
pass_object_size(N) forwards the result of __builtin_object_size(param,
N) to a function. So, a function that looks like:

  size_t foo(void *const p __pass_object_size) { return __bos0(p); }
  int bar = foo(baz);

would effectively be turned into

  size_t foo(void *const p, size_t sz) { return sz; }
  int bar = foo(baz, __bos(baz)); // note that this is not __bos0

This is bad, since if we're using __bos0, we want more relaxed
objectsize checks.

__bos0 should be more permissive than __bos in all cases, so this
change Should Be Fine™.

This change also makes GCC and clang share another function's
implementation (recv). I just realized we need to add special
diagnostic-related overloads bits for clang to it, but I can do that in
another patch.

Bug: None
Test: Bullhead builds and boots; CtsBionicTestCases passes.
Change-Id: I6818d0041328ab5fd0946a1e57321a977c1e1250
2017-02-10 18:14:43 -08:00
mspector
95972f6ee1 Merge "Removing the kuser_helper elf note from building" am: e86a8d605b
am: ad1daec1fd

Change-Id: I4f18391ea34728acd30a72f416166ca9ae33f81b
2017-02-10 06:29:46 +00:00
Treehugger Robot
e86a8d605b Merge "Removing the kuser_helper elf note from building" 2017-02-10 06:24:32 +00:00
mspector
dd91b32baf Removing the kuser_helper elf note from building
This change removes the kuser_helper note from building automatically
with any binary but leaves the note.
Also fixes a typo in the note.

Original patch adding the note:
Ib8366e2a0810092b71381d57dee4bdaa56369a24

Bug: 34815073
Test: Manual - Note is no longer added to binaries
Change-Id: Ieb81f9d9127d1f8a522434a31c696d743238e2a5
2017-02-09 18:37:52 -08:00
George Burgess IV
2cae2dc5d7 Merge "libc: add clang FORTIFY support" am: 5ac650936f
am: eeb4544186

Change-Id: I9a658f22d45ec2b002c2086e5f381ee520461b93
2017-02-10 02:14:01 +00:00
George Burgess IV
7cc779f15c libc: add clang FORTIFY support
This patch adds clang-style FORTIFY to Bionic. For more information on
FORTIFY, please see https://goo.gl/8HS2dW . This implementation works
for versions of clang that don't support diagnose_if, so please see the
"without diagnose_if" sections. We plan to swap to a diagnose_if-based
FORTIFY later this year (since it doesn't really add any features; it
just simplifies the implementation a lot, and it gives us much prettier
diagnostics)

Bug: 32073964
Test: Builds on angler, bullhead, marlin, sailfish. Bionic CTS tests
pass on Angler and Bullhead.

Change-Id: I607aecbeee81529709b1eee7bef5b0836151eb2b
2017-02-09 15:49:32 -08:00
Elliott Hughes
dcaa56e695 Merge "Revert "Stop checking the global thread list in several trivial cases."" am: f201c704d6
am: b82f472c66

Change-Id: Ib0054aceacf20ee9b0c586bdb2c6441254f157a7
2017-02-07 21:18:41 +00:00
Elliott Hughes
f201c704d6 Merge "Revert "Stop checking the global thread list in several trivial cases."" 2017-02-07 21:12:23 +00:00
Elliott Hughes
bcb152903a Revert "Stop checking the global thread list in several trivial cases."
This reverts commit f5a4992b71.

Breaks OMX_ImgEnc in cameraserver (http://b/35088254).

Change-Id: I6dcf12706a184b0b8b72451584567a42dfa1bb4f
2017-02-07 21:05:30 +00:00
Elliott Hughes
6244abf143 Merge "Improve a comment." am: a1fa522927
am: 7272909a9e

Change-Id: Ib941aa88d74a8f8bea23a149df57dd8ce981795a
2017-02-07 17:05:55 +00:00
Elliott Hughes
a1fa522927 Merge "Improve a comment." 2017-02-07 17:01:16 +00:00
Elliott Hughes
ffb2bddcb9 Merge "Stop checking the global thread list in several trivial cases." am: 4708f435f5
am: 56209f0dd4

Change-Id: If798296ea508f4f72d202948357e2816581e3977
2017-02-07 00:38:58 +00:00
Elliott Hughes
f5a4992b71 Stop checking the global thread list in several trivial cases.
Since removing the global thread is hard, let's take the different
groups of functions individually.

The existing code was racy anyway, because the thread might still be
on the list but have exited (leaving tid == 0).

Bug: http://b/19636317
Test: ran tests
Change-Id: Icc0986ff124d5f9b8a653edf718c549d1563973b
2017-02-06 14:09:53 -08:00
Elliott Hughes
5e6cf05aab Improve a comment.
Bug: http://b/23675822
Test: builds
Change-Id: Ia58ffabf38012035076e4c682faa4c93f3690e24
2017-02-06 10:26:20 -08:00
Paul Lawrence
28d7378390 Merge "Create seccomp policy without TRAP for further processing" am: 4a47d2c436
am: b62e0a316f

Change-Id: Ibcd4a63aa3175bd94eef7d0cd5197d1fa2b9807d
2017-02-03 20:21:50 +00:00
Paul Lawrence
be8a2af2aa Create seccomp policy without TRAP for further processing
Bug: 34946764
Test: Make sure boots, seccomp still blocks, and is faster
Change-Id: Ib4abf4307ae545ee69a3fb9328f62c760a1b40f7
2017-02-03 09:36:45 -08:00
Elliott Hughes
a5e949b4b6 Merge "isnan and isinf aren't functions." am: 33ae5a97f2
am: 9184128819

Change-Id: I2a80969ecfcbab1c5cb8ec03ba4cd8028d9160b6
2017-02-03 00:43:06 +00:00
Elliott Hughes
33ae5a97f2 Merge "isnan and isinf aren't functions." 2017-02-03 00:32:01 +00:00
Elliott Hughes
e76ee993ff isnan and isinf aren't functions.
isnan was a function in POSIX in 1997, but changed to a macro only in 2004
to align with the C standard. isinf wasn't in POSIX until 2004, where it
appeared as a macro only (but other C libraries already had it as a
function).

Now the C++ standard has added ::isnan and ::isinf functions with different
signatures from the historical ones, so we need to move our historical cruft
out of the way.

We'll keep the implementations for backwards compatibility.

Bug: http://b/34724220
Test: ran tests
Change-Id: Id665f0344af6fe6ed245106e60231f4ef2027f41
2017-02-02 14:02:49 -08:00
David James
91fbf754fc Merge "Revert "Remove the global thread list."" am: a187a6f12e
am: 5124a0e635

Change-Id: Id8be9184e92bb7e6a06d9da9fc1efcf06ed927b9
2017-02-02 02:52:38 +00:00
David James
a187a6f12e Merge "Revert "Remove the global thread list."" 2017-02-02 02:46:40 +00:00
Elliott Hughes
7484c21c4c Revert "Remove the global thread list."
This reverts commit b0e8c565a6.

Breaks swiftshader (http:/b/34883464).

Change-Id: I7b21193ba8a78f07d7ac65e41d0fe8516940a83b
2017-02-02 02:41:38 +00:00
Elliott Hughes
7922c13fb6 Merge "Remove the global thread list." am: 9b9d4ebc8b
am: 959ef64b41

Change-Id: I84d9a72adaac8baee9e241062c2c974d7dacc61b
2017-02-01 16:21:58 +00:00
Elliott Hughes
9b9d4ebc8b Merge "Remove the global thread list." 2017-02-01 16:16:41 +00:00
Greg Hackmann
7a9c8515d7 Merge "bionic: move ADF uapi header out of bionic" am: b88112dcfc
am: 04951b227c

Change-Id: Idd9987f6cf8c1454064d021d3699eaea73170038
2017-02-01 04:45:27 +00:00
Treehugger Robot
b88112dcfc Merge "bionic: move ADF uapi header out of bionic" 2017-02-01 04:38:15 +00:00
Elliott Hughes
f25a113f53 Merge "s/NULL/nullptr/ in system properties code." am: eb35144e58
am: 5f7024d846

Change-Id: I78324168525b0bd4fb676fa794139abc4806624d
2017-01-31 18:29:28 +00:00
Elliott Hughes
8e7396c9d7 s/NULL/nullptr/ in system properties code.
gerrit still hasn't sent out the mail asking for this in an earlier code
review...

Bug: http://b/33926793
Test: builds and boots.
Change-Id: I080de633e50e47f9a052211d47da96b971b16424
2017-01-31 08:24:43 -08:00
Elliott Hughes
fcd192e64f Merge "clang-format system_properties.cpp." am: 44bea80d31
am: 7048f79b2a

Change-Id: Ic7955005e1b60440338d24eef23f197fb4e19f01
2017-01-31 15:24:54 +00:00
Elliott Hughes
9160ed9bb7 clang-format system_properties.cpp.
Asked for on a previous code review.

Bug: http://b/33926793
Test: builds and boots.
Change-Id: Idf34804896149db5edbddf4ed88396a5df7f708a
2017-01-30 17:54:57 -08:00
Elliott Hughes
2420f394bb Merge "glibc ipc64_perm __key compatibility." am: 5dc75c6c4d
am: d0e08b37b1

Change-Id: I4f0bb0d2e335664024f94b43955b588a3fd4230e
2017-01-30 23:05:54 +00:00
Treehugger Robot
5dc75c6c4d Merge "glibc ipc64_perm __key compatibility." 2017-01-30 23:01:01 +00:00
Sandeep Patil
336caa97c6 property_contexts: split into platform and non-platform components am: 34f0cfa3a8
am: dbac5f634c

Change-Id: I493473a003a55b439b2350aec16489841c3dba6c
2017-01-30 19:25:03 +00:00
Sandeep Patil
dbac5f634c property_contexts: split into platform and non-platform components
am: 34f0cfa3a8

Change-Id: Ia1bcc896d3901217323a3d1299aada8223eceff5
2017-01-30 19:21:22 +00:00
Sandeep Patil
93e272d00a Merge "property_contexts: split into platform and non-platform components" 2017-01-30 19:16:17 +00:00
Elliott Hughes
7827cf6cf2 Merge "Remove backwards compatibility for old system properties." am: 0c6f806b1d
am: 0f265255a6

Change-Id: Ia66376e579c4eaa92e177394fb5d442abb465e7f
2017-01-28 16:51:00 +00:00
Elliott Hughes
a29821bb45 glibc ipc64_perm __key compatibility.
glibc gives the `struct ipc64_perm` fields `key` and `seq` double-underscore
names. strace refers to the fields by those names, and there's no obvious
reason not to go along with this.

Bug: N/A
Test: built strace 4.15 with a hacked NDK
Change-Id: I8b2b0f75363349d99edaecda50fe897ee0fa0c65
2017-01-27 19:12:32 -08:00
Elliott Hughes
f8562c5f8f Remove backwards compatibility for old system properties.
No-one is directly upgrading from pre-K to O...

Also move more implementation details out of the header file.

Bug: http://b/33926793
Test: boots
Change-Id: I7a0936acbb1cea8a3b2cd6797ec53ba7e4a050f3
2017-01-27 16:19:59 -08:00
Christopher Ferris
fcbe1b780f Merge "Update to kernel headers v4.9.6." am: 6a9e0c8f15
am: 553293dd96

Change-Id: Id0c472fe933d57418539f5ac091bf2d9e88cc0cd
2017-01-27 21:17:10 +00:00
Sandeep Patil
34f0cfa3a8 property_contexts: split into platform and non-platform components
Bug: 33746484
Bug: 34370523
Test: Successfully boot with original service and property contexts.
Test: Successfully boot with split serivce and property contexts.
Test: Incremental build works on sailfish (reported in b/34370523)
Test: adb sideload works with aosp updater (reported in b/34370523)

Change-Id: Idf24856193032a8bc89ec384a72451e578a9d5ac
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-01-27 13:12:32 -08:00
Greg Hackmann
7518109063 bionic: move ADF uapi header out of bionic
ADF isn't a candidate for upstreaming and isn't (directly) usable from
unprivileged NDK code, so it makes more sense to keep video/adf.h as a
private header inside libadf, where it'll still be usable by HWC
implementations without shipping in the NDK.

libadf exports its entire include/ directory, so this shouldn't have any
impact on HWC implementations that already link against libadf.

Test: mmm system/core/adf/libadf
Test: /data/nativetest64/adf-unit-tests/adf-unit-tests (on Nexus 9)
Change-Id: I6573f539cfd7fc65433237d0b115b8b7b2728133
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2017-01-27 13:01:51 -08:00
Christopher Ferris
351a796d2d Update to kernel headers v4.9.6.
Test: Built arm/arm64/x86/x86_64 targets.
Change-Id: Id4d2711aaa96fe537f3726a0a89f2959e9cca34a
2017-01-27 10:49:48 -08:00
Christopher Ferris
edcde622eb Merge "Update to kernel headers v4.9.3." am: 00e388df4e
am: 16875896ac

Change-Id: I154ea1d11d0235270bd4dec2f6eebe0307fdff40
2017-01-27 17:56:59 +00:00
Christopher Ferris
00e388df4e Merge "Update to kernel headers v4.9.3." 2017-01-27 17:50:46 +00:00
Dimitry Ivanov
5e1dc58db9 Merge "Remove dependency on libc.a from the linker" am: 2ca556bb6e
am: 6fcea73028

Change-Id: I09fc09bfb149fd7b169bbc5cab1276b1aa7c8b76
2017-01-27 03:12:51 +00:00
Dimitry Ivanov
451909da31 Remove dependency on libc.a from the linker
Provide stub for unused but needed symbol __find_icu_symbol
which is not included to libc_nomalloc.a.

Test: mm and boot
Change-Id: I57ca09c990556d1d401e2f4a75bc49b61b4cd85d
2017-01-26 17:08:01 -08:00
Max Spector
4624ed5039 Merge "Adding kuser_helper on note to all arm32 binaries." am: 577a944200
am: 36c6ce26a2

Change-Id: I6af912a1f7e52574be15e64ec099459592dd1beb
2017-01-26 18:50:48 +00:00
Max Spector
577a944200 Merge "Adding kuser_helper on note to all arm32 binaries." 2017-01-26 18:43:40 +00:00
Stephen Hines
fbb7c0e765 Merge "Don't mark __res_params or android_net_context as packed." am: 0c45c7dc5e
am: 6776efa346

Change-Id: I6b83f36d0e344c9174f7fcdd210ceecbafdd3027
2017-01-26 07:24:57 +00:00
Treehugger Robot
0c45c7dc5e Merge "Don't mark __res_params or android_net_context as packed." 2017-01-26 07:13:21 +00:00
mspector
2e3d6a1d67 Adding kuser_helper on note to all arm32 binaries.
A kernel change is going in for 64bit arm to disable kuser_helper vector
pages for 32bit processes.  This change adds a special elf note to
all arm32 binaries built with bionic.  This note tells the kernel to
load the kuser_helper vector page for the process.

Bug: 33689037
Test: Manual - Phone boots, 32bit binaries have the notes, 64bit
binaries do not.
Change-Id: Ib8366e2a0810092b71381d57dee4bdaa56369a24
2017-01-25 17:33:05 -08:00
Christopher Ferris
6a9755d20a Update to kernel headers v4.9.3.
Test: Built arm, arm64, x86, x86_64 targets.
Test: Booted on angler, and ran bionic unit tests (32 bit and 64 bit).

Change-Id: I14a8dcbea11b41f83431eabed6590cd25af07b1d
2017-01-25 16:23:56 -08:00
Paul Lawrence
fe55c3ac41 Merge "Use trap not kill in seccomp filter" am: 6418f95ca2
am: b5a151a12d

Change-Id: Icae95f9dfd6f7b4ab7e5422ee8e1b103e9c62b61
2017-01-25 22:52:56 +00:00
Paul Lawrence
6418f95ca2 Merge "Use trap not kill in seccomp filter" 2017-01-25 22:46:06 +00:00
Stephen Hines
9935e0fcee Don't mark __res_params or android_net_context as packed.
Bug: http://b/31532493

These internal API structures are never actually used anywhere that
would change behavior because it is "packed", so it is safe to remove.

Test: Builds correctly with the latest toolchain.
Change-Id: I5431992d840777605be75ab91dc21158d6d22c26
2017-01-25 00:42:45 -08:00
Dimitry Ivanov
8dba8acd6e Do not send 0 byte string content. am: cafd355375
am: 6fd88344a5

Change-Id: If8fd7fac36d145cf6f611cc562ab5b5b345e33d9
2017-01-25 03:58:50 +00:00
Dimitry Ivanov
c809b7a43f Revert "Revert "Remove limit of system property name length"" am: 16b2a4de14
am: d91e7766ec

Change-Id: I19be17e5aec71182a9b83e3720e3fc3dd0cf5d0e
2017-01-25 03:58:46 +00:00
Dimitry Ivanov
cafd355375 Do not send 0 byte string content.
Trying to send even 0 bytes to closed socket leads to
broken pipe error. Sometimes property service is just
quick enough and closes the socket between send(valuelen)
and send(value) in the case where valuelen is 0.

Bug: http://b/34670529
Test: adb reboot 20 times and make sure phone service did not fail
Test: run bionic-unit-tests --gtest_filter=prop*
Change-Id: I96f90ca6fe1790614e7efd3015bffed1ef1e9040
2017-01-24 14:19:03 -08:00
Dimitry Ivanov
16b2a4de14 Revert "Revert "Remove limit of system property name length""
This reverts commit 489f58b5ea.
Bug: http://b/33926793
Bug: http://b/34670529
Test: Run bionic-unit-tests --gtest_filter=prop*

Change-Id: Id4e94652dc2310a21f5b7bd3af098bf79df3f380
2017-01-24 12:58:18 -08:00
Dimitry Ivanov
205bb70df8 Merge "Revert "Remove limit of system property name length"" am: 40250bb683
am: e3a684f858

Change-Id: Idbd449ff4c4990695a09badc53faab34470f3737
2017-01-24 20:07:38 +00:00
Dimitry Ivanov
40250bb683 Merge "Revert "Remove limit of system property name length"" 2017-01-24 20:00:44 +00:00
Paul Lawrence
3d9fc696a5 Use trap not kill in seccomp filter
Bug: 34647665
Test: Make sure boots, check that causing a seccomp failure creates a
      crash dump

Change-Id: I5ab2fe3e8322a3c38318c97d343834baa874af8d
2017-01-24 11:07:04 -08:00
Dimitry Ivanov
489f58b5ea Revert "Remove limit of system property name length"
This reverts commit 5c1ce278f3.
Bug: http://b/33926793
Bug: http://b/34670529

Change-Id: I0dc4a8ae55576c69b34b2958d8e664f7066b9c54
2017-01-24 18:39:04 +00:00
Vijay Venkatraman
ae161415fe Merge "Removed include log\logger.h from log_fake.cpp" am: f0b42ae973
am: 6529a136e7

Change-Id: I83bef9a2dca60c16ae8e850db01f4431099ab985
2017-01-24 17:42:50 +00:00
Vijay Venkatraman
f0b42ae973 Merge "Removed include log\logger.h from log_fake.cpp" 2017-01-24 17:36:09 +00:00
Dimitry Ivanov
eda500fdf9 Merge "Remove limit of system property name length" am: 440d6c7644
am: 87190c845e

Change-Id: I3ba27bdf237f750195ce4829bd5c6181f174000c
2017-01-24 02:58:21 +00:00
Vijay Venkatraman
191d2f3c99 Removed include log\logger.h from log_fake.cpp
Test: Compile malloc_debug_unit_tests
Change-Id: I635687016570ba52c571435b87d8e89f7f04d609
2017-01-23 18:56:53 -08:00
Dimitry Ivanov
5c1ce278f3 Remove limit of system property name length
This change introduces new __system_property_read_callback
method to use in place of deprecated __system_property_read
__system_property_set() and get() should just work but now
do not have limit on system property names.

Bug: http://b/33926793
Test: boot device, run adb shell propget
Test: boot device with old version of init (protocol v1)
Test: run bionic-unit-tests --gtest_filter=prop*
Change-Id: I619fb5a7e27a272aac30011579665f6160888bc7
2017-01-23 11:21:18 -08:00
Jaekyun Seok
d18aed7e8e Merge "Add props files for each partition" am: 7844b4c5db
am: 291192fb15

Change-Id: I6dd5a0cc06c8e5f7c5d8cb1177e24aba114bd8f2
2017-01-20 04:05:47 +00:00
Treehugger Robot
7844b4c5db Merge "Add props files for each partition" 2017-01-20 03:58:52 +00:00
Jaekyun Seok
dc94cf5cd8 Add props files for each partition
The following files will be added.
- /vendor/default.prop for default prop overrides from vendor
 partition.
- /odm/default.prop for default prop overrides from odm partition.
- /odm/build.prop for build prop overrides from odm partition.

Test: tested default/build prop files with enabling early mount, but
didn't test files of odm partition because odm partition doesn't
exist now.
Bug: 34116668
Change-Id: Ia99895a0afcdc522463d95b2f3e2841dcf2e3516
2017-01-20 09:59:26 +09:00
Paul Lawrence
b46ed1098d Merge "Add seccomp support library" am: ad3b3995e7
am: 9ef18d5752

Change-Id: I07efd9bf2dc2e9c040a51265d5be6d6e8ad5c779
2017-01-19 23:32:59 +00:00
Treehugger Robot
ad3b3995e7 Merge "Add seccomp support library" 2017-01-19 23:26:10 +00:00
Paul Lawrence
eabc352651 Add seccomp support library
Policy library which exports an autogenerated policy from SYSCALLS.TXT
blocking any other calls.

Test: Generate policy, install onto Sailfish, check boots, Chrome runs,
calls are blocked.
Bug: 32313202

Change-Id: Ib590704e50122f077eeae26561eb9b0a70386551
2017-01-19 13:38:47 -08:00
Evgenii Stepanov
992d012f80 Merge "Runtime support for CFI" am: 082bec5b41
am: adcec1585b

Change-Id: I4eafd03da458f1672991fe14dfa71667ae2bc686
2017-01-18 23:54:34 +00:00
Josh Gao
2562ae8215 Reserve a realtime signal for debuggerd. am: f8a6d4745d
am: 3d8c6aa3a1

Change-Id: I24d59d8b77a8df6658637ae44afc2af5bc109f5c
2017-01-18 23:42:24 +00:00
Evgenii Stepanov
082bec5b41 Merge "Runtime support for CFI" 2017-01-18 23:39:08 +00:00
Josh Gao
3d8c6aa3a1 Reserve a realtime signal for debuggerd.
am: f8a6d4745d

Change-Id: If7eced969434e50beec04625c905ef374cdcdfb1
2017-01-18 23:16:39 +00:00
Josh Gao
2d261e8e9e Merge changes from topic 'kill_debuggerd'
* changes:
  Rename libdebuggerd_client to libdebuggerd_handler.
  Reserve a realtime signal for debuggerd.
2017-01-18 23:04:09 +00:00
Evgenii Stepanov
0a3637d3eb Runtime support for CFI
Control Flow Integrity support in bionic.

General design:
http://clang.llvm.org/docs/ControlFlowIntegrityDesign.html#shared-library-support

This CL implements subsections "CFI Shadow" and "CFI_SlowPath" in the above document.

Bug: 22033465
Test: bionic device tests
Change-Id: I14dfea630de468eb5620e7f55f92b1397ba06217
2017-01-18 13:13:52 -08:00
Colin Cross
19b40c7e14 Merge "Declare dependency on android_filesystem_config.h" am: 2f238b32cd
am: 5b91973fb7

Change-Id: I4ede35c4deab0b6cbe59a958633ac89b4cee0204
2017-01-18 17:06:18 +00:00
Jorim Jaggi
abea8788e8 Revert "property_contexts: split into platform and non-platform components" am: e2f5ea14c5
am: 860a1db8fd

Change-Id: I98f7277d7f8e4f3eb6474ec62f82a80fbf63f1b4
2017-01-18 16:47:36 +00:00
Jorim Jaggi
860a1db8fd Revert "property_contexts: split into platform and non-platform components"
am: e2f5ea14c5

Change-Id: I9a794b93b077791ce46016cb9f8965a52c98b88e
2017-01-18 16:41:36 +00:00
Jorim Jaggi
e2f5ea14c5 Revert "property_contexts: split into platform and non-platform components"
This reverts commit 8213615461.

Change-Id: Id2982eafadc5d1c307b60c1f8abe78df8dc8b82e
2017-01-18 15:37:18 +00:00
Sandeep Patil
84ac3e4354 property_contexts: split into platform and non-platform components am: 8213615461
am: 045ba4b249

Change-Id: Ie92f9de186e3ff723e67ee17f4d6224569dee65f
2017-01-18 06:16:51 +00:00
Sandeep Patil
045ba4b249 property_contexts: split into platform and non-platform components
am: 8213615461

Change-Id: Ifa1bb1e295cef8ecf74a4a4702114a88f3e6859e
2017-01-18 06:12:19 +00:00
Colin Cross
35bbed8020 Declare dependency on android_filesystem_config.h
android_filesystem_config.h comes from a directory outside bionic/libc
so it can't be referenced directly, add it as a source file through
a filegroup module.

Bug: 34283327
Test: builds
Test: libc rebuilds after touch system/core/include/private/android_filesystem_config.h
Change-Id: I90f6b7b25b70842b8619d558074449f13e6e6b03
2017-01-17 18:31:33 -08:00
Josh Gao
f8a6d4745d Reserve a realtime signal for debuggerd.
Allocate __SIGRTMIN + 3 for triggering native stack dumps (like SIGQUIT
for Java processes).

Bug: http://b/30705528
Test: debuggerd_test
Change-Id: I81d622fba32a651555268a8a2ba6721c61c93a58
2017-01-17 13:55:18 -08:00
Elliott Hughes
c9e91d1a98 Merge "localtime_r(3) should act as if it calls tzset(3)." am: 1b2975d54b
am: e767a92c57

Change-Id: I16eed5cb28e1df287f748d0028f8198f2861b428
2017-01-12 23:28:04 +00:00
Elliott Hughes
1b2975d54b Merge "localtime_r(3) should act as if it calls tzset(3)." 2017-01-12 23:19:50 +00:00
Elliott Hughes
ea87716696 localtime_r(3) should act as if it calls tzset(3).
See code comment.

Bug: http://b/31339449
Test: ran tests & benchmarks
Change-Id: I6b6a63750ef41664dc4698207e6a53e77cc28cdf
2017-01-11 14:56:04 -08:00
Dimitry Ivanov
e24dc59591 Merge "Hide __system_property_add/update, deprecate find_nth" am: 907fcc98b2
am: ee062c3577

Change-Id: Ife3992252e7d979772126ee806fdd3f2957508a1
2017-01-11 02:08:21 +00:00
Treehugger Robot
907fcc98b2 Merge "Hide __system_property_add/update, deprecate find_nth" 2017-01-11 01:57:56 +00:00
Dimitry Ivanov
581b9f661b Hide __system_property_add/update, deprecate find_nth
These functions are supposed to be used only by the
property service.

__system_property_find_nth is deprecated and no longer part
of NDK. Call to this function will result in abort for apps
targeting Android O.

Bug: http://b/34114501
Test: bionic-unit-tests --gtest_filter=prop*
Change-Id: I9846965bf248e2ddf45cd7b293618245bbd87145
2017-01-10 13:41:27 -08:00
Christopher Ferris
08dacf8d7e Merge "Fix streaming(memcpy) performance on Cortex-A7" am: 0625beb270
am: 7373d2ed3d

Change-Id: I9c1bdbab92815d05cb5bfd01bc930cb9a1523a5f
2017-01-10 18:52:51 +00:00
Christopher Ferris
0625beb270 Merge "Fix streaming(memcpy) performance on Cortex-A7" 2017-01-10 18:41:15 +00:00
Elliott Hughes
80a477c4ea Revert "Revert "move android_ids into bionic"" am: 3f6eee9793
am: 45be5dfe98

Change-Id: I56b1f2a8c10310d4ac54b0cb8a18951be6ef8bba
2017-01-10 01:27:57 +00:00
Elliott Hughes
45be5dfe98 Revert "Revert "move android_ids into bionic""
am: 3f6eee9793

Change-Id: I6a65710f926a76e48705fa4594f479f5d48df068
2017-01-10 01:23:26 +00:00
Elliott Hughes
940d460f59 Merge "Revert "Revert "move android_ids into bionic""" 2017-01-10 01:15:30 +00:00
Sandeep Patil
8213615461 property_contexts: split into platform and non-platform components
Bug: 33746484
Test: Successfully boot with original service and property contexts.
Test: Successfully boot with split serivce and property contexts.

Change-Id: Id1acb8c4273c6f93396e8cf7a063571a2bf08786
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-01-09 16:34:14 -08:00
Elliott Hughes
7b1b019a71 Merge "Move to .md files for even trivial documentation." am: 39b6d59049
am: f561edeade

Change-Id: If984fd9b2ea3d66b871b484314e79a6994ca5d6a
2017-01-09 21:35:39 +00:00
Elliott Hughes
39b6d59049 Merge "Move to .md files for even trivial documentation." 2017-01-09 21:23:01 +00:00
Elliott Hughes
b0e8c565a6 Remove the global thread list.
Another release, another attempt to fix this bug.

This change affects pthread_detach, pthread_getcpuclockid,
pthread_getschedparam/pthread_setschedparam, pthread_join, and pthread_kill:
instead of returning ESRCH when passed an invalid pthread_t, they'll now SEGV.

Note that this doesn't change behavior as much as you might think: the old
lookup only held the global thread list lock for the duration of the lookup,
so there was still a race between that and the dereference in the caller,
given that callers actually need the tid to pass to some syscall or other,
and sometimes update fields in the pthread_internal_t struct too.

We can't check thread->tid against 0 to see whether a pthread_t is still
valid because a dead thread gets its thread struct unmapped along with its
stack, so the dereference isn't safe.

Taking the affected functions one by one:

* pthread_getcpuclockid and pthread_getschedparam/pthread_setschedparam
  should be fine. Unsafe calls to those seem highly unlikely.

* Unsafe pthread_detach callers probably want to switch to
  pthread_attr_setdetachstate instead, or using pthread_detach(pthread_self())
  from the new thread's start routine rather than doing the detach in the
  parent.

* pthread_join calls should be safe anyway, because a joinable thread won't
  actually exit and unmap until it's joined. If you're joining an
  unjoinable thread, the fix is to stop marking it detached. If you're
  joining an already-joined thread, you need to rethink your design.

* Unsafe pthread_kill calls aren't portably fixable. (And are obviously
  inherently non-portable as-is.) The best alternative on Android is to
  use pthread_gettid_np at some point that you know the thread to be alive,
  and then call kill/tgkill directly. That's still not completely safe
  because if you're too late, the tid may have been reused, but then your
  code is inherently unsafe anyway.

If we find too much code is still broken, we can come back and disable
the global thread list lookups for anything targeting >= O and then have
another go at really removing this in P...

Bug: http://b/19636317
Test: N6P boots, bionic tests pass
Change-Id: Ia92641212f509344b99ee2a9bfab5383147fcba6
2017-01-07 14:16:46 -08:00
Elliott Hughes
da7a0b105d Move to .md files for even trivial documentation.
So it's automatically displayed for folks browsing the source.

Bug: N/A
Test: N/A
Change-Id: I80e823415f1fb12ad8ce5348e926519b6e29580f
2017-01-07 12:47:28 -08:00
Nick Kralevich
0354990de8 Merge "Make /dev/__properties__ 0711" am: 11798bcc35
am: 7d7e4a6955

Change-Id: I417801d251da1d8740cc70a0f9142de7ca98a829
2017-01-06 22:03:21 +00:00
Nick Kralevich
bb59d47249 Make /dev/__properties__ 0711
Don't allow processes to read the contents of the directory
/dev/__properties__. This is an implementation detail of the properties
system that processes shouldn't be concerned with.

Test: Device boots and no problems reading individual properties.
Test: ls -la /dev/__properties__ fails
Change-Id: I00130fe4529525935654bff91e3cc59253b86e26
2017-01-06 12:07:20 -08:00
Josh Gao
07739bb921 Merge "Add declaration of tgkill to signal.h." am: d26267b8b9
am: f3847eb2d7

Change-Id: I334c6731594b92788fb6045107b34bc4a7182b68
2017-01-06 00:54:13 +00:00
Josh Gao
d3cfd26872 Add declaration of tgkill to signal.h.
Expose a useful function that we've had since Jelly Bean.

Bug: http://b/34111810
Test: TreeHugger
Change-Id: Iaf3097f224c09b533f36050cf21394ba148007ad
2017-01-05 15:15:12 -08:00
Chitti Babu Theegala
cbfdc7f905 Fix streaming(memcpy) performance on Cortex-A7
Stream-mode detection for L1 in A7-core is failing for
non cache-line-size (non 64 byte) aligned addresses.
This leads to destination data getting cached unnecessarily.
This A7 issue is confirmed by ARM

This issue is solved by aligning destination address to 64 byte before
entering the loop in memcpy routine.
Though we get lower score for micro_bench memcpy when L1 cache is bypassed,
it is desirable since it avoids unnecessary eviction of other process data
from L1 which is good for overall system performance.

Higher micro_bench memcpy numbers for < 64byte alignment shows good numbers
but this is at the cost of L1 cache pollution. During memcpy/memset,
unnecessary data is filled in L1 cache, this causes eviction of other
process data from L1.
For example during msmset(0), L1 cache gets filled with 0s which should be
avoided.

Additionally, there is another issue with cortex A7 that impacts performance
for all alignments / all Android Wear versions:
Store Buffer on A7 is 32 byte which limits the 32-byte back to back stores.
In the current implementation back to back 32bytes writes is causing CPU stalls.
This issue can be solved by interleaved Loads and Stores.
This helps in avoiding CPU stalls during memcpy by utilizing efficiently the
A7 internal load and store buffers.

Change-Id: Ie5f12f2bb5d86f627686730416279057e4f5f6d0
2016-12-19 15:11:43 -08:00
Jeff Sharkey
3ef6bb6ff1 Merge "Define range of GIDs for cached app data." am: 54891837a0
am: ce7c613609

Change-Id: I564b6d18344325ff1e801590790d3813de269ad4
2016-12-15 23:14:36 +00:00
Jeff Sharkey
54891837a0 Merge "Define range of GIDs for cached app data." 2016-12-15 21:46:30 +00:00
Elliott Hughes
e0bbb4882c Merge "Make the __stack_chk_fail message more searchable on the internets." am: a1d32f95c3
am: 153ebb4557

Change-Id: Ic74ce9166627c15df7792db5c3468844b2c2148f
2016-12-15 06:31:02 +00:00
Treehugger Robot
a1d32f95c3 Merge "Make the __stack_chk_fail message more searchable on the internets." 2016-12-15 06:15:41 +00:00
Elliott Hughes
0ff61f6d19 Make the __stack_chk_fail message more searchable on the internets.
Noticed while writing documentation:

  https://source.android.com/devices/tech/debug/

Bug: http://b/28746168
Test: crasher
Change-Id: Ied1c1b1c75a85a899f07e6927134b9bf91316fe4
2016-12-14 17:30:07 -08:00
Elliott Hughes
1c07ca873a Merge "Fix an obsolete comment." am: 1adb683447
am: 58646b53b7

Change-Id: Ia7254ff57a4f318bb0bed542ed09ba661e153f45
2016-12-14 22:07:30 +00:00
Elliott Hughes
bc94bb362d Fix an obsolete comment.
280236537e factored the pthread types out
so that they could be in both <sys/types.h> and <pthread.h>.

Bug: N/A
Test: builds
Change-Id: Ie649c938ec8be1c59a0e4ef777f425550f8d4539
2016-12-14 12:43:30 -08:00
Elliott Hughes
17217b8eec Merge "Update socket constants." am: cb0134d96e
am: 72f259ac6f

Change-Id: Ie45ea13d264f876939f95ac76a2bdba1b2331e53
2016-12-14 16:44:39 +00:00
Elliott Hughes
cb0134d96e Merge "Update socket constants." 2016-12-14 16:28:24 +00:00
Christopher Ferris
5fbb15f71c Merge "Update to kernel headers v4.8.14." am: f27e97956d
am: 3ec2701f0c

Change-Id: I91e4e095bae01675698e5514c00e19896055c51d
2016-12-13 23:53:47 +00:00
Elliott Hughes
3f6eee9793 Revert "Revert "move android_ids into bionic""
This reverts commit 77cb68d9f2.

Change-Id: Ibc9f775c4cd418be90fd8a6f192dd72ca5dff09a
2016-12-13 23:47:25 +00:00
Christopher Ferris
f27e97956d Merge "Update to kernel headers v4.8.14." 2016-12-13 23:40:01 +00:00
Elliott Hughes
8d76871438 Update socket constants.
This corresponds to Linux 4.10.

Bug: N/A
Test: builds
Change-Id: Ia7135c9fec181613b79726d1b16867133cdefd04
2016-12-13 15:29:58 -08:00
Christopher Ferris
19dfe0b4ba Merge "libc: ARM64: update memset/strlen/memcpy/memmove to newlib/cortex-strings" am: 8b3e812684
am: 24dae7f57c

Change-Id: I556841ceac287f0a02746f23e6a30c436d0143b9
2016-12-13 23:27:41 +00:00
Christopher Ferris
8b3e812684 Merge "libc: ARM64: update memset/strlen/memcpy/memmove to newlib/cortex-strings" 2016-12-13 23:11:27 +00:00
Elliott Hughes
211a4e9496 Merge "Remove BSD cruft from <pwd.h>." am: 9438a648eb
am: 6890799937

Change-Id: Icf01428e52890b3e08694c600242ef4be9097742
2016-12-13 23:07:51 +00:00
Elliott Hughes
9438a648eb Merge "Remove BSD cruft from <pwd.h>." 2016-12-13 22:55:06 +00:00
Jeff Sharkey
934bc86df3 Define range of GIDs for cached app data.
To support upcoming disk usage calculation optimizations, this change
creates a new GID for each app that will be used to mark its cached
data.  We're allocating these unique GIDs so that we can use
quotactl() to track cached data on a per-app basis.

Test: builds, boots, tests pass
Bug: 27948817
Change-Id: Ic00c39ccedc23d5d43988029e9921679126f8f2d
2016-12-13 14:22:55 -07:00
Christopher Ferris
49f525c47b Update to kernel headers v4.8.14.
Test: Built mips/arm/arm64/x86/x86_64. Built and booted angler.
Change-Id: Icedb035769d8a41a170a6f1ecd707113e332d8dd
2016-12-12 19:08:01 -08:00
Elliott Hughes
21b70e667d Remove BSD cruft from <pwd.h>.
Other C libraries don't have this, and it doesn't make sense on Android
anyway.

Bug: N/A
Test: builds
Change-Id: Iebc490698d620b5baec5f9a7ad5e1a0a1323d16c
2016-12-12 17:31:02 -08:00
Elliott Hughes
2e2a6f5323 Revert "move android_ids into bionic" am: 77cb68d9f2
am: 75b51ac14e

Change-Id: Iab214bff9b94f6f3f0a3ebc217794d85b5af5164
2016-12-13 00:52:23 +00:00
Elliott Hughes
75b51ac14e Revert "move android_ids into bionic"
am: 77cb68d9f2

Change-Id: I45d8098e38dd35fdf9b3d270ac4f26c3a7284971
2016-12-13 00:42:35 +00:00
Treehugger Robot
50ae6dde5b Merge "Revert "move android_ids into bionic"" 2016-12-13 00:31:25 +00:00
Elliott Hughes
77cb68d9f2 Revert "move android_ids into bionic"
This reverts commit 1a13db5b26.

Change-Id: I7f571b3a9d542694d16fb9cf1131ef9e59d330ea
2016-12-12 22:11:37 +00:00
William Roberts
00c5608a69 move android_ids into bionic am: 1a13db5b26
am: f3def87a05

Change-Id: I245c800f5581b193cdfcfa4d88305d9b1b56edd6
2016-12-10 00:25:33 +00:00
William Roberts
f3def87a05 move android_ids into bionic
am: 1a13db5b26

Change-Id: I12ac9a338503687fba3c43dcdd8a6c1a74cc99fe
2016-12-10 00:20:28 +00:00
Elliott Hughes
ded6c91acc Merge "move android_ids into bionic" 2016-12-10 00:13:05 +00:00
Elliott Hughes
940b4c521e Merge "Fix icu4c calling on x86." am: 227894a754
am: 5fb3a092d6

Change-Id: I1480a635c68ddd6abde7df5624a08010da49e6d6
2016-12-09 02:20:38 +00:00
Elliott Hughes
722d01a991 Fix icu4c calling on x86.
Some of the function pointer types were wrong, and x86 cares if you
say `int` when you meant `int8_t` (because it feels at liberty to
leave the top bits dirty and ignore them, both sides need to agree
which they're dealing with).

Also slightly improve the wcstoimax and wcstoumax tests, since my
investigation started there.

Bug: http://b/33451822
Test: tests pass on x86, arm, and arm64
Change-Id: I553193962f0cb993666f9f8e415990bba5b669e1
2016-12-08 15:16:37 -08:00
Elliott Hughes
8b114bde2d Check for bad packets in getaddrinfo.c's getanswer. am: 87c0dba7b1 am: dc0492ac4f am: f277bb86c6 am: 389e3e92e2 am: 0ffd7a5fb1 am: 0bf10a656b am: 2646bfc213
am: 9eea4e2864

Change-Id: I410415128a6b6f2d1c818d7b639d4cc45dc3ecd0
2016-12-08 21:27:19 +00:00
Elliott Hughes
9eea4e2864 Check for bad packets in getaddrinfo.c's getanswer. am: 87c0dba7b1 am: dc0492ac4f am: f277bb86c6 am: 389e3e92e2 am: 0ffd7a5fb1 am: 0bf10a656b
am: 2646bfc213

Change-Id: I539d424a1176d294e1c1201367f4fe786b345726
2016-12-08 21:22:17 +00:00
Elliott Hughes
2646bfc213 Check for bad packets in getaddrinfo.c's getanswer. am: 87c0dba7b1 am: dc0492ac4f am: f277bb86c6 am: 389e3e92e2 am: 0ffd7a5fb1
am: 0bf10a656b

Change-Id: I22e9e28194f3599e0792ec9d7d1145cb954b3287
2016-12-08 21:17:17 +00:00
Elliott Hughes
0bf10a656b Check for bad packets in getaddrinfo.c's getanswer. am: 87c0dba7b1 am: dc0492ac4f am: f277bb86c6 am: 389e3e92e2
am: 0ffd7a5fb1

Change-Id: I286e1860addc1ae571273d2b4a4e1359e990b6aa
2016-12-08 21:12:16 +00:00
Elliott Hughes
0ffd7a5fb1 Check for bad packets in getaddrinfo.c's getanswer. am: 87c0dba7b1 am: dc0492ac4f am: f277bb86c6
am: 389e3e92e2

Change-Id: Ie935c8491aa18867a5087ca4cf707eec318b85f6
2016-12-08 21:07:17 +00:00
Elliott Hughes
dc0492ac4f Check for bad packets in getaddrinfo.c's getanswer.
am: 87c0dba7b1

Change-Id: I3a09f86362797881b4e7cc0ee807d28addf7b342
2016-12-08 20:52:15 +00:00
Dimitry Ivanov
fc0d48078a loader: stop linking libdl/c/m into the loader
This is to prevent situations when libgcc.a calls into incorrect
implementation of dl_iterate_phdr.

Bug: http://b/27106625
Test: build && run bionic-unit-tests --getst_filter=dl*:Dl*
Change-Id: I4cba8c4a156f91f17ba3d95c39cb80f9b70c9d8f
2016-12-06 11:15:24 -08:00
Erik Kline
40d51f0d28 Remove all system properties references
Test: as follows
    - build
    - flash
    - runtest -x system/netd/tests/netd_integration_test.cpp
Bug: 33308258
Change-Id: I59526cb91e91b35a63ba6b413d444712568463e4
2016-12-05 12:45:10 +09:00
Treehugger Robot
f8b4ff4aa1 Merge "Remove obsolete #include and comment." 2016-12-05 00:01:34 +00:00
Elliott Hughes
6eb8fb5f86 Remove obsolete #include and comment.
Bug: http://b/33308258
Test: builds
Change-Id: Id6bbdae536a12134899fa57ea799f488d018db00
2016-12-02 17:51:56 -08:00
Treehugger Robot
14998554dd Merge "Don't flush the per-netid cache when adding nameservers." 2016-12-02 23:55:55 +00:00