Commit graph

1538 commits

Author SHA1 Message Date
Elliott Hughes
cb239bda65 Simplify atoi*/strto* for signed integers.
Make the cost of strto<signed> closer to the cost of strto<unsigned>
by removing an `if` from the inner loop. Previously a signed conversion
cost 10ns more than an unsigned one.

After:

  BM_inttypes_strtoimax         81 ns         81 ns    8603362
  BM_inttypes_strtoumax         78 ns         78 ns    8967174
  BM_stdlib_strtol              81 ns         81 ns    8685537
  BM_stdlib_strtoll             81 ns         81 ns    8685481
  BM_stdlib_strtoul             78 ns         78 ns    8962569
  BM_stdlib_strtoull            78 ns         78 ns    8972023

Bug: N/A
Test: ran tests, benchmarks
Change-Id: I72dd5499427b6a940bd94c4d6f727f7efe134d7e
2017-12-21 17:44:22 -08:00
Elliott Hughes
1133fecde3 Use inline ctype functions for ato*/strto* and scanf.
This also let us remove the `unsigned char` casts, since we define our
inlines to work for all values.

Before:

  Benchmark                      Time           CPU Iterations
  -------------------------------------------------------------
  BM_inttypes_strtoimax        112 ns        112 ns    6222193
  BM_inttypes_strtoumax        104 ns        104 ns    6725010
  BM_stdlib_strtol             113 ns        113 ns    6195861
  BM_stdlib_strtoll            113 ns        113 ns    6195633
  BM_stdlib_strtoul            105 ns        105 ns    6691394
  BM_stdlib_strtoull           105 ns        105 ns    6690695

  BM_stdio_scanf_d                    504 ns        503 ns    1385224
  BM_stdio_scanf_maps                1900 ns       1898 ns     369260
  BM_stdio_scanf_maps_baseline       1030 ns       1030 ns     678832
  BM_stdio_scanf_s                    433 ns        432 ns    1619086

After:

  BM_inttypes_strtoimax         91 ns         91 ns    7718194
  BM_inttypes_strtoumax         82 ns         82 ns    8508052
  BM_stdlib_strtol              92 ns         92 ns    7674694
  BM_stdlib_strtoll             91 ns         91 ns    7639228
  BM_stdlib_strtoul             83 ns         82 ns    8500304
  BM_stdlib_strtoull            82 ns         82 ns    8504929

  BM_stdio_scanf_d                    465 ns        465 ns    1507891
  BM_stdio_scanf_maps                1836 ns       1836 ns     381082
  BM_stdio_scanf_maps_baseline        846 ns        845 ns     830881
  BM_stdio_scanf_s                    419 ns        419 ns    1671979

Bug: N/A
Test: ran tests, benchmarks
Change-Id: I44681daf16c4328b060770cf11fc0633157c427f
2017-12-19 16:37:01 -08:00
Elliott Hughes
9dc37b9439 Merge "Refactor the ato* and strto* family." 2017-12-20 00:05:57 +00:00
Elliott Hughes
1921dce886 Refactor the ato* and strto* family.
There are no meaningful changes here, just a minimal conversion to two
C++ templates to make further changes easier.

Bug: N/A
Test: ran tests, benchmarks
Change-Id: I958fbf17a85f19dd8f17bfb4bbb9314d220daa3b
2017-12-19 13:55:54 -08:00
Tom Cherry
e275d6d72d Split properties into their own class to make testing better
Reinitializing system properties can result in crashes later in the
program, and is generally not recommended or even supported.  This
change moves the actual logic for system properties into a class that
can be tested in isolation, without reinitializing the actual system
property area used in libc.

Bug: 62197783
Test: boot devices, ensure properties work
Test: system property unit tests and benchmarks
Change-Id: I9ae6e1b56c62f51a4d3fdb5b62b8926cef545649
2017-12-18 15:17:55 -08:00
Treehugger Robot
b9d5a87b1b Merge "Use treble_linker_namespace instead of treble." 2017-12-15 17:41:27 +00:00
Steven Moreland
96bbc5ca87 Use treble_linker_namespace instead of treble.
More specific. Treble is being removed.

Bug: 62019611
Test: manual
Change-Id: I94c21c6a5cb6a258bfb36a0b7da23abdc73a67fb
2017-12-13 14:11:26 -08:00
Mark Salyzyn
79249b0897 bionic: add vdso clock_getres
clock_getres() should not be a hot call, nevertheless it is
~6-7 times faster for supported clock ids if it uses
__vdso_clock_getres if available.  There is a 3% performance
penalty for unsupported clock ids via __vdso_clock_getres with
respect to a direct syscall.

[TL;DR]

w/vdso32 kernel patches, locked cores to MAX, little cores only.

BEFORE:

hikey960 vdso (aarch64):

----------------------------------------------------------------------
Benchmark                               Time           CPU Iterations
----------------------------------------------------------------------
BM_time_clock_getres                  126 ns        126 ns    5577874
BM_time_clock_getres_syscall          127 ns        127 ns    5505016
BM_time_clock_getres_REALTIME         126 ns        126 ns    5574682
BM_time_clock_getres_BOOTTIME         126 ns        126 ns    5575237
BM_time_clock_getres_TAI              126 ns        126 ns    5576810
BM_time_clock_getres_unsupported      128 ns        128 ns    5480189

hikey960 vdso32 (aarch32):

----------------------------------------------------------------------
Benchmark                               Time           CPU Iterations
----------------------------------------------------------------------
BM_time_clock_getres                  199 ns        199 ns    3508708
BM_time_clock_getres_syscall          220 ns        220 ns    3184676
BM_time_clock_getres_REALTIME         199 ns        199 ns    3509697
BM_time_clock_getres_BOOTTIME         199 ns        199 ns    3513551
BM_time_clock_getres_TAI              200 ns        199 ns    3512412
BM_time_clock_getres_unsupported      196 ns        196 ns    3575609

x86_64 (glibc):

---------------------------------------------------------------------
Benchmark                              Time           CPU Iterations
---------------------------------------------------------------------
BM_time_clock_getres                 252 ns        252 ns    2370263
BM_time_clock_getres_syscall         215 ns        215 ns    3287497
BM_time_clock_getres_REALTIME        214 ns        214 ns    3294228
BM_time_clock_getres_BOOTTIME        213 ns        213 ns    3277519
BM_time_clock_getres_TAI             213 ns        213 ns    3294991
BM_time_clock_getres_unsupported     206 ns        206 ns    3450654

imx7d_pico IOT nyc (w/arm,cpu-registers-not-fw-configured) (armv7a):
(Virtual Timers)

Benchmark                           Time(ns)    CPU(ns) Iterations
------------------------------------------------------------------
BM_time_clock_getres                      16        345    2000000
BM_time_clock_getres_syscall              16        339    2121212
BM_time_clock_getres_REALTIME             17        350    2058824
BM_time_clock_getres_BOOTTIME             17        345    2000000
BM_time_clock_getres_TAI                  16        350    2000000
BM_time_clock_getres_unsupported          13        284    2500000

AFTER:

hikey960 vdso (aarch64):

---------------------------------------------------------------------
Benchmark                              Time           CPU Iterations
---------------------------------------------------------------------
BM_time_clock_getres                  18 ns         18 ns   37880389
BM_time_clock_getres_syscall         127 ns        127 ns    5520029
BM_time_clock_getres_REALTIME         18 ns         18 ns   37879962
BM_time_clock_getres_BOOTTIME         19 ns         18 ns   37878361
BM_time_clock_getres_TAI             131 ns        131 ns    5368484
BM_time_clock_getres_unsupported      97 ns         97 ns    7182864

hikey960 vdso32 (aarch32):

---------------------------------------------------------------------
Benchmark                              Time           CPU Iterations
---------------------------------------------------------------------
BM_time_clock_getres                  36 ns         36 ns   19205240
BM_time_clock_getres_syscall         212 ns        212 ns    3297100
BM_time_clock_getres_REALTIME         36 ns         36 ns   19219109
BM_time_clock_getres_BOOTTIME         36 ns         36 ns   19222490
BM_time_clock_getres_TAI             206 ns        206 ns    3402868
BM_time_clock_getres_unsupported     159 ns        159 ns    4409492

imx7d_pico IOT nyc (wo/arm,cpu-registers-not-fw-configured) (armv7a):
(Physical Timers)

Benchmark                           Time(ns)    CPU(ns) Iterations
------------------------------------------------------------------
BM_time_clock_getres                       2         48   14000000
BM_time_clock_getres_syscall              14        335    2058824
BM_time_clock_getres_REALTIME              2         49   14583333
BM_time_clock_getres_BOOTTIME              2         48   14000000
BM_time_clock_getres_TAI                  14        350    2058824
BM_time_clock_getres_unsupported           8        203    3500000

Test: taskset F \
        /data/benchmarktest{64}/bionic-benchmarks/bionic-benchmarks \
        --bionic_xml=vdso.xml --benchmark_filter=BM_time_clock_getres*
Bug: 63737556
Change-Id: I80c0a5106625d76720287f715fcf145d2aad1705
2017-12-07 09:41:48 -08:00
Elliott Hughes
c1f6219c32 Merge "Make our fortify FD_ISSET const, and expose the fd_mask type." 2017-12-05 17:09:17 +00:00
Elliott Hughes
a6714d106b Make our fortify FD_ISSET const, and expose the fd_mask type.
Bug: http://b/70171464
Test: ran tests
Change-Id: Ifbee29d9888ce7cf76b99844dd9700128256a486
2017-12-04 14:16:38 -08:00
Josh Gao
b8facf2aca Reformat SIGRTMIN comments.
Test: none
Change-Id: Ief1f0c06c17df6704863c8c7176941447f2e28f4
2017-12-04 13:47:17 -08:00
Elliott Hughes
7bfacaabf2 Fix posix_spawn signal defaulting.
Add a new stress test, and fix the code to pass it. We need to ensure that
we reset signal handlers for caught signals before unblocking signals in
the child, we need to ensure that this happens even if you haven't passed
a pthread_spawn_attr_t, and we need to ensure that this happens if you
pass in an empty sigdefault set.

Bug: http://b/68707996
Test: ran tests
Change-Id: I348e9b17b1bdf221591da42c0ada133d98471d66
2017-11-29 18:36:38 -08:00
Elliott Hughes
9591df5294 Fix vdso system call fallback failures.
When a vdso call falls back to making a regular system call, the inline
code for the system call doesn't know about errno and just leaves the
usual kernel result to be translated. Add the missing translation.

Also fix the defaults for non-vdso systems so we actually take the
fallback path (and so avoid unintentionally doing the errno translation
twice in those cases).

Bug: http://b/69626243
Test: ran new tests from http://b/63737556
Change-Id: If379632ea2e059e3d3bc3ff41bf3608dc05fb0a3
2017-11-28 09:09:01 -08:00
Elliott Hughes
8c75675ec6 Merge "Change ARG_MAX/_SC_ARG_MAX back to a constant." 2017-11-16 21:46:49 +00:00
Elliott Hughes
c3f1b6a23d Merge "Simplify the posix_spawn sigdefault logic." 2017-11-16 00:08:31 +00:00
Elliott Hughes
baed51ee3a Change ARG_MAX/_SC_ARG_MAX back to a constant.
As per the lkml thread https://lkml.org/lkml/2017/11/1/946.

Bug: http://b/65818597
Test: ran tests
Change-Id: I7a0610e6903e6761f2b31416e2f5017bd7a60659
2017-11-15 15:14:35 -08:00
Tom Cherry
4362f897f7 Only use uids and gids for which we've allocated AIDs
Currently, getpwnam, getpwent, etc return successfully for any uid
from AID_APP_START (10000) to AID_USER_OFFSET (100000) for each user.
This is not correct however, as only specific ranges above
AID_APP_START are reserved as valid ranges.  This change corrects this.

This is particularly important as the newly added AID_OVERFLOWUID is
65534, which is above AID_APP_START but not in any reserved range,
collided with the faulty returned values.

Bug: 69119022
Bug: 69128408
Test: pwd/grp bionic unit tests
Change-Id: I3dae97a90597915fa30a88fe27cda88b107e9c35
2017-11-15 10:31:49 -08:00
Elliott Hughes
2b8ab4b5da Simplify the posix_spawn sigdefault logic.
I don't think there's any observable difference, but this is certainly
simpler.

Bug: http://b/68707996
Test: ran tests
Change-Id: Id9e1a7d40533c90d073ebf391a72bbdfe79627de
2017-11-14 22:31:43 -08:00
Tom Cherry
fd44b9f8d8 Split system_properties.cpp into its component pieces
system_properties.cpp is a little bit unmanageable in its current
form, and is overdue for a refactoring into more clearly defined
components.

Of particular interest, is creating of a Contexts interface that
handles mapping of system property name -> SEContext and its
associated prop_area, and creating two classes that implement the
current and legacy functionality.  This is needed as there will likely
be a third even newer way to do this mapping.

Bug: 36001741
Test: boot bullhead, system property unit tests
Change-Id: Ie75ec6fea1a95f90813918f54669d533e51327c6
2017-11-14 08:50:52 -08:00
Elliott Hughes
38f01e05ef Preserve historical pthread_create scheduler behavior better.
At the cost of two flag bits for what POSIX thinks should be a boolean
choice, plus somewhat confusing behavior from pthread_attr_getinheritsched
depending on when you call it/what specific scheduler attributes you've
set in the pthread_attr_t, we can emulate the old behavior exactly and
prevent annoying SELinux denial spam caused by calls to sched_setscheduler.

Bug: http://b/68391226
Test: adb logcat on boot contains no sys_nice avc denials
Change-Id: I4f759c2c4fd1d80cceb0912d7da09d35902e2e5e
2017-10-27 15:40:15 -07:00
dimitry
fa432524a6 Mark __BIONIC_WEAK_FOR_NATIVE_BRIDGE symbols
To make it easier for Native Bridge implementations
to override these symbols.

Bug: http://b/67993967
Test: make
Change-Id: I4c53e53af494bca365dd2b3305ab0ccc2b23ba44
2017-10-27 10:01:46 +02:00
Elliott Hughes
343d1c4953 Don't allow LIBC_DEBUG_MALLOC_OPTIONS to cross security boundaries.
Bug: http://b/68003719
Test: LIBC_DEBUG_MALLOC_OPTIONS=isbad1 MALLOC_CONF=isbad2 su 0 /system/bin/sh -c '/system/bin/echo opt=$LIBC_DEBUG_MALLOC_OPTIONS conf=$MALLOC_CONF'
Change-Id: I796cc21b230a96cb0ed87d02ddcb1706a7749a90
2017-10-26 18:25:19 -07:00
Treehugger Robot
8ae3fe2c50 Merge "Add null checks to <dirent.h> functions." 2017-10-27 01:03:32 +00:00
Elliott Hughes
cc3d04f03a Add null checks to <dirent.h> functions.
Move all the new checks over to the existing __fortify_fatal.

Bug: http://b/67455242
Test: ran tests
Change-Id: Idb899c58c32d52d3b423caf1a91feb7defcba9b3
2017-10-26 16:16:33 -07:00
Elliott Hughes
374848a16e The main thread should just INHERIT its scheduler attributes.
Explicitly setting SCHED_OTHER/0 was causing SELinux denials:

  02-08 09:58:05.430   661   661 I auditd  : type=1400 audit(0.0:20): avc: denied { sys_nice } for comm="grep" capability=23 scontext=u:r:init-qcom-devstart-sh:s0 tcontext=u:r:init-qcom-devstart-sh:s0 tclass=capability permissive=0
  02-08 09:58:05.430   662   662 I auditd  : type=1400 audit(0.0:21): avc: denied { sys_nice } for comm="sed" capability=23 scontext=u:r:init-qcom-devstart-sh:s0 tcontext=u:r:init-qcom-devstart-sh:s0 tclass=capability permissive=0

Also use public pthread API rather than modifying the main thread's
pthread_attr_t directly.

Bug: http://b/68328561
Test: strace -f -e true
Change-Id: I65b7ab3ce285a2901a6eaacb243000c780883c3a
2017-10-26 12:56:21 -07:00
Elliott Hughes
c8a2612ffc Merge "Implement pthread_attr_getinheritsched/pthread_attr_setinheritsched." 2017-10-26 16:12:04 +00:00
Elliott Hughes
8aecba7aa6 Implement pthread_attr_getinheritsched/pthread_attr_setinheritsched.
Historically, Android defaulted to EXPLICIT but with a special case
because SCHED_NORMAL/priority 0 was awkward. Because the code couldn't
actually tell whether SCHED_NORMAL/priority 0 was a genuine attempt to
explicitly set those attributes (because the parent thread is SCHED_FIFO,
say) or just because the pthread_attr_t was left at its defaults.

Now we support INHERIT, we could call sched_getscheduler to see whether
we actually need to call sched_setscheduler, but since the major cost
is the fixed syscall overhead, we may as well just conservatively
call sched_setscheduler and let the kernel decide whether it's a
no-op. (Especially because we'd then have to add both sched_getscheduler
and sched_setscheduler to any seccomp filter.)

Platform code (or app code that only needs to support >= P) can actually
add a call to pthread_attr_setinheritsched to say that they just want
to inherit (if they know that none of their threads actually mess with
scheduler attributes at all), which will save them a sched_setscheduler
call except in the doubly-special case of SCHED_RESET_ON_FORK (which we
do handle).

An alternative would be "make pthread_attr_setschedparams and
pthread_attr_setschedprio set EXPLICIT and change the platform default
to INHERIT", but even though I can only think of weird pathological
examples where anyone would notice that change, that behavior -- of
pthread_attr_setschedparams/pthread_attr_setschedprio overriding an
earlier call to pthread_attr_setinheritsched -- isn't allowed by POSIX
(whereas defaulting to EXPLICIT is).

If we have a lot of trouble with this change in the app compatibility
testing phase, though, we'll want to reconsider this decision!

 -*-

This change also removes a comment about setting the scheduler attributes
in main_thread because we'd have to actually keep them up to date,
and it's not clear that doing so would be worth the trouble.

Also make async_safe_format_log preserve errno so we don't have to be
so careful around it.

Bug: http://b/67471710
Test: ran tests
Change-Id: Idd026c4ce78a536656adcb57aa2e7b2c616eeddf
2017-10-25 14:28:42 -07:00
Elliott Hughes
1d01fe8980 Fix LP32 large pid detection.
Bug: http://b/68046352
Test: ran tests
Change-Id: I89cb99173ca77e9457e677187430b61cedb55c04
2017-10-23 10:07:55 -07:00
Treehugger Robot
8f348a0cce Merge "Remove some legacy declarations from <math.h>." 2017-10-20 18:40:17 +00:00
Treehugger Robot
ac29d9f3b9 Merge "Add POSIX swab." 2017-10-19 21:49:29 +00:00
Elliott Hughes
5c6a7bf0dc Remove some legacy declarations from <math.h>.
These are still needed for backwards compatibility with code built by old
versions of the NDK, but we don't need to pollute the headers with them.

Also lose the hand-written code for these. The compiler-generated code
is either the same or better, and no new code is calling these functions
anyway.

Bug: N/A
Test: ran tests
Change-Id: Ib01ad9805034433e0105aec882608cc8e6526f78
2017-10-19 14:15:31 -07:00
Dimitry Ivanov
1b6de87889 Merge "Make __libc_init_main_thread and android_set_abort_message weak" 2017-10-19 19:53:07 +00:00
dimitry
b6d2b87d2d Make __libc_init_main_thread and android_set_abort_message weak
Bug: http://b/67672033
Bug: http://b/67934730
Test: make && flash and boot angler.
Test: run bionic-unit-tests
Change-Id: Ibf47f00dd7fae19014f56c857eb9712711363029
2017-10-19 18:18:23 +02:00
Elliott Hughes
4d215aad85 Add POSIX fexecve.
I'm skeptical about the usefulness of this, but it's in POSIX, it's
in glibc (but not iOS), and it is used in some internal source (test
runners and container code).

Bug: N/A
Test: ran tests
Change-Id: I92c5398f2a679b21a33fba92bc8e67e3ae2eb76f
2017-10-18 16:26:17 -07:00
Elliott Hughes
fa386e0d1e Add POSIX swab.
Surprisingly to me, there are actual uses of `swab` in the codebases
I have available to search, including one with a #ifndef __ANDROID__
around it.

Bug: N/A
Test: ran tests
Change-Id: Ic91b78ae22bb65c346cb46dd38916f48d979abe0
2017-10-18 13:34:32 -07:00
Elliott Hughes
dff08ced56 Add pthread_setschedprio.
Bug: http://b/26204555
Test: ran tests
Change-Id: Ic34062b9b6036a1ce2642a069514bab48a893338
2017-10-17 09:14:05 -07:00
Elliott Hughes
bf886f621b Merge "Complete <netdb.h>." 2017-10-17 16:03:54 +00:00
Josh Gao
0e0e370154 Add libc_nopthread.
Add a static library containing the non-pthread dependent parts of
libc.

Bug: http://b/64400027
Test: sailfish boots
Test: bionic-unit-tests32/64, no new failures
Test: bionic-unit-tests-static32/64, no new failures
Change-Id: I93dc3811acddad7936d11b369b98cefd945ee2d5
2017-10-16 21:31:37 -07:00
Elliott Hughes
5033918092 Complete <netdb.h>.
Add all the missing <netdb.h> functions.

Also fix getservbyport to handle a null protocol correctly.

Also fix getservbyname/getservbyport to not interfere with getservent.

Also fix endservent to reset getservent iteration.

Also reduce unnecessary differences from upstream NetBSD sethostent.c.

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

Bug: N/A
Test: ran tests
Change-Id: I639108c46df0a768af297cf3bbce857cb1bef9d9
2017-10-15 10:37:51 -07:00
Dan Albert
c972ea7da0 Fix missing includes, again.
Test: mma
Bug: None
Change-Id: I17f07e51ebb425ebbcd2cd48e2aa173ab728c498
2017-10-13 14:38:55 -07:00
Elliott Hughes
01bb7bf6fb Merge "Implement <spawn.h>." 2017-10-12 21:02:54 +00:00
Tom Cherry
a08f704e2a Merge "Allow read-only system properties to have arbitrary lengths" 2017-10-12 00:22:57 +00:00
Elliott Hughes
14e3ff9f09 Implement <spawn.h>.
As described here:

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

And here:

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

Bug: N/A (but mentioned in my inbox since 2013)
Test: ran tests
Change-Id: I0b27b2919b660779e3bd8a25fb429527c16dc621
2017-10-11 14:57:49 -07:00
Dan Albert
1c78cb0fee Add missing includes.
Test: mma
Bug: None
Change-Id: I0221b213e08d07cc5ac0b704a86e98ae8c0f456f
2017-10-11 11:25:52 -07:00
Tom Cherry
8a311631ed Allow read-only system properties to have arbitrary lengths
We need to be able to store build fingerprints that are over 92 characters
long, which is the current restriction for system property value
length.

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

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

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

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

Bug: 23102347
Bug: 34954705
Test: bionic unit tests
Change-Id: Ia85e0d979b92afff601cc52b39114379617a0c64
2017-10-10 15:52:25 -07:00
Treehugger Robot
3dacc47642 Merge "Add a legacy inline for mmap64." 2017-10-06 22:20:54 +00:00
Christopher Ferris
e387c2f088 Merge "Add directives to force stop unwinding." 2017-10-06 17:08:34 +00:00
Dan Albert
a613d0df5c Add a legacy inline for mmap64.
While this was never an inline, this function alone has caused most of
the bug reports related to _FILE_OFFSET_BITS=64. Providing an inline
for it should allow a lot more code to build with _FILE_OFFSET_BITS=64
when targeting pre-L.

Test: make checkbuild
Test: built trivial cc_binary for LP32 against API 14 with
      _FILE_OFFSET_BITS=64 set
Bug: lots
Change-Id: I8479d34af4da358c11423bee43d45b59e9d4143e
2017-10-05 23:41:47 -07:00
Christopher Ferris
93ea09f65c Add directives to force stop unwinding.
On aarch64/x86/x86_64 add a macro that inserts a cfi directive that will
stop unwinding.

For arm, clang doesn't allow emitting .cantunwind, so add a comment and
leave it the same as it current is.

Add this macro to __libc_init and __start_thread.

Also, remove duplicate compilation of libc_init_static.cpp that already
includes the static library that includes that file.

Bug: 15469122

Test: Did unwinds using new unwinder tool (unwind) and debuggerd -b
Test: and verified new unwinder works on aarch64/x86/x86_64.
Test: Verified that it works on old unwinder for aarch64/x86, but
Test: x86_64 doesn't work properly, but as well as before.
Change-Id: I77302e8f6c7ba1549d98a4a164106ee82c9ecadc
2017-10-05 15:18:47 -07:00
Elliott Hughes
3a8f75d8b0 POSIX clock cleanup.
The newest of these clocks was added in Linux 2.6.12, so no need for runtime
checks.

Add CTS tests that we can actually use the various clocks.

Bug: http://b/67458266
Test: ran tests
Change-Id: I3cfd7982043d6f8d4ebdc2b29e8722334f443ce5
2017-10-05 10:33:18 -07:00