Commit graph

1285 commits

Author SHA1 Message Date
Yabin Cui
b804b9d67b Merge "Implement pthread barrier." 2015-11-17 00:22:54 +00:00
Yabin Cui
e7c2fffa16 Implement pthread barrier.
Bug: 24341262
Change-Id: I5472549e5d7545c1c3f0bef78235f545557b9630
2015-11-16 14:02:26 -08:00
Chih-hung Hsieh
949bfb9e3c Merge "Enable clang to compile more tests." 2015-11-16 21:31:36 +00:00
Dimitry Ivanov
1f0ccbb59c Merge "Introducing linker namespaces" 2015-11-16 20:14:37 +00:00
Chih-Hung Hsieh
1e79540807 Enable clang to compile more tests.
* Disable optimization only in gtest.h of atexit_test.c for arm/aarch64
  to keep VTT for std::__1::basic_stringstream<char, std::__1::char_traits<char>,
  std::__1::allocator<char> > to link with g++ compiled modules.
* bionic-unit-tests source files are not affected by clang x86_64 fp128 bug
  so they can be compiled with clang.

BUG: 25643775
Change-Id: I3da2a0de61edcdca07b7fcd73a16de9da4a1f7d6
2015-11-16 11:36:15 -08:00
Dmitriy Ivanov
42d5fcb9f4 Introducing linker namespaces
Bug: http://b/22548808
Change-Id: Ia3af3c0a167f1d16447a3d83bb045d143319b1e1
2015-11-15 12:09:16 -08:00
Elliott Hughes
5780f9d809 Merge "Fix strftime if tm_zone is null." 2015-11-13 02:58:30 +00:00
Elliott Hughes
a9cac4c87a Fix strftime if tm_zone is null.
Upstream tzcode said "On platforms with tm_zone, strftime.c now assumes it
is not NULL". Which is fine for any struct tm generated by tzcode, but not
necessarily true of a struct tm constructed by arbitrary code. In particular,
Netflix on Nexus Player was failing to start because they format "%Z" with
a struct tm whose tm_zone is null (the other fields are valid, but, yeah,
that's probably not intentional).

glibc takes a null tm_zone to mean "the current time zone", so let's do that
too. (Historically Android would use the empty string, and POSIX doesn't
clarify which of this is the appropriate behavior when tm_zone is null.)

Bug: http://b/25170306
Change-Id: Idbf68bfe90d143aca7dada8607742905188b1d33
2015-11-12 16:51:31 -08:00
Nick Kralevich
2ed1b29d00 FORTIFY_SOURCE: make sure gcc unittests are compiled with gcc
The default compiler is clang. We need to explicitly indicate
that we should use gcc.

Change-Id: I37859c2e303f2a86a2565fe72eda1fda7c557a59
2015-11-12 15:55:13 -08:00
Chih-hung Hsieh
0c447053de Merge "Enable clang for modules failed with TLS." 2015-11-12 01:04:51 +00:00
Chih-Hung Hsieh
5058a005b8 Enable clang for modules failed with TLS.
New 3.8 clang/llvm can compile TLS code now.
* For x86_64, still disable clang due to f128 bug.
* For b/25643775, arm and arm64, disable clang in unit tests.
* Fix thread_local_test.cpp to compile with clang and
  limit gcc workaround only to arm and aarch64.

BUG: 25643775

Change-Id: Iecd006bf1fc417dbcce2c63343a59c4bf1fa77ea
2015-11-11 16:22:38 -08:00
Elliott Hughes
f208361b2b Clean up pthread_gettid_np test.
Change-Id: I0fad26c7824981bfa3ad3a8a0b28a1984062dcd1
2015-11-11 13:32:28 -08:00
Junjie Hu
de1246202a Fix potential race condition on CTS TC pthread_gettid_np
Root cause:
If start_routine thread exits before pthread_gettid_np is invokded, the "tid" field
will be cleared so that pthread_gettid_np will get "0" (which is cleared by kernel, 
due to the flag "CLONE_CHILD_CLEARTID" is set while calling clone system call inside
pthread_create).

Proposed patch:
Use a mutex to guarantee pthread_gettid_np will be invoked and returned before the
start_routine exits

Signed-off-by: Junjie Hu <junjie.hu@mediatek.com>

Change-Id: I22411f1b0f7446d76a0373cef4ccec858fac7018
(cherry picked from commit 4f80102935)
2015-11-11 21:21:21 +00:00
Josh Gao
09fac86ca3 Fix test failure.
Bug: http://b/25596173
Change-Id: I0cf8f550837d4a936d6a784063a0ec9509150358
2015-11-09 16:04:50 -08:00
Elliott Hughes
8b5b2c4672 Merge "fix the mremap signature" 2015-11-06 21:18:08 +00:00
Daniel Micay
4200e260d2 fix the mremap signature
The mremap definition was incorrect (unsigned long instead of int) and
it was missing the optional new_address parameter.

Change-Id: Ib9d0675aaa098c21617cedc9b2b8cf267be3aec4
2015-11-06 13:14:43 -08:00
Dmitriy Ivanov
fd7a91e692 linker: cleanup solist after unsuccessful read
Bug: http://b/25560017
Change-Id: I03c5a1d7aed34c480d341aacfb3b1afdfa037b99
2015-11-06 10:44:37 -08:00
Josh Gao
eb9b925012 Fix GNU/POSIX basename headers.
Including glibc's <libgen.h> will result in the user getting the POSIX
version of basename always, regardless of when it is included relative
to <string.h>. Prior to this patch, our implementation would result in
the one that's included first winning.

Bug: http://b/25459151
Change-Id: Id4aaf1670dad317d6bbc05763a84ee87596e8e59
2015-11-04 14:19:55 -08:00
Elliott Hughes
4151db5f99 Add prlimit to LP32.
Bug: http://b/24918750
Change-Id: I0151cd66ccf79a6169610de35bb9c288c0fa4917
2015-10-28 20:04:59 -07:00
Elliott Hughes
1721be2229 Merge "Implement scandirat and scandirat64." 2015-10-27 21:40:31 +00:00
Elliott Hughes
6331e806de Implement scandirat and scandirat64.
Bug: http://b/12612339
Change-Id: Id3b249a884fe08964b26a017ae9574961f0cb441
2015-10-27 13:47:36 -07:00
Dimitry Ivanov
5238eb0984 Merge "Implement load at fixed address feature" 2015-10-27 19:03:53 +00:00
Dmitriy Ivanov
126af757c6 Implement load at fixed address feature
Bug: http://b/24683631
Change-Id: I3a39ab526c8f9e213339b60e135e5459d0f41381
2015-10-27 11:27:34 -07:00
Elliott Hughes
9216a64c90 Fix <utmp.h> declarations.
If we're going to keep this useless header -- and I think it's too late to
remove it -- it may as well be correct.

Bug: http://b/17700469
Change-Id: Ifec4f8f1a984483d7fa7d81d47786f75b70ff4ba
2015-10-26 19:29:12 -07:00
Lazar Trsic
6f2d3104c8 Correctly resolve realpath for absolute paths
Introduced by: https://android-review.googlesource.com/174475

Change-Id: I44e00040b28be167d5141454f919340afec6084e
2015-10-13 10:57:41 -07:00
Elliott Hughes
8ab433df13 Fix stdio read after EOF behavior.
Bug: https://code.google.com/p/android/issues/detail?id=184847
Change-Id: Ia20ce94007c2a09649f0763b1dc7ba959f2f618d
2015-10-09 17:57:26 -07:00
Elliott Hughes
7b77cb35af Fix inet_aton on LP32.
I wasn't checking for overflow. Luckily, I had a test that overflows on LP32.

Change-Id: If2cf33d88f459eb26d0ce75f3c5ed192f516ab7a
2015-10-09 17:36:05 -07:00
Elliott Hughes
487a1823e8 Merge "Fix inet_addr/inet_aton/inet_network." 2015-10-09 22:48:13 +00:00
Elliott Hughes
047866672c Fix inet_addr/inet_aton/inet_network.
Rewrite inet_addr and inet_network in terms of inet_aton, and reimplement
that to include all the missing error checks.

Bug: http://b/24754503
Change-Id: I5dfa971c87201968985a0894df419f0fbf54768a
2015-10-09 15:44:24 -07:00
Josh Gao
d8df28ff38 Merge "Implement setjmp cookies on MIPS and MIPS64" 2015-10-09 18:32:20 +00:00
Nikola Veljkovic
1b519c0ae4 Implement setjmp cookies on MIPS and MIPS64
Bug: http://b/23942752
Change-Id: Ie58892a97b5075d30d7607667251007cda99d38c
2015-10-09 13:42:58 +02:00
Dimitry Ivanov
268f739178 Merge "Make dt_runpath work for libraries opened from apk" 2015-10-08 19:45:45 +00:00
Dmitriy Ivanov
a1feb117e4 Make dt_runpath work for libraries opened from apk
This patch also fixes realpath for libraries opened directly
from apks.

Bug: http://b/21960914
Bug: http://b/21961857
Change-Id: I35ade661c87f1d448191f385811f6e9fd3cacf11
2015-10-07 11:44:53 -07:00
Yabin Cui
bc6379d7da Remove the workaround which fixes JOB_COUNT in CTS test.
Bug: 24376925
Change-Id: Ib195ce1577ee9412068cc1b6223fc051b5bcfcaa
2015-10-06 16:30:14 -07:00
Elliott Hughes
df62e3171c am 5c50449b: Merge "Use const auto& in for loops."
* commit '5c50449b0c098cb8191fe3f7791e91a7ec4f7029':
  Use const auto& in for loops.
2015-10-03 16:29:55 +00:00
Elliott Hughes
0b2acdfcc9 Use const auto& in for loops.
Change-Id: Ic437c59797ee4e7dc38291da35c72d827bc89c8d
2015-10-02 18:25:19 -07:00
Dimitry Ivanov
889dd56428 am a0b9cad0: Merge "Optimize dlopen from a zip file"
* commit 'a0b9cad07629439bab926373515d964253426a69':
  Optimize dlopen from a zip file
2015-09-30 20:10:49 +00:00
Dimitry Ivanov
a0b9cad076 Merge "Optimize dlopen from a zip file" 2015-09-30 19:11:30 +00:00
Dmitriy Ivanov
b48275045d Optimize dlopen from a zip file
This change makes dynamic linker reuse ZipArchiveHandles in
ld_library_path on dlopen to optimize the lookup of dt_needed
libraries.

Bug: http://b/21960534
Change-Id: I65f897910d46dd2ffabdcb0b7842db2f127eee30
2015-09-30 10:47:11 -07:00
Yabin Cui
8cd1180904 am c1eebd5f: Merge "Fix the way to count online cpus."
* commit 'c1eebd5ff42cdf8f8a08be76bfdeaad6a327976c':
  Fix the way to count online cpus.
2015-09-30 01:23:33 +00:00
Yabin Cui
c1eebd5ff4 Merge "Fix the way to count online cpus." 2015-09-30 01:17:32 +00:00
Yabin Cui
cb6f599c44 Fix the way to count online cpus.
Read /proc/stat to count online cpus is not correct for all android
kernels. Change to reading /sys/devices/system/cpu/online instead.

Bug: 24376925
Change-Id: I3785a6c7aa15a467022a9a261b457194d688fb38
2015-09-29 17:49:37 -07:00
Colin Cross
1c34fea803 am 8b279ead: Merge "Pass -q is zip for test"
* commit '8b279eadd3a635c31df9c570ab2144212bfd07cc':
  Pass -q is zip for test
2015-09-28 23:11:58 +00:00
Colin Cross
8b279eadd3 Merge "Pass -q is zip for test" 2015-09-28 23:07:04 +00:00
Colin Cross
298d176813 Pass -q is zip for test
Pass -q to zip for dlext_testzip to avoid printing:
  adding: empty_file.txt (stored 0%)
on every compile.

Bug: 24409581
Change-Id: I2320f31182a9a332b3ef8b32a22561092ab5aceb
2015-09-28 15:56:18 -07:00
Dan Willemsen
bfd9255ddb am f16f4f8a: Merge "Fix file-check-cxx to handle quoted arguments"
* commit 'f16f4f8a6bac035db5f25538ddb4fe810d0719db':
  Fix file-check-cxx to handle quoted arguments
2015-09-28 20:43:06 +00:00
Dan Willemsen
f16f4f8a6b Merge "Fix file-check-cxx to handle quoted arguments" 2015-09-28 20:37:07 +00:00
Dan Willemsen
808602a485 Fix file-check-cxx to handle quoted arguments
If the OVERRIDE_C_DATE_TIME environment variable is set, the build
system will add a macro to the global cflags that contains a static
quoted date, like:

  -D__DATE__="\"Sep 28 2015\""

file-check-cxx needs to properly pass that through as a single, still
quoted argument. So use the quoted "$@" instead of turning each word
into an argument.

Change-Id: I6929d712c280d0452062640e0cba8a176d045c97
2015-09-28 13:14:19 -07:00
Colin Cross
b99b3f773c am 55f87a0c: Merge "Force non-color output for bionic FileCheck tests"
* commit '55f87a0c0bb587ee85b5662967563462d52db560':
  Force non-color output for bionic FileCheck tests
2015-09-25 22:33:53 +00:00
Colin Cross
0f575d4482 am 4a54ec82: Merge "Add .PHONY for phony bionic test targets"
* commit '4a54ec8200356a755aeeb212c4dd9cefad39754c':
  Add .PHONY for phony bionic test targets
2015-09-25 22:33:51 +00:00
Colin Cross
55f87a0c0b Merge "Force non-color output for bionic FileCheck tests" 2015-09-25 22:27:16 +00:00
Colin Cross
4a54ec8200 Merge "Add .PHONY for phony bionic test targets" 2015-09-25 22:25:58 +00:00
Christopher Ferris
c1d4ba88cf am b48ca46d: Merge "Force cts to only run one test at a time."
* commit 'b48ca46d88d9e664763eff39604f772a57d8e2fb':
  Force cts to only run one test at a time.
2015-09-25 22:11:46 +00:00
Colin Cross
840be7cb79 Force non-color output for bionic FileCheck tests
Turning on color output will break the bionic compilation tests that
check for expected warnings, as they will be matching color output
against non-color expected values.  Turn off color locally.

Bug: 24273983
Change-Id: Ia3b3262ccece121217f0dc0997734b3ad65b928b
2015-09-25 14:42:07 -07:00
Colin Cross
b67afb3eb5 Add .PHONY for phony bionic test targets
Bug: 24384320
Change-Id: I41038ff8b34391d03ce1e204e30e5ae34ec56614
2015-09-25 14:36:15 -07:00
Christopher Ferris
daaaed18ce Force cts to only run one test at a time.
Also, slightly increase the timeout for each test run.

Bug: 24198050
Change-Id: I2b0ebdebb909023d0f179e0a433c564266a99161
2015-09-25 09:16:31 -07:00
Christopher Ferris
6eb06b0399 am 70a9f0a3: Merge "Fix over read in strcpy/stpcpy/strcat."
* commit '70a9f0a3bc310c863b5c90c9860aae842f82e47f':
  Fix over read in strcpy/stpcpy/strcat.
2015-09-24 21:38:47 +00:00
Christopher Ferris
70a9f0a3bc Merge "Fix over read in strcpy/stpcpy/strcat." 2015-09-24 21:26:40 +00:00
Christopher Ferris
fdfcfce7c6 Fix over read in strcpy/stpcpy/strcat.
This bug will happen when these circumstances are met:

- Destination address & 0x7 == 1, strlen of src is 11, 12, 13.
- Destination address & 0x7 == 2, strlen of src is 10, 11, 12.
- Destination address & 0x7 == 3, strlen of src is 9, 10, 11.
- Destination address & 0x7 == 4, strlen of src is 8, 9, 10.

In these cases, the dest alignment code does a ldr which reads 4 bytes,
and it will read past the end of the source. In most cases, this is
probably benign, but if this crosses into a new page it could cause a
crash.

Fix the labels in the cortex-a9 strcat.

Modify the overread test to vary the dst alignment to expost this bug.
Also, shrink the strcat/strlcat overread cases since the dst alignment
variation increases the runtime too much.

Bug: 24345899
Change-Id: Ib34a559bfcebd89861985b29cae6c1e47b5b5855
2015-09-24 14:17:36 -07:00
Elliott Hughes
839119757d am cb696c50: Merge "Remove libpagemap include hack."
* commit 'cb696c50c293f387c7de46cd3c8573a335e273bf':
  Remove libpagemap include hack.
2015-09-23 18:56:25 +00:00
Elliott Hughes
7660a088cd Remove libpagemap include hack.
Change-Id: I4c75ae4e311342c9ab4f317026904f893e931384
2015-09-22 22:40:22 -07:00
Elliott Hughes
12432ca483 am 8d92afe3: Merge "Fix another duplicate maps parser."
* commit '8d92afe32265be8c36ea2adb3c4059298cd583eb':
  Fix another duplicate maps parser.
2015-09-23 00:26:38 +00:00
Elliott Hughes
15dfd63aba Fix another duplicate maps parser.
Change-Id: Icb69f59ffbd0d5de7f727142260fae152d36a904
2015-09-22 16:40:14 -07:00
Elliott Hughes
f599ea9743 am 9e3a2491: Merge "Clean up /proc/<pid>/maps sscanfs."
* commit '9e3a24915241c07d8ea886533c8de6a85744a734':
  Clean up /proc/<pid>/maps sscanfs.
2015-09-22 22:54:45 +00:00
Elliott Hughes
9e3a249152 Merge "Clean up /proc/<pid>/maps sscanfs." 2015-09-22 22:49:20 +00:00
Elliott Hughes
0dec228921 Clean up /proc/<pid>/maps sscanfs.
sscanf will swallow whitespace for us.

Change-Id: I59931cbad00f0144fd33ed4749ac0aaad15e6de6
2015-09-22 15:45:50 -07:00
Jorge Lucangeli Obes
9583f7e7c2 am dd514539: Merge "Add preliminary OEM UID/GID support."
* commit 'dd51453904f609347ce7951661eff8bc12a1c0a4':
  Add preliminary OEM UID/GID support.
2015-09-22 21:59:02 +00:00
Jorge Lucangeli Obes
dd51453904 Merge "Add preliminary OEM UID/GID support." 2015-09-22 21:53:39 +00:00
Yabin Cui
042a61de21 am 3d00f79f: Merge "Increase alternative signal stack size on 64-bit devices."
* commit '3d00f79f98c8b981a36a79657f07a303a2288a55':
  Increase alternative signal stack size on 64-bit devices.
2015-09-22 20:51:36 +00:00
Yabin Cui
3d00f79f98 Merge "Increase alternative signal stack size on 64-bit devices." 2015-09-22 20:44:05 +00:00
Jorge Lucangeli Obes
a39e30141d Add preliminary OEM UID/GID support.
Until we implement full support for passwd/group files, add a simple
way to use the new OEM UID/GID range (5000-5999).

oem_XXX -> 5000 + XXX iff 0 <= XXX < 1000.

Bug: 23225475

Change-Id: If48b88135d5df538313414f747d6c4c63bf0a103
2015-09-22 13:33:17 -07:00
Elliott Hughes
d97f422405 am 822c40a3: Merge "<netinet/udp.h> should include <linux/udp.h>."
* commit '822c40a3389a953d9b43f05ad6e40640fd55f9c4':
  <netinet/udp.h> should include <linux/udp.h>.
2015-09-22 20:25:03 +00:00
Elliott Hughes
f8a2243ebe <netinet/udp.h> should include <linux/udp.h>.
The comment about "other stuff" referred to pre-uapi headers. Everything
in the current <linux/udp.h> should be exposed to userspace. The only
problem is that BSD and Linux use different names for the members of
struct udphdr. We can move the Linux udphdr out of the way and use an
anonymous union to get the best of both worlds. (Though unfortunately
this means that code that includes <linux/udp.h> directly instead of
using <netinet/udp.h> now won't have any definition of struct udphdr.
We've taken the stance in the past that you shouldn't include a linux/
header if there's a standard equivalent --- you should rely on us
transitively including it for you.)

Change-Id: Ie625892441b0edd8df3b76d3fcf2cbe299077bc4
2015-09-22 12:34:13 -07:00
Yabin Cui
33ac04a215 Increase alternative signal stack size on 64-bit devices.
Bug: 23041777
Bug: 24187462
Change-Id: I7d84c0cc775a74753a3e8e101169c0fb5dbf7437
2015-09-22 11:18:26 -07:00
Josh Gao
9e3d873036 am 823cff84: Merge changes I81408ef0,Id0eb8d06
* commit '823cff847b3b202b235ddd84650338f07bc61511':
  Implement setjmp cookies on AArch64.
  Implement setjmp cookies on ARM.
2015-09-17 21:15:57 +00:00
Josh Gao
7fda8d2aa4 Implement setjmp cookies on ARM.
Reuse the top bits of _JB_SIGFLAG field previously used to store a
boolean to store a cookie that's validated by [sig]longjmp to make it
harder to use as a ROP gadget. Additionally, encrypt saved registers
with the cookie so that an attacker can't modify a register's value to
a specific value without knowing the cookie.

Bug: http://b/23942752
Change-Id: Id0eb8d06916e89d5d776bfcaa9458f8826717ba3
2015-09-17 14:07:24 -07:00
Yabin Cui
72e678c8a7 am cbd0a15b: Merge "Fix the way to get main thread stack start address."
* commit 'cbd0a15be881abb8ce1feb5b389da2f517a9a4c6':
  Fix the way to get main thread stack start address.
2015-09-17 02:42:52 +00:00
Mor-sarid, Nitzan
569333293a Fix the way to get main thread stack start address.
For previous way to get the stack using the [stack] string from
/proc/self/task/<pid>/maps is not enough. On x86/x86_64, if an
alternative signal stack is used while a task switch happens,
the [stack] indicator may no longer be correct.

Instead, stack_start from /proc/self/stat which is always inside
the main stack, is used to find the main stack in /proc/self/maps.

Change-Id: Ieb010e71518b57560d541cd3b3563e5aa9660750
Signed-off-by: Nitzan Mor-sarid <nitzan.mor-sarid@intel.com>
Signed-off-by: Mingwei Shi <mingwei.shi@intel.com>
2015-09-16 11:45:13 -07:00
Elliott Hughes
edc73f6286 am ba9c1705: Merge "linker: don\'t pass dlextinfo to dependent loads"
* commit 'ba9c17053456aed4452a349cf45c5960d9231f25':
  linker: don't pass dlextinfo to dependent loads
2015-09-04 18:12:33 +00:00
Dmitriy Ivanov
edfc9f63a2 linker: don't pass dlextinfo to dependent loads
Don't pass the parent load's dlextinfo to dependent loads, since this
causes the linker to try to load the dependencies using the same
addresses/relro/fds/etc as the main library, which is never going to
work. This was how it worked before ae69a95 which broke this.

Bug: http://b/23742664
Bug: http://b/20948231
Bug: http://b/20841817
Change-Id: I340ebae1127666d5c6c6f9c6521b89fb93f15bdd
2015-09-02 16:32:02 -07:00
Yabin Cui
d3c7f67aed am 32c85daa: Merge "build bionic gtest runner on mac."
* commit '32c85daa1570e589ce953c42b40fb34cf2b5e989':
  build bionic gtest runner on mac.
2015-09-01 23:08:34 +00:00
Yabin Cui
767fb1c5c6 build bionic gtest runner on mac.
Change-Id: I39a7e94b6662256646dfaeb8f9ecd5c03cd5fbc6
2015-09-01 15:40:38 -07:00
Elliott Hughes
b57e9efd40 am c2e634dd: Merge "Fix regoff_t for LP32 and _FILE_OFFSET_BITS=64."
* commit 'c2e634dd303a44b11e30ab31e39ffc4eae5467f8':
  Fix regoff_t for LP32 and _FILE_OFFSET_BITS=64.
2015-08-27 23:24:33 +00:00
Elliott Hughes
adf5c7237d Fix regoff_t for LP32 and _FILE_OFFSET_BITS=64.
bionic is built without _FILE_OFFSET_BITS=64, so internally regoff_t
was 32-bit on LP32, but code compiled with _FILE_OFFSET_BITS would
expect rm_so and rm_eo in struct regmatch_t to be 64-bit, leading to
confusion.

Bug: http://b/23566443
Change-Id: Iae92fa545104068e4f64ce1977f5ec616859638c
2015-08-27 14:48:32 -07:00
Chih-hung Hsieh
e7a09ff7d9 am bfaee4bd: Merge "Add test cases for __emutls_get_address."
* commit 'bfaee4bd6ad901a699df21fd44d95f34e2e7444d':
  Add test cases for __emutls_get_address.
2015-08-27 05:22:56 +00:00
Elliott Hughes
c6effb3af6 am 848808c6: Merge "Add preadv/pwritev."
* commit '848808c660ec4811f4ff5a2748b6f754b008cd21':
  Add preadv/pwritev.
2015-08-27 05:22:55 +00:00
Chih-hung Hsieh
bfaee4bd6a Merge "Add test cases for __emutls_get_address." 2015-08-26 22:27:35 +00:00
Elliott Hughes
6f4594d5dc Add preadv/pwritev.
Bug: http://b/12612572
Change-Id: I38ff2684d69bd0fe3f21b1d371b88fa60d5421cb
2015-08-26 14:48:55 -07:00
Chih-Hung Hsieh
83380b5cf0 Add test cases for __emutls_get_address.
BUG: 22984770
Change-Id: I193c3612190260a08f3b3ad8b856c0ae8f94e03d
2015-08-26 13:10:14 -07:00
Elliott Hughes
03deb8287b am 629ed517: Merge "Add strchrnul."
* commit '629ed517126b3be32f2b2e8b710e63358691c296':
  Add strchrnul.
2015-08-26 18:42:45 +00:00
Elliott Hughes
7ac3c128bb Add strchrnul.
Bug: http://b/18374026
Change-Id: Iea923309c090a51a2d41c5a83320ab3789f40f1c
2015-08-26 09:59:29 -07:00
Yabin Cui
6524806951 am 62c26ed9: Merge "add fortified implementations of write/pwrite{,64}"
* commit '62c26ed93e76ca9b3dd265f41eb3685ed2e72808':
  add fortified implementations of write/pwrite{,64}
2015-08-21 03:17:34 +00:00
Yabin Cui
62c26ed93e Merge "add fortified implementations of write/pwrite{,64}" 2015-08-21 03:03:22 +00:00
Daniel Micay
afdd15456a add fortified implementations of write/pwrite{,64}
These are just based on the read/pread{,64} implementations with the
function calls and error messages adjusted as appropriate. The only
difference is that the buffer parameters are const.

Change-Id: Ida1597a903807f583f230d74bcedffdb7b24fcf6
2015-08-20 13:46:51 -04:00
Yabin Cui
2bcb25c1c3 am 0660be89: am a6a12a78: am 0fdcdd00: Merge "Fix flaky test time.timer_settime_0." into lollipop-mr1-cts-dev
* commit '0660be899f2d907dedbcb643315b73e652ec9510':
  Fix flaky test time.timer_settime_0.
2015-08-11 19:10:33 +00:00
Yabin Cui
0660be899f am a6a12a78: am 0fdcdd00: Merge "Fix flaky test time.timer_settime_0." into lollipop-mr1-cts-dev
* commit 'a6a12a7804402273e193074a58162cc0b3890812':
  Fix flaky test time.timer_settime_0.
2015-08-11 19:05:43 +00:00
Yabin Cui
a6a12a7804 am 0fdcdd00: Merge "Fix flaky test time.timer_settime_0." into lollipop-mr1-cts-dev
* commit '0fdcdd0067af88e7deef73070d0861ceb9f53c37':
  Fix flaky test time.timer_settime_0.
2015-08-11 18:56:43 +00:00
Yabin Cui
bf572d91b5 Fix flaky test time.timer_settime_0.
It fixes the problem reported in https://code.google.com/p/android/issues/detail?id=182395.

Change-Id: Ie16aa04095dac08a62dd0d4c50e763b36526624c
2015-08-11 11:25:02 -07:00
Dan Albert
ee8576d114 am a3c01467: Merge "Move up to C++14."
* commit 'a3c01467ecf31cab1410ce7b8554e2e77dae3309':
  Move up to C++14.
2015-08-11 00:00:14 +00:00
Dan Albert
5341691955 Move up to C++14.
The default standard version is now ahead of us. Stop specifying C++11
so we get that too.

Change-Id: Ic96942cd7fd134118e29b744601b0119e49b6ac4
2015-08-10 16:40:06 -07:00
Yabin Cui
c23143a5fd am ff4afc13: Merge "Omit comment when reading --gtest_list_tests option\'s output."
* commit 'ff4afc136ef5d00d33a611e7bc1950249db9fbcf':
  Omit comment when reading --gtest_list_tests option's output.
2015-08-10 22:22:04 +00:00
Yabin Cui
ff4afc136e Merge "Omit comment when reading --gtest_list_tests option's output." 2015-08-10 22:01:07 +00:00
Elliott Hughes
23e0bdf7d4 am 182b91f6: Merge "Invalidate cached pid in vfork."
* commit '182b91f62809b03870f561a88135f5453966fe41':
  Invalidate cached pid in vfork.
2015-08-10 20:08:09 +00:00
Yabin Cui
bf830ade7f Omit comment when reading --gtest_list_tests option's output.
Gtest add comments when listing typed tests. And we should omit them.

Bug: 23040880
Change-Id: If6034af301337fc06eeab294d2dbe5317a6b7f91
2015-08-10 12:12:39 -07:00
Elliott Hughes
5891abdc66 Invalidate cached pid in vfork.
Bug: http://b/23008979
Change-Id: I1dd900ac988cdbe10aad3abc53240c5d352891d5
2015-08-07 19:44:12 -07:00
Yabin Cui
993a2bee84 am 7e919dae: Merge "add a fortified implementation of getcwd"
* commit '7e919daeaad62515ebbbf7b06badc77625a14d90':
  add a fortified implementation of getcwd
2015-08-01 05:25:13 +00:00
Daniel Micay
9101b00400 add a fortified implementation of getcwd
Change-Id: Ice3e6d3e1ff07788305dc85f8ee4059baad5fac4
2015-08-01 00:42:30 -04:00
Elliott Hughes
9d7c6a7e57 am 61c21b63: Merge "Revert "add a fortified implementation of getcwd""
* commit '61c21b63bc1602bce8685757fb1c2a788cc9eb8d':
  Revert "add a fortified implementation of getcwd"
2015-07-31 17:41:05 +00:00
Elliott Hughes
4c43aac9a5 Revert "add a fortified implementation of getcwd"
This reverts commit 89a121d43a.

Change-Id: Ib6f6fd424acea68a063777e9f324405450e23316
2015-07-31 17:32:50 +00:00
Yabin Cui
4279bac26a am 442a3fca: Merge "add a fortified implementation of getcwd"
* commit '442a3fcae68152a95ef481ef99932d1bc001dc08':
  add a fortified implementation of getcwd
2015-07-31 17:11:27 +00:00
Daniel Micay
89a121d43a add a fortified implementation of getcwd
Change-Id: I95001ae4fe8f206db83e5c44d129ba11310695ce
2015-07-30 17:16:40 -04:00
Elliott Hughes
c9bee10805 am 4955cde2: Merge "Add a regression test for a fixed strnlen bug."
* commit '4955cde2c55d4860f12039a96d14fc756b1308a3':
  Add a regression test for a fixed strnlen bug.
2015-07-28 15:30:24 +00:00
Elliott Hughes
d2a9fb3267 Add a regression test for a fixed strnlen bug.
Bug: https://code.google.com/p/android/issues/detail?id=74741
Change-Id: I78b0114bdbe8e680b0e938af608a634e73c86eda
2015-07-27 20:55:03 -07:00
Chih-hung Hsieh
c11758f2c9 am cebef1a7: Merge "Add one simple thread local storage test."
* commit 'cebef1a7812fe3552f12dd7e885a1f879a9946ed':
  Add one simple thread local storage test.
2015-07-28 02:01:16 +00:00
Chih-hung Hsieh
cebef1a781 Merge "Add one simple thread local storage test." 2015-07-28 01:33:01 +00:00
Chih-Hung Hsieh
7656d0cec0 Add one simple thread local storage test.
This test should pass with gcc and fail with clang,
until clang/llvm supports emutls or Android linker supports
ELF TLS models.

BUG: 21082792
Change-Id: Id8c97da52c68ec230c7d26af703f6ed32d53a4fe
2015-07-27 17:20:19 -07:00
Yabin Cui
0e63c39cca am 8af32633: Merge "add fortified implementations of fread/fwrite"
* commit '8af32633498184e58e6f8d5d75b9f9cdbef5b6be':
  add fortified implementations of fread/fwrite
2015-07-28 00:17:08 +00:00
Yabin Cui
8af3263349 Merge "add fortified implementations of fread/fwrite" 2015-07-27 22:46:29 +00:00
Elliott Hughes
7835c65ca7 am adc5795f: Merge "Use AT_PAGESZ for sysconf(_SC_PAGE_SIZE)."
* commit 'adc5795fb7b674e6d40d1f190c675607c1379343':
  Use AT_PAGESZ for sysconf(_SC_PAGE_SIZE).
2015-07-25 18:58:57 +00:00
Elliott Hughes
189394b885 Use AT_PAGESZ for sysconf(_SC_PAGE_SIZE).
Bug: http://b/18342333
Change-Id: Id12ed4e85a0f35d7d27202f7792df42a65a74b4e
2015-07-24 23:22:07 -07:00
Daniel Micay
fed2659869 add fortified implementations of fread/fwrite
A __size_mul_overflow utility is used to take advantage of the checked
overflow intrinsics in Clang and GCC (>= 5). The fallback for older
compilers is the optimized but less than ideal overflow checking pattern
used in OpenBSD.

Change-Id: Ibb0d4fd9b5acb67983e6a9f46844c2fd444f7e69
2015-07-23 18:55:46 -04:00
Yabin Cui
c0c9704e11 am 2565492d: Merge "Add getgrgid_r/getgrnam_r."
* commit '2565492db0d67b95348cd1c3026ed338ca59aa37':
  Add getgrgid_r/getgrnam_r.
2015-07-23 02:06:56 +00:00
Yabin Cui
2565492db0 Merge "Add getgrgid_r/getgrnam_r." 2015-07-22 03:22:26 +00:00
Yabin Cui
c4786d366b Add getgrgid_r/getgrnam_r.
Bug: 22568551
Change-Id: I3c0772d119d6041063c6be53f5bcc5ea1768f0d5
2015-07-21 19:33:34 -07:00
Ying Wang
361d4b4c87 We don't have CXX_BARE any more
Now we have split CXX_WRAPPER from TARGET_CXX and CXX_BARE isn't needed
any more.

Bug: 22612634
Change-Id: I52c78b0d1b325910e875a786d17f780731778b4b
(cherry-pick from commit 9d11a7087c)
2015-07-21 14:08:42 -07:00
Ying Wang
40e2b72fb3 am e39b279b: Merge "We don\'t have CXX_BARE any more" into mnc-dev
* commit 'e39b279bb4971d0c3322214ea977275f1bc58c0b':
  We don't have CXX_BARE any more
2015-07-21 21:01:46 +00:00
Ying Wang
9d11a7087c We don't have CXX_BARE any more
Now we have split CXX_WRAPPER from TARGET_CXX and CXX_BARE isn't needed
any more.

Bug: 22612634
Change-Id: I52c78b0d1b325910e875a786d17f780731778b4b
2015-07-20 18:51:30 -07:00
Dmitriy Ivanov
8bdf8ab97c am e70d7a78: Merge "Fix dt_runpath test."
* commit 'e70d7a78f0bfba8b09d37c145769cb8d1d7c5fb6':
  Fix dt_runpath test.
2015-07-20 19:17:02 +00:00
Dmitriy Ivanov
3fef96f827 Fix dt_runpath test.
Bfd linker produces DT_RPATH instead of DT_RUNPATH
unless --enable-new-dtags option is specified.

Bug: http://b/22560945
Change-Id: I71bdc5137b899ab736e55c5a9574cfbba8e1983b
2015-07-20 10:47:49 -07:00
Yabin Cui
a89821abe3 am 60a11dcb: Merge "Add test for an Android kernel bug about prctl."
* commit '60a11dcb44992f610e696fc246c70731012080dd':
  Add test for an Android kernel bug about prctl.
2015-07-14 22:52:49 +00:00
Yabin Cui
91ce715af1 Add test for an Android kernel bug about prctl.
Bug: 20017123

Change-Id: I8c109a06999a8bffcc8e8298b04ee637bb67d878
2015-07-13 19:15:38 -07:00
Pirama Arumuga Nainar
fcd017148b am d1e10d7d: Merge "Use delete[] to de-allocate pointers from new[]"
* commit 'd1e10d7d168a8461d9eb47e48802ea11d8bd0640':
  Use delete[] to de-allocate pointers from new[]
2015-07-09 23:04:30 +00:00
Pirama Arumuga Nainar
d1e10d7d16 Merge "Use delete[] to de-allocate pointers from new[]" 2015-07-09 22:40:51 +00:00
Pirama Arumuga Nainar
4d44675283 Use delete[] to de-allocate pointers from new[]
Upstream clang has a new diagnostic, '-Wmismatched-new-delete' to
generate a warning (that becomes an error with -Werror) when delete is
used to deallocate pointers created with 'new[]'.  This patch fixes
'delete's that trigger this warning/error.

Change-Id: Id7b6f6c2df3e860e576de55e2f61f3d2be3a3986
2015-07-09 10:15:15 -07:00
Evgenii Stepanov
b4f5d6d894 am 33ef6c20: Merge "Respect caller DT_RUNPATH in dlopen()."
* commit '33ef6c20f2ddf19b29ed3a4e50139fa391b1a3d4':
  Respect caller DT_RUNPATH in dlopen().
2015-07-08 20:16:35 +00:00
Evgenii Stepanov
33ef6c20f2 Merge "Respect caller DT_RUNPATH in dlopen()." 2015-07-08 19:50:03 +00:00
Evgenii Stepanov
0cdef7e7f3 Respect caller DT_RUNPATH in dlopen().
When dlopen-ing a library, add the caller's DT_RUNPATH to the directory search
list. This fixes dlfcn.dt_runpath in bionic-unit-tests-glibc(32|64).

Bug: 21899363
Change-Id: Ife6a7e192939292cf4dc291b7e6b95945761cde3
2015-07-07 10:56:06 -07:00
Dmitriy Ivanov
7830dcf1b5 am 416695a7: Merge "Improve personality initialization"
* commit '416695a75c3892dd709a80ea8a640da07082594e':
  Improve personality initialization
2015-07-01 02:36:04 +00:00
Dmitriy Ivanov
c2247478d5 Improve personality initialization
1. Personality parameter should be unsigned int (not long)
2. Do not reset bits outside of PER_MASK when setting
   personality value.
3. Set personality for static executables.

Bug: http://b/21900686
Change-Id: I4c7e34079cbd59b818ce221eed325c05b9bb2303
(cherry picked from commit f643eb38c3)
2015-06-30 19:01:24 -07:00
Dmitriy Ivanov
f643eb38c3 Improve personality initialization
1. Personality parameter should be unsigned int (not long)
2. Do not reset bits outside of PER_MASK when setting
   personality value.
3. Set personality for static executables.

Bug: http://b/21900686
Change-Id: I4c7e34079cbd59b818ce221eed325c05b9bb2303
2015-06-30 18:45:59 -07:00
Dmitriy Ivanov
168ebad960 am 46d24d12: Merge "Replace NULL with nullptr"
* commit '46d24d12e167a0b5afa4ded218aa4db0a477141a':
  Replace NULL with nullptr
2015-06-29 21:34:07 +00:00
Dmitriy Ivanov
46d24d12e1 Merge "Replace NULL with nullptr" 2015-06-29 21:08:49 +00:00
Chih-Hung Hsieh
4ab0edac1a am d807b9a1: Merge "Use gcc to build and test x86_64 long double code."
* commit 'd807b9a12d3e49132b095df3d883618452033b51':
  Use gcc to build and test x86_64 long double code.
2015-06-24 00:40:16 +00:00
Chih-Hung Hsieh
d807b9a12d Merge "Use gcc to build and test x86_64 long double code." 2015-06-24 00:15:51 +00:00
Chih-Hung Hsieh
e79d06b0e8 Use gcc to build and test x86_64 long double code.
Clang/llvm x86_64 configuration of long double is still
incompatible with gcc.
https://llvm.org/bugs/show_bug.cgi?id=23897

BUG: 21899249
Change-Id: I47fd6d0ce2daa84ae0035e7885a4d90e4c3056f7
2015-06-23 23:13:39 +00:00
Dmitriy Ivanov
0a9df9a13e am af6ee5b5: Merge "Work around compiler optimization"
* commit 'af6ee5b5bc446ef5a6f2bf41bc4f2e13657978be':
  Work around compiler optimization
2015-06-23 22:17:08 +00:00
Dmitriy Ivanov
aff18fd608 Replace NULL with nullptr
Change-Id: If66d0c5ae1ea1ed371b44e067d4ae59ac54a8842
2015-06-23 13:58:22 -07:00
Dmitriy Ivanov
7d09a8cd11 Work around compiler optimization
This makes bionic-unit-test-glibc64 behave consistently
when testing dlopen from a library with dt_runpath.

Bug: http://b/21899363
Change-Id: I9d446eb6852876975874d6b7761f6f81cc4e9916
2015-06-23 13:47:23 -07:00
Dmitriy Ivanov
c29626c12a am 13cee57d: Merge "Remove libdl* tests from bionic-unit-tests-static"
* commit '13cee57dee4ebd14b57e7b5acd372228eb9c4a37':
  Remove libdl* tests from bionic-unit-tests-static
2015-06-22 19:50:49 +00:00
Dmitriy Ivanov
96ebdcdca0 Remove libdl* tests from bionic-unit-tests-static
Bug: http://b/21900592
Change-Id: I907cc15684b121ec2fbdeca49fc584bb6d2eaacc
(cherry picked from commit de4e27e231)
2015-06-22 12:24:36 -07:00
Dmitriy Ivanov
de4e27e231 Remove libdl* tests from bionic-unit-tests-static
Bug: http://b/21900592
Change-Id: I907cc15684b121ec2fbdeca49fc584bb6d2eaacc
2015-06-22 11:54:58 -07:00
Yabin Cui
1df44bd0a4 am cb060759: am 8beb0c34: am b245bc75: am 0f455612: Merge "Fix flaky test of timer_create_multiple in L." into lollipop-mr1-cts-dev
* commit 'cb0607590341ed2512a55015e66e19e7f7db3723':
  Fix flaky test of timer_create_multiple in L.
2015-06-19 20:29:49 +00:00
Yabin Cui
cb06075903 am 8beb0c34: am b245bc75: am 0f455612: Merge "Fix flaky test of timer_create_multiple in L." into lollipop-mr1-cts-dev
* commit '8beb0c34da46a5146a2de8256db8bb42febb283c':
  Fix flaky test of timer_create_multiple in L.
2015-06-19 19:06:22 +00:00
Yabin Cui
8beb0c34da am b245bc75: am 0f455612: Merge "Fix flaky test of timer_create_multiple in L." into lollipop-mr1-cts-dev
* commit 'b245bc750021ce6d220e71625fca66620cdd1f05':
  Fix flaky test of timer_create_multiple in L.
2015-06-19 18:55:51 +00:00
Yabin Cui
d1ade7ce02 Don't use TIMER_ABSTIME in time_test.
If TIMER_ABSTIME is used in timer_settime(), the timer is always fired
immediately, which is not the intent of the tests.

Change-Id: I76047dbeb2bdded272ee6d028630b53bfd7d8514
2015-06-19 00:54:34 +00:00
Yabin Cui
410c1adf5f Fix flaky test of timer_create_multiple in L.
Bug: 20677618
Change-Id: I0cb5faf77edce042b10611543180f3e2e73d3d05
2015-06-18 16:19:02 -07:00
Dan Albert
11ea08c5cb Use new sanitizer option.
Change-Id: I21b04a1f3be3b10ee557bf9e0caa5db638686364
2015-06-16 13:57:54 -07:00
Dan Albert
cce405a134 Add a sys/procfs.h.
Needed for building gdbserver out of the box.

Bug: http://b/21695943
Bug: https://code.google.com/p/android/issues/detail?id=86712
Change-Id: Ieadda2b595f08bfddfa61fcd68006b8e7c1a438d
(cherry picked from commit bf18c61798)
2015-06-15 18:39:02 -07:00
Elliott Hughes
333bdad361 Merge "Add a sys/procfs.h." 2015-06-16 01:28:48 +00:00
Dan Albert
bf18c61798 Add a sys/procfs.h.
Needed for building gdbserver out of the box.

Bug: http://b/21695943
Bug: https://code.google.com/p/android/issues/detail?id=86712
Change-Id: Ieadda2b595f08bfddfa61fcd68006b8e7c1a438d
2015-06-15 14:33:54 -07:00
Dmitriy Ivanov
ae1e75458a Merge "Make path to apk compliant with jar url format" into mnc-dev 2015-06-11 21:55:09 +00:00
Dmitriy Ivanov
402a75060d Make path to apk compliant with jar url format
Bug: http://b/21726698
Bug: http://b/8076853
Change-Id: I8c1942a98fe3119746b4dc9f60a7ff215ea7009c
(cherry picked from commit 524f1f1efe)
2015-06-11 11:01:23 -07:00
Elliott Hughes
25ac753f47 Add process_vm_readv and process_vm_writev.
Bug: http://b/21761353
Change-Id: Ic8ef3f241d62d2a4271fbc783c8af50257bac498
(cherry picked from commit be57a40d29)
2015-06-10 18:55:06 -07:00
Elliott Hughes
c910de9d5e Merge "Add process_vm_readv and process_vm_writev." 2015-06-11 01:31:17 +00:00
Elliott Hughes
be57a40d29 Add process_vm_readv and process_vm_writev.
Bug: http://b/21761353
Change-Id: Ic8ef3f241d62d2a4271fbc783c8af50257bac498
2015-06-10 17:24:20 -07:00
Dmitriy Ivanov
bd3b961186 Fix application_sdk_versions_smoke test
Bug: http://b/21364029
Change-Id: I9716d6b0ea7fae6483629a290dbe695b68526588
(cherry picked from commit 79b3877a13)
2015-06-10 17:03:12 -07:00
Dmitriy Ivanov
79b3877a13 Fix application_sdk_versions_smoke test
Bug: http://b/21364029
Change-Id: I9716d6b0ea7fae6483629a290dbe695b68526588
2015-06-10 16:55:50 -07:00
Evgenii Stepanov
6865082ca6 Support DT_RUNPATH in the linker.
Only $ORIGIN substitution is supported, but not linux-specific $LIB
or $PLATFORM.

Change-Id: I5814a016c7c91afba080230a547a863686e7c2b9
2015-06-10 16:44:22 -07:00
Christopher Ferris
60907c7f4e Allow NULL in pthread_mutex_lock/unlock.
The pthread_mutex_lock and pthread_mutex_unlock were allowed to
fail silently on L 32 bit devices when passed a NULL. We changed
this to a crash on 32 bit devices, but there are still games that make
these calls and are not likely to be updated. Therefore, once again
allow NULL to be passed in on 32 bit devices.

Bug: 19995172
(cherry picked from commit 511cfd9dc8)

Change-Id: I159a99a941cff94297ef3fffda7075f8ef1ae252
2015-06-10 10:50:43 -07:00
Christopher Ferris
511cfd9dc8 Allow NULL in pthread_mutex_lock/unlock.
The pthread_mutex_lock and pthread_mutex_unlock were allowed to
fail silently on L 32 bit devices when passed a NULL. We changed
this to a crash on 32 bit devices, but there are still games that make
these calls and are not likely to be updated. Therefore, once again
allow NULL to be passed in on 32 bit devices.

Bug: 19995172
Change-Id: If7e8860075ecd63c0064d80f64e226fad7bd3c26
2015-06-09 18:46:15 -07:00
Dmitriy Ivanov
524f1f1efe Make path to apk compliant with jar url format
Bug: http://b/21726698
Bug: http://b/8076853
Change-Id: I8c1942a98fe3119746b4dc9f60a7ff215ea7009c
2015-06-09 13:47:46 -07:00
Nick Kralevich
e1d0810cd7 Add O_PATH support for flistxattr()
A continuation of commit 2825f10b7f.

Add O_PATH compatibility support for flistxattr(). This allows
a process to list out all the extended attributes associated with
O_PATH file descriptors.

Change-Id: Ie2285ac7ad2e4eac427ddba6c2d182d41b130f75
2015-06-06 11:25:41 -07:00
Yabin Cui
ea248d9ca8 Merge "Make sys_resource test more robust." into lollipop-cts-dev
automerge: 492a0bf

* commit '492a0bf212973baa1c33d584d57e75395774447f':
  Make sys_resource test more robust.
2015-06-02 22:03:23 +00:00
Yabin Cui
e7ece90b50 Make sys_resource test more robust.
Bug: 19482626

"ulimit -c xxx" command may run before bionic-unit-tests.
Make sure sys_resource test fails gently in that case.

Change-Id: Ic3b5ed8b20acba56df8c5ef082c88e5050e761aa
(cherry picked from commit 4853f40f3f)
2015-06-02 14:40:26 -07:00
Nick Kralevich
c92f9f8069 libc: Add O_PATH support for fgetxattr / fsetxattr
Support O_PATH file descriptors when handling fgetxattr and fsetxattr.
This avoids requiring file read access to pull extended attributes.

This is needed to support O_PATH file descriptors when calling
SELinux's fgetfilecon() call. In particular, this allows the querying
and setting of SELinux file context by using something like the following
code:

  int dirfd = open("/path/to/dir", O_DIRECTORY);
  int fd = openat(dirfd, "file", O_PATH | O_NOFOLLOW);
  char *context;
  fgetfilecon(fd, &context);

This change was motivated by a comment in
https://android-review.googlesource.com/#/c/152680/1/toys/posix/ls.c

(cherrypicked from commit 2825f10b7f)

Change-Id: Ic0cdf9f9dd0e35a63b44a4c4a08400020041eddf
2015-06-02 10:08:05 -07:00
Dmitriy Ivanov
c4ebe60e1a Fix dlsym(handle_of_main_executable, ...)
According to man dlopen(3) and posix docs in the case when si is handle
  of the main executable we need to search not only in the executable and its
  dependencies but also in all libraries loaded with RTLD_GLOBAL.

  see also: http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlopen.html

Bug: http://b/21528224
Bug: http://b/17512583
Bug: https://code.google.com/p/android/issues/detail?id=173822
Change-Id: Ib2801367ba48b6f3704da89a6d9f5e6911430013
(cherry picked from commit f439b5a318)
2015-06-01 16:57:33 -07:00
Dmitriy Ivanov
ef55f96723 Merge "Fix dlsym(handle_of_main_executable, ...)" 2015-06-01 23:51:24 +00:00
Nick Kralevich
2825f10b7f libc: Add O_PATH support for fgetxattr / fsetxattr
Support O_PATH file descriptors when handling fgetxattr and fsetxattr.
This avoids requiring file read access to pull extended attributes.

This is needed to support O_PATH file descriptors when calling
SELinux's fgetfilecon() call. In particular, this allows the querying
and setting of SELinux file context by using something like the following
code:

  int dirfd = open("/path/to/dir", O_DIRECTORY);
  int fd = openat(dirfd, "file", O_PATH | O_NOFOLLOW);
  char *context;
  fgetfilecon(fd, &context);

This change was motivated by a comment in
https://android-review.googlesource.com/#/c/152680/1/toys/posix/ls.c

Change-Id: Ic0cdf9f9dd0e35a63b44a4c4a08400020041eddf
2015-06-01 15:51:56 -07:00
Dmitriy Ivanov
f439b5a318 Fix dlsym(handle_of_main_executable, ...)
According to man dlopen(3) and posix docs in the case when si is handle
  of the main executable we need to search not only in the executable and its
  dependencies but also in all libraries loaded with RTLD_GLOBAL.

  see also: http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlopen.html

Bug: http://b/21528224
Bug: http://b/17512583
Bug: https://code.google.com/p/android/issues/detail?id=173822
Change-Id: Ib2801367ba48b6f3704da89a6d9f5e6911430013
2015-06-01 14:33:43 -07:00
Dan Albert
c5e02eeb35 Cleanup ftruncate negative test.
Addresses post-submit comments from
I54692ab8105dd09db6af7a2c0894a17bdd118aa0.

Bug: http://b/21309901
Change-Id: Ie19ee8cdcc4055a65fe7dfc103156e54eafe8977
(cherry picked from commit 9d476a02e9)
2015-06-01 13:24:36 -07:00
Dan Albert
9d476a02e9 Cleanup ftruncate negative test.
Addresses post-submit comments from
I54692ab8105dd09db6af7a2c0894a17bdd118aa0.

Bug: http://b/21309901
Change-Id: Ie19ee8cdcc4055a65fe7dfc103156e54eafe8977
2015-06-01 13:22:57 -07:00
Dan Albert
5f3e19dbbe Fix error handling for negative size in ftruncate.
Bug: 21309901
Change-Id: I54692ab8105dd09db6af7a2c0894a17bdd118aa0
(cherry picked from commit c05554ec5c)
2015-06-01 11:28:13 -07:00
Dmitriy Ivanov
d8ead18145 Add functions to provide target sdk version
Bug: http://b/21364029
Change-Id: I8648d1bff6c8fd6e7cd12da7f128e048b9f2829a
(cherry picked from commit 79fd668bb4)
2015-05-27 16:20:16 -07:00
Dmitriy Ivanov
79fd668bb4 Add functions to provide target sdk version
Bug: http://b/21364029
Change-Id: I8648d1bff6c8fd6e7cd12da7f128e048b9f2829a
2015-05-27 14:31:36 -07:00
Dan Albert
ffe01a3de6 Merge "Fix error handling for negative size in ftruncate." 2015-05-21 20:41:25 +00:00
Yabin Cui
c15a935202 am fd20a8c2: resolved conflicts for merge of 473d96c0 to lmp-mr1-ub-dev
* commit 'fd20a8c2d669b3f2d63e2d33a32b90d1b7f17b82':
  Fix timer flaky test in lollipop-mr1-cts-dev.
2015-05-20 21:48:09 +00:00
Yabin Cui
b0c6f2dba2 Fix pthread_attr_getstack__main_thread failure on glibc.
Move test of bionic specific implementation into bionic ifdef.

Bug: 19805726
Change-Id: Idf369b16e7f41f060c75b0aaf34e05cf3c161aa9
2015-05-20 14:41:15 -07:00
Dan Albert
c05554ec5c Fix error handling for negative size in ftruncate.
Bug: 21309901
Change-Id: I54692ab8105dd09db6af7a2c0894a17bdd118aa0
2015-05-20 14:20:33 -07:00
Yabin Cui
fd20a8c2d6 resolved conflicts for merge of 473d96c0 to lmp-mr1-ub-dev
Change-Id: I48269218b152054d527d9257d40490b54205140f
2015-05-20 13:36:56 -07:00
Yabin Cui
2b5c2285c0 Remove pthread_detach_no_leak test.
This test has lost its purpose as we are using mmap/munmap for pthread_internal_t. And it is a flaky test.

Bug: 21205574
Bug: 20860440
Change-Id: I7cbb6bc3fd8a2ca430415beab5ee27a856ce4ea7
(cherry picked from commit 2957cc5f10)
2015-05-18 10:31:20 -07:00
Dmitriy Ivanov
ff407803db Remove -z global workaround for target x86
Change-Id: I08e75a1c7437c97e4af59316d2c14c7fa3f65e03
(cherry picked from commit 933332462d)
2015-05-15 10:30:47 -07:00
Dmitriy Ivanov
933332462d Remove -z global workaround for target x86
Change-Id: I08e75a1c7437c97e4af59316d2c14c7fa3f65e03
2015-05-14 21:28:21 -07:00
Dmitriy Ivanov
4bac6ea463 Improved dlsym tests and fixes to linker
Answers the question: what if dependent library
 was preloaded with RTLD_LOCAL flag.

 Also add test for RTLD_NEXT within local_group.

Bug: http://b/17512583
Change-Id: I79e081e68b3a8c0ed8980d4275a06515fea94ec9
(cherry picked from commit 697bd9fd38)
2015-05-12 13:49:13 -07:00
Dmitriy Ivanov
697bd9fd38 Improved dlsym tests and fixes to linker
Answers the question: what if dependent library
 was preloaded with RTLD_LOCAL flag.

 Also add test for RTLD_NEXT within local_group.

Bug: http://b/17512583
Change-Id: I79e081e68b3a8c0ed8980d4275a06515fea94ec9
2015-05-12 13:46:40 -07:00
Yabin Cui
5c0996a969 Fix timer flaky test in lollipop-mr1-cts-dev.
It is partically cherry-pick from https://android-review.googlesource.com/#/c/123410/.
And as lollipop-mr1-cts-dev still uses stlport, <stdatomic.h> is used instead of <atomic>.

Bug: 20677618
Change-Id: I952a6fd074facc4227c955fecf3ecbfbbaec4193
2015-05-08 13:12:01 -07:00
Yabin Cui
f9eeea6d65 Merge "Remove pthread_detach_no_leak test." 2015-05-08 01:36:30 +00:00
Yabin Cui
2957cc5f10 Remove pthread_detach_no_leak test.
This test has lost its purpose as we are using mmap/munmap for pthread_internal_t. And it is a flaky test.

Bug: 20860440
Change-Id: I7cbb6bc3fd8a2ca430415beab5ee27a856ce4ea7
2015-05-07 16:53:25 -07:00
Dmitriy Ivanov
a60fd09e26 Move pthread_atfork_dlclose test out of static lib
Bug: http://b/20858755
Change-Id: I0d84e8b43dc33902d75af18db6b7c8e0b619d718
(cherry picked from commit 5624a6a1e5)
2015-05-06 16:47:54 -07:00
Dmitriy Ivanov
5624a6a1e5 Move pthread_atfork_dlclose test out of static lib
Bug: http://b/20858755
Change-Id: I0d84e8b43dc33902d75af18db6b7c8e0b619d718
2015-05-06 14:15:28 -07:00
Christopher Ferris
64a8698809 Modify test to avoid race condition.
automerge: 3da136a

* commit '3da136aa47e2d1608b98abb2580f024b36f92831':
  Modify test to avoid race condition.
2015-05-04 16:45:13 +00:00
Elliott Hughes
9a2744df30 Merge "Fix POSIX timer thread naming." 2015-04-25 18:01:18 +00:00
Elliott Hughes
d1aea30b2a Fix POSIX timer thread naming.
Spencer Low points out that we never actually set a name because the constant
part of the string was longer than the kernel's maximum, and the kernel
rejects long names rather than truncate.

Shorten the fixed part of the string while still keeping it meaningful. 9999
POSIX timers should be enough for any process...

Bug: https://code.google.com/p/android/issues/detail?id=170089
Change-Id: Ic05f07584c1eac160743519091a540ebbf8d7eb1
2015-04-25 10:05:24 -07:00
Dmitriy Ivanov
2c256a0f09 Merge "Unregister pthread_atfork handlers on dlclose()" 2015-04-25 05:36:07 +00:00
Dmitriy Ivanov
e91e66f223 Use bfd linker for x86/x86_64 targets
ld.gold in current toolchain for x86_64
 does not support -z global.

Change-Id: Iea2b192f0f0aa998a02adb356fd4eec4e10a1739
2015-04-24 21:05:49 -07:00
Dmitriy Ivanov
ea295f68f1 Unregister pthread_atfork handlers on dlclose()
Bug: http://b/20339788
Change-Id: I874c87faa377645fa9e0752f4fc166d81fd9ef7e
2015-04-24 17:57:37 -07:00
Dmitriy Ivanov
6612d7a347 Enable dlsym_df_1_global test for arm/arm64
Change-Id: I1fdebced93175cb14053e2239e79f97239fc2dc2
2015-04-24 16:26:03 -07:00
Dimitry Ivanov
094f58fb2a Revert "Unregister pthread_atfork handlers on dlclose()"
The visibility control in pthread_atfork.h is incorrect.
 It breaks 64bit libc.so by hiding pthread_atfork.

 This reverts commit 6df122f852.

Change-Id: I21e4b344d500c6f6de0ccb7420b916c4e233dd34
2015-04-24 03:46:57 +00:00
Dmitriy Ivanov
6df122f852 Unregister pthread_atfork handlers on dlclose()
Change-Id: I326fdf6bb06bed12743f08980b5c69d849c015b8
2015-04-22 19:19:37 -07:00
Daniel Micay
42281880a8 add fortified readlink/readlinkat implementations
Change-Id: Ia4b1824d20cad3a072b9162047492dade8576779
2015-04-17 18:49:12 -04:00
Dmitriy Ivanov
3875744f89 Merge "Support symbol versioning" 2015-04-17 03:57:46 +00:00
Dmitriy Ivanov
2a81536144 Support symbol versioning
Bug: http://b/20139821
Change-Id: I64122a0fb0960c20b2ce614161b7ab048456b681
2015-04-16 17:57:30 -07:00
Daniel Micay
e7e1c875b0 add fortified implementations of pread/pread64
Change-Id: Iec39c3917e0bc94371bd81541619392f5abe29b9
2015-04-16 10:33:35 -04:00
Dmitriy Ivanov
a40cb0ca7f Merge "Call __cxa_thread_finalize for the main thread." 2015-04-16 08:06:03 +00:00
Yabin Cui
2587c6a2f0 Merge "Change on handling of SIGEV_THREAD timers." 2015-04-16 01:08:25 +00:00
Yabin Cui
95f1ee235a Change on handling of SIGEV_THREAD timers.
1. Don't prevent calling callback when SIGEV_THREAD timers are disarmed by timer_settime.
As in POSIX standard: The effect of disarming or resetting a timer with pending
expiration notifications is unspecified. And glibc didn't prevent in this situation, so I
think it is fine to remove the support.
2. Still prevent calling callback when SIGEV_THREAD timers are deleted by timer_delete.
As in POSIX standard: The disposition of pending signals for the deleted timer is unspecified.
However, glibc handles this (although that is not perfect). And some of our tests in
time_test.cpp depend on this feature as described in b/18039727. so I retain the support.
3. Fix some flaky test in time_test.cpp, and make "time*" test pass on bionic-unit-tests-glibcxx.

Bug: 18263854

Change-Id: I8ced184eacdbfcf433fd81b0c69c38824beb8ebc
2015-04-15 17:36:01 -07:00
Dmitriy Ivanov
163ab8ba86 Call __cxa_thread_finalize for the main thread.
Bug: http://b/20231984
Bug: http://b/16696563
Change-Id: I71cfddd0d404d1d4a593ec8d3bca9741de8cb90f
2015-04-15 16:24:21 -07:00
Dmitriy Ivanov
66aa0b61f7 Hide emutls* symbols in libc.so
Also make thread_local in test static to avoid ld.bfd
 warning for arm64.

Change-Id: I09a3f2aa9b73a4fafa3f3bbc64ddc2a128ad50ee
2015-04-15 14:23:00 -07:00
Yabin Cui
8f3f04184a Merge "Prevent using static-allocated pthread keys before creation." 2015-04-14 20:35:08 +00:00
Yabin Cui
5ddbb3f936 Prevent using static-allocated pthread keys before creation.
Bug: 19993460

Change-Id: I244dea7f5df3c8384f88aa48d635348fafc9cbaf
2015-04-14 13:32:09 -07:00
Dmitriy Ivanov
de88974120 Merge "Fix dl* tests to run-on-host" 2015-04-11 00:28:05 +00:00
Dmitriy Ivanov
ef25592f14 Fix dl* tests to run-on-host
Bug: http://b/20121152
Change-Id: I1e1f41d885c75dbb26f91565a53a15d62ef72ce6
2015-04-09 14:56:26 -07:00
Yabin Cui
9f2c2f53d3 Merge "Provide writer preference option in rwlock." 2015-04-09 17:19:44 +00:00
Yabin Cui
76615dae93 Provide writer preference option in rwlock.
Previous implementation of rwlock contains four atomic variables, which
is hard to maintain and change. So I make following changes in this CL:

1. Add pending flags in rwlock.state, so we don't need to synchronize
between different atomic variables. Using compare_and_swap operations
on rwlock.state is enough for all state change.

2. Add pending_lock to protect readers/writers waiting and wake up
operations. As waiting/wakeup is not performance critical, using a
lock is easier to maintain.

3. Add writer preference option.

4. Add unit tests for rwlock.

Bug: 19109156

Change-Id: Idcaa58d695ea401d64445610b465ac5cff23ec7c
2015-04-08 13:11:13 -07:00
Dmitriy Ivanov
1dce3ed249 Fix x86_64 build
Change-Id: Id81c059bf3ecdb9cc84d04d16ffda34baaadc5a1
2015-04-06 19:05:58 -07:00
Dmitriy Ivanov
8a1007dbab Merge "Add realpath for soinfo" 2015-04-07 00:14:57 +00:00
Dmitriy Ivanov
aae859cc3c Add realpath for soinfo
This change adds realpath to soinfo and
  extends limit on filenames from 128 to PATH_MAX.

  It also removes soinfo::name field, linker uses
  dt_soname instead.

Bug: http://b/19818481
Bug: https://code.google.com/p/android/issues/detail?id=80336
Change-Id: I9cff4cb5bda3ee2bc74e1bbded9594ea7fbe2a08
2015-04-06 21:15:43 +00:00
Elliott Hughes
67de2593b3 Merge "Add a test for getdelim(3) on a directory." 2015-04-06 19:36:13 +00:00
Elliott Hughes
694fd2d880 Add a test for getdelim(3) on a directory.
Apparently uClibc has a bug here. We don't, but let's keep it that way.

Bug: http://landley.net/notes.html#21-03-2015
Change-Id: If406df963db9bee47921d7a1c116ebcab08d96bf
2015-04-05 10:51:56 -07:00
Yabin Cui
4bd8f9637d Merge "Fix bug for recursive/errorcheck mutex on 32-bit devices." 2015-04-04 19:31:55 +00:00
Yabin Cui
f796985923 Fix bug for recursive/errorcheck mutex on 32-bit devices.
Bug: 19216648
Change-Id: I3b43b2d18d25b9bde352da1e35f9568133dec7cf
2015-04-03 19:01:17 -07:00
Dmitriy Ivanov
45c57131d2 Add libdl dependency for target libraries
Fixed x86_64 target build with gcc 4.9

Change-Id: Id3b1e9286c2bcbb8e3ac117bcef957304db7cfd3
2015-04-03 15:17:52 -07:00
Dmitriy Ivanov
aea165cb03 Merge "Add ANDROID_DLEXT_FORCE_LOAD flag" 2015-04-03 19:45:24 +00:00
Dmitriy Ivanov
9b82136b98 Add ANDROID_DLEXT_FORCE_LOAD flag
This flag allows to force loading of the library
  in the case when for some reason multiple ELF files
  share the same filename (because the already-loaded
  library has been removed and overwritten, for example).

Change-Id: I798d44409ee13d63eaa75d685e99c4d028d2b0c1
2015-04-03 10:50:48 -07:00
Dmitriy Ivanov
06b6e3c51d Merge "Look into local group on dlsym with RTLD_DEFAULT" 2015-04-02 21:55:01 +00:00
Dmitriy Ivanov
76ac1acdac Look into local group on dlsym with RTLD_DEFAULT
Fix dlsym to look into local group when called with
  RTLD_DEFAULT and RTLD_NEXT.

Bug: 17512583
Change-Id: I541354e89539c712af2ea4ec751e546913027084
2015-04-02 14:12:45 -07:00
Yabin Cui
00d1101cc1 Merge "Refactor pthread_mutex to support 32-bit owner_tid on 64-bit devices." 2015-04-02 20:27:40 +00:00
Christopher Ferris
618935d267 Merge "gtest_repeat should allow negative values." 2015-04-02 19:19:38 +00:00
Christopher Ferris
119cb55d43 gtest_repeat should allow negative values.
If you pass in a negative value to gtest_repeat, it should run forever.
The new runner didn't allow this, now it does.

Change-Id: Ie0002c12e2fdad22b264adca37c165cfcfe05c7a
2015-04-02 12:16:00 -07:00
Yabin Cui
e69c24543d Refactor pthread_mutex to support 32-bit owner_tid on 64-bit devices.
Bug: 19216648
Change-Id: I765ecacc9036659c766f5d1f6600e1a65364199b
2015-04-01 21:12:22 -07:00
Elliott Hughes
0ad256c1b2 Fix ftw tests when run as non-root.
Root can create subdirectories inside non-writable directories, but
other users can't.

Change-Id: I102fe610d1bd2733aebf184b544e58612465287d
2015-04-01 12:22:40 -07:00
Elliott Hughes
6170693e28 Make ThreadLocalBuffer a class rather than a macro.
Bug: 19995392
Change-Id: I497c512648fbe66257da3fb3bcd5c9911f983705
2015-03-31 10:56:58 -07:00
Dmitriy Ivanov
947adedebc Add test for thread_local keyword.
For gcc only for the time being.

Bug: 19800080
Bug: 16696563
Change-Id: Ifaa59a131ca2d9030554cee7ce631dcb1d081938
2015-03-27 12:05:36 -07:00
Yabin Cui
8f3eb5a4e5 Merge "Revert "Cause Fatal error when invalid pthread_id is detected."" 2015-03-26 18:14:23 +00:00
Yabin Cui
220b99bdc1 Revert "Cause Fatal error when invalid pthread_id is detected."
Some code like in https://buganizer.corp.google.com/u/0/issues/19942911 need to change first.

This reverts commit 03324780aa.

Change-Id: I13ff1e5b3d0672bae9cde234ffba32fbbf33d338
2015-03-26 18:13:07 +00:00
Dmitriy Ivanov
f2d153f836 Merge "Initial implementation of __cxa_thread_atexit_impl" 2015-03-26 17:50:23 +00:00
Dmitriy Ivanov
df79c330d8 Initial implementation of __cxa_thread_atexit_impl
This is initial implementations; does not yet handle
  dlclose - undefined behavior, needs linker support to
  handle it right.

Bug: 19800080
Bug: 16696563
Change-Id: I7a3e21ed7f7ec01e62ea1b7cb2ab253590ea0686
2015-03-25 18:07:59 -07:00
Yabin Cui
17393b06ba Hide internal of pthread_mutex_t.
Bug: 19249079
Change-Id: Iffb79c8d861b698d474f212dc80c638fc2cf1620
2015-03-25 17:54:17 -07:00
Yabin Cui
03324780aa Cause Fatal error when invalid pthread_id is detected.
This is a patch testing whether we can use abort() instead of
returning ESRCH for invalid pthread ids. It is an intermediate
step to remove g_thread_list/g_thread_list_lock.

Bug: 19636317
Change-Id: Idd8e4a346c7ce91e1be0c2ebcb78ce51c0d0a31d
2015-03-25 15:30:39 -07:00
Yabin Cui
b584572213 Add test for pthread types alignment check.
Bug: 19249079
Change-Id: I83c4f0d11ec5d82a346ae0057d02a92bb1d519e8
2015-03-20 17:42:09 -07:00
Yabin Cui
bbb0432a33 Return EINVAL when calling pthread_detach for joined thread.
Change-Id: I717015132187e087e0ad485284a13c8801e25e77
2015-03-19 16:48:19 -07:00