OSDN Git Service

android-x86/bionic.git
7 years agoMerge "Add tests for ptrace resumption behavior." am: d11584665c
Josh Gao [Fri, 17 Feb 2017 19:46:25 +0000 (19:46 +0000)]
Merge "Add tests for ptrace resumption behavior." am: d11584665c
am: d4233fbc5e

Change-Id: Id0ee86d392268211501183e67600bcb9c7fde1d9

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

Change-Id: I4a57cc866b5a7facecd9cbe0084cd0c55304d58f

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 agoMerge changes from topic 'debuggerd_inproc' am: 4509e0ec94 am: 243b4ba143
Josh Gao [Thu, 16 Feb 2017 23:28:22 +0000 (23:28 +0000)]
Merge changes from topic 'debuggerd_inproc' am: 4509e0ec94 am: 243b4ba143
am: 82503678f0

Change-Id: I1d4efc4b34effcce377c2c83e016f6e0bcca620c

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

Change-Id: Ief1c3ba804e4d6832340fb51e68b54d174f3a5da

7 years agoMerge changes from topic 'debuggerd_inproc'
Josh Gao [Thu, 16 Feb 2017 23:19:24 +0000 (23:19 +0000)]
Merge changes from topic 'debuggerd_inproc'
am: 4509e0ec94

Change-Id: I120a178e8332e650b96f708a3e68c9e3ba4e726c

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." am: fec0e015ce am: 33b9640132
Josh Gao [Thu, 16 Feb 2017 03:56:32 +0000 (03:56 +0000)]
Merge "Add __libc_format_buffer_va_list." am: fec0e015ce am: 33b9640132
am: f1d42d6acd

Change-Id: I447306ecc5218d7638181fe9a163cf5e10b0cad4

7 years agoMerge "Add __libc_format_buffer_va_list." am: fec0e015ce
Josh Gao [Thu, 16 Feb 2017 03:53:33 +0000 (03:53 +0000)]
Merge "Add __libc_format_buffer_va_list." am: fec0e015ce
am: 33b9640132

Change-Id: I6848c4ef176cd04daa8ca1d1799aa69f1a00678d

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

Change-Id: I1028ee851f6fdd30e93858e89a5bd741bbb54e62

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)" am: 10a441bfcd am: a368dd9dbf
Dimitry Ivanov [Thu, 16 Feb 2017 02:31:59 +0000 (02:31 +0000)]
Merge "Unify linker files under one license (BSD)" am: 10a441bfcd am: a368dd9dbf
am: 401384c3de

Change-Id: I8e26fc4518a0b89fec88e217e1ea04bf357182b2

7 years agoMerge "Unify linker files under one license (BSD)" am: 10a441bfcd
Dimitry Ivanov [Thu, 16 Feb 2017 02:28:28 +0000 (02:28 +0000)]
Merge "Unify linker files under one license (BSD)" am: 10a441bfcd
am: a368dd9dbf

Change-Id: Ic3da42612438aad889c916092e0293be89b9c340

7 years agoMerge "Unify linker files under one license (BSD)"
Dimitry Ivanov [Thu, 16 Feb 2017 02:24:27 +0000 (02:24 +0000)]
Merge "Unify linker files under one license (BSD)"
am: 10a441bfcd

Change-Id: I63ea67e032edcdf9bc27180030b5e6b1ae2473d4

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 am: 606ba2762e am: cec0e2f9b1
Dan Albert [Wed, 15 Feb 2017 19:30:29 +0000 (19:30 +0000)]
Merge changes I9d06ea8a,I2d157024 am: 606ba2762e am: cec0e2f9b1
am: 4587ac034b

Change-Id: I33c08738e7fb605bb97236f36880a61372aba769

7 years agoMerge changes I9d06ea8a,I2d157024 am: 606ba2762e
Dan Albert [Wed, 15 Feb 2017 19:26:57 +0000 (19:26 +0000)]
Merge changes I9d06ea8a,I2d157024 am: 606ba2762e
am: cec0e2f9b1

Change-Id: I224d0d121716b0bee40478d3011a2f625248300a

7 years agoMerge changes I9d06ea8a,I2d157024
Dan Albert [Wed, 15 Feb 2017 19:24:02 +0000 (19:24 +0000)]
Merge changes I9d06ea8a,I2d157024
am: 606ba2762e

Change-Id: I85a709298e33ee2475db2e4af2312b7c9ae93e12

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" am: c54937b972 am: 0a4fb394c8
Daniel Micay [Wed, 15 Feb 2017 18:41:25 +0000 (18:41 +0000)]
Merge "add fortified implementations of send/sendto" am: c54937b972 am: 0a4fb394c8
am: 63e9cd65f3

Change-Id: I23328cb633a50a5821ae7d29dc68b8abeaa06228

7 years agoMerge "add fortified implementations of send/sendto" am: c54937b972
Daniel Micay [Wed, 15 Feb 2017 18:38:56 +0000 (18:38 +0000)]
Merge "add fortified implementations of send/sendto" am: c54937b972
am: 0a4fb394c8

Change-Id: Ib9ba3836fa2f197388a4659906b2b0664a497098

7 years agoMerge "add fortified implementations of send/sendto"
Daniel Micay [Wed, 15 Feb 2017 18:34:27 +0000 (18:34 +0000)]
Merge "add fortified implementations of send/sendto"
am: c54937b972

Change-Id: I74107e22aa6f3e62e9225f6201d6b70daf6ea427

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" am: 7b52454084 am: 42969056d0
Nick Kralevich [Tue, 14 Feb 2017 23:31:09 +0000 (23:31 +0000)]
Merge "Add details on why AT_SYMLINK_NOFOLLOW is dangerous" am: 7b52454084 am: 42969056d0
am: 98aad56070

Change-Id: I3cbca82748330f968c0361c13df488c74fefe337

7 years agoMerge "Add details on why AT_SYMLINK_NOFOLLOW is dangerous" am: 7b52454084
Nick Kralevich [Tue, 14 Feb 2017 23:13:36 +0000 (23:13 +0000)]
Merge "Add details on why AT_SYMLINK_NOFOLLOW is dangerous" am: 7b52454084
am: 42969056d0

Change-Id: Ic71a202f3c64f36e1d80af7f2fa64cf72d020626

7 years agoMerge "Add details on why AT_SYMLINK_NOFOLLOW is dangerous"
Nick Kralevich [Tue, 14 Feb 2017 23:11:06 +0000 (23:11 +0000)]
Merge "Add details on why AT_SYMLINK_NOFOLLOW is dangerous"
am: 7b52454084

Change-Id: If9d65e973d9fda2ceb373ca050608cde52ebad25

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"" am: e7ea7612f9 am: 028e306731
Dimitry Ivanov [Tue, 14 Feb 2017 22:56:33 +0000 (22:56 +0000)]
Merge "Revert "Make libc.so global"" am: e7ea7612f9 am: 028e306731
am: 0379c92138

Change-Id: I69c44fa749d25e44a302d95fe88ffd6306bdf92b

7 years agoMerge "Revert "Make libc.so global"" am: e7ea7612f9
Dimitry Ivanov [Tue, 14 Feb 2017 22:54:35 +0000 (22:54 +0000)]
Merge "Revert "Make libc.so global"" am: e7ea7612f9
am: 028e306731

Change-Id: If09db33cbb36328f99753b41dac2ced87f79f0a1

7 years agoMerge "Revert "Make libc.so global""
Dimitry Ivanov [Tue, 14 Feb 2017 22:49:33 +0000 (22:49 +0000)]
Merge "Revert "Make libc.so global""
am: e7ea7612f9

Change-Id: I975b9aa0aaa8307592593163fef1bbfb2940f8e5

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 agoMerge "Be more strict about using invalid `pthread_t`s." am: 0370905502 am: a18e9f88c8
Elliott Hughes [Tue, 14 Feb 2017 19:08:18 +0000 (19:08 +0000)]
Merge "Be more strict about using invalid `pthread_t`s." am: 0370905502 am: a18e9f88c8
am: daa5c8afa9

Change-Id: Ifd6fb9a24635b7f1cb32178247fd0e16a00502ea

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

Change-Id: Ie74df14b7772a0f14f9b20fa3c58d6455e55e42d

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

Change-Id: I476dfe579855d06ea7a1ab34888642f43c58725b

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...
Elliott Hughes [Tue, 14 Feb 2017 03:56:24 +0000 (03:56 +0000)]
Merge "Add __system_property_wait and return the serial in __system_property_read_callback." am: ade3be476f am: c9df674347
am: 520814a223

Change-Id: Id98cf76455a07eae901ea28aef2c273480722c70

7 years agoMerge "Add __system_property_wait and return the serial in __system_property_read_cal...
Elliott Hughes [Tue, 14 Feb 2017 03:54:22 +0000 (03:54 +0000)]
Merge "Add __system_property_wait and return the serial in __system_property_read_callback." am: ade3be476f
am: c9df674347

Change-Id: I62ca9f6f84cfb91875a6b5d9cf4aa47fb4299655

7 years agoMerge "Add __system_property_wait and return the serial in __system_property_read_cal...
Elliott Hughes [Tue, 14 Feb 2017 03:52:23 +0000 (03:52 +0000)]
Merge "Add __system_property_wait and return the serial in __system_property_read_callback."
am: ade3be476f

Change-Id: I33c5acd3ebba551723639aa2b2540603e2434b4c

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" am: 9fc52deab1...
Dimitry Ivanov [Mon, 13 Feb 2017 21:54:30 +0000 (21:54 +0000)]
Merge "Do not use std::vector in android_namespace_t::is_accessible" am: 9fc52deab1 am: 62b5ca5a11
am: c42072bedf

Change-Id: Ic8238d945ea6f154a13861ab527ebb72f9c12c7b

7 years agoMerge "Do not use std::vector in android_namespace_t::is_accessible" am: 9fc52deab1
Dimitry Ivanov [Mon, 13 Feb 2017 21:51:31 +0000 (21:51 +0000)]
Merge "Do not use std::vector in android_namespace_t::is_accessible" am: 9fc52deab1
am: 62b5ca5a11

Change-Id: Ib861240a66a23655f10ea346d4648c13a5f6e5f2

7 years agoMerge "Do not use std::vector in android_namespace_t::is_accessible"
Dimitry Ivanov [Mon, 13 Feb 2017 21:49:30 +0000 (21:49 +0000)]
Merge "Do not use std::vector in android_namespace_t::is_accessible"
am: 9fc52deab1

Change-Id: I0449e82bb130e9eed59ccf932a97ce69c16b7a4d

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" am: 5b74e9b2f5 am: 96a8cfcd09
Dimitry Ivanov [Mon, 13 Feb 2017 20:40:57 +0000 (20:40 +0000)]
Merge "Make libc.so global" am: 5b74e9b2f5 am: 96a8cfcd09
am: eb108f8e0d

Change-Id: I6ad39544746d87b0b737bfeb5323125f8ff24a48

7 years agoMerge "Make libc.so global" am: 5b74e9b2f5
Dimitry Ivanov [Mon, 13 Feb 2017 20:38:25 +0000 (20:38 +0000)]
Merge "Make libc.so global" am: 5b74e9b2f5
am: 96a8cfcd09

Change-Id: I04bfd1c0165b5ff9f4af16511031f66393902be9

7 years agoMerge "Make libc.so global"
Dimitry Ivanov [Mon, 13 Feb 2017 20:35:55 +0000 (20:35 +0000)]
Merge "Make libc.so global"
am: 5b74e9b2f5

Change-Id: Ie5dc459b78b4b7fad148af3196aeec6df1faba59

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" am: 572b1dde03 am: ae80a17b4f
George Burgess IV [Mon, 13 Feb 2017 19:52:52 +0000 (19:52 +0000)]
Merge "Match __bos0 to __pass_object_size0 in FORTIFY" am: 572b1dde03 am: ae80a17b4f
am: 20c5fe3a2b

Change-Id: Iad9923bdecdf8a10686dc62c25e644071b9bda98

7 years agoMerge "Match __bos0 to __pass_object_size0 in FORTIFY" am: 572b1dde03
George Burgess IV [Mon, 13 Feb 2017 19:50:22 +0000 (19:50 +0000)]
Merge "Match __bos0 to __pass_object_size0 in FORTIFY" am: 572b1dde03
am: ae80a17b4f

Change-Id: I27b09cb45c33858a2a42df4fecedeace024f1cf0

7 years agoMerge "Match __bos0 to __pass_object_size0 in FORTIFY"
George Burgess IV [Mon, 13 Feb 2017 19:47:53 +0000 (19:47 +0000)]
Merge "Match __bos0 to __pass_object_size0 in FORTIFY"
am: 572b1dde03

Change-Id: Ic2993a4692105f18d24573297479ce7f57964dea

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)" am: 2cb4dfbb8c...
Dimitry Ivanov [Sat, 11 Feb 2017 19:37:58 +0000 (19:37 +0000)]
Merge "Replace public library list with shared lib sonames (part 2/2)" am: 2cb4dfbb8c am: ae80d78b5b
am: f3dde6d7e9

Change-Id: Ie589574e4e49949b8384d0924f2d4647b277f1ba

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

Change-Id: I18aed24818f8bd26b6561c311ce434b85bb702f1

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

Change-Id: Ie62e6810486fce1c2e84df7991ba11c8d69a6fef

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" am: c9fb1774c5 am: 636354190d
Dimitry Ivanov [Sat, 11 Feb 2017 06:06:21 +0000 (06:06 +0000)]
Merge "loader: fix d-tor call order" am: c9fb1774c5 am: 636354190d
am: c78b116a5e

Change-Id: I1f4d2e5313d52adf2b1159710b2029755da51b21

7 years agoMerge "loader: fix d-tor call order" am: c9fb1774c5
Dimitry Ivanov [Sat, 11 Feb 2017 06:01:50 +0000 (06:01 +0000)]
Merge "loader: fix d-tor call order" am: c9fb1774c5
am: 636354190d

Change-Id: Ia3ac8ab43e7891be0fb60b7581bd15079996093a

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

Change-Id: I99b0284fcb0b5d0b3ec011b969d174a1ad8db32e

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)" am: 132768084e...
Dimitry Ivanov [Fri, 10 Feb 2017 19:09:28 +0000 (19:09 +0000)]
Merge "Replace public library list with shared lib sonames (part 1/2)" am: 132768084e am: 0e27209156
am: 9a6cd5d620

Change-Id: Id21ed632aa74f8eee75fc8cabc9748d8c2c3a3d2

7 years agoMerge "Replace public library list with shared lib sonames (part 1/2)" am: 132768084e
Dimitry Ivanov [Fri, 10 Feb 2017 19:06:59 +0000 (19:06 +0000)]
Merge "Replace public library list with shared lib sonames (part 1/2)" am: 132768084e
am: 0e27209156

Change-Id: I1605323bf575cf1778ca95af45c56eac7f31ec2e

7 years agoMerge "Replace public library list with shared lib sonames (part 1/2)"
Dimitry Ivanov [Fri, 10 Feb 2017 19:04:59 +0000 (19:04 +0000)]
Merge "Replace public library list with shared lib sonames (part 1/2)"
am: 132768084e

Change-Id: If0454fdc0c632d1560662cbd0f660687bbb35fad

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" am: e86a8d605b am: ad1daec1fd
mspector [Fri, 10 Feb 2017 06:31:46 +0000 (06:31 +0000)]
Merge "Removing the kuser_helper elf note from building" am: e86a8d605b am: ad1daec1fd
am: 95972f6ee1

Change-Id: I21f1cf38cfcf255dad270fee0036e82aaf366445

7 years agoMerge "Removing the kuser_helper elf note from building" am: e86a8d605b
mspector [Fri, 10 Feb 2017 06:29:46 +0000 (06:29 +0000)]
Merge "Removing the kuser_helper elf note from building" am: e86a8d605b
am: ad1daec1fd

Change-Id: I4f18391ea34728acd30a72f416166ca9ae33f81b

7 years agoMerge "Removing the kuser_helper elf note from building"
mspector [Fri, 10 Feb 2017 06:27:46 +0000 (06:27 +0000)]
Merge "Removing the kuser_helper elf note from building"
am: e86a8d605b

Change-Id: Ica80892b0973f2370bc10d23aa4279fd76c6ef7e

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 agoMerge "Remove unnecessary memsets in linker allocators" am: 43801a50b0 am: 6731a65042
Dimitry Ivanov [Fri, 10 Feb 2017 02:42:31 +0000 (02:42 +0000)]
Merge "Remove unnecessary memsets in linker allocators" am: 43801a50b0 am: 6731a65042
am: 4ebd02f4ea

Change-Id: Iddd64ae5fb06669a6feeda3474ccad445a6c01e6

7 years agoMerge "Remove unnecessary memsets in linker allocators" am: 43801a50b0
Dimitry Ivanov [Fri, 10 Feb 2017 02:40:30 +0000 (02:40 +0000)]
Merge "Remove unnecessary memsets in linker allocators" am: 43801a50b0
am: 6731a65042

Change-Id: I6fb7a1142503c3bf6f0b36dd1a48489bc64ed0e5

7 years agoMerge "Remove unnecessary memsets in linker allocators"
Dimitry Ivanov [Fri, 10 Feb 2017 02:38:30 +0000 (02:38 +0000)]
Merge "Remove unnecessary memsets in linker allocators"
am: 43801a50b0

Change-Id: I9916105c744178672b03803234b3c22e64435f8b

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" am: 5ac650936f am: eeb4544186
George Burgess IV [Fri, 10 Feb 2017 02:16:03 +0000 (02:16 +0000)]
Merge "libc: add clang FORTIFY support" am: 5ac650936f am: eeb4544186
am: 2cae2dc5d7

Change-Id: I34fc97a1a7e9354899cdf78552388cc6ed07edea

7 years agoMerge "libc: add clang FORTIFY support" am: 5ac650936f
George Burgess IV [Fri, 10 Feb 2017 02:14:01 +0000 (02:14 +0000)]
Merge "libc: add clang FORTIFY support" am: 5ac650936f
am: eeb4544186

Change-Id: I9a658f22d45ec2b002c2086e5f381ee520461b93

7 years agoMerge "libc: add clang FORTIFY support"
George Burgess IV [Fri, 10 Feb 2017 02:11:31 +0000 (02:11 +0000)]
Merge "libc: add clang FORTIFY support"
am: 5ac650936f

Change-Id: Id9b7bc08a9c60f1ce34768063cdc8d61098ffc0e

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" am: 4e7ab9292d am: 915b6d8d9d
Dimitry Ivanov [Fri, 10 Feb 2017 00:33:01 +0000 (00:33 +0000)]
Merge "Add test checking init/fini call order" am: 4e7ab9292d am: 915b6d8d9d
am: c46af6b708

Change-Id: Ib6459cf3652a4d56ba631629eae8920724ff020d

7 years agoMerge "Add test checking init/fini call order" am: 4e7ab9292d
Dimitry Ivanov [Fri, 10 Feb 2017 00:31:02 +0000 (00:31 +0000)]
Merge "Add test checking init/fini call order" am: 4e7ab9292d
am: 915b6d8d9d

Change-Id: Iaabbb92f09543aaab80dbec71d1919a2d08691b6

7 years agoMerge "Add test checking init/fini call order"
Dimitry Ivanov [Fri, 10 Feb 2017 00:27:32 +0000 (00:27 +0000)]
Merge "Add test checking init/fini call order"
am: 4e7ab9292d

Change-Id: If03d6740dbd8e9202ca39a502854a98c95cb4500

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