Commit graph

27843 commits

Author SHA1 Message Date
dimitry
c7b81108b4 Make pthread_get/setschedparam weak for native bridge
Bug: http://b/130825973
Test: run affected app on cuttlefish
Change-Id: I776f26f5eaebdfdb1256ff621bd05ef5a90b852a
2019-04-25 16:43:24 +02:00
Tom Cherry
731ed0fb52 Merge "Refactor some pieces of grp_pwd.cpp" 2019-04-24 23:02:06 +00:00
Tom Cherry
5fb07634c3 Refactor some pieces of grp_pwd.cpp
We loop through android_ids in many functions, but this can be
consolidated into find functions.

Test: bionic-unit-tests
Change-Id: I70c423affe49090a93e999c72bb4c84a068de5d8
2019-04-24 13:37:11 -07:00
Elliott Hughes
8c3140a612 Merge "threads.h: Add C11 thread support." 2019-04-24 20:33:08 +00:00
Elliott Hughes
4206711352 threads.h: Add C11 thread support.
FreeBSD, glibc, and musl have all implemented C11 threads at this
point. POSIX is looking at how to align with it. Probably time to jump
on the bandwagon ourselves...

Implemented in the same style as <termios.h> so we can provide this
functionality even on older API levels. This does mean that this is
strictly more expensive than calling pthread functions directly.

Although this isn't in POSIX yet, assume that it's going to be basically
the same as C11 and add the header test anyway. We should revisit this
when POSIX actually adds <threads.h>.

Test: new tests
Change-Id: I8602d67ce71ca7f8ed1529daa0a8ea1feb083dd6
2019-04-24 09:12:29 -07:00
Treehugger Robot
06a5617f24 Merge "Update doc comment about running the benchmarks." 2019-04-23 23:54:17 +00:00
Elliott Hughes
d655bc6dfa Update doc comment about running the benchmarks.
Test: N/A
Change-Id: Idf1f8c38aa90478b861358677e1d12b96809377d
2019-04-23 11:49:13 -07:00
Christopher Ferris
31fe3c637e Merge "Move all leak info functions to android_mallopt." 2019-04-23 17:45:01 +00:00
Elliott Hughes
640bd0bf3a Merge "libdl.a: make dlerror() always report an error." 2019-04-23 14:47:05 +00:00
Yi Kong
7f3527fb5c Merge "Implement __gnu_[u]ldivmod_helper methods in libc" 2019-04-23 05:54:33 +00:00
Yi Kong
b410d0e69e Implement __gnu_[u]ldivmod_helper methods in libc
These symbols were previously provided by Android's out-dated libgcc,
but they're removed/deprecated in upstream libgcc, and also won't be
available in libclang_rt.builtins. We need to provide these methods in
libc itself for compatiblity.

Test: build with these symbols stripped in libgcc
Bug: 29275768
Change-Id: I04a05258c6c06b5a22ead41e148b02792ffbc941
2019-04-22 18:12:55 -07:00
Elliott Hughes
1311545bb2 Merge "Reland ifuncs for strcmp and strlen." 2019-04-22 23:32:33 +00:00
Treehugger Robot
401e2efa39 Merge "Only write main library's RELRO by default." 2019-04-22 23:26:36 +00:00
Ryan Prichard
b250766282 Merge "PIMutexUnlock: load owner_tid in non-common case" 2019-04-22 21:09:52 +00:00
Ryan Prichard
f32e1a1f50 Merge "Comment about lock destruction and unlocking" 2019-04-22 21:09:44 +00:00
Elliott Hughes
b7155fd4e4 Merge "Document __register_atfork." 2019-04-22 19:38:42 +00:00
Elliott Hughes
927fe99692 Reland ifuncs for strcmp and strlen.
This reverts commit e4788d4c7e,
which undid this change during the Q betas.

Bug: http://b/120989619
Change-Id: Iea589fd0e56426971adf9f7c19c2aedf0d7a7a60
2019-04-22 18:57:21 +00:00
Elliott Hughes
fb9ce2882b Document __register_atfork.
Bug: https://github.com/android-ndk/ndk/issues/964
Test: N/A
Change-Id: I5f3fa4c7fa42abde05f5b5fe730748d8c5fb4bb2
2019-04-22 08:57:36 -07:00
Elliott Hughes
915c5fb9f6 libdl.a: make dlerror() always report an error.
Seems only logical, given that all the other calls fail.

(Only thing that's weird about this is that calling dlerror() usually
clears the error until you do something else that causes an error, but
that doesn't seem worth the bookkeeping?)

Bug: https://github.com/android-ndk/ndk/issues/965
Test: static unit tests still pass
Change-Id: I5e5401e148c5857f1dbab9c5a7f4a6fc43d8d626
2019-04-22 08:43:57 -07:00
Elliott Hughes
493322baf1 Merge "Move libdl and linker to static NOTICE files." 2019-04-22 15:33:05 +00:00
Elliott Hughes
bdf8528a85 Merge "Workaround ASan not knowing about reallocarray." 2019-04-22 14:50:57 +00:00
Elliott Hughes
390be50067 Workaround ASan not knowing about reallocarray.
Ensure we call realloc@plt rather than (as was previously happening)
inlining realloc into reallocarray, which makes the allocation invisible
to ASan.

Bug: http://b/129989984
Test: objdump
Change-Id: If8a43cba11aa5a2f2f62bacd02ef6ef4032e0dbb
2019-04-20 22:18:49 -07:00
Ryan Prichard
aca110173f Comment about lock destruction and unlocking
Add a couple of comments explaining that a mutex can be freed during
the unlock call, immediately after the unlock's atomic exchange call but
before its futex wakeup call.

Bug: http://b/129744706
Test: bionic unit tests
Change-Id: I2d290ebde880f46866098d022720896039e7022e
2019-04-19 17:16:25 -07:00
Ryan Prichard
4b6c0f5dce PIMutexUnlock: load owner_tid in non-common case
For a recursive or errorcheck PI mutex, the old_owner variable wasn't
being initialized. As a result, unlocking a doubly-locked recursive
mutex owned by another thread decremented the mutex counter. Instead, the
unlock call should fail with EPERM.

Bug: http://b/130841532
Test: bionic-unit-tests
Test: bionic-unit-tests-glibc --gtest_filter='pthread.pthread_mutex_lock*'
Change-Id: I37adb094cb2ce8d51df7b4f48e8d6bc144436418
2019-04-19 17:16:16 -07:00
Elliott Hughes
584bc626b6 Move libdl and linker to static NOTICE files.
The libstdc++ directory has no copyright headers, so it was a no-op
anyway.

The interesting part will be switching libc and libm over to genrules...

Test: N/A
Change-Id: Iec92562af40c451fdcb4a7468984878ec5dba2ce
2019-04-19 14:18:07 -07:00
Christopher Ferris
30659fd243 Move all leak info functions to android_mallopt.
Bug: 130028357

Test: malloc_hooks unit tests.
Test: Enable backtrace for mediaserver, run dumpsys media.player -m
Test: Enable backtrace for calendar, run am dumpheap -n <PID> <FILE>
Change-Id: I6774e28ccd9b3f2310127a5b39ccd15fe696a787
Merged-In: I6774e28ccd9b3f2310127a5b39ccd15fe696a787
(cherry picked from commit 3aadc5e80a)
2019-04-19 11:27:02 -07:00
Tom Cherry
75f7b06454 Merge "paths.h: /sbin and /system/sbin no longer exist." 2019-04-17 23:26:13 +00:00
Christopher Ferris
30bcaae2b6 Merge "Remove gMallocLeakZygoteChild." 2019-04-17 17:31:04 +00:00
Elliott Hughes
032aed9f4b Merge "Generate assembler system call stubs via genrule." 2019-04-17 15:11:15 +00:00
Treehugger Robot
be128f38d6 Merge "Fix linker compilation with timing enabled" 2019-04-16 23:39:30 +00:00
Elliott Hughes
07c5587e56 paths.h: /sbin and /system/sbin no longer exist.
Bug: http://b/73660730
Test: treehugger
Change-Id: Ie49253304e192b0eafa5747e547371d1d128a6f5
2019-04-16 15:52:20 -07:00
Vic Yang
7b9db347ae Fix linker compilation with timing enabled
Test: Build with TIMING set to 1 in linker_debug.h.
Change-Id: Ia11021f6221bc985abddb379e813e4e353fd7149
2019-04-16 14:54:58 -07:00
Treehugger Robot
21cf101f54 Merge "Remove dead script." 2019-04-16 21:11:36 +00:00
Elliott Hughes
7d8c4602fb Remove dead script.
This is already handled by genrules.

Test: N/A
Change-Id: I123a971486431cc2b888df515b7bda8e408fa876
2019-04-16 12:34:03 -07:00
Elliott Hughes
782c485880 Generate assembler system call stubs via genrule.
There's no need to check in generated code.

Test: builds & boots
Change-Id: Ife368bca4349d4adeb0666db590356196b4fbd63
2019-04-16 12:31:00 -07:00
Christopher Ferris
8189e77bbb Remove gMallocLeakZygoteChild.
Remove this global variable and change the setting of it to non-zero
to a call to android_mallopt.

In addition, change the initialize function to use pass a bool* instead of
int*.

Bug: 130028357

Test: Ran malloc_debug/malloc_hooks/perfetto tests.
Change-Id: I20d382bdeaaf38aac6b9dcabea5b3dfab3c945f6
Merged-In: I20d382bdeaaf38aac6b9dcabea5b3dfab3c945f6
(cherry picked from commit 5225b342f0)
2019-04-16 11:22:06 -07:00
Elliott Hughes
b9a7c651f1 Merge "libc: generate syscall stubs in one big file..." 2019-04-16 15:43:24 +00:00
Elliott Hughes
d67b03734d libc: generate syscall stubs in one big file...
...all the better to switch to a genrule rather than checking in
generated source.

This also removes all the code in the script to deal with git,
rather than fix it. We won't need that where we're going.

Test: boots
Change-Id: I468ce019d4232a7ef27e5cb5cfd89f4c2fe4ecbd
2019-04-16 00:54:11 +00:00
Daniel Mentz
f7f5ba4cde Merge changes I48210ea1,I5f717dd1
* changes:
  clean_header: Run outside of $ANDROID_BUILD_TOP
  clean_header: Fix error handling for no-such-file case
2019-04-16 00:47:37 +00:00
Daniel Mentz
d12d6f67bc clean_header: Run outside of $ANDROID_BUILD_TOP
Enable the use case where we run clean_header.py from outside of
$ANDROID_BUILD_TOP. Previously, this script required the current working
directory to be under $ANDROID_BUILD_TOP. Running it from a different
directory resulted in the following error message:

 clean_header.py: error: Not in android tree pointed at by ANDROID_BUILD_TOP (....)

Change-Id: I48210ea1a0033228a9aaa4124d28247b07cee6d4
2019-04-15 15:19:31 -07:00
Daniel Mentz
6d6b4cedd1 clean_header: Fix error handling for no-such-file case
The function cleanupFile should always return a single value (as opposed
to a tuple or list). In addition, if it encounters an error, it is
expected to return a value that evaluates to False. As it stands,
however, it returns (None, None) in certain error cases. Change this
function to return None, in those cases.

We previously saw the following error message, when we tried to run
clean_header.py on a non-existent file.

Traceback (most recent call last):
  File "clean_header.py", line 208, in <module>
    b.updateGitFiles()
  File "utils.py", line 164, in updateGitFiles
    self._writeFile(dst)
  File "utils.py", line 136, in _writeFile
    f.write(self.new_data[dst])
TypeError: expected a string or other character buffer object

Change-Id: I5f717dd1a4388f598f0fd4bfd5e6129017de9095
2019-04-15 15:03:39 -07:00
Treehugger Robot
9586c0f4f4 Merge "Move kernel README files to Markdown." 2019-04-12 03:11:30 +00: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
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
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