Commit graph

23488 commits

Author SHA1 Message Date
Dan Albert
b37e9aa9a6 Revert "Revert "Revert "Cleanup transitive includes in the legacy inlines."""
This reverts commit f945fb6b8a.

Reason for revert: haven't fixed all the builds yet

Change-Id: I55aff5d0290c27691427d91a8e46ae01c87da6b2
2017-10-24 09:20:41 +00:00
Dan Albert
f945fb6b8a Revert "Revert "Cleanup transitive includes in the legacy inlines.""
This reverts commit 9cb8639b18.

Fixed all the broken builds that were reported to me before this was
reverted.

Test: make checkbuild  # kikey960, marlin, aosp_arm64; master and aosp
2017-10-17 11:07:26 -07:00
Treehugger Robot
435e6384de Merge "Add pthread_setschedprio." 2017-10-17 17:58:19 +00:00
Christopher Ferris
5f1a8440ad Merge "Force _start to be the top frame for the linker." 2017-10-17 17:55:26 +00:00
Elliott Hughes
dff08ced56 Add pthread_setschedprio.
Bug: http://b/26204555
Test: ran tests
Change-Id: Ic34062b9b6036a1ce2642a069514bab48a893338
2017-10-17 09:14:05 -07:00
Elliott Hughes
bf886f621b Merge "Complete <netdb.h>." 2017-10-17 16:03:54 +00:00
Orion Hodson
1ef6a6ad1a Merge "Revert "Cleanup transitive includes in the legacy inlines."" 2017-10-17 08:50:07 +00:00
Orion Hodson
9cb8639b18 Revert "Cleanup transitive includes in the legacy inlines."
This reverts commit 43df953502.

Reason for revert: Breaks most AOSP builds.
https://android-build.googleplex.com/builds/branch-dashboard/aosp-master?build_id=4399910

Change-Id: I53459f97b7dffb1f7f602db03893564dd3cfe6bf
2017-10-17 08:41:23 +00:00
Treehugger Robot
9deef03c16 Merge "Cleanup transitive includes in the legacy inlines." 2017-10-17 07:17:23 +00:00
Treehugger Robot
d4b4f06cad Merge changes I93dc3811,I710d2929,I6ae029ed
* changes:
  Add libc_nopthread.
  Trivial style fix.
  Don't use PR_SET_DUMPABLE to prevent crash dumping in death tests.
2017-10-17 06:29:27 +00:00
Josh Gao
0e0e370154 Add libc_nopthread.
Add a static library containing the non-pthread dependent parts of
libc.

Bug: http://b/64400027
Test: sailfish boots
Test: bionic-unit-tests32/64, no new failures
Test: bionic-unit-tests-static32/64, no new failures
Change-Id: I93dc3811acddad7936d11b369b98cefd945ee2d5
2017-10-16 21:31:37 -07:00
Josh Gao
a0f6dc577e Trivial style fix.
Test: none
Change-Id: I710d29293171c6160558dab66c515eae16b92923
2017-10-16 21:31:37 -07:00
Josh Gao
084f6ec9af Don't use PR_SET_DUMPABLE to prevent crash dumping in death tests.
Bug: http://b/27833000
Test: bionic-unit-tests are way faster
Change-Id: I6ae029edcd4c4b4b0dfaf613fc17c208d3cb24d1
2017-10-16 21:31:37 -07:00
Treehugger Robot
03507a1d29 Merge "Remove dangling symlink." 2017-10-17 01:37:27 +00:00
Elliott Hughes
5fd11666df Remove dangling symlink.
Bug: N/A
Test: N/A
Change-Id: I6af95827b28f47aa0cd5f1abb5dded15253f7686
2017-10-16 15:10:00 -07:00
Christopher Ferris
aa81761c5e Force _start to be the top frame for the linker.
I noticed that sometimes the old unwinder will add an extra PC 0 frame
after this change, but the new unwinder works in all cases. I'm not going
to fix the old unwinder since I plan to remove it very soon.

Bug: 67784501

Test: Forced a crash in the linker and verified that the unwind
Test: stops in __dl_start. Tested on arm/aarch64/x86/x86_64.

Change-Id: Id6585768023256be5c1d341df7b06b786a220b40
2017-10-16 14:43:34 -07:00
Elliott Hughes
5033918092 Complete <netdb.h>.
Add all the missing <netdb.h> functions.

Also fix getservbyport to handle a null protocol correctly.

Also fix getservbyname/getservbyport to not interfere with getservent.

Also fix endservent to reset getservent iteration.

Also reduce unnecessary differences from upstream NetBSD sethostent.c.

The servent implementation is still horrific, and we should
probably support protoent too so that debugging tools can use
getprotobyname/getprotobynumber.

Bug: N/A
Test: ran tests
Change-Id: I639108c46df0a768af297cf3bbce857cb1bef9d9
2017-10-15 10:37:51 -07:00
Treehugger Robot
a27bfd4131 Merge "Fix missing includes, again." 2017-10-13 23:27:26 +00:00
Treehugger Robot
92b0f36acc Merge "Fix mip64 build." 2017-10-13 22:26:31 +00:00
Dan Albert
43df953502 Cleanup transitive includes in the legacy inlines.
We don't want to be exposing so much through the headers for the
implementation details unless we have to.

Test: make checkbuild
Bug: None
Change-Id: Ieca9cd8106725e08887a3e9fde60d1eef64ef98b
2017-10-13 14:39:03 -07:00
Dan Albert
c972ea7da0 Fix missing includes, again.
Test: mma
Bug: None
Change-Id: I17f07e51ebb425ebbcd2cd48e2aa173ab728c498
2017-10-13 14:38:55 -07:00
Elliott Hughes
ab413c535c Fix mip64 build.
Fallout from the unified sysroot work.

Bug: N/A
Test: builds
Change-Id: If0595a241b9ce0d8c8c7137ddaf8fca932487b7c
2017-10-13 13:22:24 -07:00
Treehugger Robot
9db0e013b1 Merge "Ignore pthread_getconcurrency/pthread_setconcurrency." 2017-10-13 19:33:28 +00:00
Treehugger Robot
73651cf23f Merge "MIPS: Fix MIPS linker VDSO issues" 2017-10-13 19:07:45 +00:00
Elliott Hughes
62446279f3 Ignore pthread_getconcurrency/pthread_setconcurrency.
They're marked obsolescent in POSIX, don't clearly mean anything, aren't
portable because the values don't mean anything, and are no-ops in other
C libraries that do "implement" them.

Bug: N/A
Test: N/A
Change-Id: I07342a0a6a5f6616a8432bfea24ed944c7971d27
2017-10-13 10:21:37 -07:00
Treehugger Robot
1a5a9b7bbc Merge "Define BIONIC_STOP_UNWIND for mips" 2017-10-13 16:42:25 +00:00
Treehugger Robot
f9433e6891 Merge "Ignore endutxent." 2017-10-13 16:12:32 +00:00
Goran Jakovljevic
ea827925ab Define BIONIC_STOP_UNWIND for mips
This fixes mips and mips64 build failures.

Test: successful aosp_mips-eng and aosp_mips64-eng builds
Change-Id: I6648b9cae876cda13369cf10edf61ce9fdca342c
2017-10-13 14:22:10 +02:00
Goran Ferenc
e8c76b7a30 MIPS: Fix MIPS linker VDSO issues
This patch resolves two issues:
(1) AOSP MIPS linker crash with SIGSEGV while relocating VDSO GOT
(2) Missing of MIPS_ABI_FP_ANY flag while ckecking & adjusting MIPS FP modes

(1): AOSP MIPS linker crash with SIGSEGV while relocating VDSO GOT

During bringup and testing of the kernel VDSO support on the emulator we
encountered an issue where all userspace processes were crashing due to
linker crash with SIGSEGV during VDSO GOT relocation.

The mentioned scenario will trigger SIGSEGV in the linker only if the kernel
code base contains VDSO implementation introduced with the following commits:

a7f4df4 MIPS: VDSO: Add implementations of gettimeofday() and clock_gettime()
c0a9f72 irqchip: irq-mips-gic: Provide function to map GIC user section
ebb5e78 MIPS: Initial implementation of a VDSO

Another prerequisite is that the linker contains the following commit from AOSP:
https://android-review.googlesource.com/#/c/264857/

The above commit introduces auxvec.h header containing definition of
AT_SYSINFO_EHDR in:
https://android.googlesource.com/platform/bionic/+/master/libc/kernel/uapi/asm-mips/asm/auxvec.h,
which in turn activates VDSO GOT relocations in mips_relocate_got():
https://android.googlesource.com/platform/bionic/+/master/linker/linker_mips.cpp#149

Since VDSO is mapped as a RO region, writing anything to its page will result
in SIGSEGV.

Removing this 0xdeadbeef cookies writes to the got[0]/got[1] solved SIGSEGV issue.
We also compared with the glibc linker code and we haven't seen anything similar
like writing some cookie values into GOT entries.

(2): Missing of MIPS_ABI_FP_ANY flag while checking & adjusting MIPS FP modes

This issue was found during testing of the patch:
https://android-review.googlesource.com/#/c/platform/bionic/+/494440/

This patch adds a bionic dlfcn.dlopen_vdso test which tries to open "linux-vdso.so.1"
(virtual ELF shared library) and expects to succeed.

dlopen fails in the mips linker part due to the following error:
"Unsupported MIPS32 FloatPt ABI 0 found in linux.vdso.so.1"

According to:
https://dmz-portal.imgtec.com/wiki/MIPS_O32_ABI_-_FR0_and_FR1_Interlinking#A.2._O32_FPXX_code_calling_FPXX,
ABI 0 is:
Val_GNU_MIPS_ABI_FP_ANY = 0 /* Not tagged or not using any ABIs affected by the differences.  */

The issue appeared because MIPS_ABI_FP_ANY is not supposed to be checked as
a possible FP ABI-variant compatibility flag.

This patch adds logic to MIPS linker to handle this case appropriately,
after which dlfcn.dlopen_vdso test passes.

Test:
* bionic-unit-tests --gtest_filter=dlfcn.dlopen_vdso
* Boot android in emulator with kernel which supports VDSO optimizations

Change-Id: Icbcd9879beea1b38fbe8d97b3b205058eaa861f4
Signed-off-by: Goran Ferenc <goran.ferenc@imgtec.com>
2017-10-13 12:08:30 +02:00
Elliott Hughes
d036a8dd17 Ignore endutxent.
We have no utmp, and we're ignoring getutxent/setutxent, and endutxent
belongs in the same group.

Bug: N/A
Test: N/A
Change-Id: Ide032960a0f95750f3bb8f2e62a25e5e7d25c7b6
2017-10-12 20:32:22 -07:00
Elliott Hughes
ddd6436df2 Merge "Unified sysroot: kill arch-specific include dirs." 2017-10-12 22:23:58 +00:00
Elliott Hughes
01bb7bf6fb Merge "Implement <spawn.h>." 2017-10-12 21:02:54 +00:00
Elliott Hughes
d4ca231ae2 Unified sysroot: kill arch-specific include dirs.
<machine/asm.h> was internal use only.

<machine/fenv.h> is quite large, but can live in <bits/...>.

<machine/regdef.h> is trivially replaced by saying $x instead of x in
our assembler.

<machine/setjmp.h> is trivially inlined into <setjmp.h>.

<sgidefs.h> is unused.

Bug: N/A
Test: builds
Change-Id: Id05dbab43a2f9537486efb8f27a5ef167b055815
2017-10-12 13:19:51 -07:00
Treehugger Robot
b49ac81c8e Merge "ns_anonymous test: Make it work for natively bridged environment" 2017-10-12 17:26:32 +00:00
dimitry
8eaf28dc42 ns_anonymous test: Make it work for natively bridged environment
The executable flag might not be present for the executable segment
if the code is being handled by native bridge implementation. This
commit changes the test to restore executable flag for first segment
if it was removed.

Test: bionic-unit-tests
Change-Id: Ie930539135edc4db3245574b5cbe476aa1ad49c7
2017-10-12 15:02:16 +02:00
Tom Cherry
a08f704e2a Merge "Allow read-only system properties to have arbitrary lengths" 2017-10-12 00:22:57 +00:00
Elliott Hughes
14e3ff9f09 Implement <spawn.h>.
As described here:

  http://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn.html

And here:

  http://man7.org/linux/man-pages/man3/posix_spawn.3.html

Bug: N/A (but mentioned in my inbox since 2013)
Test: ran tests
Change-Id: I0b27b2919b660779e3bd8a25fb429527c16dc621
2017-10-11 14:57:49 -07:00
Treehugger Robot
36f7b8b789 Merge "Add missing includes." 2017-10-11 20:39:56 +00:00
Treehugger Robot
1d297d2654 Merge "Fix dlopen_vdso test" 2017-10-11 19:17:10 +00:00
Dan Albert
1c78cb0fee Add missing includes.
Test: mma
Bug: None
Change-Id: I0221b213e08d07cc5ac0b704a86e98ae8c0f456f
2017-10-11 11:25:52 -07:00
dimitry
b9555a9251 Fix dlopen_vdso test
arm32 is still missing vdso (at least on some kernels).
This commit adds explicit check for it and skip the test
if AT_SYSINFO_EHDR is not set.

Test: run 32bit bionic-unit-tests --gtest_filter=dlfcn.dlopen_vdso on angler
Change-Id: I7fae78c6a4f819601a4ac9e8e1da53ff07c833ff
2017-10-11 18:04:05 +02:00
Treehugger Robot
a52555d356 Merge "Fix fcntrl#tee test to use the same expected/actual buffer size." 2017-10-10 23:32:52 +00:00
Tom Cherry
8a311631ed Allow read-only system properties to have arbitrary lengths
We need to be able to store build fingerprints that are over 92 characters
long, which is the current restriction for system property value
length.

Increasing the value maximum across the board has plenty of caveats,
particularly that an allocator would be required to handle
deallocation when replacing long property values with short values.
There is also no compelling reasons to do this.

But, increasing the length of simply read-only properties, such as the
build fingerprint, has less caveats as there will never be a
deallocation of these strings.

This change uses spare bits in the top of serial (only spare for
read-only properties) to indicate if a property is 'long' or not.  The
information required to access these 'long' properties is stored in a
union where the legacy property value is located.  An error message is
retained for legacy callers.

The new property is readable via __system_property_read_callback() and
most importantly android::base::GetProperty and higher level (Java,
`getprop`) callers.  All code should move to these higher level
functions as much as possible.

Bug: 23102347
Bug: 34954705
Test: bionic unit tests
Change-Id: Ia85e0d979b92afff601cc52b39114379617a0c64
2017-10-10 15:52:25 -07:00
Treehugger Robot
983c2da84c Merge "Fix "Add a legacy inline for mmap64"." 2017-10-07 00:56:41 +00:00
Dan Albert
8c2323c697 Fix "Add a legacy inline for mmap64".
Autosubmit fired before the CL was actually ready (forgot to hit "y"
on the repo upload).

Test: make checkbuild
Test: copied into the NDK and ran mmap64_fob64 test.
Bug: lots
Change-Id: I8c0400a703f319e8e230f7ba9178009ed7c88be0
2017-10-06 16:01:36 -07:00
Treehugger Robot
3dacc47642 Merge "Add a legacy inline for mmap64." 2017-10-06 22:20:54 +00:00
Christopher Ferris
e387c2f088 Merge "Add directives to force stop unwinding." 2017-10-06 17:08:34 +00:00
Dan Albert
a613d0df5c Add a legacy inline for mmap64.
While this was never an inline, this function alone has caused most of
the bug reports related to _FILE_OFFSET_BITS=64. Providing an inline
for it should allow a lot more code to build with _FILE_OFFSET_BITS=64
when targeting pre-L.

Test: make checkbuild
Test: built trivial cc_binary for LP32 against API 14 with
      _FILE_OFFSET_BITS=64 set
Bug: lots
Change-Id: I8479d34af4da358c11423bee43d45b59e9d4143e
2017-10-05 23:41:47 -07:00
Elliott Hughes
7181e53cfe Merge "More POSIX limits cleanup." 2017-10-06 02:17:26 +00:00
Elliott Hughes
aaf83e8051 More POSIX limits cleanup.
http://man7.org/linux/man-pages/man7/posixoptions.7.html is a very useful
quick reference to what these are supposed to mean.

Bug: http://b/32776472
Test: ran tests
Change-Id: Icea6812d6075e663885844d7424aa6cf73d6284a
2017-10-05 16:18:10 -07:00