Commit graph

21177 commits

Author SHA1 Message Date
Yi Kong
2d3122c90b Fix test compile errors after LLVM rebase
After the new rebase of Clang, we now support the alloc_size attribute,
so we can remove the warning about switching to alloc_size once Clang
has support.

Also fix an issue where 'false' is returned in a main method.

Test: make cts
Bug: 37752547
Change-Id: I32ee814aaa0338567cb8174a68d7ee1bfece2f75
2017-05-02 21:14:42 +00:00
Treehugger Robot
dfe0fa4151 Merge "Include the libc/kernel/android/scsi headers in the NDK." 2017-04-28 02:48:02 +00:00
Elliott Hughes
2fad0d5927 Include the libc/kernel/android/scsi headers in the NDK.
We have some non-upstream (but Android common kernel) scsi headers to include
in the NDK.

Bug: N/A
Test: checked out/soong/ndk/sysroot
Change-Id: If7611e1e554ada63f266ec99d95dfedb99562ae9
2017-04-27 16:26:55 -07:00
Elliott Hughes
306ea55952 Merge "Compare Pss of tested library in VerifyMemorySaving" 2017-04-27 15:40:37 +00:00
Treehugger Robot
36d5c54b5e Merge "Make dl_iterate_phdr weak in libdl." 2017-04-27 07:44:14 +00:00
Treehugger Robot
9cc08e0a1f Merge "watchpoint_imprecise test: set 4-byte watchpoints on 32-bit arches" 2017-04-27 00:42:15 +00:00
Zhenhua WANG
81aad0058c Compare Pss of tested library in VerifyMemorySaving
DlExtRelroSharingTest.VerifyMemorySaving verifies whether
android_dlopen_ext(ANDROID_DLEXT_USE_RELRO) really saves memory.

This patch compares Pss of the tested library rather than total
Pss of the process, in case different behavior of dlopen() and
android_dlopen_ext() introduces random Pss usage.

Test: DlExtRelroSharingTest.VerifyMemorySaving

Change-Id: I696eca736018fca5d9ec9385ac1c79ced280281d
2017-04-26 17:06:32 -07:00
Yi Kong
82f7208ac0 Merge "Update bionic after Clang rebase" 2017-04-26 23:00:41 +00:00
Elliott Hughes
fd7c2a32e5 Merge "Make unified headers' SIGRTMIN/SIGRTMAX usable before API 21." 2017-04-26 22:16:20 +00:00
Elliott Hughes
7ba2bed0b2 Make unified headers' SIGRTMIN/SIGRTMAX usable before API 21.
Bug: https://github.com/android-ndk/ndk/issues/352
Test: built new NDK test
Change-Id: Iacebe574bbf693701949e038005a40ba6520d592
2017-04-26 14:34:36 -07:00
Yi Kong
06be3459ca Update bionic after Clang rebase
After the new rebase of Clang, we now supports alloc_size attribute, so
we can remove the warning about switching to alloc_size once Clang has
support.

Compiler.setInvocation has changed argument type from raw pointer to
shared pointer. Add version check here so that we can build under either
old rebase or the new rebase.

Test: build
Bug: 37423073
Change-Id: I4563eaf93bae6c59a4a19318f8caa92bd361b3ab
2017-04-26 10:44:12 -07:00
Pavel Labath
4a6202683a watchpoint_imprecise test: set 4-byte watchpoints on 32-bit arches
8-byte watchpoints are not supported on 32-bit kernels (at least on x86,
probably arm as well). 8-byte watchpoints are not required for this
test, so just decrease the size of watchpoints on these architectures.

Change-Id: Ie96b4bc8ce0ad8c924ac737083cf9fe0182aee4d
Test: bionic-unit-tests-static --gtest_filter=sys_ptrace.*
Bug: 37662849
2017-04-26 11:33:17 +01:00
Dan Albert
db98fed03d Make dl_iterate_phdr weak in libdl.
This needs to be defined as weak because it is also defined in libc.a.
Without this, static executables will have a multiple definition
error.

Test: make checkbuild
Bug: None
Change-Id: If2024ef4191c8ab7cf087d21d76fefdc92b58da1
2017-04-25 15:42:42 -07:00
Elliott Hughes
5deddda68e Merge "Add basic tests for <link.h>." 2017-04-24 17:52:13 +00:00
Christopher Ferris
6c8881d99c Merge "Update static functions/macro definitions." 2017-04-22 19:16:39 +00:00
Christopher Ferris
ee1e0a34ae Update static functions/macro definitions.
Fix the list of static functions coming from swab.h to match the
ones exported by glibc.

Force the definition of __HAVE_BUILTIN_BSWAP{16,32,64}__ so the headers
use the builtin.

Add a unit test to guarantee that kernel header updates do not break this.

Test: Built and booted angler.
Test: Built the bionic unit tests for arm, arm64, mips, x86, x86_64.
Test: Ran the new test on angler and glibc.

Change-Id: I4ce229e3f198c204186d72bf22dd97b5cdf239e4
2017-04-21 20:59:53 -07:00
Elliott Hughes
7c10abb4a4 Add basic tests for <link.h>.
The dl_iterate_phdr test is new, but the exidx test is largely copy & paste
from ndk_translation.

Bug: http://b/31556066
Test: ran tests
Change-Id: If754f1459ef1d789ee98a89cd2215188edca51da
2017-04-21 17:35:06 -07:00
Treehugger Robot
1328b96faf Merge "loader: enable loading libraries from tmpfs" 2017-04-22 00:09:50 +00:00
Dimitry Ivanov
bf34ba3641 loader: enable loading libraries from tmpfs
This change adds two tests for dlopen from temporary files.
1. One Uses memfd_create() can be used to load libraries directly
from memory. This requires relaxing namespace accessibility check
in order to make this work in isolated namespaces.
2. Another checks that open with O_TMPFILE works.

Bug: http://b/37245203
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: I3be1d7198ca17e7f1ba022a0d86c64d59a493506
(cherry picked from commit bb8b22a087)
2017-04-21 14:45:07 -07:00
Elliott Hughes
e54e64bd60 Merge "Make the _Unwind_Ptr declaration match clang's." 2017-04-21 19:52:32 +00:00
Elliott Hughes
f2c6ad6338 Make the _Unwind_Ptr declaration match clang's.
Bug: https://issuetracker.google.com/37126620
Test: builds, boots angler
Change-Id: I7d4a9b998f2e5c4c7b0beed87807d7b76a564c5c
2017-04-21 19:52:21 +00:00
Yi Kong
61e932ee65 Merge "Remove unused lambda captures" 2017-04-21 19:48:58 +00:00
Treehugger Robot
802e2fd87c Merge "DO NOT MERGE: The future is now." 2017-04-21 01:10:23 +00:00
Josh Gao
2e8e5e60b6 DO NOT MERGE: The future is now.
__INTRODUCED_IN_FUTURE -> __INTRODUCED_IN(26)

Bug: http://b/37437368
Test: treehugger
Change-Id: I601a23da83b65a0cd582cc840ed3856a9031b673
(cherry picked from commit cb302f932a)
2017-04-20 16:57:25 -07:00
Yi Kong
ff6c8de4f5 Remove unused lambda captures
Clean up. This fixes build under -Wunused-lambda-capture.

Test: build
Change-Id: Ic12aa39e14ed55dbb28cf55303f9c4258179037d
2017-04-20 14:37:56 -07:00
Josh Gao
ee1c45f88f Merge "Add syscalls that aren't currently used to the seccomp whitelist." 2017-04-20 19:52:53 +00:00
Treehugger Robot
627ed91625 Merge "Decode the common EM_ values." 2017-04-20 02:45:03 +00:00
Elliott Hughes
72007ee68f Decode the common EM_ values.
We know what "3" and "40" are, but most folks not on our team don't.

I don't think we need to support all the weird values, because only the
supported architectures actually occur in practice.

Bug: N/A
Test: manually overwrote aarch64 libcrypto.so with an x86-64 .so and ran "date"
Test: CANNOT LINK EXECUTABLE "date": "/system/lib64/libcrypto.so" has unexpected e_machine: 62 (EM_X86_64)
Change-Id: Ic4c6325fe7968f0c96fc0bfe15a50ed922a5ba55
2017-04-19 17:49:43 -07:00
Treehugger Robot
64cdd0c886 Merge "Make all the ELF relocation constants available." 2017-04-19 22:29:42 +00:00
Josh Gao
de9262e5c5 Add syscalls that aren't currently used to the seccomp whitelist.
Add some useful new syscalls that we currently aren't using in bionic,
but might in the future to the seccomp whitelist.

Bug: http://b/37317198
Test: mma
Change-Id: I6550867da152cea84fb13d0c15a399cdb2acf1aa
2017-04-19 13:45:47 -07:00
Treehugger Robot
cdf0b1a44c Merge "Add missing required libraries" 2017-04-19 20:38:58 +00:00
Treehugger Robot
237c3ee0f8 Merge "libc: fix typo in __RENAME macro" 2017-04-19 20:31:41 +00:00
Elliott Hughes
5109bb463d Make all the ELF relocation constants available.
BSD thinks you should only get the relocation constants for your target
architecture, but it's often useful to have them all available at once.
Rearrange the headers to enable that.

Also update the (modified) NetBSD files to CVS HEAD.

Also remove the unused BSDism R_TYPE.

Bug: N/A
Test: builds
Change-Id: Iad5ef29192a732696e2b36af35144a9ca116aa46
2017-04-19 13:28:32 -07:00
Treehugger Robot
0fc84517ab Merge "Add missing arch-specific AT_ cruft." 2017-04-19 19:26:42 +00:00
Dimitry Ivanov
f1db8372de Add missing required libraries
Test: m
Change-Id: Id8c8c69547fbfb0c8efe73b324c8b6dcd52aa8ca
2017-04-19 11:58:52 -07:00
George Burgess IV
31e5a35f3d libc: fix typo in __RENAME macro
Apparently __strncpy_real redirects to strcpy instead of strncpy for GCC
builds. This is bad, and it confused a project compiled by GCC that uses
strcpy.

I audited all of the FORTIFY-related __RENAMEs both manually and with a
script I hacked together; they all look correct aside from this one.

FWIW, with the cleaned up clang FORTIFY, lots of the `void foo()
__RENAME(foo)` will just become `void foo()` if this last thing I'm
working on gets through review.

Bug: 35329524
Test: Previously broken project now seems to work. Bullhead and Ryu
both build + boot.

Change-Id: Ib18ee3535ae31eb7e8ae846dc012f9b64cac80bf
2017-04-19 18:46:44 +00:00
Elliott Hughes
0446c8c095 Add missing arch-specific AT_ cruft.
AP_FPUCW is referenced by valgrind.

Bug: https://bugs.kde.org/show_bug.cgi?id=339945
Test: valgrind builds with one less hack
Change-Id: I7146f3709286662108cc82ba3c55ce935375a1f1
2017-04-19 10:52:35 -07:00
Treehugger Robot
791989d250 Merge "Add PT_ARM_EXIDX." 2017-04-18 22:47:00 +00:00
Treehugger Robot
7b37fa9384 Merge "Move bionic_systrace.cpp over to CachedProperty." 2017-04-18 17:56:07 +00:00
Elliott Hughes
5dc0565c1b Merge "Remove unused elf_machdep.h cruft." 2017-04-18 04:16:05 +00:00
Treehugger Robot
fe56b52b23 Merge "Document DT_RUNPATH support." 2017-04-18 01:00:22 +00:00
Treehugger Robot
57e7a0d853 Merge "Un-deprecated __system_property_find_nth." 2017-04-17 23:45:57 +00:00
Elliott Hughes
901601b48e Remove unused elf_machdep.h cruft.
Also add a few missing include guards.

Bug: N/A
Test: builds
Change-Id: I9557303c81a4b11d430112528def038ecb5562a9
2017-04-17 16:25:09 -07:00
Dan Albert
3914b19bd4 Add PT_ARM_EXIDX.
The updated LLVM libunwind needs this to be defined.

Test: make checkbuild
Bug: None
Change-Id: Ia20016a9e3becb37ea6902f1959d1884c1263e51
2017-04-17 16:06:59 -07:00
Elliott Hughes
d6f91ce85f Document DT_RUNPATH support.
Bug: http://b/37328826
Test: N/A
Change-Id: Ia220f7f519e3cdd6193faff3b58d598505d4d0cf
2017-04-17 16:01:23 -07:00
Elliott Hughes
438e01940b Un-deprecated __system_property_find_nth.
Netflix was using this, and looking the header file, although
__system_property_find_nth has been available since the beginning of time,
__system_property_foreach only appeared in 16. So anyone who wants to run
on pre-JellyBean devices would want to use __system_property_find_nth.

It's pretty much a one-liner in terms of __system_property_foreach anyway,
so it doesn't cost us anything to keep it.

Also restore slightly better tests than we originally removed.

Bug: http://b/36566667
Test: ran tests
Change-Id: Id268c2c2e848da17bb0a5a5420af234d9dcb829a
2017-04-17 14:53:07 -07:00
Elliott Hughes
e4ddb3c587 Move bionic_systrace.cpp over to CachedProperty.
This is the last bionic caller that was manually trying to cache
property values.

Bug: N/A
Test: builds and boots
Change-Id: Id66c0a05d8448f08c39dbf7189241e75615d44b4
2017-04-17 14:12:25 -07:00
Treehugger Robot
661a2ed9df Merge "Link to the public post about clang FORTIFY." 2017-04-17 17:09:42 +00:00
Elliott Hughes
ef2b2fe99e Link to the public post about clang FORTIFY.
Bug: N/A
Test: builds
Change-Id: I1c2040fdd3c3bbe61a8adfc1f414fce50087a1b8
2017-04-16 08:50:58 -07:00
Treehugger Robot
9852fba985 Merge "Avoid "D linker : (null)" with debug.ld.all for dlerror." 2017-04-15 22:30:58 +00:00