Commit graph

23283 commits

Author SHA1 Message Date
Elliott Hughes
3ce774c83b Merge "Add three more functions to the list of POSIX cruft." 2017-08-23 00:29:45 +00:00
Christopher Ferris
1b3fe44e3d Merge "Refactor BufferOutputStream." 2017-08-22 22:50:32 +00:00
Elliott Hughes
abf510a39f Add three more functions to the list of POSIX cruft.
It will never make sense to implement confstr, gethostid, or ulimit.

Bug: N/A
Test: N/A
Change-Id: I9cc18b8a0dbe066f0f76b842c5a5be6b8d5da436
2017-08-22 15:21:39 -07:00
Christopher Ferris
9247640711 Refactor BufferOutputStream.
- Rewrite BufferOutputStream to handle 0 sized buffers and to get rid
  of an unnecessary loop.
- Add tests to verify overflow corner cases.
- Implement async_safe_format_buffer to call async_safe_format_buffer_va_list
  instead of duplicate the code.

Test: Ran new unit tests, booted on angler.
Change-Id: I7fb13e209f5b7443d212f55aab4b05ff2e0e8219
2017-08-22 13:17:28 -07:00
Sandeep Patil
4a3c9751eb Merge "libc: Add support to allow library calls to find appropriate shell executable for a process" 2017-08-22 19:55:41 +00:00
Sandeep Patil
9b1ca569db libc: Add support to allow library calls to find appropriate shell executable for a process
Library calls like system() and popen() invoke the shell executable
pointed to by '_PATH_BSHELL' in order to run the command passed into the
function. The _PATH_BSHELL points to /system/bin/sh by default and thus
breaks any vendor process trying to use system() / popen(), as they are
denied access to system shell by selinux.

This CL make necessary changes, so the implmentations of system() and popen()
can use the appropriate shell (e.g. /vendor/bin/sh for processes running
out of /vendor partition). Also, changes the implementation of system()
and popen().

Bug: 64832610
Test: Manual, Using a test program running from /system/bin and
      /vendor/bin to ensure correct shell is being used.

Change-Id: Ie7168d69decb1ae98284446ae7db34dec930dc33
Merged-In: Ie7168d69decb1ae98284446ae7db34dec930dc33
Signed-off-by: Sandeep Patil <sspatil@google.com>
(cherry picked from commit aa3e32422c)
2017-08-22 10:17:28 -07:00
Elliott Hughes
8440dc736d Merge "Name function arguments in libc headers for Studio."
am: 611d0de62f

Change-Id: I5c089d77145a0189b6ec52ecad65bdfaa8477fd2
2017-08-22 16:22:54 +00:00
Elliott Hughes
611d0de62f Merge "Name function arguments in libc headers for Studio." 2017-08-22 16:14:26 +00:00
Elliott Hughes
ffde533ed9 Name function arguments in libc headers for Studio.
Final batch of headers...

Bug: http://b/64613623
Test: builds

Change-Id: I86578c7c2df446b210fa1bdda3391b21f340e947
2017-08-21 14:51:59 -07:00
Elliott Hughes
119ef0a320 Merge "Name function arguments in libc headers for Studio."
am: f3b92f1485

Change-Id: I033daf856c6fab5ec41702b36c4d384475de9178
2017-08-19 16:48:21 +00:00
Elliott Hughes
f3b92f1485 Merge "Name function arguments in libc headers for Studio." 2017-08-19 16:42:07 +00:00
George Burgess IV
411814e0a9 Merge "Disable FORTIFY on ASAN builds"
am: 7ac99d3ff6

Change-Id: Ib469956edc364bd0d4af59dc5a79439528bf5efd
2017-08-18 22:58:12 +00:00
Treehugger Robot
7ac99d3ff6 Merge "Disable FORTIFY on ASAN builds" 2017-08-18 22:52:27 +00:00
Elliott Hughes
684c31a267 Name function arguments in libc headers for Studio.
Third batch of headers...

Bug: http://b/64613623
Test: builds
Change-Id: I32d8467a0bd22ba94d76476397f4f7dc51003886
2017-08-18 15:07:41 -07:00
George Burgess IV
d9551db089 Disable FORTIFY on ASAN builds
FORTIFY's *_chk functions mess with ASAN's library function
interceptors, which can apparently result in false-positives.

Since adding even more complexity to every run-time check condition in
FORTIFY doesn't seem like a great idea, and the majority of our builds
will still use FORTIFY anyway, turning FORTIFY off here seems
reasonable.

Bug: 63104159
Test: checkbuild on internal master + CtsBionicTestCases. No new
failures.

Change-Id: Id32e551e28ee70a9815ad140c3253b86f03de63f
2017-08-18 13:33:45 -07:00
Tom Cherry
55d0f16369 Merge "Always use CLOCK_MONOTONIC for pthreads and semaphores"
am: cbb09bcbb1

Change-Id: Ic0192542c3f4de8afc4cdc4719c2db1e59bcfc4b
2017-08-18 20:06:28 +00:00
Tom Cherry
cbb09bcbb1 Merge "Always use CLOCK_MONOTONIC for pthreads and semaphores" 2017-08-18 19:59:26 +00:00
Tom Cherry
ac49cedc7e Always use CLOCK_MONOTONIC for pthreads and semaphores
pthread's and semaphore's default behavior is to use CLOCK_REALTIME,
however this behavior is essentially never intended, as that clock is
prone to change discontinuously.

What users really intend is to use CLOCK_MONOTONIC, however only
pthread_cond_timedwait() provides this as an option and even there, a
large amount of existing code does not opt into CLOCK_MONOTONIC.

We have seen numerous bugs directly attributable to this difference.
Therefore, we provide this general workaround to always use
CLOCK_MONOTONIC for waiting, regardless of what the input timespec
is.

Specifically this impacts the below APIs:
pthread_mutex_timedlock()
pthread_cond_timedwait()
pthread_rwlock_timedrdlock()
pthread_rwlock_timedwrlock()
sem_timedwait()

Test: boot bullhead, boot sailfish
Test: bionic pthread/semaphore unit tests
Test: check that pthread_cond_timedwait() timeouts are uneffected by
      CLOCK_REALTIME time changes

Bug: 64694413
Bug: 64623895
Bug: 35756266
Bug: 35678943
Change-Id: Ibba98f5d88be1c306d14e9b9366302ecbef6d534
2017-08-18 09:11:05 -07:00
Elliott Hughes
169f883ef1 Merge "Re-submit "Name function arguments in libc headers for Studio.""
am: 096fa4497c

Change-Id: I402df5b9c5dd3cdbe247db7e25c6baecf57ef2dc
2017-08-18 15:40:53 +00:00
Treehugger Robot
096fa4497c Merge "Re-submit "Name function arguments in libc headers for Studio."" 2017-08-18 15:34:55 +00:00
Andreas Huber
47b244c850 Merge "Fix out-of-bounds deque access causing build failure."
am: ad5c4e3596

Change-Id: Iaf40064fa230b6887e080a288f33c01680d61ef2
2017-08-18 02:00:29 +00:00
Treehugger Robot
ad5c4e3596 Merge "Fix out-of-bounds deque access causing build failure." 2017-08-18 01:55:39 +00:00
Elliott Hughes
ff26a16c1d Re-submit "Name function arguments in libc headers for Studio."
This reverts commit 9af9120091 (a revert
of 079bff4fa5), now the versioner bug is
fixed.

Bug: http://b/64613623 # header bug
Bug: http://b/64802958 # versioner bug
Change-Id: I1cb9d7832d4b3aecdc57a9285e2291443e59d02d
2017-08-18 00:00:38 +00:00
Andreas Huber
113e9b1bc1 Fix out-of-bounds deque access causing build failure.
Bug: http://b/64802958
Test: built successfully

Change-Id: I8029826f0e4c7f578155d7db545e7786c76a0cdf
2017-08-17 22:26:20 +00:00
Colin Cross
c9ca3ddbaf Merge "Revert "Name function arguments in libc headers for Studio.""
am: cf3b0c183d

Change-Id: I5877c029c8a7125c94456dc09c72e23c6b1d8af0
2017-08-17 18:35:56 +00:00
Colin Cross
cf3b0c183d Merge "Revert "Name function arguments in libc headers for Studio."" 2017-08-17 18:30:57 +00:00
Colin Cross
9af9120091 Revert "Name function arguments in libc headers for Studio."
This reverts commit 079bff4fa5.

Broke builds with SANITIZE_HOST=address with an asan failure in versioner.

Change-Id: I22b113fd5405589d1a25e5e137c450aaba1ade5f
2017-08-17 18:29:54 +00:00
Elliott Hughes
060e6f57e2 Merge "Name function arguments in libc headers for Studio."
am: 84669837f7

Change-Id: I2a3f9aad107f92f6dbc6cc0df229b8f9503ee5d0
2017-08-17 14:53:09 +00:00
Elliott Hughes
84669837f7 Merge "Name function arguments in libc headers for Studio." 2017-08-17 14:47:05 +00:00
Elliott Hughes
1472dbb0cf Merge "Improve debug malloc docs slightly for app developers."
am: a3d3e8e148

Change-Id: I364551c1b05666eb8828cbac55b64127dd664794
2017-08-17 14:46:38 +00:00
Elliott Hughes
a3d3e8e148 Merge "Improve debug malloc docs slightly for app developers." 2017-08-17 14:43:06 +00:00
Isaac Chen
a3d7c4f0b2 Merge "Build support for 32-bit armv8-a"
am: b890336756

Change-Id: Ic985dba02870526bc38187d2ff28d868b8163adc
2017-08-17 07:27:09 +00:00
Isaac Chen
b890336756 Merge "Build support for 32-bit armv8-a" 2017-08-17 07:19:33 +00:00
Evgenii Stepanov
62adbbf5e8 Merge changes from topic "cfi-shadow-size"
am: fc89237b77

Change-Id: I34c706c542e338616d07035e5209d727a43c69bb
2017-08-17 00:37:59 +00:00
Treehugger Robot
fc89237b77 Merge changes from topic "cfi-shadow-size"
* changes:
  Revert "Revert "arm64: expand CFI shadow to cover 48-bit virtual addresses""
  [cfi] Export __cfi_shadow_size.
2017-08-17 00:16:56 +00:00
Elliott Hughes
079bff4fa5 Name function arguments in libc headers for Studio.
Second batch of headers...

Bug: http://b/64613623
Test: builds
Change-Id: I8eef043dbf32afee8ff814e9d005f46aee8fa21f
2017-08-16 16:30:54 -07:00
George Burgess IV
d9dddc34be Merge "Enable FORTIFY in unoptimized builds"
am: 67e7bf137e

Change-Id: Ifc5bde6056467f207565c20f5610ce46470c9f38
2017-08-16 20:55:49 +00:00
Dan Albert
a9aa2ccbfd Merge "Add guards for things the versioner can't catch."
am: 82f28565ce

Change-Id: I5c84c2250fe0c37d8cc8a8a86a4bf0f7baaaf353
2017-08-16 20:55:30 +00:00
Treehugger Robot
67e7bf137e Merge "Enable FORTIFY in unoptimized builds" 2017-08-16 20:43:54 +00:00
Treehugger Robot
82f28565ce Merge "Add guards for things the versioner can't catch." 2017-08-16 20:42:07 +00:00
Justin Yun
01a2910758 Merge "Make default namespace handle the 'visible' flag."
am: f2c203f188

Change-Id: Ia95b8d4179265d49ab51cd0dee57f52919e4f549
2017-08-16 17:18:42 +00:00
Treehugger Robot
f2c203f188 Merge "Make default namespace handle the 'visible' flag." 2017-08-16 17:07:25 +00:00
Dimitry Ivanov
a86d68dcd2 Merge "Report correct errno on clone failure"
am: b2688f4a2a

Change-Id: I7ea8aae468320c16665729a3a925dc921ea35726
2017-08-16 11:27:21 +00:00
Dimitry Ivanov
b2688f4a2a Merge "Report correct errno on clone failure" 2017-08-16 11:22:26 +00:00
Elliott Hughes
644275abe0 Improve debug malloc docs slightly for app developers.
Bug: http://b/63098430
Test: N/A
Change-Id: Icde92f5e8b01b5f918cbfdc470b947bd56bb35c6
2017-08-15 23:17:35 -07:00
Justin Yun
90de9f081e Make default namespace handle the 'visible' flag.
'visible' flag was interpreted only the namespaces other than 'default'.
The flag has to be handled without exception once it is set.

Bug: 63411330
Test: Build and boot without errors.
Test: Add `namespace.default.visible = true` to [vendor] process in
      'ld.config.txt' and reboot the device.

Change-Id: Ia363dfadf0200317b875e26bb4b2fae849af1384
2017-08-16 14:38:07 +09:00
George Burgess IV
1de2e358ca Enable FORTIFY in unoptimized builds
GCC's FORTIFY required optimizations to be enabled in order to function
properly. Clang's FORTIFY doesn't have this limitation, so it seems
pointless to keep it disabled due to a GCC-specific limitation.

Bug: 12231437
Test: Checkbuild on bullhead internal master + CtsBionicTestCases. No
new failures.

Change-Id: I74aa35f9d3f3d2a6b11a7adfe72a787e3d7f7f36
2017-08-15 21:20:09 -07:00
Dan Albert
3f7e65e66e Add guards for things the versioner can't catch.
The versioner doesn't handle C++ blocks yet, so these guards won't be
added and it will appear as though the functions are always available
in C++, but based on API level in C.

Test: make checkbuild
Bug: https://github.com/android-ndk/ndk/issues/440
Change-Id: I31a20fa1596d836b280ffc6d7feb863afccca6c7
2017-08-15 14:42:31 -07:00
Elliott Hughes
f43e6a41cd Merge "Name function arguments in libc headers for Studio."
am: 3ce8834e53

Change-Id: I1452bc760374d4e3e5535258d2fb3f659b09842c
2017-08-15 20:39:48 +00:00
Elliott Hughes
3ce8834e53 Merge "Name function arguments in libc headers for Studio." 2017-08-15 20:30:28 +00:00