Commit graph

962 commits

Author SHA1 Message Date
Colin Cross
4a54ec8200 Merge "Add .PHONY for phony bionic test targets" 2015-09-25 22:25:58 +00: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
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
7660a088cd Remove libpagemap include hack.
Change-Id: I4c75ae4e311342c9ab4f317026904f893e931384
2015-09-22 22:40:22 -07:00
Elliott Hughes
15dfd63aba Fix another duplicate maps parser.
Change-Id: Icb69f59ffbd0d5de7f727142260fae152d36a904
2015-09-22 16:40:14 -07: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
dd51453904 Merge "Add preliminary OEM UID/GID support." 2015-09-22 21:53:39 +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
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
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
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
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
767fb1c5c6 build bionic gtest runner on mac.
Change-Id: I39a7e94b6662256646dfaeb8f9ecd5c03cd5fbc6
2015-09-01 15:40:38 -07: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
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
7ac3c128bb Add strchrnul.
Bug: http://b/18374026
Change-Id: Iea923309c090a51a2d41c5a83320ab3789f40f1c
2015-08-26 09:59:29 -07: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
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
ff4afc136e Merge "Omit comment when reading --gtest_list_tests option's output." 2015-08-10 22:01:07 +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
Daniel Micay
9101b00400 add a fortified implementation of getcwd
Change-Id: Ice3e6d3e1ff07788305dc85f8ee4059baad5fac4
2015-08-01 00:42:30 -04: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
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
8af3263349 Merge "add fortified implementations of fread/fwrite" 2015-07-27 22:46:29 +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
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
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
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
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
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
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
46d24d12e1 Merge "Replace NULL with nullptr" 2015-06-29 21:08:49 +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
aff18fd608 Replace NULL with nullptr
Change-Id: If66d0c5ae1ea1ed371b44e067d4ae59ac54a8842
2015-06-23 13:58:22 -07:00