OSDN Git Service

android-x86/bionic.git
7 years agoCope with argv[0] being null in the dynamic linker.
Elliott Hughes [Thu, 23 Feb 2017 01:31:41 +0000 (17:31 -0800)]
Cope with argv[0] being null in the dynamic linker.

Somewhat unsurprisingly, very few commands are happy to be run like this,
in particular multiplexed commands like toybox. But that's no reason for
the linker to get in the way too.

Bug: http://b/33276926
Test: new test
Change-Id: I6dd71ea0183f4da83571039c2198ebb6ed38520e

7 years agoMerge "Add timeout support to __system_property_wait."
Treehugger Robot [Wed, 22 Feb 2017 01:43:30 +0000 (01:43 +0000)]
Merge "Add timeout support to __system_property_wait."

7 years agoMerge "Downgrade the special case of pthread_t(0) to a warning."
Treehugger Robot [Wed, 22 Feb 2017 00:37:08 +0000 (00:37 +0000)]
Merge "Downgrade the special case of pthread_t(0) to a warning."

7 years agoAdd timeout support to __system_property_wait.
Elliott Hughes [Fri, 17 Feb 2017 01:13:04 +0000 (17:13 -0800)]
Add timeout support to __system_property_wait.

Bug: http://b/35201172
Test: ran tests
Change-Id: I3a78813bf3cd50d1b308ecb3c742f923606c0cc4

7 years agoDowngrade the special case of pthread_t(0) to a warning.
Elliott Hughes [Tue, 21 Feb 2017 21:15:20 +0000 (13:15 -0800)]
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

7 years agoMerge "Fix a comment in the pthread_cond_t implementation."
Treehugger Robot [Sun, 19 Feb 2017 05:19:54 +0000 (05:19 +0000)]
Merge "Fix a comment in the pthread_cond_t implementation."

7 years agoFix a comment in the pthread_cond_t implementation.
Elliott Hughes [Sun, 19 Feb 2017 00:35:36 +0000 (16:35 -0800)]
Fix a comment in the pthread_cond_t implementation.

Bug: http://b/34592766
Test: N/A
Change-Id: I341f837dca52865ae5f8fe9ff50ba8999e297179

7 years agoMerge "Fix debug.ld for apps with long names and services"
Treehugger Robot [Sat, 18 Feb 2017 00:50:47 +0000 (00:50 +0000)]
Merge "Fix debug.ld for apps with long names and services"

7 years agoMerge "Revert "Revert "Make libc.so global"""
Treehugger Robot [Sat, 18 Feb 2017 00:18:26 +0000 (00:18 +0000)]
Merge "Revert "Revert "Make libc.so global"""

7 years agoFix debug.ld for apps with long names and services
Dimitry Ivanov [Fri, 17 Feb 2017 22:41:30 +0000 (14:41 -0800)]
Fix debug.ld for apps with long names and services

1. There is no longer limit on property names - remove
   the trimming the name of the property.
2. Make debug.ld work for processes with names ending with ":something"
   This is naming convention for services:
   https://developer.android.com/guide/components/services.html

Bug: http://b/35338922
Bug: http://b/33926793
Test: manual - set ld.debug.app property for the app
Test: from http://b/35338922 and see that it works
Test: for the service as well.
Change-Id: Ic7c6d4edce4a5a22f144496d5c0a3e458217c6e4

7 years agoRevert "Revert "Make libc.so global""
Dimitry Ivanov [Thu, 16 Feb 2017 20:03:21 +0000 (12:03 -0800)]
Revert "Revert "Make libc.so global""

This reverts commit 65236d43e8e8ea2155c0d64e35f00b3c30b21147.

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

7 years agoMerge "Cleanup now that we don't need __NDK_FPABI__."
Treehugger Robot [Fri, 17 Feb 2017 21:11:26 +0000 (21:11 +0000)]
Merge "Cleanup now that we don't need __NDK_FPABI__."

7 years agoMerge "Include the pthread_t in the "bad pthread_t" fatal abort."
Treehugger Robot [Fri, 17 Feb 2017 20:44:43 +0000 (20:44 +0000)]
Merge "Include the pthread_t in the "bad pthread_t" fatal abort."

7 years agoMerge "Add tests for ptrace resumption behavior."
Josh Gao [Fri, 17 Feb 2017 19:35:58 +0000 (19:35 +0000)]
Merge "Add tests for ptrace resumption behavior."

7 years agoCleanup now that we don't need __NDK_FPABI__.
Dan Albert [Fri, 17 Feb 2017 19:08:53 +0000 (11:08 -0800)]
Cleanup now that we don't need __NDK_FPABI__.

Test: tools/update_headers.sh && make checkbuild
Bug: None
Change-Id: I1b9986c4d7d5da349a8ad394e8fcf64b87c89fdf

7 years agoInclude the pthread_t in the "bad pthread_t" fatal abort.
Elliott Hughes [Fri, 17 Feb 2017 18:27:45 +0000 (10:27 -0800)]
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

7 years agoMerge changes from topic 'debuggerd_inproc'
Josh Gao [Thu, 16 Feb 2017 23:11:51 +0000 (23:11 +0000)]
Merge changes from topic 'debuggerd_inproc'

* changes:
  linker: use fallback crash handler dumping.
  linker: add android_use_fallback_allocator.

7 years agoAdd tests for ptrace resumption behavior.
Josh Gao [Thu, 16 Feb 2017 22:12:41 +0000 (14:12 -0800)]
Add tests for ptrace resumption behavior.

Add tests that ensure that the kernel behaves properly w.r.t.
resumption of ptraced processes when the tracer dies.

Bug: http://b/34516140
Test: /data/nativetest/bionic-unit-tests/bionic-unit-tests --gtest_filter="PtraceResumption*"
Change-Id: Id35e069a7e5edd6964637dd3f6358ad59db19792

7 years agoMerge "Add __libc_format_buffer_va_list."
Josh Gao [Thu, 16 Feb 2017 03:42:50 +0000 (03:42 +0000)]
Merge "Add __libc_format_buffer_va_list."

7 years agoMerge "Unify linker files under one license (BSD)"
Treehugger Robot [Thu, 16 Feb 2017 02:15:54 +0000 (02:15 +0000)]
Merge "Unify linker files under one license (BSD)"

7 years agolinker: use fallback crash handler dumping.
Josh Gao [Thu, 9 Feb 2017 01:27:20 +0000 (17:27 -0800)]
linker: use fallback crash handler dumping.

Bug: http://b/34684590
Test: mma
Change-Id: I0801a83768f172308339ab2118e492b5df96acd0

7 years agolinker: add android_use_fallback_allocator.
Josh Gao [Thu, 9 Feb 2017 18:54:44 +0000 (10:54 -0800)]
linker: add android_use_fallback_allocator.

Add a function to enable a fallback allocator to use for crash handling
in a signal handler.

Bug: http://b/34684590
Test: crasher PR_SET_NO_NEW_PRIVS
Change-Id: Ifa5de636164f34b8cb2fdec4471c20f8516b6dbe

7 years agoAdd __libc_format_buffer_va_list.
Josh Gao [Wed, 15 Feb 2017 19:46:55 +0000 (11:46 -0800)]
Add __libc_format_buffer_va_list.

Bug: http://b/35367169
Test: m
Change-Id: I133f231d3b93bdef56d06497679320a89c7188a9

7 years agoUnify linker files under one license (BSD)
Dimitry Ivanov [Wed, 15 Feb 2017 23:31:13 +0000 (15:31 -0800)]
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

7 years agoMerge changes I9d06ea8a,I2d157024
Treehugger Robot [Wed, 15 Feb 2017 19:14:49 +0000 (19:14 +0000)]
Merge changes I9d06ea8a,I2d157024

* changes:
  Fixup API level guards for new fortify functions.
  Guard the GNU strerror_r with an API check.

7 years agoMerge "add fortified implementations of send/sendto"
Treehugger Robot [Wed, 15 Feb 2017 18:26:49 +0000 (18:26 +0000)]
Merge "add fortified implementations of send/sendto"

7 years agoFixup API level guards for new fortify functions.
Dan Albert [Wed, 15 Feb 2017 03:28:18 +0000 (19:28 -0800)]
Fixup API level guards for new fortify functions.

Test: tools/update_headers.sh && make checkbuild
Bug: None
Change-Id: I9d06ea8a5ee9dc27d957f59e6e84150651ed1c76

7 years agoGuard the GNU strerror_r with an API check.
Dan Albert [Wed, 15 Feb 2017 00:33:06 +0000 (16:33 -0800)]
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

7 years agoadd fortified implementations of send/sendto
Daniel Micay [Tue, 14 Feb 2017 01:27:59 +0000 (17:27 -0800)]
add fortified implementations of send/sendto

Bug: None
Test: Bullhead builds+boots; CtsBionicTestCases passes.
Change-Id: I2f137a100f679f7f2145d84b2f29ddd3e96a36ae

7 years agoMerge "Add details on why AT_SYMLINK_NOFOLLOW is dangerous"
Treehugger Robot [Tue, 14 Feb 2017 23:08:12 +0000 (23:08 +0000)]
Merge "Add details on why AT_SYMLINK_NOFOLLOW is dangerous"

7 years agoMerge "Revert "Make libc.so global""
Treehugger Robot [Tue, 14 Feb 2017 22:40:58 +0000 (22:40 +0000)]
Merge "Revert "Make libc.so global""

7 years agoAdd details on why AT_SYMLINK_NOFOLLOW is dangerous
Nick Kralevich [Tue, 14 Feb 2017 17:49:30 +0000 (09:49 -0800)]
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

7 years agoRevert "Make libc.so global"
Dimitry Ivanov [Tue, 14 Feb 2017 19:03:26 +0000 (19:03 +0000)]
Revert "Make libc.so global"

This reverts commit 879177c9e12df4efe9f17ff3536005c258f625e8.

Bug: http://b/26833548
Change-Id: I23e0b34777d18e369063185da14c57994807da29

7 years agoMerge "Be more strict about using invalid `pthread_t`s."
Elliott Hughes [Tue, 14 Feb 2017 18:32:18 +0000 (18:32 +0000)]
Merge "Be more strict about using invalid `pthread_t`s."

7 years agoMerge "Add __system_property_wait and return the serial in __system_property_read_cal...
Treehugger Robot [Tue, 14 Feb 2017 03:48:23 +0000 (03:48 +0000)]
Merge "Add __system_property_wait and return the serial in __system_property_read_callback."

7 years agoBe more strict about using invalid `pthread_t`s.
Elliott Hughes [Tue, 14 Feb 2017 01:59:29 +0000 (17:59 -0800)]
Be more strict about using invalid `pthread_t`s.

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

7 years agoMerge "Do not use std::vector in android_namespace_t::is_accessible"
Treehugger Robot [Mon, 13 Feb 2017 21:43:48 +0000 (21:43 +0000)]
Merge "Do not use std::vector in android_namespace_t::is_accessible"

7 years agoAdd __system_property_wait and return the serial in __system_property_read_callback.
Elliott Hughes [Sat, 11 Feb 2017 02:13:46 +0000 (18:13 -0800)]
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

7 years agoMerge "Make libc.so global"
Treehugger Robot [Mon, 13 Feb 2017 20:29:51 +0000 (20:29 +0000)]
Merge "Make libc.so global"

7 years agoMerge "Match __bos0 to __pass_object_size0 in FORTIFY"
Treehugger Robot [Mon, 13 Feb 2017 19:39:28 +0000 (19:39 +0000)]
Merge "Match __bos0 to __pass_object_size0 in FORTIFY"

7 years agoDo not use std::vector in android_namespace_t::is_accessible
Dimitry Ivanov [Mon, 13 Feb 2017 18:49:40 +0000 (10:49 -0800)]
Do not use std::vector in android_namespace_t::is_accessible

Avoid constructing vector and walking all the parents of a soinfo
to check if it is accessible. The most likely scenario that the
very first check returns true.

Bug: http://b/35313368
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: I06c65cf61ed1c30e5e454a169de4c41038863587

7 years agoMake libc.so global
Dimitry Ivanov [Mon, 13 Feb 2017 17:17:21 +0000 (09:17 -0800)]
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

7 years agoMerge "Replace public library list with shared lib sonames (part 2/2)"
Dimitry Ivanov [Sat, 11 Feb 2017 19:26:48 +0000 (19:26 +0000)]
Merge "Replace public library list with shared lib sonames (part 2/2)"

7 years agoMerge "loader: fix d-tor call order"
Dimitry Ivanov [Sat, 11 Feb 2017 05:50:53 +0000 (05:50 +0000)]
Merge "loader: fix d-tor call order"

7 years agoMatch __bos0 to __pass_object_size0 in FORTIFY
George Burgess IV [Fri, 10 Feb 2017 21:56:22 +0000 (13:56 -0800)]
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

7 years agoloader: fix d-tor call order
Dimitry Ivanov [Fri, 10 Feb 2017 19:04:20 +0000 (11:04 -0800)]
loader: fix d-tor call order

In the case when there are multiple dependencies on
the same library in the local_group the unload may
in some situations (covered now by tests) result
calling d-tors for some libraries prematurely.

In order to have correct call order loader checks if this
is last dependency in local group before adding it to BFS
queue.

Bug: http://b/35201832
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Test: bionic-unit-tests-glibc --gtest_filter=dl*
Change-Id: I4c6955b9032acc7147a51d9f09b61d9e0818700c

7 years agoMerge "Replace public library list with shared lib sonames (part 1/2)"
Treehugger Robot [Fri, 10 Feb 2017 19:01:18 +0000 (19:01 +0000)]
Merge "Replace public library list with shared lib sonames (part 1/2)"

7 years agoReplace public library list with shared lib sonames (part 2/2)
Dimitry Ivanov [Fri, 3 Feb 2017 22:07:34 +0000 (14:07 -0800)]
Replace public library list with shared lib sonames (part 2/2)

This commit updates interface of libdl.c.

1. android_init_namespaces is replaces with android_init_anonymous_namespace
2. added 2 arguments to android_create_namespace to specify linked namespace
   and the list of shared libraries sonames.
3. symbol lookup does not get past boundary libraries (added check and test for it).

Bug: http://b/26833548
Bug: http://b/21879602
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: I32921da487a02e5bd0d2fc528904d1228394bfb9

7 years agoReplace public library list with shared lib sonames (part 1/2)
Dimitry Ivanov [Wed, 1 Feb 2017 23:28:52 +0000 (15:28 -0800)]
Replace public library list with shared lib sonames (part 1/2)

Replace public library list with shared lib sonames
which are property of a link between namespaces

This change does not touch any external interfaces
so from outside it behaves almost as it was before

One significant difference is that there is no longer
need to preload public libraries.

Bug: http://b/26833548
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: I57e44e18a9b4f07dcd6556436346be52f52b79d7

7 years agoMerge "Removing the kuser_helper elf note from building"
Treehugger Robot [Fri, 10 Feb 2017 06:24:31 +0000 (06:24 +0000)]
Merge "Removing the kuser_helper elf note from building"

7 years agoRemoving the kuser_helper elf note from building
mspector [Thu, 9 Feb 2017 01:01:27 +0000 (17:01 -0800)]
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

7 years agoMerge "Remove unnecessary memsets in linker allocators"
Treehugger Robot [Fri, 10 Feb 2017 02:32:16 +0000 (02:32 +0000)]
Merge "Remove unnecessary memsets in linker allocators"

7 years agoMerge "libc: add clang FORTIFY support"
Treehugger Robot [Fri, 10 Feb 2017 02:07:28 +0000 (02:07 +0000)]
Merge "libc: add clang FORTIFY support"

7 years agoMerge "Add test checking init/fini call order"
Treehugger Robot [Fri, 10 Feb 2017 00:21:06 +0000 (00:21 +0000)]
Merge "Add test checking init/fini call order"

7 years agoRemove unnecessary memsets in linker allocators
Dimitry Ivanov [Thu, 9 Feb 2017 23:53:54 +0000 (15:53 -0800)]
Remove unnecessary memsets in linker allocators

Test: linker-unit-tests
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: I96f983dba77c9cb5698a9eb2e51b33bc128c6dd7

7 years agolibc: add clang FORTIFY support
George Burgess IV [Thu, 9 Feb 2017 08:00:31 +0000 (00:00 -0800)]
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

7 years agoAdd test checking init/fini call order
Dimitry Ivanov [Thu, 9 Feb 2017 21:31:57 +0000 (13:31 -0800)]
Add test checking init/fini call order

This test is checking that loader complies with the order described in
http://www.sco.com/developers/gabi/latest/ch5.dynamic.html#init_fini

Bug: http://b/35201832
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Test: bionic-unit-tests-glibc --gtest_filter=dl*
Change-Id: I4cdf878c043112442c191e82aa9f5d5077e4d8c4

7 years agoMerge "Add "benchmark" to time atomic operations"
Hans Boehm [Thu, 9 Feb 2017 02:03:22 +0000 (02:03 +0000)]
Merge "Add "benchmark" to time atomic operations"

7 years agoMerge "Revert "Stop checking the global thread list in several trivial cases.""
Elliott Hughes [Tue, 7 Feb 2017 21:12:22 +0000 (21:12 +0000)]
Merge "Revert "Stop checking the global thread list in several trivial cases.""

7 years agoRevert "Stop checking the global thread list in several trivial cases."
Elliott Hughes [Tue, 7 Feb 2017 21:05:30 +0000 (21:05 +0000)]
Revert "Stop checking the global thread list in several trivial cases."

This reverts commit f5a4992b7186c01b98cb9400b2b5b490805a87bb.

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

Change-Id: I6dcf12706a184b0b8b72451584567a42dfa1bb4f

7 years agoMerge "Improve a comment."
Elliott Hughes [Tue, 7 Feb 2017 17:01:15 +0000 (17:01 +0000)]
Merge "Improve a comment."

7 years agoMerge "Stop checking the global thread list in several trivial cases."
Treehugger Robot [Tue, 7 Feb 2017 00:29:02 +0000 (00:29 +0000)]
Merge "Stop checking the global thread list in several trivial cases."

7 years agoStop checking the global thread list in several trivial cases.
Elliott Hughes [Mon, 6 Feb 2017 22:09:53 +0000 (14:09 -0800)]
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

7 years agoImprove a comment.
Elliott Hughes [Mon, 6 Feb 2017 18:26:20 +0000 (10:26 -0800)]
Improve a comment.

Bug: http://b/23675822
Test: builds
Change-Id: Ia58ffabf38012035076e4c682faa4c93f3690e24

7 years agoMerge "Create seccomp policy without TRAP for further processing"
Paul Lawrence [Fri, 3 Feb 2017 20:14:14 +0000 (20:14 +0000)]
Merge "Create seccomp policy without TRAP for further processing"

7 years agoCreate seccomp policy without TRAP for further processing
Paul Lawrence [Wed, 25 Jan 2017 23:20:52 +0000 (15:20 -0800)]
Create seccomp policy without TRAP for further processing

Bug: 34946764
Test: Make sure boots, seccomp still blocks, and is faster
Change-Id: Ib4abf4307ae545ee69a3fb9328f62c760a1b40f7

7 years agoMerge "Fix CFI initialization crash on x86."
Evgenii Stepanov [Fri, 3 Feb 2017 01:47:14 +0000 (01:47 +0000)]
Merge "Fix CFI initialization crash on x86."

7 years agoMerge "isnan and isinf aren't functions."
Elliott Hughes [Fri, 3 Feb 2017 00:32:00 +0000 (00:32 +0000)]
Merge "isnan and isinf aren't functions."

7 years agoFix CFI initialization crash on x86.
Evgenii Stepanov [Tue, 31 Jan 2017 21:19:30 +0000 (13:19 -0800)]
Fix CFI initialization crash on x86.

Third try.

Bug: 34752378
Test: bionic tests
Change-Id: I247c127489a8ee38404e104f28d916a704e35f36

7 years agoisnan and isinf aren't functions.
Elliott Hughes [Thu, 2 Feb 2017 22:02:49 +0000 (14:02 -0800)]
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

7 years agoMerge "Revert "Remove the global thread list.""
David James [Thu, 2 Feb 2017 02:46:40 +0000 (02:46 +0000)]
Merge "Revert "Remove the global thread list.""

7 years agoRevert "Remove the global thread list."
Elliott Hughes [Thu, 2 Feb 2017 02:41:38 +0000 (02:41 +0000)]
Revert "Remove the global thread list."

This reverts commit b0e8c565a622b5519e03d4416b0b5b1a5f20d7f5.

Breaks swiftshader (http:/b/34883464).

Change-Id: I7b21193ba8a78f07d7ac65e41d0fe8516940a83b

7 years agoMerge "Exit failure if trying to load non-PIE."
Dan Albert [Wed, 1 Feb 2017 23:38:33 +0000 (23:38 +0000)]
Merge "Exit failure if trying to load non-PIE."

7 years agoMerge "Check overflows in c-tor instead of doing it in d-tor"
Treehugger Robot [Wed, 1 Feb 2017 22:58:22 +0000 (22:58 +0000)]
Merge "Check overflows in c-tor instead of doing it in d-tor"

7 years agoCheck overflows in c-tor instead of doing it in d-tor
Dimitry Ivanov [Wed, 1 Feb 2017 20:55:11 +0000 (12:55 -0800)]
Check overflows in c-tor instead of doing it in d-tor

Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: Id3b17a79732155b4e469c43c764afef1dfc59057

7 years agoMerge "Do not load second copy of a library into same namespace"
Treehugger Robot [Wed, 1 Feb 2017 19:23:55 +0000 (19:23 +0000)]
Merge "Do not load second copy of a library into same namespace"

7 years agoDo not load second copy of a library into same namespace
Dimitry Ivanov [Wed, 1 Feb 2017 16:54:43 +0000 (08:54 -0800)]
Do not load second copy of a library into same namespace

This workaround was introduced in M in order to make sure
that linker loads libraries provided in apk in case a library
with the same name was loaded by the system.

This is no longer a problem starting with Android N because
app is using different namespace and therefore does not see
libraries loaded by the system.

Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: I9995258c0f361e8df35420682b84e85a0cb924b4

7 years agoMerge "Remove the global thread list."
Elliott Hughes [Wed, 1 Feb 2017 16:16:41 +0000 (16:16 +0000)]
Merge "Remove the global thread list."

7 years agoMerge "bionic: move ADF uapi header out of bionic"
Treehugger Robot [Wed, 1 Feb 2017 04:38:12 +0000 (04:38 +0000)]
Merge "bionic: move ADF uapi header out of bionic"

7 years agoMerge "Revert "Fix CFI initialization crash on x86.""
Evgenii Stepanov [Wed, 1 Feb 2017 01:14:48 +0000 (01:14 +0000)]
Merge "Revert "Fix CFI initialization crash on x86.""

7 years agoRevert "Fix CFI initialization crash on x86."
Evgenii Stepanov [Wed, 1 Feb 2017 01:10:03 +0000 (17:10 -0800)]
Revert "Fix CFI initialization crash on x86."

Breaks aosp-master/sdk.

This reverts commit 4ccd4317f9301ec9b32aa0d3317a0439b994d7bf.

7 years agoMerge "Fix CFI initialization crash on x86."
Evgenii Stepanov [Wed, 1 Feb 2017 00:29:57 +0000 (00:29 +0000)]
Merge "Fix CFI initialization crash on x86."

7 years agoExit failure if trying to load non-PIE.
Dan Albert [Wed, 1 Feb 2017 00:02:43 +0000 (16:02 -0800)]
Exit failure if trying to load non-PIE.

Amazingly this was actually breaking the NDK's ability to build
libstdc++ for x86.

Test: mma
Bug: None
Change-Id: Iafa55c31fdeb35caca7d7d7a39a3e7afa0713557

7 years agoFix CFI initialization crash on x86.
Evgenii Stepanov [Tue, 31 Jan 2017 21:19:30 +0000 (13:19 -0800)]
Fix CFI initialization crash on x86.

Second try.

Bug: 34752378
Test: bionic tests
Change-Id: I0a7453154671918b2e6e72f0bb9074c29ceb0f34

7 years agoAdd "benchmark" to time atomic operations
Hans Boehm [Tue, 24 Jan 2017 01:30:44 +0000 (17:30 -0800)]
Add "benchmark" to time atomic operations

The intent here is to confirm that the compiler behaves as expected,
and to guide optimization efforts, particularly where there is a
choice between primitives.

Test: Built and ran benchmark on Angler repeatedly. Manually confirmed
that the compiler behaves roughly as expected.

Change-Id: I059b245d1ba8296e9b28602559b53eafafe0a30f

7 years agoMerge "s/NULL/nullptr/ in system properties code."
Treehugger Robot [Tue, 31 Jan 2017 18:19:46 +0000 (18:19 +0000)]
Merge "s/NULL/nullptr/ in system properties code."

7 years agos/NULL/nullptr/ in system properties code.
Elliott Hughes [Tue, 31 Jan 2017 16:24:43 +0000 (08:24 -0800)]
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

7 years agoMerge "clang-format system_properties.cpp."
Treehugger Robot [Tue, 31 Jan 2017 15:20:19 +0000 (15:20 +0000)]
Merge "clang-format system_properties.cpp."

7 years agoMerge "Revert "Fix CFI initialization crash on x86.""
Alex Cheung [Tue, 31 Jan 2017 06:27:17 +0000 (06:27 +0000)]
Merge "Revert "Fix CFI initialization crash on x86.""

7 years agoRevert "Fix CFI initialization crash on x86."
Alex Cheung [Tue, 31 Jan 2017 04:05:00 +0000 (04:05 +0000)]
Revert "Fix CFI initialization crash on x86."

This reverts commit be46d3871c91902504e5ec4c7f575c86f647aafc.

Reverting due to broken build:

https://android-build.googleplex.com/builds/branch-dashboard/aosp-master?build_id=3687823

Change-Id: I30968398edd9a094fce878839ba0a002ed487a77

7 years agoclang-format system_properties.cpp.
Elliott Hughes [Tue, 31 Jan 2017 01:54:57 +0000 (17:54 -0800)]
clang-format system_properties.cpp.

Asked for on a previous code review.

Bug: http://b/33926793
Test: builds and boots.
Change-Id: Idf34804896149db5edbddf4ed88396a5df7f708a

7 years agoMerge "Fix CFI initialization crash on x86."
Evgenii Stepanov [Tue, 31 Jan 2017 00:58:09 +0000 (00:58 +0000)]
Merge "Fix CFI initialization crash on x86."

7 years agoMerge "glibc ipc64_perm __key compatibility."
Treehugger Robot [Mon, 30 Jan 2017 23:01:00 +0000 (23:01 +0000)]
Merge "glibc ipc64_perm __key compatibility."

7 years agoFix CFI initialization crash on x86.
Evgenii Stepanov [Fri, 27 Jan 2017 21:42:03 +0000 (13:42 -0800)]
Fix CFI initialization crash on x86.

Bug: 34752378
Test: bionic tests
Change-Id: If8e33f76a1a2d83356d818fed506ea624f579860

7 years agoMerge "property_contexts: split into platform and non-platform components"
Sandeep Patil [Mon, 30 Jan 2017 19:16:16 +0000 (19:16 +0000)]
Merge "property_contexts: split into platform and non-platform components"

7 years agoMerge "Remove backwards compatibility for old system properties."
Treehugger Robot [Sat, 28 Jan 2017 16:44:09 +0000 (16:44 +0000)]
Merge "Remove backwards compatibility for old system properties."

7 years agoglibc ipc64_perm __key compatibility.
Elliott Hughes [Sat, 28 Jan 2017 03:12:32 +0000 (19:12 -0800)]
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

7 years agoRemove backwards compatibility for old system properties.
Elliott Hughes [Fri, 27 Jan 2017 00:48:57 +0000 (16:48 -0800)]
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

7 years agoproperty_contexts: split into platform and non-platform components
Sandeep Patil [Wed, 28 Dec 2016 01:37:44 +0000 (17:37 -0800)]
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>
7 years agoMerge "Update to kernel headers v4.9.6."
Treehugger Robot [Fri, 27 Jan 2017 21:11:50 +0000 (21:11 +0000)]
Merge "Update to kernel headers v4.9.6."