Commit graph

8619 commits

Author SHA1 Message Date
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
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
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
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
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
George Burgess IV
87fcfefe26 Merge "libc fortify: error on realpath(NULL, foo)"
am: 6beab08440

Change-Id: I50cf25955d28df10661e08579fac001f7abdab5f
2017-08-15 17:45:01 +00:00
George Burgess IV
95bd4884b5 libc fortify: error on realpath(NULL, foo)
I've half a mind to make this a warning instead, since this sort of
call isn't UB. That said:
- if the user really wants this (I can't imagine why they would), they
  can just put NULL in a non-const variable,
- we're slowly moving to -Werror ~everywhere anyway, and
- it's presumably easier to change this from an error to a warning than
  the other way around

Bug: 12231437
Test: m checkbuild on bullhead internal master. No new
CtsBionicTestCases failures.

Change-Id: Ie8bf5a3455f663686fda4a7450fb35d147fa745e
2017-08-14 14:48:55 -07:00
dimitry
6de60874aa Report correct errno on clone failure
Test: make
Change-Id: Id0af3678627c06167a6d434d8616c4a304e1fbc0
2017-08-14 14:42:19 +02:00
Isaac Chen
d544fb7da0 Build support for 32-bit armv8-a
The assembly in arm's generic strlen implementation contains deprecated
instruction sequence:
    it      eq  ; start of IT block
    ldreq   ... ; 32-bit T32 insruction in IT block deprecated in armv8
This will cause compiler error because of -Winline-asm and -Werror.

The fix here is to change the sequence:
    it      eq
    ldreq   ...
    bne     1f
to equivalent sequence:
    bne     1f
    ldr     ...
The resulted sequence is (1 instruction) shorter.

See ARM for ARMv8 for details:
F6.2 Partial Deprecation of IT
... All uses of IT that apply to instructions other than a single
subsequent 16-bit instruction from a restricted set are deprecated, ...

Bug: 62895439
Test: "bionic-unit-tests-static --gtest_filter=*strlen*" on Nexus 4
      (krait), emulator (armv7), and sailfish (armv8).
      The test binary for the first 2 is built with armv7-a as its
      TARGET_CPU_ARCH; The test binary for the last is built with
      armv8-a as its TARGET_2ND_CPU_ARCH.
      TARGET(_2ND)_CPU_VARIANTs of both binaries are set to "generic".

Change-Id: Ia2208b4e2ba2cad589975bc7b4617688cbb8826a
2017-08-14 06:05:20 +00:00
Elliott Hughes
faa74342e3 Name function arguments in libc headers for Studio.
First batch of headers...

Bug: http://b/64613623
Test: builds
Change-Id: I6bc3ad79daa635456b61d03b1f43f06c433ec596
2017-08-11 17:45:59 -07:00
Dimitry Ivanov
8ba9c534e6 Merge "Fix pattern to account for '_' prefix in syscalls"
am: cf764c05e4

Change-Id: I2175ac929b30b42e2208e339d1bac11c18875d79
2017-08-10 15:12:18 +00:00
dimitry
daebd05739 Fix pattern to account for '_' prefix in syscalls
Bug: http://b/64549471
Test: make
Change-Id: I7ba856a2cad29adbb028f150aeaabb9894e84d6e
2017-08-10 11:11:00 +02:00
Dan Albert
fda7562aa3 Merge "Put back the _Exit rename for pre-L."
am: 0cd32c1aba

Change-Id: I9d0654a024ccf752be80bb28820fb245973458a3
2017-08-10 00:03:38 +00:00
Treehugger Robot
0cd32c1aba Merge "Put back the _Exit rename for pre-L." 2017-08-09 23:44:41 +00:00
Elliott Hughes
45e8d1d898 Merge "Remove reference to non-existent __LP32__."
am: 8aa387fbee

Change-Id: I9acb4bf22ed7e60deb356a7bda61ec97787a91c7
2017-08-07 23:18:03 +00:00