OSDN Git Service

android-x86/bionic.git
2 years agoWe need text relocations r-x86
Chih-Wei Huang [Thu, 8 Mar 2018 04:30:36 +0000 (12:30 +0800)]
We need text relocations

Don't show annoying warnings.

2 years agoAdd syscalls ioperm and iopl
Chih-Wei Huang [Wed, 24 Aug 2016 14:58:24 +0000 (22:58 +0800)]
Add syscalls ioperm and iopl

2 years agolinker: Allow text-relocs for x86 (only)
Christopher R. Palmer [Sun, 7 Feb 2016 11:46:05 +0000 (06:46 -0500)]
linker: Allow text-relocs for x86 (only)

This effectively reverts

https://android.googlesource.com/platform/bionic/+/e4ad91f86a47b39612e030a162f4793cb3421d31%5E%21/#F0

for x86 platforms.  Unfortunately, this seems like it is required
if we are going to support ffmpeg.  The ffmpeg team decreed that they
require text relocations for x86 (only) and that they would not
fix the fact that android 6.0 makes ffmpeg unusable on x86:

https://trac.ffmpeg.org/ticket/4928

Change-Id: I68397f4d62f4f6acd8e0d41b7ecdc115969b890a

3 years agoSnap for 6952926 from 6aaff2a54df115dd12b5034d03a2c58c39e4881b to rvc-d2-release
android-build-team Robot [Thu, 5 Nov 2020 00:02:09 +0000 (00:02 +0000)]
Snap for 6952926 from 6aaff2a54df115dd12b5034d03a2c58c39e4881b to rvc-d2-release

Change-Id: I43ec97d5123405a4f786f1f09bff1a2414538f93

3 years agoFix __cxa_atexit run-time regression with many registrations
Ryan Prichard [Fri, 9 Oct 2020 12:08:36 +0000 (05:08 -0700)]
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
Merged-In: I88cc15c29c9890b422b7f621f29f98a03ca1f886
(cherry picked from commit de523c02bbea1923ee5fbe9d1d60a905f6e965b0)

3 years agoSnap for 6824415 from 087507107e7a5d352dbcd8bd5618b5f82bb160eb to rvc-d2-release
android-build-team Robot [Thu, 10 Sep 2020 03:47:55 +0000 (03:47 +0000)]
Snap for 6824415 from 087507107e7a5d352dbcd8bd5618b5f82bb160eb to rvc-d2-release

Change-Id: Ife829bbafbf0df55fef98b2661e2897d8cd4c55e

3 years agoFix OOB read in DNS resolver am: 43264bc365 am: c5ea7569a8 am: 2c2546b158 am: cf6b3ec...
Ken Chen [Sun, 30 Aug 2020 06:35:12 +0000 (06:35 +0000)]
Fix OOB read in DNS resolver am: 43264bc365 am: c5ea7569a8 am: 2c2546b158 am: cf6b3ecd4d am: 2820a9770e

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/12329970

Change-Id: Ic91c04263e75d739a43f3a92756981fb030559ce

3 years agoFix OOB read in DNS resolver am: 43264bc365 am: c5ea7569a8 am: 2c2546b158 am: cf6b3ecd4d
Ken Chen [Sun, 30 Aug 2020 06:01:55 +0000 (06:01 +0000)]
Fix OOB read in DNS resolver am: 43264bc365 am: c5ea7569a8 am: 2c2546b158 am: cf6b3ecd4d

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/12329970

Change-Id: I8a4388a793a26fb246529165c3e6338115cdaff9

3 years agoFix OOB read in DNS resolver am: 43264bc365 am: c5ea7569a8 am: 2c2546b158
Ken Chen [Sun, 30 Aug 2020 05:25:44 +0000 (05:25 +0000)]
Fix OOB read in DNS resolver am: 43264bc365 am: c5ea7569a8 am: 2c2546b158

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/12329970

Change-Id: I5e167b6717d7f90ba782e26ef553fb6d302b493a

3 years agoFix OOB read in DNS resolver am: 43264bc365 am: c5ea7569a8
Ken Chen [Sun, 30 Aug 2020 05:07:23 +0000 (05:07 +0000)]
Fix OOB read in DNS resolver am: 43264bc365 am: c5ea7569a8

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/12329970

Change-Id: I5a3ea0eb929c76e76be9a17264b7f1b6b04e9f8c

3 years agoFix OOB read in DNS resolver am: 43264bc365
Ken Chen [Sun, 30 Aug 2020 04:49:07 +0000 (04:49 +0000)]
Fix OOB read in DNS resolver am: 43264bc365

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/12329970

Change-Id: Ief989a779e7fea19a92fb90a863017ecdb1bc7a3

3 years agoSnap for 6792403 from 8860af56c35d2797a9ed934eb2fd1cb0f39f6130 to rvc-d2-release
android-build-team Robot [Wed, 26 Aug 2020 16:56:00 +0000 (16:56 +0000)]
Snap for 6792403 from 8860af56c35d2797a9ed934eb2fd1cb0f39f6130 to rvc-d2-release

Change-Id: Id412751918f046c754919a4f3a1d7d0d25f65f30

3 years agoasync_safe: don't call libc's socket.
Josh Gao [Thu, 20 Aug 2020 23:27:01 +0000 (16:27 -0700)]
async_safe: don't call libc's socket.

Like with close, socket is no longer a simple syscall, so we can get
recursive calls that deadlock.

Bug: http://b/165206592
Test: bionic-unit-tests on cuttlefish
Test: treehugger
Change-Id: I2ba77d733d1ebf08a91afd6ca179e7ae6ae3866e
(cherry picked from commit d37113311c9541876bf3e268f2cace272515a694)

3 years agoRemove stack address check in cfi_basic test. am: cc3c685b5f am: d43f9a8831 am: 99d9b...
Evgenii Stepanov [Tue, 11 Aug 2020 20:42:45 +0000 (20:42 +0000)]
Remove stack address check in cfi_basic test. am: cc3c685b5f am: d43f9a8831 am: 99d9bfa6b4

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/12347832

Change-Id: I91f6cb07ac87eb3f4f64fa748b57eb9444c3be7b

3 years agoRemove stack address check in cfi_basic test. am: cc3c685b5f am: d43f9a8831
Evgenii Stepanov [Tue, 11 Aug 2020 20:26:00 +0000 (20:26 +0000)]
Remove stack address check in cfi_basic test. am: cc3c685b5f am: d43f9a8831

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/12347832

Change-Id: I6601c7fbc627b71cffad0b9043926e45166b8ecd

3 years agoRemove stack address check in cfi_basic test. am: cc3c685b5f
Evgenii Stepanov [Tue, 11 Aug 2020 20:06:44 +0000 (20:06 +0000)]
Remove stack address check in cfi_basic test. am: cc3c685b5f

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/12347832

Change-Id: Iba89ecc4e8c5c453fa1c8f023c91c14cff5a0a44

3 years agoRemove stack address check in cfi_basic test.
Evgenii Stepanov [Mon, 20 Jul 2020 22:52:06 +0000 (15:52 -0700)]
Remove stack address check in cfi_basic test.

This is not actually a property that is guaranteed by the bionic
implementation of CFI shadow. Since the gaps between libraries are not
completely inaccessible, it is possible for a stack mapping to sneak in,
which would cause the callback to register in the test library.

This is not a correctness issue in CFI as the actual __cfi_check
callback will reject such address anyway, at a small CPU cost.

Bug: 156218352
Test: CtsBionicTestCases-cfi_test#basic
Change-Id: I8d04fb7132e1eac2a8abfbc48a37c8eac6e25a09
Merged-In: I8d04fb7132e1eac2a8abfbc48a37c8eac6e25a09
(cherry picked from commit 0f6b504e0c682e7c3d377416dacfe57b6c59f1b8)

3 years agoFix OOB read in DNS resolver
Ken Chen [Fri, 7 Aug 2020 11:04:25 +0000 (19:04 +0800)]
Fix OOB read in DNS resolver

The remote server specifies resplen, the length of the response it
intends to send. anssiz represents the size of the destination buffer.
If the reported resplen is larger than the anssiz, the code correctly
only reads up to anssiz bytes, but returns resplen. so later functions
will access far out of bounds.

The fix ensures that the length of send_vc return does not exceed the
buffer size.

Bug: 161362564
Test: build, flash, boot
Test: atest netd_integration_test
Merged-In: Id4b5df1be4652e4623847b0b0bad0af65b80fdd5
Change-Id: Id4b5df1be4652e4623847b0b0bad0af65b80fdd5

3 years agoSnap for 6741352 from d10da4eb3006271484986246483bcc330ce0458d to rvc-d2-release
android-build-team Robot [Thu, 6 Aug 2020 07:26:10 +0000 (07:26 +0000)]
Snap for 6741352 from d10da4eb3006271484986246483bcc330ce0458d to rvc-d2-release

Change-Id: If92ee1a0164b598d6b2dc1e2953385f5623d5c6e

3 years agoAdd support for new scudo mallopt options. am: 44f0faa247
Christopher Ferris [Tue, 4 Aug 2020 17:05:41 +0000 (17:05 +0000)]
Add support for new scudo mallopt options. am: 44f0faa247

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/12296260

Change-Id: I7e699a3e8f232aea5de4270ab4eca2e8f58d7f8d

3 years agoAdd support for new scudo mallopt options.
Christopher Ferris [Tue, 28 Jul 2020 21:15:31 +0000 (14:15 -0700)]
Add support for new scudo mallopt options.

Bug: 162092537

Test: Ran new unit tests.
Change-Id: I4b7d17a9e98166c03cd153eb9e9d847693914ea3
Merged-In: I4b7d17a9e98166c03cd153eb9e9d847693914ea3
(cherry picked from commit 8844879212852a70918df1c9ebcac4d574f1fcd9)

3 years agoResolve interface flags using SIOCGIFFLAGS ioctl am: 3a5a22d607 am: 4f4ad63a64
Bram Bonné [Fri, 24 Jul 2020 21:35:45 +0000 (21:35 +0000)]
Resolve interface flags using SIOCGIFFLAGS ioctl am: 3a5a22d607 am: 4f4ad63a64

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/12216903

Change-Id: I1606ca60ef6cb6d5d259d93d91e8f22f8bf39b8b

3 years agoResolve interface flags using SIOCGIFFLAGS ioctl am: 3a5a22d607
Bram Bonné [Fri, 24 Jul 2020 21:24:07 +0000 (21:24 +0000)]
Resolve interface flags using SIOCGIFFLAGS ioctl am: 3a5a22d607

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/12216903

Change-Id: I883aa15f40106cb7b3ed44eb395fd5018b48a8ae

3 years agoResolve interface flags using SIOCGIFFLAGS ioctl
Bram Bonné [Mon, 20 Jul 2020 09:18:03 +0000 (11:18 +0200)]
Resolve interface flags using SIOCGIFFLAGS ioctl

Normally, getifaddrs() gets its information about interface flags from
RTM_NEWLINK messages. With the ability for non-system apps to send
RTM_GETLINK messages going away, resolve these flags by performing a
SIOCGIFFLAGS ioctl call instead.

This fixes a bug where the flags were erroneously copied over from an
ifaddrmsg's ifa_flags.

Bug: 141455849
Bug: 161869825
Test: atest bionic-unit-tests-static
Test: Connect to wireless network.
Test: Call getifaddrs() from a non-system app targeting API R+, verify
that the interface flags are correct.

Change-Id: I552f3b9d21072f59ee6f0890f47cb1bdf3cfcf20

3 years agoDon't test pw_shell for old vendor images am: 4785c13549 am: a7985e0324
Tom Cherry [Mon, 13 Jul 2020 17:01:37 +0000 (17:01 +0000)]
Don't test pw_shell for old vendor images am: 4785c13549 am: a7985e0324

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/12133446

Change-Id: I5a729a381d01dda260c43392f33c84d4ab11b598

3 years agoDon't test pw_shell for old vendor images am: 4785c13549
Tom Cherry [Mon, 13 Jul 2020 16:50:20 +0000 (16:50 +0000)]
Don't test pw_shell for old vendor images am: 4785c13549

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/12133446

Change-Id: I2b6934bd1a142553c215ef5343984b562985f2d6

3 years agoDon't test pw_shell for old vendor images
Tom Cherry [Fri, 10 Jul 2020 17:40:21 +0000 (10:40 -0700)]
Don't test pw_shell for old vendor images

R GSI on P product tests fail since pw_shell has changed.  This value
has no practical use on Android, so we ignore testing it for older
vendor images.

Bug: 160937247
Test: this test does/doesn't run appropriately
Merged-In: Ie485bd019b3826e71ad19131effcbb002f888d52
Change-Id: Ie485bd019b3826e71ad19131effcbb002f888d52
(cherry picked from commit b9fa04d805912d58d920ccd1a7af77daf81293e7)

4 years agoMove set_cached_pid() to __clone_for_fork() am: c8c3bc58a1 am: 936dc784c8
Lev Rumyantsev [Tue, 9 Jun 2020 23:21:36 +0000 (23:21 +0000)]
Move set_cached_pid() to __clone_for_fork() am: c8c3bc58a1 am: 936dc784c8

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/11800686

Change-Id: Id373e1024fae0aef271b7655413567a31e026781

4 years agoRemove WEAK_FOR_NATIVE_BRIDGE for fork am: 8b26ca4164 am: a4c0e31906
Lev Rumyantsev [Tue, 9 Jun 2020 23:21:33 +0000 (23:21 +0000)]
Remove WEAK_FOR_NATIVE_BRIDGE for fork am: 8b26ca4164 am: a4c0e31906

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/11800685

Change-Id: I29ac82e06198fd2ef4e2e354a00624c6cf2ed802

4 years agoMove set_cached_pid() to __clone_for_fork() am: c8c3bc58a1
Lev Rumyantsev [Tue, 9 Jun 2020 23:05:28 +0000 (23:05 +0000)]
Move set_cached_pid() to __clone_for_fork() am: c8c3bc58a1

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/11800686

Change-Id: Id7c4ee7687e98340fb99c1974e6c3872594aed55

4 years agoRemove WEAK_FOR_NATIVE_BRIDGE for fork am: 8b26ca4164
Lev Rumyantsev [Tue, 9 Jun 2020 23:05:26 +0000 (23:05 +0000)]
Remove WEAK_FOR_NATIVE_BRIDGE for fork am: 8b26ca4164

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/11800685

Change-Id: Iaa834bc6dfef109de45960757d37b005bfecf942

4 years agoMove set_cached_pid() to __clone_for_fork()
Lev Rumyantsev [Tue, 2 Jun 2020 01:43:55 +0000 (18:43 -0700)]
Move set_cached_pid() to __clone_for_fork()

Bug: 145028007
Test: bionic-unit-tests
Merged-In: I3c697924f2a3ef1804a688dd1fe9669f6b7a71bf
Change-Id: I3c697924f2a3ef1804a688dd1fe9669f6b7a71bf
(cherry picked from commit 3a4c2ffff80402f6c250f1491302aa7d65411349)

4 years agoRemove WEAK_FOR_NATIVE_BRIDGE for fork
Lev Rumyantsev [Tue, 2 Jun 2020 01:43:55 +0000 (18:43 -0700)]
Remove WEAK_FOR_NATIVE_BRIDGE for fork

Bug: 145028007
Test: bionic-unit-tests
Merged-In: I0b019cd08c9d7426a953bd199f2ecd6dd42db00e
Change-Id: I0b019cd08c9d7426a953bd199f2ecd6dd42db00e
(cherry picked from commit 520398ffe90a45e2f2a85f56230055f9f2f6bf02)

4 years agoNarrow native bridge to clone_for_fork am: 018f4a1310 am: 589927296b
Lev Rumyantsev [Tue, 9 Jun 2020 21:11:03 +0000 (21:11 +0000)]
Narrow native bridge to clone_for_fork am: 018f4a1310 am: 589927296b

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/11800684

Change-Id: I81c54a1a5b693b107c639579772510a857418de9

4 years agoNarrow native bridge to clone_for_fork am: 018f4a1310
Lev Rumyantsev [Tue, 9 Jun 2020 21:00:24 +0000 (21:00 +0000)]
Narrow native bridge to clone_for_fork am: 018f4a1310

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/11800684

Change-Id: I5074c3f3cfea929c7c4f6c592cfae01b3ecf4361

4 years agoNarrow native bridge to clone_for_fork
Lev Rumyantsev [Tue, 2 Jun 2020 01:43:55 +0000 (18:43 -0700)]
Narrow native bridge to clone_for_fork

We are removing native bridge copy of fork.cpp, but need to
replace call to clone() when it's done for bionic's fork.

The code here will run all pre-/post-clone routines for *guest*,
while native bridge implementation will need to run the
corresponding *host* routines.

Bug: 145028007
Test: bionic-unit-tests
Merged-In: Ic5524e743caa287d7aaa8dc7e5d34acd1c7e1170
Change-Id: Ic5524e743caa287d7aaa8dc7e5d34acd1c7e1170
(cherry picked from commit 41127dca3d08e5eb350b678ee03eae30ab779921)

4 years agoUse PROT_NONE on the unused parts of CFI shadow. am: c3b3e869ce am: bca71db10d
Evgenii Stepanov [Mon, 8 Jun 2020 20:09:57 +0000 (20:09 +0000)]
Use PROT_NONE on the unused parts of CFI shadow. am: c3b3e869ce am: bca71db10d

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/11760912

Change-Id: I4cb258a190f0e70d57ac36646800f74665e27855

4 years agoUse PROT_NONE on the unused parts of CFI shadow. am: c3b3e869ce
Evgenii Stepanov [Mon, 8 Jun 2020 19:58:00 +0000 (19:58 +0000)]
Use PROT_NONE on the unused parts of CFI shadow. am: c3b3e869ce

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/11760912

Change-Id: I53474581958ab2de4beea417c59d60ef891f5c7c

4 years agoUse PROT_NONE on the unused parts of CFI shadow.
Evgenii Stepanov [Fri, 5 Jun 2020 23:50:10 +0000 (16:50 -0700)]
Use PROT_NONE on the unused parts of CFI shadow.

This replaces a single 2Gb readable memory region with a bunch of tiny
regions, and leaves the bulk of 2Gb mapped but unaccessible. This makes
it harder to defeat ASLR by probing for the CFI shadow region.

Sample CFI shadow mapping with this change:
7165151000-716541f000 ---p 00000000 00:00 0                              [anon:cfi shadow]
716541f000-7165420000 r--p 00000000 00:00 0                              [anon:cfi shadow]
7165420000-71654db000 ---p 00000000 00:00 0                              [anon:cfi shadow]
71654db000-71654dc000 r--p 00000000 00:00 0                              [anon:cfi shadow]
71654dc000-71654dd000 r--p 00000000 00:00 0                              [anon:cfi shadow]
71654dd000-71654f0000 ---p 00000000 00:00 0                              [anon:cfi shadow]
71654f0000-71654f1000 r--p 00000000 00:00 0                              [anon:cfi shadow]
71654f1000-71e5151000 ---p 00000000 00:00 0                              [anon:cfi shadow]

This change degrades CFI diagnostics for wild jumps and casts (i.e. when
the target of a CFI check is outside of any known library bounds). This
is acceptable, because CFI does not have much to tell about those cases
anyway. Such bugs will show up as SEGV_ACCERR crashes inside
__cfi_slowpath in libdl.so from now on.

Bug: 158113540
Test: bionic-unit-tests/cfi_test.*
Test: adb shell cat /proc/$PID/maps | grep cfi

Change-Id: I57cbd0d3f87eb1610ad99b48d98ffd497ba214b4

4 years agoHandle the alternate signal stack correctly in android_unsafe_frame_pointer_chase...
Peter Collingbourne [Wed, 3 Jun 2020 19:03:13 +0000 (19:03 +0000)]
Handle the alternate signal stack correctly in android_unsafe_frame_pointer_chase. am: 91740684c2 am: 5c5aef1c0b

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/11720548

Change-Id: Ifc50f48fef92bed91998cf59f43b5657e2c0d26a

4 years agoHandle the alternate signal stack correctly in android_unsafe_frame_pointer_chase...
Peter Collingbourne [Wed, 3 Jun 2020 18:39:38 +0000 (18:39 +0000)]
Handle the alternate signal stack correctly in android_unsafe_frame_pointer_chase. am: 91740684c2

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/11720548

Change-Id: I46c15e323c1f5a14c8491e628c8be3167c3073f3

4 years agoHandle the alternate signal stack correctly in android_unsafe_frame_pointer_chase.
Peter Collingbourne [Thu, 27 Feb 2020 03:01:13 +0000 (19:01 -0800)]
Handle the alternate signal stack correctly in android_unsafe_frame_pointer_chase.

If an alternate signal stack is set and the frame record is in bounds of
that stack, we need to use the top of the alternate signal stack for bounds
checking rather than the normal stack.

Bug: 150215618
Change-Id: I78b760d61b27da44f8e0cfee3fe94a791011fe58
Merged-In: I78b760d61b27da44f8e0cfee3fe94a791011fe58

4 years agoCopy translateSystemPathToApexPath to linker_translate_path.cpp am: eb6c7abdf9 am...
Victor Khimenko [Mon, 1 Jun 2020 18:24:06 +0000 (18:24 +0000)]
Copy translateSystemPathToApexPath to linker_translate_path.cpp am: eb6c7abdf9 am: 4f143b9f3d

Change-Id: If176bdccfdda0f435fe79d7ac1066b10429ea6ac

4 years agoAllow native_bridge linker to use different APEX from native one am: ccf160244c am...
Victor Khimenko [Mon, 1 Jun 2020 18:24:02 +0000 (18:24 +0000)]
Allow native_bridge linker to use different APEX from native one am: ccf160244c am: 396f91543d

Change-Id: Ifc531f05f5310536cfbb048bd1f36c3b35dae2b1

4 years agoCopy translateSystemPathToApexPath to linker_translate_path.cpp am: eb6c7abdf9
Victor Khimenko [Mon, 1 Jun 2020 17:55:50 +0000 (17:55 +0000)]
Copy translateSystemPathToApexPath to linker_translate_path.cpp am: eb6c7abdf9

Change-Id: Ifd4a6e0f9442708a9f0d33808818b005c4ff4819

4 years agoAllow native_bridge linker to use different APEX from native one am: ccf160244c
Victor Khimenko [Mon, 1 Jun 2020 17:55:48 +0000 (17:55 +0000)]
Allow native_bridge linker to use different APEX from native one am: ccf160244c

Change-Id: Ie10e352cebd6466dc69a126924440ef8ffc8ccfe

4 years agoCopy translateSystemPathToApexPath to linker_translate_path.cpp
Victor Khimenko [Thu, 14 May 2020 20:14:45 +0000 (22:14 +0200)]
Copy translateSystemPathToApexPath to linker_translate_path.cpp

Bug: http://b/156397945

Test: m

Merged-In: I33f11b8a6a41475b6cdd65e1ff49b2084c33b197
Change-Id: I33f11b8a6a41475b6cdd65e1ff49b2084c33b197
(cherry picked from commit d15229df76e78337532c19d42c01b2c51db8f2f1)

4 years agoAllow native_bridge linker to use different APEX from native one
Victor Khimenko [Tue, 12 May 2020 20:59:04 +0000 (22:59 +0200)]
Allow native_bridge linker to use different APEX from native one

Bug: http://b/156397945

Test: dlfcn.dlopen_system_libicuuc_android_api_level_28 with native_bridge

Merged-In: I3ecd929a0c31dda8cd424795f21f6ef472776557
Change-Id: I3ecd929a0c31dda8cd424795f21f6ef472776557
(cherry picked from commit 01790fdc6928a34125f092bbf98e9217a2251fa5)

4 years agoIgnore SCUDO_OPTIONS across a security boundary. am: 2082446f8a am: 07de2f8f09
Christopher Ferris [Wed, 27 May 2020 03:45:20 +0000 (03:45 +0000)]
Ignore SCUDO_OPTIONS across a security boundary. am: 2082446f8a am: 07de2f8f09

Change-Id: I4466a0b40bd70c8f6856b3382af86d2a4cfe7bfd

4 years agoIgnore SCUDO_OPTIONS across a security boundary. am: 2082446f8a
Christopher Ferris [Wed, 27 May 2020 03:31:22 +0000 (03:31 +0000)]
Ignore SCUDO_OPTIONS across a security boundary. am: 2082446f8a

Change-Id: Ie38e25c059189b0a14d7e502493645f76009013b

4 years agoIgnore SCUDO_OPTIONS across a security boundary.
Christopher Ferris [Tue, 26 May 2020 18:14:17 +0000 (11:14 -0700)]
Ignore SCUDO_OPTIONS across a security boundary.

Add SCUDO_OPTIONS to the list of the environment variables that should
not be preserved across a security boundary.

Bug: 157484128

Test: Builds and boots.
Change-Id: Id8644608114ad2fd49baedbdbbe1c899768bd54d
(cherry picked from commit ad3be7e649e755c0895dbae378a5c88ae3bddb90)

4 years agoFix deadlock/timeout in thread unwinding. am: 73ca781f43 am: 1fddcc5c18
Christopher Ferris [Thu, 21 May 2020 21:45:25 +0000 (21:45 +0000)]
Fix deadlock/timeout in thread unwinding. am: 73ca781f43 am: 1fddcc5c18

Change-Id: I93cfa420a1ee8995bb18fbf4d46c56254b4ce55b

4 years agoFix deadlock/timeout in thread unwinding. am: 73ca781f43
Christopher Ferris [Thu, 21 May 2020 21:22:51 +0000 (21:22 +0000)]
Fix deadlock/timeout in thread unwinding. am: 73ca781f43

Change-Id: I3fb995a7cf99bba28c8fc4e6ad43f50db01ca2c7

4 years agoFix deadlock/timeout in thread unwinding.
Christopher Ferris [Wed, 20 May 2020 22:37:30 +0000 (15:37 -0700)]
Fix deadlock/timeout in thread unwinding.

When malloc debug is enabled, using libbacktrace to unwind can
result in a deadlock. This happens when an unwind of a thread
is occuring which triggers a signal to be sent to that thread. If
that thread is interrupted while a malloc debug function is
executing and owns a lock, that thread is then stuck in the signal
handler. Then the original unwinding thread attempts to do an
allocation and gets stuck waiting for the same malloc debug lock.

This is not a complete deadlock since the unwinder has timeouts,
but it results in truncated unwinds that take at least five
seconds to complete.

Only the backtrace signals needs to be blocked because it is the only
known signal that will result in a thread being paused in a signal
handler.

Also, added a named signal in the reserved signal list for the
special bionic backtrace signal.

Bug: 150833265

Test: New unit tests pass with fix, fail without fix.
Change-Id: If3e41f092ebd40ce62a59ef51d636a91bc31ed80
(cherry picked from commit 9bf7817dd29d15ea49c88436db4067d87fc7e6c4)

4 years agoMerge "Revert "[GWP-ASan] Don't intercept calloc."" into rvc-d1-dev am: 8749470524
TreeHugger Robot [Mon, 18 May 2020 17:26:16 +0000 (17:26 +0000)]
Merge "Revert "[GWP-ASan] Don't intercept calloc."" into rvc-d1-dev am: 8749470524

Change-Id: I52349980c528046d513a0fc09c7fc745901930a1

4 years agoMerge "Revert "[GWP-ASan] Don't intercept calloc."" into rvc-d1-dev
TreeHugger Robot [Mon, 18 May 2020 17:12:06 +0000 (17:12 +0000)]
Merge "Revert "[GWP-ASan] Don't intercept calloc."" into rvc-d1-dev

4 years agoRevert "[GWP-ASan] Don't intercept calloc."
Mitch Phillips [Mon, 18 May 2020 15:22:48 +0000 (15:22 +0000)]
Revert "[GWP-ASan] Don't intercept calloc."

This reverts commit 76ce32657d0917244845a51af2075cf124015da9.

Bug: 154618758
Change-Id: Ie638560454495bd3d0b26376def9930bde0e33c2

4 years agoMerge "Speed up seccomp with priority list." into rvc-dev am: 53a9db72cc am: 9dd5086d6f
Bram Bonné [Mon, 18 May 2020 09:45:30 +0000 (09:45 +0000)]
Merge "Speed up seccomp with priority list." into rvc-dev am: 53a9db72cc am: 9dd5086d6f

Change-Id: Ic69ca669e8bfdd95e04fae013226f6bda2cb9e26

4 years agoMerge "Speed up seccomp with priority list." into rvc-dev am: 53a9db72cc
Bram Bonné [Mon, 18 May 2020 09:34:30 +0000 (09:34 +0000)]
Merge "Speed up seccomp with priority list." into rvc-dev am: 53a9db72cc

Change-Id: I4b779e7f832d456c82f76c9ace23ff2431a9e200

4 years agoMerge "Speed up seccomp with priority list." into rvc-dev
Bram Bonné [Mon, 18 May 2020 09:22:19 +0000 (09:22 +0000)]
Merge "Speed up seccomp with priority list." into rvc-dev

4 years agoSpeed up seccomp with priority list.
Bram Bonné [Wed, 6 May 2020 11:49:55 +0000 (13:49 +0200)]
Speed up seccomp with priority list.

Allow to provide a list of prioritized syscalls (e.g., syscalls that we
know occur often) which are checked before other syscalls in seccomp.

When constructing the bpf seccomp filter, traverse prioritized syscalls
in a linear list before checking all other syscalls in a binary tree.

Bug: 156732794
Test: make, inspect generated *_system_policy.cpp files
Test: simpleperf on futex/ioctl-heavy app seems to show 5-10% less time
spent in seccomp call

Change-Id: I509343bcd32ada90c0591785ab5cb12d2a38c31e

4 years agoSet min_sdk_version for mainline dependencies am: 01e19d2be8 am: 5dabdece6a
Jooyung Han [Wed, 13 May 2020 09:14:26 +0000 (09:14 +0000)]
Set min_sdk_version for mainline dependencies am: 01e19d2be8 am: 5dabdece6a

Change-Id: I83c686630a5e3067c5c5a9be6024d396d87ce93d

4 years agoSet min_sdk_version for mainline dependencies am: 01e19d2be8
Jooyung Han [Wed, 13 May 2020 09:02:25 +0000 (09:02 +0000)]
Set min_sdk_version for mainline dependencies am: 01e19d2be8

Change-Id: I70ff03d07223b36d268417057706b88f7e8143ea

4 years agoSet min_sdk_version for mainline dependencies
Jooyung Han [Thu, 16 Apr 2020 09:26:45 +0000 (18:26 +0900)]
Set min_sdk_version for mainline dependencies

To enforce all modules included in mainline modules(apex/apk),
modules should set min_sdk_version which is the minimum sdk versions
that compiled artifacts run against.

Setting this doesn't change build output.

(While cherry-picking s/29/apex_inherit)

Bug: 145796956
Test: m
Merged-In: Ibbe3771592677d729c81343fe00859c0afa81918
Change-Id: Ibbe3771592677d729c81343fe00859c0afa81918
(cherry picked from commit 15c32a8e1aa0f7754b5b25bb6c160b5d8b8b49c3)

4 years agofdtrack: don't do anything while vforked. am: 7501c6de1a am: 44c738fde5
Josh Gao [Tue, 12 May 2020 16:48:02 +0000 (16:48 +0000)]
fdtrack: don't do anything while vforked. am: 7501c6de1a am: 44c738fde5

Change-Id: I2adcc7e7d232431b054b1754b6ff11c8d22b70bb

4 years agofdsan: don't do anything when vforked. am: 1bf410b5f9 am: 41aeeefa3d
Josh Gao [Tue, 12 May 2020 16:48:00 +0000 (16:48 +0000)]
fdsan: don't do anything when vforked. am: 1bf410b5f9 am: 41aeeefa3d

Change-Id: Ibec75065b0e423176d4d4f4d9cc7e2a258c3db66

4 years agoTrack whether a thread is currently vforked. am: 5378351432 am: 5d09f1c9ba
Josh Gao [Tue, 12 May 2020 16:47:59 +0000 (16:47 +0000)]
Track whether a thread is currently vforked. am: 5378351432 am: 5d09f1c9ba

Change-Id: Ie5c4c61af44344de8682f796923fd518876928ec

4 years agofdtrack: don't do anything while vforked. am: 7501c6de1a
Josh Gao [Tue, 12 May 2020 16:36:16 +0000 (16:36 +0000)]
fdtrack: don't do anything while vforked. am: 7501c6de1a

Change-Id: I90fbeee6c17a54ac398c3b15b7d997cbd82efa37

4 years agofdsan: don't do anything when vforked. am: 1bf410b5f9
Josh Gao [Tue, 12 May 2020 16:36:14 +0000 (16:36 +0000)]
fdsan: don't do anything when vforked. am: 1bf410b5f9

Change-Id: Ibc0c7042c3485d96f4075cd2f5d0ba8021db90b2

4 years agoTrack whether a thread is currently vforked. am: 5378351432
Josh Gao [Tue, 12 May 2020 16:36:12 +0000 (16:36 +0000)]
Track whether a thread is currently vforked. am: 5378351432

Change-Id: I70d09823175a35cee7136594061d6c05c66cead9

4 years agofdtrack: don't do anything while vforked.
Josh Gao [Fri, 8 May 2020 02:43:38 +0000 (19:43 -0700)]
fdtrack: don't do anything while vforked.

Bug: http://b/153926671
Test: 32/64-bit bionic-unit-tests on blueline, x86_64 emulator
Change-Id: If42905f3d6a76ed70a45e5b9edd029ffd7789045
(cherry picked from commit 41291131284471eed7cb6c22cac8b442fd3d1c52)

4 years agofdsan: don't do anything when vforked.
Josh Gao [Fri, 8 May 2020 02:40:14 +0000 (19:40 -0700)]
fdsan: don't do anything when vforked.

Bug: http://b/153926671
Test: 32/64-bit bionic-unit-tests on blueline, x86_64 emulator
Change-Id: Id351a993e396774b68239edfef83d9e81205290b
(cherry picked from commit 65fb2a7f0304fda4463771ae40f8b83728e74a62)

4 years agoTrack whether a thread is currently vforked.
Josh Gao [Fri, 8 May 2020 00:02:19 +0000 (17:02 -0700)]
Track whether a thread is currently vforked.

Our various fd debugging facilities get extremely confused by a vforked
process closing file descriptors in preparation to exec: fdsan can
abort, and fdtrack will delete backtraces for any file descriptors that
get closed. Keep track of whether we're in a vforked child in order to
be able to detect this.

Bug: http://b/153926671
Test: 32/64-bit bionic-unit-tests on blueline, x86_64 emulator
Change-Id: I8a082fd06bfdfef0e2a88dbce350b6f667f7df9f
(cherry picked from commit 230328374018c7ca4e82a47ff4eb91dd2f79a5c3)

4 years agoAdd goldfish-opengl to use bionic_libc_platform_headers am: b47eeab232 am: 2a8fc8baee
Roman Kiryanov [Fri, 8 May 2020 04:02:47 +0000 (04:02 +0000)]
Add goldfish-opengl to use bionic_libc_platform_headers am: b47eeab232 am: 2a8fc8baee

Change-Id: Ia2ac43a3b7a813cd5b8c3ee24392682d818a3f67

4 years agoAdd goldfish-opengl to use bionic_libc_platform_headers am: b47eeab232
Roman Kiryanov [Fri, 8 May 2020 03:43:28 +0000 (03:43 +0000)]
Add goldfish-opengl to use bionic_libc_platform_headers am: b47eeab232

Change-Id: I964130895606efe1208a1fd5d129e71182f20fdd

4 years agoAdd goldfish-opengl to use bionic_libc_platform_headers
Roman Kiryanov [Thu, 7 May 2020 21:58:30 +0000 (14:58 -0700)]
Add goldfish-opengl to use bionic_libc_platform_headers

We need __get_tls and TLS_SLOT_OPENGL for our
OpenGL implementation. We currently use .mk files
and this restriction does not apply, since we are
migrating to .bp we need to address restriction.

Bug: 154151802
Test: presubmit
Signed-off-by: Roman Kiryanov <rkir@google.com>
Merged-In: I007664d919204cd4f6a623f9695a56e94bab7ae6
Change-Id: I6616331b03649eb19ceeb8121d56e55a9270548a

4 years agoMerge "Set apex_available property" into rvc-dev am: 8ee9132285 am: 5537c45052
Jiyong Park [Wed, 6 May 2020 12:50:54 +0000 (12:50 +0000)]
Merge "Set apex_available property" into rvc-dev am: 8ee9132285 am: 5537c45052

Change-Id: Iba03c8165cad2c91c4a8c7559c7894e2e146108e

4 years agoMerge "Set apex_available property" into rvc-dev am: 8ee9132285
Jiyong Park [Wed, 6 May 2020 12:38:39 +0000 (12:38 +0000)]
Merge "Set apex_available property" into rvc-dev am: 8ee9132285

Change-Id: I60634400078dcf09d89568a5e398d1eabb33a52a

4 years agoMerge "Set apex_available property" into rvc-dev
Jiyong Park [Wed, 6 May 2020 12:27:09 +0000 (12:27 +0000)]
Merge "Set apex_available property" into rvc-dev

4 years agoMerge "Fix foritfy test for clang update." into rvc-dev am: 7e486eab1f am: 0bb6c63e17
Yabin Cui [Tue, 5 May 2020 21:04:36 +0000 (21:04 +0000)]
Merge "Fix foritfy test for clang update." into rvc-dev am: 7e486eab1f am: 0bb6c63e17

Change-Id: Id3afd7a64df1683041143196d576cec327e22420

4 years agoMerge "Fix foritfy test for clang update." into rvc-dev am: 7e486eab1f
Yabin Cui [Tue, 5 May 2020 20:51:20 +0000 (20:51 +0000)]
Merge "Fix foritfy test for clang update." into rvc-dev am: 7e486eab1f

Change-Id: Ie0d8ce799d911c1a8f3f3367b7a77989f76cbd0c

4 years agoMerge "Fix foritfy test for clang update." into rvc-dev
Yabin Cui [Tue, 5 May 2020 20:36:15 +0000 (20:36 +0000)]
Merge "Fix foritfy test for clang update." into rvc-dev

4 years agoFix argument order in api level test am: 40a86559c3 am: 2aa06ad824
Alistair Delva [Mon, 4 May 2020 11:59:52 +0000 (11:59 +0000)]
Fix argument order in api level test am: 40a86559c3 am: 2aa06ad824

Change-Id: I28ab8621f1699c422ae415d1b1ae36fd739d2f00

4 years agoFix argument order in api level test am: 40a86559c3
Alistair Delva [Mon, 4 May 2020 11:45:40 +0000 (11:45 +0000)]
Fix argument order in api level test am: 40a86559c3

Change-Id: I3c4e0a48c8f9bef95ab4a1184a94a4a3f07b2e59

4 years agoFix argument order in api level test
Alistair Delva [Mon, 4 May 2020 03:08:26 +0000 (20:08 -0700)]
Fix argument order in api level test

Looks like the arguments were unintentionally swapped?

Bug: 155526611
Change-Id: I39d49f94387cfd337c89becb5eb6f85ca638bef1
Merged-In: I39d49f94387cfd337c89becb5eb6f85ca638bef1
Signed-off-by: Alistair Delva <adelva@google.com>
(cherry picked from commit bed98c0deb429dca7947d6b0190ff62cc92f2608)

4 years agoMerge changes I8b25accf,I59013f0c,I6c881e5d,I66826f31,I552692ae, ... into rvc-dev...
Josh Gao [Thu, 30 Apr 2020 21:13:00 +0000 (21:13 +0000)]
Merge changes I8b25accf,I59013f0c,I6c881e5d,I66826f31,I552692ae, ... into rvc-dev am: 524510bc5c am: 33971718b2

Change-Id: Ie63b7eeb557dd24f26d4d7f79e22da95bf41fab8

4 years agoFix foritfy test for clang update.
Yabin Cui [Thu, 16 Apr 2020 22:07:28 +0000 (15:07 -0700)]
Fix foritfy test for clang update.

When doing checkbuild for make_fortify_compile_test.mk:
bionic/tests/clang_fortify_tests.cpp
error: 'error' diagnostics seen but not expected:
  Line 171: 'mempcpy' will always overflow; destination buffer has size 8, but size argument is 9
1 error generated.

Bug: 149839606
Test: run checkbuild.
Change-Id: I97371600f6183b5cee8c2a6b976f5bf33e1f781d
(cherry picked from commit ae1745d37550de264b600b08c13242513116b8ac)

4 years agoMerge changes I8b25accf,I59013f0c,I6c881e5d,I66826f31,I552692ae, ... into rvc-dev...
Josh Gao [Thu, 30 Apr 2020 20:54:26 +0000 (20:54 +0000)]
Merge changes I8b25accf,I59013f0c,I6c881e5d,I66826f31,I552692ae, ... into rvc-dev am: 524510bc5c

Change-Id: I1e58eba89806b18b11682142bb2a8281f797a4a5

4 years agoMerge changes I8b25accf,I59013f0c,I6c881e5d,I66826f31,I552692ae, ... into rvc-dev
Josh Gao [Thu, 30 Apr 2020 20:40:39 +0000 (20:40 +0000)]
Merge changes I8b25accf,I59013f0c,I6c881e5d,I66826f31,I552692ae, ... into rvc-dev

* changes:
  fdtrack: add wrapper for socketpair.
  fdtrack: add wrapper for eventfd.
  fdtrack: add wrappers for epoll_create, epoll_create1.
  fdtrack: add wrappers for pipe, pipe2.
  fdtrack: add tests for individual wrappers.
  fdtrack: don't destroy traces.

4 years agofdtrack: add wrapper for socketpair.
Josh Gao [Thu, 30 Apr 2020 00:17:56 +0000 (17:17 -0700)]
fdtrack: add wrapper for socketpair.

Bug: https://issuetracker.google.com/154450436
Test: bionic-unit-tests
Change-Id: I8b25accf00dc01f6fab351f3ba612f6b0ff9d094
(cherry picked from commit b107eab5ef1d5946bd753cad0e8b178172d362df)

4 years agofdtrack: add wrapper for eventfd.
Josh Gao [Thu, 30 Apr 2020 00:08:46 +0000 (17:08 -0700)]
fdtrack: add wrapper for eventfd.

Bug: https://issuetracker.google.com/154450436
Test: bionic-unit-tests
Change-Id: I59013f0c4da0debbcc50269c64ae9db0cdc4eaa0
(cherry picked from commit 7de412443dd4201c61d7bb17c443bbf2dfd96bad)

4 years agofdtrack: add wrappers for epoll_create, epoll_create1.
Josh Gao [Thu, 30 Apr 2020 00:06:14 +0000 (17:06 -0700)]
fdtrack: add wrappers for epoll_create, epoll_create1.

Bug: https://issuetracker.google.com/154450436
Test: bionic-unit-tests
Change-Id: I6c881e5d67596c543526536541d5b8086e21d9e9
(cherry picked from commit a38331d833fb74607e964b0749427415545018fe)

4 years agofdtrack: add wrappers for pipe, pipe2.
Josh Gao [Thu, 30 Apr 2020 00:00:13 +0000 (17:00 -0700)]
fdtrack: add wrappers for pipe, pipe2.

Bug: https://issuetracker.google.com/154450436
Test: bionic-unit-tests
Change-Id: I66826f312a65ab9f1bd8193bf684e330baa952dc
(cherry picked from commit 1fad5283a07e87b3ae28f4a2dd6943d600c2926b)

4 years agofdtrack: add tests for individual wrappers.
Josh Gao [Wed, 29 Apr 2020 23:34:37 +0000 (16:34 -0700)]
fdtrack: add tests for individual wrappers.

Add tests for all of our existing wrappers (with one commented out,
because it's unexpectedly generating multiple events).

Bug: https://issuetracker.google.com/154450436
Test: bionic-unit-tests
Change-Id: I552692aef952237c2eee0dabec61b7ea7fd230e3
(cherry picked from commit 9d512402d4a07053f179bf33d78a9beda1424306)

4 years agofdtrack: don't destroy traces.
Josh Gao [Wed, 22 Apr 2020 00:05:32 +0000 (17:05 -0700)]
fdtrack: don't destroy traces.

There's a bad interaction with malloc_debug when the libraries are being
destroyed.

Bug: https://issuetracker.google.com/154439915
Test: treehugger
Change-Id: Ib47c8139c3a88dd52865ea93654b2926bd708729
(cherry picked from commit 38d00b80a072374792bb159e558195eeb8cbd271)

4 years agoSet apex_available property
Jiyong Park [Tue, 28 Apr 2020 09:21:08 +0000 (18:21 +0900)]
Set apex_available property

The marked library(ies) were available to the APEXes via the
hand-written whitelist in build/soong/apex/apex.go. Trying to remove the
whitelist by adding apex_available property to the Android.bp of the
libraries.

Bug: 150999716
Test: m
Change-Id: If64eff62b9e93af95089e5010c30eb586673b92e

4 years agoBlock all signals in ScopedSignalBlocker. am: 95cebe5b11 am: a160acd83e
Elliott Hughes [Fri, 24 Apr 2020 17:36:37 +0000 (17:36 +0000)]
Block all signals in ScopedSignalBlocker. am: 95cebe5b11 am: a160acd83e

Change-Id: Iebd5fcd7d7ef764397faae842bc031a133ec3122

4 years agoBlock all signals in ScopedSignalBlocker. am: 95cebe5b11
Elliott Hughes [Fri, 24 Apr 2020 17:27:04 +0000 (17:27 +0000)]
Block all signals in ScopedSignalBlocker. am: 95cebe5b11

Change-Id: Idd5b34792082f672cac6c8396bb7285cf022800a

4 years agoBlock all signals in ScopedSignalBlocker.
Elliott Hughes [Thu, 23 Apr 2020 22:53:17 +0000 (15:53 -0700)]
Block all signals in ScopedSignalBlocker.

When a thread calls pthread_exit(3), ScopedSignalBlocker blocks all
user-visible signals, but leaves internal-use signals 33/34/36/36/37.
Signal 33 is used to unwind a thread for a backtrace, which can cause us
to access the stack after it's been unmapped. (Avoiding this was the
reason why we have the ScopedSignalBlocker in pthread_exit(3)!)

Fix this (and other potential issues) by changing ScopedSignalBlocker to
call __rt_sigprocmask(2) directly, so we don't mask out the internal-use
signals.

Bug: https://issuetracker.google.com/153624226
Test: not trivially reproducible
Change-Id: I9b125ed41ddee4c5d33b45920f1d142e52db47cb
Merged-In: I9b125ed41ddee4c5d33b45920f1d142e52db47cb

4 years ago__loader_cfi_fail: acquire g_dl_mutex am: 76eb84a4f4 am: 73a451c90e
Ryan Prichard [Thu, 23 Apr 2020 22:19:58 +0000 (22:19 +0000)]
__loader_cfi_fail: acquire g_dl_mutex am: 76eb84a4f4 am: 73a451c90e

Change-Id: Id02454e7ee0ff606c510a1934559ef7acd513df1