Commit graph

28546 commits

Author SHA1 Message Date
Elliott Hughes
5a799ca565 Merge "Move kernel README files to Markdown."
am: 9586c0f4f4

Change-Id: Ic8f960bf2b5c9020fe644a2d7755146b4a217146
2019-04-11 20:20:57 -07:00
Treehugger Robot
9586c0f4f4 Merge "Move kernel README files to Markdown." 2019-04-12 03:11:30 +00:00
Elliott Hughes
35c508aacf Merge "<bits/glibc-syscalls.h>: only regenerate when we have new uapi headers."
am: e689eb0154

Change-Id: Iff2f3450cad1ddd00668415f7b814d5b8a6f5f29
2019-04-11 17:29:36 -07:00
Treehugger Robot
e689eb0154 Merge "<bits/glibc-syscalls.h>: only regenerate when we have new uapi headers." 2019-04-12 00:12:19 +00:00
Elliott Hughes
c4c2e24d5f <bits/glibc-syscalls.h>: only regenerate when we have new uapi headers.
Test: update_all.py
Change-Id: Iaa92dce263197f5a0e7d2dce5e00a31372dcb3e9
2019-04-11 14:19:17 -07:00
Elliott Hughes
adcb515bfc Move kernel README files to Markdown.
Test: N/A
Change-Id: If987d8a24baf87adba20914896d29c94fc01cbfd
2019-04-11 13:38:25 -07:00
Elliott Hughes
cd9faf6b50 Merge "Remove seccomp upload hook."
am: 934afc08c8

Change-Id: I5d36861b63bb2192230ac19972623ec70b332d6c
2019-04-11 12:54:28 -07:00
Treehugger Robot
934afc08c8 Merge "Remove seccomp upload hook." 2019-04-11 19:32:42 +00:00
Torne (Richard Coles)
5d10374947 Only write main library's RELRO by default.
ANDROID_DLEXT_WRITE_RELRO was inadvertently writing out the RELRO
section of all libraries loaded during a given dlopen() call instead of
only the main library; since the other libraries are loaded at
unpredictable addresses this additional data is rarely useful.

Fix this to only happen when the
ANDROID_DLEXT_RESERVED_ADDRESS_RECURSIVE flag is being used.

Bug: 128623590
Test: DlExtRelroSharingTest.CheckRelroSizes
Change-Id: I05e8651d06ce2de77b8c85fe2b6238f9c09691ad
2019-04-11 13:57:31 -04:00
Elliott Hughes
6b6a6c8407 Remove seccomp upload hook.
We switched to genrules already, and the lack of `set -e` in the script
means that no-one's even noticed that this script has been failing since
then...

Test: N/A
Change-Id: Ie57cc97ab4e1003a106d4667cd404d22f0ee68a2
2019-04-11 10:42:19 -07:00
Jiyong Park
7e50abf7ee Merge changes from topic "apex_libc_malloc"
am: c345d87aab

Change-Id: I431000eea4b8c5424f58d7c753d186619a71e8b8
2019-04-11 07:26:00 -07:00
Jiyong Park
af4f78a0bf Load libc_malloc_* libraries from the runtime APEX
am: 3ff116a68c

Change-Id: I22fa597ba813ed7e2d1af0665140549ee40f6e9d
2019-04-11 07:25:07 -07:00
Treehugger Robot
c345d87aab Merge changes from topic "apex_libc_malloc"
* changes:
  Don't load libc_malloc_* libs from runtime ns for libc_scudo
  Load libc_malloc_* libraries from the runtime APEX
2019-04-11 14:07:02 +00:00
Jiyong Park
5569650721 Don't load libc_malloc_* libs from runtime ns for libc_scudo
malloc_common_dynamic.cpp is compiled into both libc.so and
libc_scudo.so. When compiled for libc_scudo.so, it doesn't try to load
libc_malloc_* libs from the runtime linker namespace. This is because,
unlike libc.so which is shared from the runtime APEX, libc_scudo.so is
copied to any APEX that it needs. Furthermore, libdl_android which
provides android_get_exported_namespace is not available for vendors. So
the vendor variant of libc_scudo.so can't anyway locate the runtime
namespace.

Bug: 130213757
Bug: 122566199
Test: `m libc_scudo libc_scudo` is successful
Test: inspect the built library to see if it has reference to
android_get_exported_namespace

Merged-In: I4c41de361fdb3fa34b95218923f4ce4e9c010f9e
Change-Id: I4c41de361fdb3fa34b95218923f4ce4e9c010f9e
(cherry picked from commit ff94a13d2d)
2019-04-11 21:37:59 +09:00
Jiyong Park
3ff116a68c Load libc_malloc_* libraries from the runtime APEX
/system/lib/libc.so is a symlink to libc.so in the runtime APEX.
libc_malloc_* libraries are bundled with libc.so because they share
implementation details.

However, since libc.so is loaded in the default namespace where the
runtime APEX path (/apex/com.android.runtime/lib) is not accessible,
libc.so has been using libc_malloc_* from /system/lib. This is
wrong because libc.so (from the runtime APEX) and libc_malloc_* (from
the platform) may not be in-sync.

libc.so now uses android_dlopen_ext to load libc_malloc_* libraries
correctly from the "runtime" linker namespace.

Bug: 122566199
Test: bionic-unit-tests

Merged-In: I46980fbe89e93ea79a7760c9b8eb007af0ada8d8
Change-Id: I46980fbe89e93ea79a7760c9b8eb007af0ada8d8
(cherry picked from commit 4e46ac69c2)
2019-04-11 21:36:16 +09:00
Christopher Ferris
056558f5e1 Merge "Add malloc benchmarks."
am: 1b7881a393

Change-Id: I95e346229b2fbc3cd500c37e008c57df0d228c8b
2019-04-08 19:59:56 -07:00
Christopher Ferris
1b7881a393 Merge "Add malloc benchmarks." 2019-04-09 01:25:17 +00:00
Christopher Ferris
7ec2c8a9b6 Add malloc benchmarks.
Adding some benchmarks that keep a certain number of allocation
around. This benchmark should not be used as an absolute for determining
what is a good/bad native allocator. However, it should be used to make
sure that numbers are not completely changed between allocator versions.

Also update the malloc sql benchmark to match the same style as these
new benchmarks.

Bug: 129743239

Test: Ran these benchmarks.
Change-Id: I1995d98fd269b61d9c96efed6eff3ed278e24c97
2019-04-05 14:45:15 -07:00
dimitry
90a3547fa5 Merge changes Iba5f74e1,I92b88939
am: d1ff49c24a

Change-Id: If6814271a0f0ac20b721cff96010f8653811bf6b
2019-04-05 12:48:03 -07:00
Treehugger Robot
d1ff49c24a Merge changes Iba5f74e1,I92b88939
* changes:
  Fix CtsJniTestCases
  Fix formatting
2019-04-05 18:31:25 +00:00
dimitry
9d1f2b3c76 Merge "Move platform-private symbols out of libdl.so"
am: 1701d887ac

Change-Id: I9187959913fa2e052916c0862965385c73c17336
2019-04-05 09:58:30 -07:00
Treehugger Robot
1701d887ac Merge "Move platform-private symbols out of libdl.so" 2019-04-05 16:45:49 +00:00
Ryan Prichard
7287d1410f Merge changes I59a8bc4a,Ic437d352
am: 93ea856949

Change-Id: I337b38fe7c3d7f41510c7a947ac1131dbdeb93cb
2019-04-04 13:53:52 -07:00
Ryan Prichard
93ea856949 Merge changes I59a8bc4a,Ic437d352
* changes:
  Fix dlsym and dladdr for TLS symbols
  Fix BionicAllocator comment
2019-04-04 20:38:47 +00:00
Elliott Hughes
cd73aa3585 Merge "Workaround potential access to unmapped stack"
am: 5493ddcaa2

Change-Id: I60d14f81cb7078650307a10ec8119e31f87ebd4b
2019-04-04 13:16:18 -07:00
Elliott Hughes
5493ddcaa2 Merge "Workaround potential access to unmapped stack" 2019-04-04 19:47:52 +00:00
Dmytro Chystiakov
c011e04df6 Merge "Fix Bionic dlfcn.dladdr_libc test case for 64bit binary translations"
am: 02accd0ff4

Change-Id: If710ede1e61769155f821da4143b20cbaa815947
2019-04-04 08:14:05 -07:00
Treehugger Robot
02accd0ff4 Merge "Fix Bionic dlfcn.dladdr_libc test case for 64bit binary translations" 2019-04-04 14:59:21 +00:00
Ryan Prichard
e4d620bc80 Fix dlsym and dladdr for TLS symbols
* dlsym: call __tls_get_addr for TLS symbols

 * dladdr: skip TLS symbols

Bug: b/123772574
Test: bionic unit tests
Change-Id: I59a8bc4a7d455e1018b0d577b027b6417c8487cd
2019-04-03 18:19:50 -07:00
Torne (Richard Coles)
c950489599 Merge "Fix DLEXT_WRITE_RELRO when loading multiple libs."
am: 865866ee2b

Change-Id: I96ec82554fbb96b983d09db9c998274dda9e1a1a
2019-04-03 08:27:54 -07:00
Treehugger Robot
865866ee2b Merge "Fix DLEXT_WRITE_RELRO when loading multiple libs." 2019-04-03 15:19:57 +00:00
Pirama Arumuga Nainar
b993b94d41 Merge "Move bionic-unit-tests-static to libclang_rt.builtins"
am: 96c21e43b4

Change-Id: I79c2c06cd179d6cb1fa63e69735ae4bff0559145
2019-04-03 08:06:09 -07:00
Treehugger Robot
96c21e43b4 Merge "Move bionic-unit-tests-static to libclang_rt.builtins" 2019-04-03 14:45:47 +00:00
Pirama Arumuga Nainar
0d16a31664 Move bionic-unit-tests-static to libclang_rt.builtins
Bug: http://b/129728267
Bug: http://b/117167374

This test is now built with XOM (because libm now uses XOM) but it
should also use libclang_rt.builtins since libgcc is not built with XOM.

Test: bionic-unit-tests-static passes (but used to segfault with XOM
exceptions without this change).

Change-Id: I0b1dfe52e48db5f5e9386c7722ecd91e155be56f
2019-04-02 22:45:29 -07:00
Adrian-CJ Hung
8c1a14d4f3 Workaround potential access to unmapped stack
Issue:
Process is crashed near the end (startup_handshake_lock.unlock()) in
pthread_create().

The newly created child thread passes this handshake_lock unexpectedly
=> its stack is unmapped & its associated pthread_internal_t data
structure can’t be accessed.

Analysis:
The created child thread should be blocked by startup_handshake_lock.lock()
and enter __futex_wait_ex()

But if the parent thread is in the middle of startup_handshake_lock.unlock():

  void unlock() {
    if (atomic_exchange_explicit(&state, Unlocked, memory_order_seq_cst) == LockedWithWaiter) {  // => the state is modified to Unlocked

    // (a) if the child thread is back to running and pass the while() check in Lock::lock()
    // (b) the child thread executes its start_routine and then pthread_exit
    // (c) the stack of the child thread (where its pthread_internal_t (so the startup_handshake_lock) is located) will be unmapped

     __futex_wake_ex(&state, process_shared, 1);   // => when the parent thread is back to running
                                                   // the “state” & “process_shared” of startup_handshake_lock can’t be accessed (unmapped)
                                                   // so the process will be crashed
    }
  }

Bug: 129744706
Test: Monkey
Change-Id: I55175e8c7ebc2b3b52de8a5602def0667076b974
2019-04-03 11:50:33 +08:00
Torne (Richard Coles)
fa9f7f28d4 Fix DLEXT_WRITE_RELRO when loading multiple libs.
ANDROID_DLEXT_WRITE_RELRO was causing the GNU RELRO sections of
libraries to become corrupted if more than one library was being loaded
at once (i.e. if the root library has DT_NEEDED entries for libraries
that weren't already loaded). The file offset was not being correctly
propagated between calls, so after writing out the (correct) RELRO data
to the file, it was mapping the data at file offset 0 for all libraries,
which corrupted the data for all but one of the libraries.

Fix this by passing file_offset as a pointer the same way that
phdr_table_map_gnu_relro does.

Bug: 128623590
Test: tbd
Change-Id: I196cd336bd5a67454e89fd85487356b1c7856871
2019-04-02 18:06:12 -04:00
Christopher Ferris
f2905f4ce3 Merge "Disable info messages by default for malloc debug."
am: e6fd53b751

Change-Id: I088f92572a5b0af474a311f6bf73b48924b2960a
2019-04-02 13:06:53 -07:00
Christopher Ferris
e6fd53b751 Merge "Disable info messages by default for malloc debug." 2019-04-02 19:46:29 +00:00
Christopher Ferris
c328e4465d Disable info messages by default for malloc debug.
Add a new option verbose for malloc debug that is not enabled by default.
This disables all of the info log messages. It turns out these log
messages can add a measurable amount of time and can change the boot up.

Bug: 129239269

Test: Adjusted unit tests pass.
Test: Verified no messages unless verbose option used.
Change-Id: I805cb7c8ecb44de88119574e59d784877cacc383
2019-04-02 10:55:21 -07:00
Vic Yang
b325aaa0d1 Merge "libc: Update symbol_ordering file"
am: 4fbe126643

Change-Id: I65533c8e42cbc630d14fa3f62a70a4af9a652875
2019-04-01 21:10:50 -07:00
Treehugger Robot
4fbe126643 Merge "libc: Update symbol_ordering file" 2019-04-02 03:51:51 +00:00
Christopher Ferris
b525ee4a11 Merge "Create a lib that uses scudo instead of jemalloc."
am: d486e024c6

Change-Id: I181015004ab7c1f74112048395173d0067ba1753
2019-04-01 18:54:22 -07:00
Christopher Ferris
d486e024c6 Merge "Create a lib that uses scudo instead of jemalloc." 2019-04-02 01:37:07 +00:00
Ryan Prichard
db6edcca36 Fix BionicAllocator comment
Test: n/a
Bug: none
Change-Id: Ic437d35231b47553add49e20d7ee451d42db710c
2019-04-01 16:17:59 -07:00
Christopher Ferris
fc26d71af1 Create a lib that uses scudo instead of jemalloc.
The media processes already use scudo as their allocator. However, it
doesn't really correctly replace the normal allocation functions, so create
a set of wrappers that allow us to use scudo closer to how jemalloc is used.

This is only a temporary change, and should be removed for the next
release of Android. In that version, we will be using standalone
scudo which won't require this wrapper code.

Bug: 123689570

Test: Ran new bionic unit tests. There are failures, but only with
Test: extensions that scudo does not support.

Change-Id: I0516c23d654a9b6c69b157c5501245d2e0b3d264
2019-04-01 13:02:49 -07:00
Vic Yang
90cca40111 libc: Update symbol_ordering file
There have been several changes since the file was created.  Update the
file with latest build.  We also sort the symbols by names when they
have the same size so that future updates are easier to review.

Bug: 124521408
Test: Build and inspect symbol ordering
Change-Id: Iedd885b9a87d882ae278a1f117f40b20d064c384
2019-04-01 12:08:50 -07:00
dimitry
ce584e4fc9 Fix CtsJniTestCases
The linker_namespaces test need android_get_LD_LIBRARY_PATH function.

Bug: http://b/129479780
Test: atest CtsJniTestCases
Change-Id: Iba5f74e1e4b5b1de173150120293102524db2507
(cherry picked from commit 91b0c68009)
2019-04-01 13:17:20 +02:00
dimitry
8868d9e900 Move platform-private symbols out of libdl.so
Symbols not intended to be accessible from apps are moved to libdl_android.so

Test: bionic-unit-tests
Bug: http://b/129387775
Change-Id: Ib8ba6147a20cf56550c9a008f66570a2d419565a
(cherry picked from commit 2d6be9a751)
2019-04-01 13:16:33 +02:00
dimitry
4b8b849371 Fix formatting
Test: make
Change-Id: I92b8893997c2fd75002e84070a3ca91fca4b110e
2019-04-01 13:16:33 +02:00
Yi Kong
2e3a19d5b4 Merge "Modernise code to use override specifier"
am: 4699cf6174

Change-Id: Ia22c546feed8711579cc5aaf4833cf29652506c2
2019-03-29 19:34:20 -07:00