Commit graph

30637 commits

Author SHA1 Message Date
Christopher Ferris
fdaf82f96b Link .clang-format file to system/core one.
Use the .clang-format-2 found in system/core instead of this which is
not actually being used.

Also, enable clang-format running by default.

All upstream directories are marked as ignoring formatting so that
their source files are not modified.

Test: NA
Change-Id: Icee6030f373fa5f072df162f97e6f34320e3d89a
2020-01-29 15:14:20 -08:00
Christopher Ferris
0e0b473a4c Merge "Update to remove direct include of jemalloc_new." 2020-01-29 17:22:01 +00:00
Elliott Hughes
35a09a3493 Merge "Test all four supported relocation encodings." 2020-01-29 16:44:20 +00:00
Elliott Hughes
6dd1f587c8 Test all four supported relocation encodings.
Test (a) that we can load the library, but also (b) that readelf thinks
it contains the relocation encoding we were expecting. Do this for all
four of RELR, ANDROID_RELR, relocation packer, and the original ELF
relocation encoding.

Bug: http://b/147452927
Test: treehugger
Change-Id: I5fab72f99d46991c1b206a1c15c76e185b7148b3
2020-01-28 17:59:23 -08:00
Christopher Ferris
ee12e47788 Merge "Use platform signal name." 2020-01-28 20:26:47 +00:00
Elliott Hughes
a2132f23b8 Merge "elf.h: move all the Android extensions together." 2020-01-28 16:33:51 +00:00
Elliott Hughes
b070cabea8 elf.h: move all the Android extensions together.
...and document them slightly better.

Test: N/A
Change-Id: I32ad209f4086f617978c093782ac45977561445f
2020-01-27 16:00:19 -08:00
Christopher Ferris
4df29ed9b4 Update to remove direct include of jemalloc_new.
In order to support scudo for non-svelte malloc and jemalloc5 for
svelte malloc, do not include jemalloc_new directly. Move that to
the export_include_dirs for libjemalloc5.

Also, change the way to enable scudo so that it only enables it
for the non-svelte config for now.

Bug: 137795072

Test: Builds
Change-Id: I3d68b443fe4d6b21729795649d0dcf66b7e95e03
2020-01-27 14:50:52 -08:00
Elliott Hughes
1d8f6f2f5d Merge "Modernize SHT_RELR support." 2020-01-27 18:10:13 +00:00
Christopher Ferris
b874c339cd Use platform signal name.
Test: Compiles and test passes.
Change-Id: I8d19431ded97f5a8e7baa0c85b9496eddd36a25a
2020-01-27 09:36:34 -08:00
Bram Bonné
f62865767f Merge "Soft-enables MAC address restrictions." 2020-01-27 08:36:08 +00:00
Chih-hung Hsieh
823f74b4c3 Merge "Fix new clang compiler warning" 2020-01-25 00:22:11 +00:00
Elliott Hughes
6663f5525d Modernize SHT_RELR support.
Until now we've only supported RELR with our own OS-private-use
constants. Add support for the official numbers (while maintaining
support for the historical numbers).

Add tests to ensure we continue to support both indefinitely.

We can't yet flip the build system over to using the official constants
because the old GNU binutils objcopy we still use in most cases (for the
mini-debug section) only supports the historical constants.

Bug: http://b/147452927
Test: treehugger
Change-Id: If214fce7fade4316115947e90b78ab40864b61f2
2020-01-24 15:39:01 -08:00
Yifan Hong
29546b9133 Merge "Make ramdisk_available." 2020-01-24 22:39:41 +00:00
Chih-Hung Hsieh
7d66bf9d90 Fix new clang compiler warning
Bug: 148287059
Test: make
Change-Id: I24972955454fa40fc565744e2caaaa636caa44c2
2020-01-24 14:28:45 -08:00
Treehugger Robot
5b9cc31442 Merge "Fix includes for MTE builds." 2020-01-24 20:06:16 +00:00
Mitch Phillips
484b0cd5d4 Fix includes for MTE builds.
Fixes includes in heap tagging to ensure that bionic under MTE builds
successfully.

Thanks Kevin for finding this!

Test: TARGET_EXPERIMENTAL_MTE=true mmma bionic
Bug: N/A
Change-Id: Idd1b9ed3737e48a35f8d8628d13e85f1d58f5c93
2020-01-24 09:16:44 -08:00
Bram Bonné
3af2071f76 Merge "Extends ifaddrs for cases where the client cannot send RTM_GETLINK requests." 2020-01-24 08:40:14 +00:00
Evgenii Stepanov
3ff4245c70 Merge "Add tagged pointers to bionic." 2020-01-24 00:26:32 +00:00
Elliott Hughes
8fe1fcd804 Merge "Reimplement realpath." 2020-01-23 20:34:15 +00:00
Mitch Phillips
3b21ada5f1 Add tagged pointers to bionic.
This patch introduces tagged pointers to bionic. We add a static tag to
all pointers on arm64 compatible platforms (needs requisite
top-byte-ignore hardware feature and relevant kernel patches).

We dynamically detect TBI-compatible devices (a device with the TBI feature and
kernel support) at process start time, and insert an implementation-dependent
tag into the top byte of the pointer for all heap allocations. We then check
that the tag has not been truncated when deallocating the memory.

If an application incorrectly writes to the top byte of the pointer, we
terminate the process at time of detection. This will allow MTE-incompatible
applications to be caught early.

Bug: 135754954
Bug: 147147490

Test: cd bionic && atest .
Change-Id: Ie424325ba1e3c4443040ac265aeaa28d9e405d28
2020-01-23 10:37:24 -08:00
Elliott Hughes
51aa2cfe79 Merge "Initialize __progname correctly." 2020-01-23 18:07:39 +00:00
Christopher Ferris
c53b0e9603 Merge "Update for change MapInfo constructor." 2020-01-23 17:45:26 +00:00
Elliott Hughes
75064c177f Initialize __progname correctly.
setprogname() does a basename, but we were initializing __progname
directly. Stop doing that, and add some tests.

Test: treehugger
Change-Id: I06f306ade4161b2f0c7e314a3b1b30c9420117b7
2020-01-23 08:28:48 -08:00
Bram Bonné
d3df35e026 Soft-enables MAC address restrictions.
Updates getifaddrs() to behave as if RTM_GETLINK requests are not
allowed for non-system apps that have their target SDK set to R.

This change will be reverted when kernel changes enforcing this behavior
are merged, and is purely meant to check for potential appcompat issues
beforehand.

Bug: 141455849
Test: atest bionic-unit-tests-static
Test: atest NetworkInterfaceTest
Test: Connect to Wi-Fi network
Test: Set up hotspot
Test: Cast from device
Test: Pair Bluetooth device
Test: Call getifaddrs() directly from within an app.
Test: Call NetworkInterface#getNetworkInterfaces() from within an app.
Test: Repeat above tests with an app that targets Android R.
Change-Id: I472891d3e8a18c86ae478be1bab1048636aa95b4
2020-01-23 17:05:42 +01:00
Bram Bonné
d54ad07f50 Extends ifaddrs for cases where the client cannot send RTM_GETLINK requests.
The previous implementation of getifaddrs() depended on RTM_GETLINK requests being allowed, returning an error otherwise. This change makes getifaddrs() attempt to get all necessary information from RTM_NEWADDR messages when RTM_NEWLINK messages are not available.

The code is functionally the same when RTM_GETLINK requests are allowed. When RTM_GETLINK requests are denied, only interfaces that have a network address are returned, and physical addresses for these interfaces remain unset.

In addition, this change updates the copyright notice because repohooks asked nicely.

Bug: 141455849
Test: atest bionic-unit-tests-static
Test: atest NetworkInterfaceTest
Test: Connect to Wi-Fi network
Test: Set up hotspot
Test: Cast from device
Test: Pair Bluetooth device
Test: Call getifaddrs() directly from within an app.
Test: Call NetworkInterface#getNetworkInterfaces() from within an app.

Change-Id: Ia47e037d181ca5df6d9fdae19b405cabfafc6b0f
2020-01-23 16:15:44 +01:00
Christopher Ferris
00a131f387 Update for change MapInfo constructor.
Bug: 148075852

Test: Ran unit tests.
Change-Id: I8326d8db9887e2bba26d6d94786a72c49edc5d21
2020-01-22 23:29:43 -08:00
Elliott Hughes
22fb267ad6 Reimplement realpath.
Use O_PATH like musl to let the kernel do the hard work, rather than the
traditional BSD manual scheme.

Also add the most obvious missing tests from reading the man page, plus
a non-obvious test for deleted files.

Bug: http://b/131435126
Test: treehugger
Change-Id: Ie8a8986fea55f045952a81afee377ce8288a49d5
2020-01-22 18:30:50 -08:00
Treehugger Robot
96fbba1ea0 Merge "Mention why we don't have pthread_cancel()." 2020-01-23 00:56:36 +00:00
Treehugger Robot
7a73a2c84f Merge "Remove an unused code path" 2020-01-23 00:01:16 +00:00
Treehugger Robot
3d34bfc45c Merge "Update the copyright notice" 2020-01-22 23:51:46 +00:00
Elliott Hughes
b5a7741bb3 Mention why we don't have pthread_cancel().
It's a somewhat frequently asked question.

Change-Id: I2ad88e8d79607e49a891eb2304e9be63494ad193
2020-01-22 15:10:52 -08:00
Ryan Prichard
928c2492a3 Remove an unused code path
A static analyzer is complaining that num_valid_bits could be 64, and if
it were 64, then two later accesses would be out-of-bounds. is_nul_u64
can't be zero, though, because we only exit the loop when part of is_nul
is non-zero.

Bug: none
Test: manual
Change-Id: I75c3f70b600aa5478cb32fdf4ca0ae1173b69524
2020-01-22 13:59:15 -08:00
Ryan Prichard
8bff8bb622 Update the copyright notice
The repo/pore upload hook made this change automatically.

Bug: none
Test: manual
Change-Id: I1a00edc525f05b53511d8affd84bff926a5c090d
2020-01-22 13:59:15 -08:00
Yifan Hong
5a39cee1ce Make ramdisk_available.
Test: pass
Bug: 147347110
Change-Id: I142311a7558a19d209bcd63207a88e12cf6f130e
2020-01-22 12:09:33 -08:00
Elliott Hughes
73e9f242ed Merge "There are no typewriters in 2020." 2020-01-22 00:59:19 +00:00
Elliott Hughes
70a5c9923d Merge "Document the changed fdsan default from Q to R." 2020-01-21 21:46:43 +00:00
Christopher Ferris
c8226ec23d Merge "Revert "Enable the scudo native allocator."" 2020-01-21 21:32:32 +00:00
Peter Collingbourne
39d9156bdc Merge "Export the unwinder implementation from libc." 2020-01-21 21:28:44 +00:00
Elliott Hughes
a8c4542450 There are no typewriters in 2020.
The BSD "Not a typewriter" translation of ENOTTY looks very weird in
2020. The glibc "Inappropriate ioctl for device" is more generic, and
so much less likely to be inappropriate.

Test: strace on a failed fs ioctl
Change-Id: Iad374d6b91ca9f2e4fa1079986fd698feef8359f
2020-01-21 13:10:13 -08:00
Treehugger Robot
b04be9b4ee Merge "platform profiler signal: add traced_perf codepath" 2020-01-21 19:35:25 +00:00
Tom Cherry
227b44d69d Merge "Add a README.md for async_safe" 2020-01-21 17:00:02 +00:00
Nicolas Geoffray
5c9efd1d66 Merge "Revert "Add tagged pointers to bionic."" 2020-01-21 13:57:45 +00:00
Nicolas Geoffray
ce4c42e09f Revert "Add tagged pointers to bionic."
This reverts commit 43d5f9d4dd.

Bug: 135754954
Bug: 147147490

Exempt-From-Owner-Approval: clean revert

Reason for revert: Breaks ART gtest, see:
https://ci.chromium.org/p/art/builders/ci/angler-armv8-non-gen-cc/561

The crash happens on mprotect of a page, the test crashes with ENOMEM.

Change-Id: I52eea1abbfaf8d8e2226f92d30aa55aba3810528
2020-01-21 13:57:26 +00:00
Dan Willemsen
a547762ae3 Merge "Convert more bionic tests to Android.bp" 2020-01-21 04:52:16 +00:00
Mitch Phillips
3460b6c265 Merge "Add tagged pointers to bionic." 2020-01-20 23:31:27 +00:00
Anna Trostanetski
9981a1dac8 Revert "Enable the scudo native allocator."
This reverts commit b198958412.

Reason for revert: b/147838132. Breaks JNI calls.

Bug: 147838132

Change-Id: I657cf9fddc1e8ee60c1830a1b3f560ab51928a40
2020-01-20 20:17:10 +00:00
Ryan Prichard
0bf9aed92e Merge "Neon-optimized version of the GNU symbol calculation" 2020-01-17 20:48:14 +00:00
Tom Cherry
2185a12312 Add a README.md for async_safe
Particularly to document why both this and liblog exist, when they do
essentially the same thing.

Test: n/a
Change-Id: I216194402a12270cfbb6bc9b840d054dc9c1dc16
2020-01-17 12:12:26 -08:00
Elliott Hughes
91e3bd1f33 Document the changed fdsan default from Q to R.
Change-Id: I98c50232184a8bf929579a7a30460dc33555475e
2020-01-16 15:23:58 -08:00