OSDN Git Service

android-x86/bionic.git
7 years agoAdd __RENAME_IF_FILE_OFFSET64.
Dan Albert [Mon, 17 Jul 2017 21:05:44 +0000 (14:05 -0700)]
Add __RENAME_IF_FILE_OFFSET64.

Convenience macro for __RENAME if __USE_FILE_OFFSET64 mode. Lets us
avoid duplicating all the doxygen comments in frameworks headers.

Test: make checkbuild
Bug: https://github.com/android-ndk/ndk/issues/459
Change-Id: Ica44f22b2f1596e484694006c0926d94d16187b5

7 years agoMerge "Hide various mbstate implementation details."
Treehugger Robot [Sat, 15 Jul 2017 03:12:36 +0000 (03:12 +0000)]
Merge "Hide various mbstate implementation details."

7 years agoMerge "Allow passing filenames to generate-NOTICE.py."
Treehugger Robot [Sat, 15 Jul 2017 01:07:39 +0000 (01:07 +0000)]
Merge "Allow passing filenames to generate-NOTICE.py."

7 years agoHide various mbstate implementation details.
Elliott Hughes [Sat, 15 Jul 2017 00:00:05 +0000 (17:00 -0700)]
Hide various mbstate implementation details.

...by inlining them.

Also fix a couple of harmless bugs in passing. I've added tests, but in
both cases I don't think it was actually possible to hit the bad behavior:
we'd hit another test and fail immediately after in an externally
indistinguishable way.

Bug: N/A
Test: readelf
Change-Id: I8466050b0bfe2b7b94c76b383cf10c1d9d28debd

7 years agoAllow passing filenames to generate-NOTICE.py.
Elliott Hughes [Fri, 14 Jul 2017 17:00:32 +0000 (10:00 -0700)]
Allow passing filenames to generate-NOTICE.py.

For the libandroid_support NOTICE file, we need to combine all the files
in that directory, plus the specific files pulled from bionic.

Also cleaned up some of the Python style.

Bug: N/A
Test: used for libandroid_support
Change-Id: If433e3a0f0478f06d99a9b3556e99dde06a7e5e1

7 years agoMerge "__cfi_slowpath[_diag] are available to NDK and VNDK clients"
Treehugger Robot [Fri, 14 Jul 2017 22:09:50 +0000 (22:09 +0000)]
Merge "__cfi_slowpath[_diag] are available to NDK and VNDK clients"

7 years agoMerge "libm symbol cleanup."
Treehugger Robot [Fri, 14 Jul 2017 18:51:03 +0000 (18:51 +0000)]
Merge "libm symbol cleanup."

7 years agolibm symbol cleanup.
Elliott Hughes [Fri, 14 Jul 2017 00:30:06 +0000 (17:30 -0700)]
libm symbol cleanup.

Some of this code is used in the NDK libandroid_support now, as a static
library, so just being HIDDEN in the ELF sense isn't sufficient.

Rename digittoint to __libm_digittoint so we don't trample anyone's toes.

Also remove imprecise_powl and imprecise_tgammal. It turns out (to my
surprise) that we don't even have ld128 implementations of powl and tgammal,
so even LP64 was just using the "fake_long_double.c" hack in effect. Since
that's the case, let's *actually* do that because then we're not polluting
with the internal names in addition to the aliases.

Bug: N/A
Test: readelf
Change-Id: I273cc8fdc7ce53f9b8dfd4ef7796e358fe901837

7 years agoMerge "Fix unistd._POSIX_macros_smoke test."
Treehugger Robot [Thu, 13 Jul 2017 19:25:38 +0000 (19:25 +0000)]
Merge "Fix unistd._POSIX_macros_smoke test."

7 years agoMerge "Move wchar _l functions out of wchar.cpp."
Treehugger Robot [Thu, 13 Jul 2017 19:21:11 +0000 (19:21 +0000)]
Merge "Move wchar _l functions out of wchar.cpp."

7 years agoMove wchar _l functions out of wchar.cpp.
Dan Albert [Thu, 13 Jul 2017 17:29:20 +0000 (10:29 -0700)]
Move wchar _l functions out of wchar.cpp.

We don't need these in libandroid_support, but we do need the other
parts of wchar.cpp, and they're not really related.

Test: make checkbuild
Bug: None
Change-Id: I40f3089b034abfd4873e81c0b6216a7cfd977d8d

7 years agoFix unistd._POSIX_macros_smoke test.
Elliott Hughes [Thu, 13 Jul 2017 17:20:41 +0000 (10:20 -0700)]
Fix unistd._POSIX_macros_smoke test.

We now claim _POSIX2_VERSION, but the test wasn't updated.

Bug: N/A
Test: ran tests
Change-Id: Idb3369b3df4b964f585597f0d37962ae619322d2

7 years agoMerge changes from topic 'locale-android-support'
Dan Albert [Thu, 13 Jul 2017 08:34:57 +0000 (08:34 +0000)]
Merge changes from topic 'locale-android-support'

* changes:
  Add a non-TLS slot implementation of locale.cpp.
  Move non-locale.h APIs out of locale.cpp.

7 years agoMerge "Really fix the mac build."
Christopher Ferris [Thu, 13 Jul 2017 06:13:14 +0000 (06:13 +0000)]
Merge "Really fix the mac build."

7 years agoReally fix the mac build.
Christopher Ferris [Thu, 13 Jul 2017 06:10:07 +0000 (23:10 -0700)]
Really fix the mac build.

I forgot an underscore.

Test: Builds.
Change-Id: Ib7da13dea315822af89c53a569fb0a0c2fd5d321

7 years agoMerge "Fix max build."
Treehugger Robot [Thu, 13 Jul 2017 04:32:33 +0000 (04:32 +0000)]
Merge "Fix max build."

7 years agoFix max build.
Christopher Ferris [Thu, 13 Jul 2017 02:33:32 +0000 (19:33 -0700)]
Fix max build.

Test: Built properly.
Change-Id: I37b8ac7d42653617be6611b640a883066257214c

7 years ago__cfi_slowpath[_diag] are available to NDK and VNDK clients
Jiyong Park [Fri, 30 Jun 2017 06:36:12 +0000 (15:36 +0900)]
__cfi_slowpath[_diag] are available to NDK and VNDK clients

When a vendor lib (or vendor-available platform lib) is built with
sanitizer on, __cfi_slowpath_diag is required. However, when building
for those libs, the llndk stub of libdl.so is provided for them and
__cfi_slowpath_diag is not exposed to the stub. In order to make the
sanitizing build successful, expose the symbol.

These symbols are also exposed to NDK clients since we may want to CFI
for unbundled apps.

Bug: 63053790
Bug: 63342219
Test: BOARD_VNDK_VERSION=current m -j libstagefright_foundation.vendor

Change-Id: I081deddb4f66354aaecec4b395d4e17e5566c578

7 years agoMerge "Support memory alignment tests for string_benchmark.cpp"
Christopher Ferris [Wed, 12 Jul 2017 22:56:13 +0000 (22:56 +0000)]
Merge "Support memory alignment tests for string_benchmark.cpp"

7 years agoAdd a non-TLS slot implementation of locale.cpp.
Dan Albert [Wed, 12 Jul 2017 20:47:42 +0000 (13:47 -0700)]
Add a non-TLS slot implementation of locale.cpp.

libandroid_support shouldn't be using Bionic's TLS slot. Add a
thread_local based implementation. We can't use the thread_local
implementation in bionic because the linker needs this and pthread
thread-locals (which is how thread_local is implemented) doesn't work
that early.

Test: make checkbuild
Test: adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
Bug: https://github.com/android-ndk/ndk/issues/300
Change-Id: I7dcbf554ade2264d541d722fa3f86df04926e67a

7 years agoSupport memory alignment tests for string_benchmark.cpp
Anders Lewis [Fri, 23 Jun 2017 22:53:59 +0000 (15:53 -0700)]
Support memory alignment tests for string_benchmark.cpp

Test: Manually verify that benchmark times are similar and add a unit test.
Change-Id: Idaaeb4c8c3629f797ffd8d0c86c8d7b7b9653181

7 years agoMove non-locale.h APIs out of locale.cpp.
Dan Albert [Tue, 11 Jul 2017 21:27:07 +0000 (14:27 -0700)]
Move non-locale.h APIs out of locale.cpp.

libandroid_support only needs the locale.h stuff.

Test: make checkbuild
Bug: None
Change-Id: I0c53fe9d2df4f9ff4b99771727034508bc89cb32

7 years agoMerge "Sync with upstream OpenBSD: trivial stuff."
Treehugger Robot [Tue, 11 Jul 2017 21:34:08 +0000 (21:34 +0000)]
Merge "Sync with upstream OpenBSD: trivial stuff."

7 years agoSync with upstream OpenBSD: trivial stuff.
Elliott Hughes [Tue, 11 Jul 2017 19:34:19 +0000 (12:34 -0700)]
Sync with upstream OpenBSD: trivial stuff.

No active ingredient to any of these changes.

Bug: N/A
Test: builds
Change-Id: Ib1191a5c2826da024245d03dfc57557c8903a6cc

7 years agoMerge "The future passed part of <stdlib.h> by..."
Treehugger Robot [Tue, 11 Jul 2017 18:54:24 +0000 (18:54 +0000)]
Merge "The future passed part of <stdlib.h> by..."

7 years agoMerge "Properly handle elf-files without relocation sections"
Treehugger Robot [Tue, 11 Jul 2017 17:41:13 +0000 (17:41 +0000)]
Merge "Properly handle elf-files without relocation sections"

7 years agoProperly handle elf-files without relocation sections
dimitry [Tue, 11 Jul 2017 14:51:45 +0000 (16:51 +0200)]
Properly handle elf-files without relocation sections

Relocation packer no longer complains about missing
relocation sections.

Test: relocation-packer-unit-tests
Test: mm
Change-Id: I56814be326c15e046db1a96d14568d951f689ae2

7 years agoMerge "sys_ptrace_test: Better detect missing HW support"
Treehugger Robot [Tue, 11 Jul 2017 08:10:41 +0000 (08:10 +0000)]
Merge "sys_ptrace_test: Better detect missing HW support"

7 years agoMerge "Move environ valiable into it's own file"
Victor Khimenko [Mon, 10 Jul 2017 22:33:54 +0000 (22:33 +0000)]
Merge "Move environ valiable into it's own file"

7 years agoMerge "Make inline tcsetattr definition match constants."
Elliott Hughes [Mon, 10 Jul 2017 20:40:53 +0000 (20:40 +0000)]
Merge "Make inline tcsetattr definition match constants."

7 years agoMerge "Undo recent _FILE_OFFSET_BITS=64 changes."
Treehugger Robot [Mon, 10 Jul 2017 20:20:53 +0000 (20:20 +0000)]
Merge "Undo recent _FILE_OFFSET_BITS=64 changes."

7 years agoMerge "Fix ffs on x86 for old API levels."
Treehugger Robot [Mon, 10 Jul 2017 20:07:01 +0000 (20:07 +0000)]
Merge "Fix ffs on x86 for old API levels."

7 years agoUndo recent _FILE_OFFSET_BITS=64 changes.
Elliott Hughes [Wed, 5 Jul 2017 22:23:50 +0000 (15:23 -0700)]
Undo recent _FILE_OFFSET_BITS=64 changes.

We had several bugs filed saying "if I set _FILE_OFFSET_BITS=64 when
targeting an API < L, various functions are missing". Instead of
saying "yes, they are", we quietly just modified the header files to
expose the non-64-bit variants. This makes no sense. We can't just say
"oh, yeah, we don't have a version of this function that agrees with
your calling code about how large off_t is, but here's a version that
doesn't: I'm sure it'll be fine".

_FILE_OFFSET_BITS=64 on Android LP32 has always been a game of chance,
but that game should be "are all the functions my code needs available
at compile time?", not "will my code actually work at run time?".

Bug: https://github.com/android-ndk/ndk/issues/449
Bug: https://github.com/android-ndk/ndk/issues/442
Bug: https://github.com/android-ndk/ndk/issues/333
Bug: https://github.com/android-ndk/ndk/issues/332
Bug: https://github.com/android-ndk/ndk/issues/324
Test: builds
Change-Id: Ib095251d3e21e77ed50cc3575388107fecec4ecd

7 years agoMove environ valiable into it's own file
Victor Khimenko [Mon, 10 Jul 2017 19:15:37 +0000 (21:15 +0200)]
Move environ valiable into it's own file

Test: build statically the example program below

  char** environ;
  int main() {
  }

Change-Id: I3f01652da1d5063d92ba7cbff7fb09bd0a89325c

7 years agoThe future passed part of <stdlib.h> by...
Elliott Hughes [Mon, 10 Jul 2017 18:51:00 +0000 (11:51 -0700)]
The future passed part of <stdlib.h> by...

Bug: N/A
Test: builds
Change-Id: Ibac3c1abd82838dccd360cb70decb7083401c28e

7 years agosys_ptrace_test: Better detect missing HW support
Pavel Labath [Fri, 7 Jul 2017 10:42:34 +0000 (11:42 +0100)]
sys_ptrace_test: Better detect missing HW support

If the hardware debug support is missing from the CPU, the kernel can
end up in the state where it reports that it supports N(>0) watchpoints,
but the "maximum supported watchpoint size" is zero.

This is not a really sensible API, but it is what we have. I'm going to
speak to folks upstream about whether we can have it report something
more sensible, but that will take a while (if ever).

So, for the time being, detect this situation and treat it as if no
hardware watchtpoints/breakpoints are supported.

Test: bionic-unit-tests --gtest_filter="sys_ptrace.*"
Change-Id: Id6a013c9bec8d8b450b4a36c28431f6b7fd15879
Bug: 63116544

7 years agoMerge "Disable integer_overflow sanitizer in libm."
Ivan Lozano [Fri, 7 Jul 2017 20:07:20 +0000 (20:07 +0000)]
Merge "Disable integer_overflow sanitizer in libm."

7 years agoMerge "Support building binutils out of the box for x86/x86-64."
Elliott Hughes [Thu, 6 Jul 2017 22:33:42 +0000 (22:33 +0000)]
Merge "Support building binutils out of the box for x86/x86-64."

7 years agoMerge "Make <sys/ttydefaults.h> more usable."
Elliott Hughes [Thu, 6 Jul 2017 22:20:34 +0000 (22:20 +0000)]
Merge "Make <sys/ttydefaults.h> more usable."

7 years agoDisable integer_overflow sanitizer in libm.
Ivan Lozano [Thu, 6 Jul 2017 20:54:56 +0000 (13:54 -0700)]
Disable integer_overflow sanitizer in libm.

Explicitly disables the integer_overflow sanitizer in the libm library.
This change should not impact any other build targets.

Bug: 30969751
Test: Built with and without SANITIZE_TARGET=integer_overflow
Change-Id: I98d0312344086b01394f456d4b953463b5e6cb1a

7 years agoMerge "Update <arpa/*> from FreeBSD."
Elliott Hughes [Thu, 6 Jul 2017 22:15:04 +0000 (22:15 +0000)]
Merge "Update <arpa/*> from FreeBSD."

7 years agoMerge "Claim to have a POSIX shell and utilities."
Elliott Hughes [Thu, 6 Jul 2017 21:22:20 +0000 (21:22 +0000)]
Merge "Claim to have a POSIX shell and utilities."

7 years agoMerge "Conditionally expose splice(2) and sync_file_range(2) constants."
Elliott Hughes [Thu, 6 Jul 2017 21:21:20 +0000 (21:21 +0000)]
Merge "Conditionally expose splice(2) and sync_file_range(2) constants."

7 years agoMerge "Fix <dirent.h> d_ino/d_off types."
Elliott Hughes [Thu, 6 Jul 2017 21:15:35 +0000 (21:15 +0000)]
Merge "Fix <dirent.h> d_ino/d_off types."

7 years agoSupport building binutils out of the box for x86/x86-64.
Elliott Hughes [Thu, 6 Jul 2017 18:04:15 +0000 (11:04 -0700)]
Support building binutils out of the box for x86/x86-64.

x86 needs the <sys/user.h> additions, x86-64 the <sys/procfs.h> ones.

Bug: N/A
Test: ndkports x86 and x86_64 binutils-2.28
Change-Id: I2e4738d3f8343d12db0536ca77045e2a0ccc6596

7 years agoMake <sys/ttydefaults.h> more usable.
Elliott Hughes [Thu, 6 Jul 2017 17:33:15 +0000 (10:33 -0700)]
Make <sys/ttydefaults.h> more usable.

* TTYDEF_OFLAG referred to the BSD OXTABS constant instead of the Linux XTABS,
  so references to it wouldn't compile.

* CEOL was incorrect (compared to `stty -a`).

* ttydefchars wouldn't compile (removed rather than attempt to fix something
  of unclear utility).

Bug: http://b/63145226
Test: new test
Change-Id: I823e5eaab789cafd2eeea03f77ea553346822f74

7 years agoMerge "The ifdef check for AT_SYSINFO_EHDR is no longer needed"
Dimitry Ivanov [Thu, 6 Jul 2017 15:16:03 +0000 (15:16 +0000)]
Merge "The ifdef check for AT_SYSINFO_EHDR is no longer needed"

7 years agoMerge "Bionic: Add ziparchive test dependency"
Treehugger Robot [Thu, 6 Jul 2017 14:48:01 +0000 (14:48 +0000)]
Merge "Bionic: Add ziparchive test dependency"

7 years agoThe ifdef check for AT_SYSINFO_EHDR is no longer needed
dimitry [Thu, 6 Jul 2017 10:17:14 +0000 (12:17 +0200)]
The ifdef check for AT_SYSINFO_EHDR is no longer needed

AT_SYSINFO_EHDR is present in all architectures

Test: make
Change-Id: I0f4c115bb48e47ea156e7fca936960f5f10c618e

7 years agoBionic: Add ziparchive test dependency
Andreas Gampe [Thu, 6 Jul 2017 05:36:20 +0000 (22:36 -0700)]
Bionic: Add ziparchive test dependency

Add missing dependency.

Bug: 37342627
Test: m
test: mmma bionic
Change-Id: I43ae69a007f0e8745db5721296f457b3e58206dd

7 years agoClaim to have a POSIX shell and utilities.
Elliott Hughes [Wed, 5 Jul 2017 23:45:55 +0000 (16:45 -0700)]
Claim to have a POSIX shell and utilities.

We pretty much do these days. And apparently some GNU tools turn on obsolete
backwards-compatible behaviors otherwise.

Bug: http://b/63145226
Test: builds
Change-Id: I9a8af860768cc2c10548f172d1e8b4fba3e5115b

7 years agoUpdate <arpa/*> from FreeBSD.
Elliott Hughes [Wed, 5 Jul 2017 22:51:44 +0000 (15:51 -0700)]
Update <arpa/*> from FreeBSD.

We've had <arpa/telnet.h> for years, despite being slightly more useless
than <arpa/ftp.h> and <arpa/tftp.h>. The inetutils package expects these
to be available.

Bug: http://b/63145226
Test: builds
Change-Id: I1e3c7421779e965b3342d681fefb8dc2561b604d

7 years agoConditionally expose splice(2) and sync_file_range(2) constants.
Elliott Hughes [Wed, 5 Jul 2017 22:59:58 +0000 (15:59 -0700)]
Conditionally expose splice(2) and sync_file_range(2) constants.

As in other places, only expose the constants at API levels where
we're also exposing the functions (to cope with "poor man's configure"
where an author assumes the presence of the #define to imply the
availability of the function).

Bug: http://b/63145226
Test: builds
Change-Id: I524f7288513aa6c35479c550e748a619397929b0

7 years agoFix <dirent.h> d_ino/d_off types.
Elliott Hughes [Wed, 5 Jul 2017 19:34:29 +0000 (12:34 -0700)]
Fix <dirent.h> d_ino/d_off types.

Bug: http://b/63336806
Test: builds
Change-Id: I781e7c66c41bcb772d49ce7c23aab185ddd5da1e

7 years agoMake inline tcsetattr definition match constants.
Elliott Hughes [Wed, 5 Jul 2017 19:00:29 +0000 (12:00 -0700)]
Make inline tcsetattr definition match constants.

Before this change we have the old NDK inline termios functions with the
modern constants. Unfortunately the old NDK inline functions relied on
hacking the constants. Fix things by sharing the implementation between
the platform and the NDK headers.

Bug: https://github.com/android-ndk/ndk/issues/441
Test: ran tests
Change-Id: I2773634059530bc954167f29c4783413a2294d5a

7 years agoMerge "Work around missing _Exit in old API levels."
Elliott Hughes [Sat, 1 Jul 2017 15:48:58 +0000 (15:48 +0000)]
Merge "Work around missing _Exit in old API levels."

7 years agoFix ffs on x86 for old API levels.
Elliott Hughes [Fri, 30 Jun 2017 22:57:59 +0000 (15:57 -0700)]
Fix ffs on x86 for old API levels.

<strings.h>'s ffs used to work by accident. In the past, <strings.h> used
to incorrectly declare ffs for all platforms at all API levels. In the
unified headers, there's no such declaration for x86 before API 18 (which
makes sense, because that function was missing on x86 until then).

But as long as there was a declaration for ffs, the compiler just inlined
__builtin_ffs. There was no problem at link time because the compiler didn't
actually add a reference to the missing ffs symbol.

Restore the old behavior by manually instructing the compiler to inline its
builtin in these cases.

Bug: https://github.com/android-ndk/ndk/issues/439
Test: built new NDK 'ffs' test
Change-Id: I840e99f237c86f7cb028a0f67aaa8c6ff3eda245

7 years agoWork around missing _Exit in old API levels.
Elliott Hughes [Fri, 30 Jun 2017 23:39:25 +0000 (16:39 -0700)]
Work around missing _Exit in old API levels.

Rather than do this in libandroid_support, we may as well just stick it with
the other historical stdlib workarounds in bionic itself...

Bug: N/A
Test: built new NDK test
Change-Id: Ia5cf4010581eb79d4adf924e87d0bc050b9e2839

7 years agoMerge "Add version info for C++ versions of basename, strchrnul."
Treehugger Robot [Fri, 30 Jun 2017 22:33:27 +0000 (22:33 +0000)]
Merge "Add version info for C++ versions of basename, strchrnul."

7 years agoAdd version info for C++ versions of basename, strchrnul.
Josh Gao [Fri, 30 Jun 2017 20:20:28 +0000 (13:20 -0700)]
Add version info for C++ versions of basename, strchrnul.

These still won't get guards added by the preprocessor, because it
compiles with C-only.

Bug: https://github.com/android-ndk/ndk/issues/440
Test: treehugger
Change-Id: I893b345e528ed1b761e0db00700037411bbb8b78

7 years agoMerge "Revert "arm64: expand CFI shadow to cover 48-bit virtual addresses""
Roozbeh Pournader [Fri, 30 Jun 2017 01:10:10 +0000 (01:10 +0000)]
Merge "Revert "arm64: expand CFI shadow to cover 48-bit virtual addresses""

7 years agoRevert "arm64: expand CFI shadow to cover 48-bit virtual addresses"
Elliott Hughes [Thu, 29 Jun 2017 23:48:43 +0000 (23:48 +0000)]
Revert "arm64: expand CFI shadow to cover 48-bit virtual addresses"

This reverts commit ae735163e51fbc7cac4217ce392c4894efdfc5a7.

QA claims this causes:

  AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.media.MediaPlayer.setSurface(android.view.Surface)' on a null object reference
  AndroidRuntime:        at com.android.setupwizardlib....

Bug: http://b/63141434
Change-Id: I05a6849471623d4cde8b254b1020b0ccbd84b699

7 years agoMerge "bionic: fix assorted static analyzer warnings"
Treehugger Robot [Thu, 29 Jun 2017 16:27:52 +0000 (16:27 +0000)]
Merge "bionic: fix assorted static analyzer warnings"

7 years agoMerge "arm64: expand CFI shadow to cover 48-bit virtual addresses"
Elliott Hughes [Thu, 29 Jun 2017 15:23:32 +0000 (15:23 +0000)]
Merge "arm64: expand CFI shadow to cover 48-bit virtual addresses"

7 years agoMerge "Put back more legacy pthread APIs."
Treehugger Robot [Thu, 29 Jun 2017 00:39:30 +0000 (00:39 +0000)]
Merge "Put back more legacy pthread APIs."

7 years agobionic: fix assorted static analyzer warnings
George Burgess IV [Tue, 27 Jun 2017 23:23:45 +0000 (16:23 -0700)]
bionic: fix assorted static analyzer warnings

Warnings:

bionic/libc/bionic/fts.c:722:5: warning: Null passed to a callee that
requires a non-null 1st parameter

bionic/libc/bionic/sched_cpualloc.c:34:25: warning: Result of 'malloc'
is converted to a pointer of type 'cpu_set_t', which is incompatible
with sizeof operand type 'unsigned long'

bionic/linker/linker_main.cpp:315:7: warning: Access to field 'e_type'
results in a dereference of a null pointer (loaded from variable
'elf_hdr')

bionic/linker/linker_main.cpp:493:66: warning: Access to field 'e_phoff'
results in a dereference of a null pointer (loaded from variable
'elf_hdr')

bionic/linker/linker_main.cpp:90:14: warning: Access to field 'next'
results in a dereference of a null pointer (loaded from variable 'prev')

Bug: None
Test: mma; analyzer warnings are gone. CtsBionicTestCases pass.
Change-Id: I699a60c2c6f64c50b9ea06848a680c98a8abb44a

7 years agoarm64: expand CFI shadow to cover 48-bit virtual addresses
Kevin Brodsky [Mon, 26 Jun 2017 10:46:02 +0000 (11:46 +0100)]
arm64: expand CFI shadow to cover 48-bit virtual addresses

Starting from Linux 4.7, arm64's defconfig enables 48-bit VAs, see:
https://git.kernel.org/torvalds/c/211102d8

On arm64, the CFI shadow configuration currently assumes that VAs
are 39-bit long, and as expected this results in a segfault on a
(defconfig) 4.7+ kernel, when linking a CFI-enabled library.

Consequently, this change increases the max target address to
account for the new max VA size.

Change-Id: I3fb808563fa77a457c65e9663da0613117332072

7 years agoMerge "Enable dlfcn.dt_runpath_absolute_path in glibc tests"
Treehugger Robot [Tue, 27 Jun 2017 19:46:28 +0000 (19:46 +0000)]
Merge "Enable dlfcn.dt_runpath_absolute_path in glibc tests"

7 years agoEnable dlfcn.dt_runpath_absolute_path in glibc tests
Dimitry Ivanov [Tue, 27 Jun 2017 18:02:51 +0000 (11:02 -0700)]
Enable dlfcn.dt_runpath_absolute_path in glibc tests

dlfcn.dt_runpath_absolute_path no longer fails when
running bionic-unit-tests on glibc

Bug: http://b/25320359
Test: bionic-unit-tests-glibc --gtest_filter=dlfcn.dt*
Change-Id: Ia0ecf43293cb0fed28516fd8cb87e7f5f2d6e648

7 years agoMerge "Expand Seccomp whitelist"
Treehugger Robot [Fri, 23 Jun 2017 17:39:05 +0000 (17:39 +0000)]
Merge "Expand Seccomp whitelist"

7 years agoExpand Seccomp whitelist
Paul Lawrence [Fri, 23 Jun 2017 15:10:18 +0000 (08:10 -0700)]
Expand Seccomp whitelist

This seccomp failure is in the fault handler:

05-25 12:03:25.042 10201 27425 27425 F DEBUG   : backtrace:
05-25 12:03:25.042 10201 27425 27425 F DEBUG   :     #00 pc 00015380
/data/data/redacted/files/storage/lib/libcrashsdk.so

So whenever an app using this crash sdk crashes it looks like a seccomp
problem.  Fixing this won't stop the apps crashing, but will make the
crash reports accurate and useful.

So yes, the bug below is already fixed, but this issue has come back 2
or 3 times with different apps (latest is b/62874867). This change
doesn't fix that crash either, but again it improves the reporting.

Bug: 62090571
Test: Device boots, app still fails but no longer with SECCOMP error
Change-Id: Ie0f8dc965001c8bc43f6a545b35bdcd38f006213

7 years agoMerge "Whitelist __NR__newselect."
Treehugger Robot [Fri, 23 Jun 2017 01:39:07 +0000 (01:39 +0000)]
Merge "Whitelist __NR__newselect."

7 years agoWhitelist __NR__newselect.
Josh Gao [Thu, 22 Jun 2017 23:46:19 +0000 (16:46 -0700)]
Whitelist __NR__newselect.

Bug: http://b/62779795
Test: treehugger
Change-Id: I3e0279385641d4f06fcdeb955819a01c12c5229e

7 years agoPut back more legacy pthread APIs.
Dan Albert [Thu, 22 Jun 2017 19:40:55 +0000 (12:40 -0700)]
Put back more legacy pthread APIs.

Test: make checkbuild
Bug: https://github.com/android-ndk/ndk/issues/423
Bug: https://stackoverflow.com/q/44580542/632035
Change-Id: Ibf52a969afffbfcdf6793a0bf8b0e10bbdd1f32c

7 years agoMerge "Disable stack protector for __libc_preinit"
Treehugger Robot [Thu, 22 Jun 2017 01:40:04 +0000 (01:40 +0000)]
Merge "Disable stack protector for __libc_preinit"

7 years agoDisable stack protector for __libc_preinit
Stephen Crane [Tue, 9 May 2017 21:27:43 +0000 (14:27 -0700)]
Disable stack protector for __libc_preinit

__libc_preinit sets up the stack protector global cookie value, and thus
cannot intialize a stack protector cookie for itself in the function
prologue. LTO compilation can inline functions requiring a stack
protector into __libc_preinit. This patch disables stack protection for
__libc_preinit and forces all potentially inlined functions into a
helper that can have a stack protector.

Test: run bionic-unit-tests

Change-Id: I45911611190f216c91eb6feff722967214c5f99f

7 years agoMerge "Shave a stack frame off asserts."
Elliott Hughes [Wed, 21 Jun 2017 15:09:53 +0000 (15:09 +0000)]
Merge "Shave a stack frame off asserts."

7 years agoShave a stack frame off asserts.
Elliott Hughes [Wed, 21 Jun 2017 00:28:42 +0000 (17:28 -0700)]
Shave a stack frame off asserts.

No-one cares about seeing "async_safe_fatal" (which you have to admit is a
pretty confusing name for an app developer anyway).

On arm:

     #00 pc 0001a43c  /system/lib/libc.so (abort+63)
     #01 pc 0001a627  /system/lib/libc.so (__assert+14)

And aarch64:

     #00 pc 000000000001d75c  /system/lib64/libc.so (abort+120)
     #01 pc 000000000001dad0  /system/lib64/libc.so (__assert+44)

Bug: N/A
Test: ran `crasher assert` and `crasher64 assert`
Change-Id: I00be71c566c74cdb00f8e95d634777155bc3da03

7 years agoMerge "Shave another uninteresting stack frame off aborts."
Treehugger Robot [Wed, 21 Jun 2017 00:20:33 +0000 (00:20 +0000)]
Merge "Shave another uninteresting stack frame off aborts."

7 years agoShave another uninteresting stack frame off aborts.
Elliott Hughes [Tue, 20 Jun 2017 21:26:56 +0000 (14:26 -0700)]
Shave another uninteresting stack frame off aborts.

With this, stack frame 0 is the abort, not tgkill.

arm:

     #00 pc 0001a41c  /system/lib/libc.so (abort+63)

arm64:

     #00 pc 000000000001d75c  /system/lib64/libc.so (abort+120)

Also "include what you use" for <sys/syscall.h>.

Bug: N/A
Test: ran `crasher abort` and `crasher64 abort`
Change-Id: I6517ac67b39b4133e890d52efc115071c812958b

7 years agoMerge "make libasync_safe vendor_available:true"
Treehugger Robot [Tue, 20 Jun 2017 10:35:52 +0000 (10:35 +0000)]
Merge "make libasync_safe vendor_available:true"

7 years agoMerge "linker_config_test: allow search paths of systems without a vendor partition"
Jaesung Chung [Mon, 19 Jun 2017 00:13:07 +0000 (00:13 +0000)]
Merge "linker_config_test: allow search paths of systems without a vendor partition"

7 years agolinker_config_test: allow search paths of systems without a vendor partition
Jaesung Chung [Fri, 16 Jun 2017 05:43:16 +0000 (14:43 +0900)]
linker_config_test: allow search paths of systems without a vendor partition

linker_config#smoke and linker_config.asan_smoke are trying to find
paths under the /vendor directory. If there is no vendor partition,
the real path of them is started with /system/vendor.

This CL allows those paths in the tests by getting the resolved paths
for systems without a vendor partition.

Bug: http://b/62562515
Test: linker_config_test passes without a vendor partition.
Change-Id: Id6d16ef623efd81ab9083c3e819da2ad22a28bf8

7 years agoMerge "Add sys/stat.h compatibility macros for old NDKs."
Treehugger Robot [Fri, 16 Jun 2017 22:51:58 +0000 (22:51 +0000)]
Merge "Add sys/stat.h compatibility macros for old NDKs."

7 years agoMerge "Remove obsolete <machine/cpu-features.h>."
Treehugger Robot [Fri, 16 Jun 2017 21:04:10 +0000 (21:04 +0000)]
Merge "Remove obsolete <machine/cpu-features.h>."

7 years agoMerge "Add #defines for some key enums."
Elliott Hughes [Fri, 16 Jun 2017 20:56:03 +0000 (20:56 +0000)]
Merge "Add #defines for some key enums."

7 years agoRemove obsolete <machine/cpu-features.h>.
Elliott Hughes [Fri, 16 Jun 2017 18:05:16 +0000 (11:05 -0700)]
Remove obsolete <machine/cpu-features.h>.

This is no longer used in the platform, and shouldn't be used in NDK. Apps
should use the NDK's cpu-features module, which supports (a) more specific
queries and (b) all Android architectures, not just 32-bit ARM.

Bug: http://b/18556103
Test: builds
Change-Id: I544ef267a6d7d887223186180c77d9ad0321e605

7 years agoMerge "Add benchmarks for strcpy and strcmp."
Christopher Ferris [Fri, 16 Jun 2017 16:40:01 +0000 (16:40 +0000)]
Merge "Add benchmarks for strcpy and strcmp."

7 years agoMerge "libc: warn that cpu-features.h is deprecated"
Elliott Hughes [Fri, 16 Jun 2017 14:40:08 +0000 (14:40 +0000)]
Merge "libc: warn that cpu-features.h is deprecated"

7 years agoMerge "Update posix_memalign testing."
Christopher Ferris [Thu, 15 Jun 2017 23:11:48 +0000 (23:11 +0000)]
Merge "Update posix_memalign testing."

7 years agoAdd #defines for some key enums.
Elliott Hughes [Thu, 15 Jun 2017 22:12:29 +0000 (15:12 -0700)]
Add #defines for some key enums.

Building ruby actually trips over both of these:

* if the RTLD_ constants aren't #defined, it uses its own incorrect values.

* if the REG_ constants aren't #defined, it confuses x86 with x86-64.

In all other places where we have enums in our headers, we already match
existing glibc practice.

Bug: http://b/62531921
Test: builds
Change-Id: I5b3aab25a1a24611bdc58f2eda4104a78e9f841c

7 years agoMerge "Move a <wchar.h> implementation detail into the implementation."
Elliott Hughes [Thu, 15 Jun 2017 21:30:06 +0000 (21:30 +0000)]
Merge "Move a <wchar.h> implementation detail into the implementation."

7 years agoUpdate posix_memalign testing.
Christopher Ferris [Thu, 15 Jun 2017 20:30:44 +0000 (13:30 -0700)]
Update posix_memalign testing.

Move all tests into stdlib_test.cpp since that's where the definition lives
in bionic.

Add a sweep test and a various size test.

Test: Run new unit tests on glibc and angler.
Change-Id: Ief1301f402bea82ce90240500dd6a01636dbdbae

7 years agoMerge "Add copy-only, seek-only, and copy-and-seek benchmarks for strcat"
Christopher Ferris [Thu, 15 Jun 2017 20:34:54 +0000 (20:34 +0000)]
Merge "Add copy-only, seek-only, and copy-and-seek benchmarks for strcat"

7 years agoMerge "MIPS64: move fstat64/fstatat64/_flush_cache syscalls to SECCOMP_WHITELIST...
Treehugger Robot [Thu, 15 Jun 2017 18:21:12 +0000 (18:21 +0000)]
Merge "MIPS64: move fstat64/fstatat64/_flush_cache syscalls to SECCOMP_WHITELIST.TXT"

7 years agoMove a <wchar.h> implementation detail into the implementation.
Elliott Hughes [Thu, 15 Jun 2017 17:36:43 +0000 (10:36 -0700)]
Move a <wchar.h> implementation detail into the implementation.

No other C library expose these, and I couldn't find any callers.

Bug: http://b/62531921
Test: builds
Change-Id: I4a3505bc0897286a4036c48066b98d16665b573a

7 years agoMerge "Expose pthread_mutex_lock_timeout_np to the NDK."
Treehugger Robot [Thu, 15 Jun 2017 16:15:22 +0000 (16:15 +0000)]
Merge "Expose pthread_mutex_lock_timeout_np to the NDK."

7 years agoMerge "Don't use the overloadable attribute if we're not fortified."
Elliott Hughes [Thu, 15 Jun 2017 15:06:34 +0000 (15:06 +0000)]
Merge "Don't use the overloadable attribute if we're not fortified."

7 years agoMerge "Move libc/zoneinfo/ files to system/timezone"
Nicolas Geoffray [Thu, 15 Jun 2017 09:05:31 +0000 (09:05 +0000)]
Merge "Move libc/zoneinfo/ files to system/timezone"

7 years agoMIPS64: move fstat64/fstatat64/_flush_cache syscalls to SECCOMP_WHITELIST.TXT
Miodrag Dinic [Mon, 12 Jun 2017 08:52:12 +0000 (10:52 +0200)]
MIPS64: move fstat64/fstatat64/_flush_cache syscalls to SECCOMP_WHITELIST.TXT

fstat64/fstatat64/_flush_cache were accidentally put in SYSCALLS.TXT in:
    https://android-review.googlesource.com/#/c/390454/

This patch just moves them to SECCOMP_WHITELIST.TXT because we do not
want stubs accidenatally generated for the mentioned syscalls using
gensyscalls.py script.

This commit does not introduce any functional changes to mips64_policy.cpp.

Test: Run genseccomp.py -> File seccomp/mips64_policy.cpp not changed.
Test: Run gensyscalls.py -> INFO:root:no changes detected!

Change-Id: I3b527b3d9f18715c44a4e6ddc6db6e49f48f4890
Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com>