Commit graph

33344 commits

Author SHA1 Message Date
Ryan Prichard
e9eae51539 Merge "Put __*_ARRAY__ symbols before prioritized init/fini funcs" 2020-11-03 22:19:57 +00:00
Elliott Hughes
718a5fd73e Merge "Add a couple of demangler tests." 2020-11-03 18:40:34 +00:00
Matthew Maurer
de30635eb6 Put __*_ARRAY__ symbols before prioritized init/fini funcs
A constructor or destructor function with an integral priority is
placed in an .init_array or .fini_array section with the priority
suffixed to the section name:
 - __attribute__((constructor)) ==> .init_array
 - __attribute__((constructor(42))) ==> .init_array.42

The suffixed init/fini sections appear before the unsuffixed sections,
so the prioritized functions appeared before the __{INIT,FINI}_ARRAY__
symbols and were dropped when the symbols were used.

The (static) linker doesn't recognize priority suffixes on
.preinit_array.

This bug affected .init_array and .fini_array for static executables.
For dynamic executables, only .fini_array was affected, because
.init_array is handled by the dynamic loader instead, which uses
DT_INIT_ARRAY[SZ]. For DSOs, neither is affected, because the two
sections are only handled by the dynamic loader.

This patch also fixes a minor inconsistency where dynamic init/preinit
were passed argc/argv/envp, but static were not.

Bug: http://b/170983066
Test: bionic-unit-tests
Change-Id: I0fffa776e5d9bdb6f8af06b4c1af148236742fef
2020-11-02 17:28:41 -08:00
Elliott Hughes
413817f69c Add a couple of demangler tests.
Bug: http://b/152588929
Test: treehugger
Change-Id: I4528e464f969e9167d459f292b179d14381d0f2e
2020-11-02 20:46:19 +00:00
Elliott Hughes
0c2350413e Merge "Docs: link to the unwinder docs." 2020-11-02 20:09:01 +00:00
Elliott Hughes
0427760a54 Docs: link to the unwinder docs.
Since (a) they're not a README.md and (b) they moved git project
recently, it's really hard to find these docs even if you know they
exist, which no-one does.

Test: N/A
Change-Id: Ic12e47ef5eb09e692ac0974b1d33bc5dc83d1028
2020-10-30 16:36:16 -07:00
Treehugger Robot
10c2875934 Merge "getgrnam, getgrgid, getpwnam, getpwuid for host" 2020-10-29 23:53:50 +00:00
Yifan Hong
02bee7182e Merge "Make vendor_ramdisk_available." 2020-10-29 17:17:29 +00:00
Jiyong Park
bf383283d9 getgrnam, getgrgid, getpwnam, getpwuid for host
The functions now read /etc/group and /etc/passwd on host machines.
Android-specific IDs are not recognized in the host.

getpwent and getgrent are still not working though. They require a
bigger refactoring to sequentially advance in the database files.

Bug: 171718702
Test: run assemble_cvd in aosp_cf_arm64_phone
Change-Id: Ie8da382a467bbd0bffac7b4b8592cd871db80181
2020-10-29 07:52:54 +09:00
Yifan Hong
b04490d7e5 Make vendor_ramdisk_available.
Test: pass
Bug: 156098440
Change-Id: I8fe2deb8fa3b24c227202be02d8af648629cffeb
2020-10-27 17:06:45 -07:00
Treehugger Robot
c3ecfb623f Merge "system(3) uses /bin/sh when built for host" 2020-10-26 19:28:27 +00:00
Elliott Hughes
40aed73b5f Merge "Add DoNotOptimize and use it in tests." 2020-10-26 16:19:05 +00:00
Jiyong Park
8dd649deac system(3) uses /bin/sh when built for host
/system/bin/sh exists only on Android. When Bionic is built for the
host, use the standard /bin/sh.

Bug: 159685774
Test: run aosp_cf_arm64_phone on rockpi4
Change-Id: Idf4028c134abc128f203fc4d3be591f06b8fe8ff
2020-10-26 22:02:53 +09:00
Colin Cross
c44b1d0676 Merge "Make the connection between implementation and llndk_library explicit" 2020-10-23 18:09:42 +00:00
Treehugger Robot
c5617a4be7 Merge "Make more use of benchmark::DoNotOptimize in benchmarks." 2020-10-23 16:34:13 +00:00
Martin Stjernholm
d88c8eb6b0 Merge "Rename ART release APEX to com.android.art." 2020-10-23 10:03:24 +00:00
Elliott Hughes
e8693e7871 Make more use of benchmark::DoNotOptimize in benchmarks.
A lot of these benchmarks predate DoNotOptimize and rolled their own
hacks.

Bug: http://b/148307629
Test: ran benchmarks before & after and got similar results
Change-Id: If44699d261b687f6253af709edda58f4c90fb285
2020-10-22 13:43:59 -07:00
Elliott Hughes
7cda75f1d3 Add DoNotOptimize and use it in tests.
Bug: http://b/148307629
Test: treehugger
Change-Id: I3b1726ae55116f6553ea38fe163abdde179c21f0
2020-10-22 13:22:35 -07:00
Christopher Ferris
9aa6b15d79 Merge "Update to v5.9 kernel headers." 2020-10-22 00:54:16 +00:00
Martin Stjernholm
81c260d34b Rename ART release APEX to com.android.art.
Test: See https://r.android.com/1457217
Bug: 169639321
Change-Id: I71c75987ebfb1196d63f452945c5d387f2976d86
Merged-In: I71c75987ebfb1196d63f452945c5d387f2976d86
2020-10-21 15:41:02 +01:00
Ryan Prichard
72b1aaf68e Merge "Fix __cxa_atexit run-time regression with many registrations" 2020-10-21 00:44:50 +00:00
Peter Kalauskas
3f09b0ac2e Merge "Update module name referenced in README.md" 2020-10-20 17:17:29 +00:00
Treehugger Robot
38940f17ac Merge "Replace libandroidicu usage in bionic with the new libicu.so available in NDK" 2020-10-20 17:04:01 +00:00
Victor Chang
c0d50d4a37 Replace libandroidicu usage in bionic with the new libicu.so available in NDK
Bug: 160350521
Test: atest CtsBionicTestCases
Change-Id: Id5fa76872ec295674eb1bed3b66e037a04fe6bf8
2020-10-20 15:44:20 +01:00
Ryan Prichard
de523c02bb Fix __cxa_atexit run-time regression with many registrations
When an array element is added or removed, make only the relevant page
writable, rather than the entire array. The entire array is still made
writable during recompaction and expansion.

This change fixes most of a large regression in __cxa_atexit runtime
(blueline, taskset 10, performance governor, 100000 registrations,
times are in seconds)
 - Q: _Exit=0.292380, exit=0.626801
 - R: _Exit=28.435082, exit=95.785110
 - new: _Exit=0.352285, exit=0.713893

Test: bionic unit tests
Test: adb shell taskset 10 \
  /data/benchmarktest64/bionic-spawn-benchmarks/bionic-spawn-benchmarks \
  --benchmark_filter='atexit' \
  --benchmark_display_aggregates_only=true \
  --benchmark_repetitions=10
Bug: http://b/168043760
Change-Id: I88cc15c29c9890b422b7f621f29f98a03ca1f886
2020-10-20 01:10:33 -07:00
Ryan Prichard
b88edc6739 Merge "Add __cxa_atexit benchmark" 2020-10-20 04:03:50 +00:00
Kiyoung Kim
6dc330a714 Merge "Update linkerconfig configuration format" 2020-10-20 00:23:58 +00:00
Christopher Ferris
25c18d45cf Update to v5.9 kernel headers.
Kernel headers coming from:

Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-5.9

Test: Boots cuttlefish 64bit, passes 32 bit and 64 bit bionic unit tests.
Change-Id: Ib5503355b238ea75595538e63eb000c867d06ef7
2020-10-19 15:48:58 -07:00
Colin Cross
8393a8bc84 Make the connection between implementation and llndk_library explicit
Instead of assuming a module with the .llndk suffix exists, add an
llndk_stubs property to every cc_library module that has a
corresponding llndk_library.  Also rename the llndk_library to have
an explicit .llndk suffix.

Bug: 170784825
Test: no changes to build.ninja (excluding comments) or Android-${TARGET_PRODUCT}.mk
Change-Id: Ib5453472a09ebc64818ceb69bcbe1184720ce86a
2020-10-19 13:37:49 -07:00
Ryan Prichard
a3d41ee176 Add __cxa_atexit benchmark
The benchmark calls __cxa_atexit 100000 times, then either exits early
without calling the destructors (_Exit) or exits normally, calling them
(exit).

Test: mmma bionic/benchmarks/spawn
Change-Id: I41fe702d6ef11acb7a1dec95bf546b5dc693bd4a
2020-10-16 17:55:54 -07:00
Baligh Uddin
bb34f8ddd3 Merge "Fix visibility rules." am: 8c8d3e7288
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1455917

Change-Id: I25a1ffae570aa9605feeeae92d5656ece072f071
2020-10-16 16:51:16 +00:00
Baligh Uddin
8c8d3e7288 Merge "Fix visibility rules." 2020-10-16 15:49:44 +00:00
Baligh Uddin
db0c6deed6 Fix visibility rules.
BUG: 163786882
Test: Local build + TH
Change-Id: I788af6cf17ebee1fa5001768389a2c8b855c3534
2020-10-16 15:46:59 +00:00
Lev Rumyantsev
c7484205c2 Merge "Make more functions weak for native bridge" am: cf878313b0
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1459742

Change-Id: I33410ba3d38f3c18df50211cb0010c7e0303ed18
2020-10-16 00:49:56 +00:00
Lev Rumyantsev
cf878313b0 Merge "Make more functions weak for native bridge" 2020-10-15 23:58:14 +00:00
Treehugger Robot
1c86687153 Merge "pthread_cond: only call futex_wake when there are waiters" am: ddbcea2c11
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1462542

Change-Id: I1efe83a837331797e9eae0132e7d1f5b5e30e705
2020-10-15 21:19:45 +00:00
Treehugger Robot
ddbcea2c11 Merge "pthread_cond: only call futex_wake when there are waiters" 2020-10-15 20:11:00 +00:00
Vy Nguyen
5d926baab8 Merge "Fix bug in finding another thread's TCB." am: e4f7c6d70b
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1419435

Change-Id: I6d7cea931fcf1b0b5d3576b8fca4cb2e7e9dfae3
2020-10-15 17:46:13 +00:00
Vy Nguyen
e4f7c6d70b Merge "Fix bug in finding another thread's TCB." 2020-10-15 17:20:47 +00:00
Tim Murray
9c08f4fecc pthread_cond: only call futex_wake when there are waiters
pthread_cond_pulse would unconditionally call futex, which meant that
a number of processes were spending a significant amount of time in
pthread_cond_broadcast and pthread_cond_signal when there were no
threads waiting on that pthread_cond_t.

This change adds a counter to the 64-bit pthread_cond_t struct and
only calls futex() in cases where there is a nonzero waiter count. The
32-bit pthread_cond_t is unchanged due to compatibility reasons.

Test: no pthread_cond_broadcast/signal stacks without try_to_wake_up
in SurfaceFlinger
bug: 168831708

Change-Id: I105e1345cd2a3a75f98cd0acf316e790ba1716f0
2020-10-15 16:16:07 +00:00
Vy Nguyen
19f84868f4 Fix bug in finding another thread's TCB.
Change-Id: I06c86ca0c077b464fc6c9fbdf5b89889a26da5fb
2020-10-15 10:28:19 -04:00
Lev Rumyantsev
814f38fc28 Make more functions weak for native bridge
Test: CtsNetTestCases android.net.cts.DnsTest#testDnsWorks
Bug: 170665833
Change-Id: I83242e336f6ee5a0115252a12eddf9def26db90f
2020-10-13 17:03:15 -07:00
Peter Kalauskas
b5f8e03496 Update module name referenced in README.md
Test: atest-src google/perf/jank/UIBench/UIBench-Lock -v
Bug: 170349152

Change-Id: I0dfb9422b068952c6f4d506a8fbfa5316dbe9886
2020-10-12 16:48:36 -07:00
Steven Moreland
20ca28938a Merge changes from topic "I81ece86ace916eb6b435ab516cd431ec4b48a3bf" am: dcbc8ec29a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1449140

Change-Id: Ibda51d9f321b5bbb4860be054f83bbf7859bc8a3
2020-10-09 21:36:45 +00:00
Steven Moreland
dcbc8ec29a Merge changes from topic "I81ece86ace916eb6b435ab516cd431ec4b48a3bf"
* changes:
  Expose per-process memory init.
  Add an API for per-process disabling memory initialization.
2020-10-09 21:05:02 +00:00
Steven Moreland
0cdf132f84 Expose per-process memory init.
In order to disable memory initialization for a process, the following
command can be used:

    android_mallopt(M_DISABLE_MEMORY_MITIGATIONS, nullptr, 0);

Since this is needed in vendor processes, this is exposing this
functionality to llndk. For convenience (and adding standard logging),
a helper function is being added into libcutils in order to use this,
w/o having to get into so many details.

Bug: 166675194
Test: use function from libcutils
Change-Id: Ia816089a9f3469c50c70afaa7244abeac5a51dcd
2020-10-09 00:33:30 +00:00
Xin Li
69eb7bb510 Skip ab/6749736 in stage.
Merged-In: If2409b0a846f19071aff66bade9cc120a078bbbc
Change-Id: I9881c6c9053da31f4107b0b70b8c65fc1569f2ed
2020-10-08 17:19:18 -07:00
Peter Collingbourne
5d3aa86cd1 Add an API for per-process disabling memory initialization.
Introduce an android_mallopt(M_DISABLE_MEMORY_MITIGATIONS) API call
that may be used to disable zero- or pattern-init on non-MTE hardware,
or memory tagging on MTE hardware. The intent is that this function
may be called at any time, including when there are multiple threads
running.

Disabling zero- or pattern-init is quite trivial, we just need to set
a global variable to 0 via a Scudo API call (although there will be
some separate work required on the Scudo side to make this operation
thread-safe).

It is a bit more tricky to disable MTE across a process, because
the kernel does not provide an API for disabling tag checking in all
threads in a process, only per-thread. We need to send a signal to each
of the process's threads with a handler that issues the required prctl
call, and lock thread creation for the duration of the API call to
avoid races between thread enumeration and calls to pthread_create().

Bug: 135772972
Change-Id: I81ece86ace916eb6b435ab516cd431ec4b48a3bf
2020-10-08 14:02:36 -07:00
Kiyoung Kim
2d4bbf2415 Update linkerconfig configuration format
Update linkerconfig configuration format as json.

Bug: 169634881
Test: cuttelfish boot succeeded
Change-Id: I297ffc9e5c8d8916b2e7e0b3e837b6b82247401b
2020-10-06 17:28:19 +09:00
Evgeny Eltsin
90e8c9700c Merge "Mark __progname as weak for native_bridge" am: 08a43426a0
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1446695

Change-Id: I48bfede0722124372e275a40360b50c8285ed69e
2020-10-03 08:01:43 +00:00