Compare commits

..

428 Commits

Author SHA1 Message Date
Chad Brubaker
081db840be Allow overlap in resolv uid => DNS iface mapping
When multiple rules exist covering a given uid the one added most
recently will be used.

This allows us to handle the simultaneous tuns case where a new tun is
coming online for an already running VPN.

_resolv_clear_iface_for_uid_range now also takes the iface and removes
only that matching (iface, uid range) entry.

Bug: 12134439
Change-Id: I9b9cfcfae2f38c409022a8c76ccadad7e2babd78
2014-03-15 15:29:01 -07:00
Elliott Hughes
04583ce9b9 Upgrade to tzdata2014a.
From the release notes:

  Changes affecting near-future time stamps

    Turkey begins DST on 2014-03-31, not 03-30.  (Thanks to Faruk Pasin
    for the heads-up, and to Tim Parenti for simplifying the update.)

  Changes affecting past time stamps

    Fiji ended DST on 2014-01-19 at 02:00, not the previously-scheduled
    03:00.  (Thanks to Steffen Thorsen.)

    Ukraine switched from Moscow to Eastern European time on 1990-07-01
    (not 1992-01-01), and observed DST during the entire next winter.
    (Thanks to Vladimir in Moscow via Alois Treindl.)

    In 1988 Israel observed DST from 04-10 to 09-04, not 04-09 to
    09-03.  (Thanks to Avigdor Finkelstein.)

(cherry picked from commit 159b28eb46)

Bug: 13193205
Change-Id: I3d302039f7e057a97c9d307ce8d32efa056481ed
2014-03-10 15:23:02 -07:00
Robert Greenwalt
abf91850f9 Merge "Fix dns searchdomain use in gethostbyname." into klp-dev 2014-03-05 18:26:27 +00:00
Elliott Hughes
806f3bd7aa Upgrade to tzdata2013i.
From the release notes:

  Changes affecting near-future time stamps:

    Jordan switches back to standard time at 00:00 on December 20, 2013.
    The 2006-2011 transition schedule is planned to resume in 2014.
    (Thanks to Steffen Thorsen.)

  Changes affecting past time stamps:

    In 2004, Cuba began DST on March 28, not April 4.
    (Thanks to Steffen Thorsen.)

Bug: 13193205
Change-Id: I8f26cc50f6b571804a18ff2113b4a47a22bc56dd
2014-02-25 22:47:29 +00:00
Robert Greenwalt
5fddfb8915 Fix dns searchdomain use in gethostbyname.
Need to load search domain data before we attempt to use it.
This is a cherry pick of an AOSP change c11f6f0f39.

bug:6799630

Change-Id: I4ea1131f06ffdf4037fe67f82af5a0349469b609
2013-12-12 21:34:36 +00:00
Elliott Hughes
5ab8d33aa6 Upgrade to tzdata2013h.
From the release notes:

  Changes affecting current and future time stamps:

    Libya has switched its time zone back to UTC+2 without DST,
    instead of UTC+1 with DST.  (Thanks to Even Scharning.)

    Western Sahara (Africa/El_Aaiun) uses Morocco's DST rules.
    (Thanks to Gwillim Law.)

  Changes affecting future time stamps:

    Acre and (we guess) western Amazonas will switch from UTC-4 to UTC-5
    on 2013-11-10.  This affects America/Rio_Branco and America/Eirunepe.
    (Thanks to Steffen Thorsen.)

    Add entries for DST transitions in Morocco in the year 2038.
    This avoids some year-2038 glitches introduced in 2013g.
    (Thanks to Yoshito Umaoka for reporting the problem.)

(cherry picked from commit 3df3879bd6)

Change-Id: Ibdac6cc1db0fe24c62fe68e99d057dface6b6745
2013-10-31 13:41:31 -07:00
Ed Heyl
be662187aa merge in klp-release (no-op) 2013-10-16 17:34:49 -07:00
The Android Automerger
8e39d2f9f4 merge in klp-release history after reset to klp-dev 2013-10-15 21:13:52 -07:00
Christopher Ferris
fbefb252b0 Modify prefetch for krait memcpy.
I originally modified the krait mainloop prefetch from cacheline * 8 to * 2.
This causes a perf degradation for copies bigger than will fit in the cache.
Fixing this back to the original * 8. I tried other multiples, but * 8 is th
sweet spot on krait.

Bug: 11221806

(cherry picked from commit c3c58fb560)

Change-Id: I369f81d91ba97a3fcecac84ac57dec921b4758c8
2013-10-15 15:44:00 -07:00
Christopher Ferris
ac6bc31942 Remove new aligned memcpy path for cortex-a15.
For some reason the new cortex-a15 memcpy code from ARM is really bad
for really large copies. This change forces us to go down the old path
for all copies.

All of my benchmarks show the new version is faster for large copies, but
something is going on that I don't understand.

Bug: 10838353
Change-Id: I01c16d4a2575e76f4c69862c6f78fd9024eb3fb8
2013-10-15 14:54:02 -07:00
Ed Heyl
f87684eea1 merge in KQS81M 2013-10-08 15:35:17 -07:00
The Android Automerger
303f08b439 merge in klp-release history after reset to klp-dev 2013-10-08 06:00:18 -07:00
Elliott Hughes
3fce401590 Upgrade to tzdata2013g.
From the release notes:

  Changes affecting current and near-future time stamps

    Morocco now observes DST from the last Sunday in March to the last
    Sunday in October, not April to September respectively.  (Thanks
    to Steffen Thorsen.)

(cherry picked from commit 40f072192f)

Change-Id: I247f8cf4ef32ec5d6e6fe3845f9a8977b7e748b9
2013-10-06 19:59:14 -07:00
Elliott Hughes
e1fe52ccf1 Upgrade to tzdata2013f.
From the release notes:

  Changes affecting near-future time stamps

    Tocantins will very likely not observe DST starting this spring.
    (Thanks to Steffen Thorsen.)

    Jordan will likely stay at UTC+3 indefinitely, and will not fall
    back this fall.

    Palestine will fall back at 00:00, not 01:00.  (Thanks to Steffen Thorsen.)

(cherry picked from commit 4ced7ef05a)

Change-Id: Icd4754694fbe3b7c475a63666eeeab36c72908ac
2013-10-06 11:41:17 -07:00
Elliott Hughes
21f5927605 Upgrade to tzdata2013e.
From the release notes:

  Changes affecting near-future time stamps

    This year Fiji will start DST on October 27, not October 20.
    (Thanks to David Wheeler for the heads-up.)  For now, guess that
    Fiji will continue to spring forward the Sunday before the fourth
    Monday in October.

  Changes affecting time stamps before 1970

    Pacific/Johnston is now a link to Pacific/Honolulu.  This corrects
    some errors before 1947.

    Some zones have been turned into links, when they differ from
    existing zones only in older data that was likely invented or that
    differs only in LMT or transition from LMT.  These changes affect
    only time stamps before 1943.  The affected zones are:
    Africa/Juba, America/Anguilla, America/Aruba, America/Dominica,
    America/Grenada, America/Guadeloupe, America/Marigot,
    America/Montserrat, America/St_Barthelemy, America/St_Kitts,
    America/St_Lucia, America/St_Thomas, America/St_Vincent,
    America/Tortola, and Europe/Vaduz.  (Thanks to Alois Treindl for
    confirming that the old Europe/Vaduz zone was wrong and the new
    link is better for WWII-era times.)

    Change Kingston Mean Time from -5:07:12 to -5:07:11.  This affects
    America/Cayman, America/Jamaica and America/Grand_Turk time stamps
    from 1890 to 1912.

    Change the UT offset of Bern Mean Time from 0:29:44 to 0:29:46.
    This affects Europe/Zurich time stamps from 1853 to 1894.  (Thanks
    to Alois Treindl).

    Change the date of the circa-1850 Zurich transition from 1849-09-12
    to 1853-07-16, overriding Shanks with data from Messerli about
    postal and telegraph time in Switzerland.

  Data changes affecting behavior of tzselect and similar programs

    Country code BQ is now called the more-common name "Caribbean Netherlands"
    rather than the more-official "Bonaire, St Eustatius & Saba".

    Remove from zone.tab the names America/Montreal, America/Shiprock,
    and Antarctica/South_Pole, as they are equivalent to existing
    same-country-code zones for post-1970 time stamps.  The data for
    these names are unchanged, so the names continue to work as before.

(cherry picked from commit 35b123ef1e)

Change-Id: Ieb2627cc817db93280ceabe4034800bf36ca3f5f
2013-10-06 11:40:07 -07:00
The Android Automerger
33f6390064 merge in klp-release history after reset to klp-dev 2013-09-29 06:00:40 -07:00
Christopher Ferris
34c2a9fc37 Move stack unwinding test into library.
Bug: 8291716

(cherry picked from commit 8240bed918)

Change-Id: I1da2d0757ed304c352229f9818c052925d4e976a
2013-09-23 12:16:19 -07:00
Christopher Ferris
f4af911065 Create bionic unit test library for use with CTS.
Bug: 8291716

(cherry picked from commit 153d92765b)

Change-Id: Ia53b85b95621b7000034e4c6259d6586d0987dee
2013-09-23 12:16:01 -07:00
Christopher Ferris
7bfef355b1 Change hard-coded directory.
The tests are using /data/data which is not accessible to a non-root
user. Change this to /data/local/tmp which is accessible to all users.

Bug: 8291716

(cherry picked from commit 5227bb363d)

Change-Id: I83bf70aa8edd21b00321363d7ddcb65a5f048ba5
2013-09-23 12:12:58 -07:00
Christopher Ferris
6d1f85dcdc Change hard-coded temporary directory.
The properties tests creates a temporary directory in /data/nativetest,
but this directory might not exist in all circumstances.
Change this to create the temporary directory in /data/local/tmp.

(cherry picked from commit bd6dc6a886)

Change-Id: I15144ece7ffb5c29eded9a1ef399db630f6af5ab
2013-09-23 12:10:49 -07:00
Elliott Hughes
e0d1d4cf49 am 6ebc24fc: am d3f9e815: resolved conflicts for merge of 5d0ad38c to jb-mr2-dev
* commit '6ebc24fcc3cf07f1be936ef9d7a8c3afff1861c7':
  Upgrade pre-jb-mr2 releases to tzdata2013d.
2013-09-13 11:50:20 -07:00
Elliott Hughes
6ebc24fcc3 am d3f9e815: resolved conflicts for merge of 5d0ad38c to jb-mr2-dev
* commit 'd3f9e8155bfc17b2d67d2ffe5bc1d3a5e2656cd4':
  Upgrade pre-jb-mr2 releases to tzdata2013d.
2013-09-13 11:46:09 -07:00
Brian Carlstrom
7751d9158f Use kernel default for initial thread size
Bug: 10697851

Change-Id: I8d980f5e0b584799536f6e6b891056c968d26cdf
2013-09-13 11:16:50 -07:00
Elliott Hughes
d3f9e8155b resolved conflicts for merge of 5d0ad38c to jb-mr2-dev
Change-Id: I606f6d86aad46c5eda0dc0d907fe691ca0eea826
2013-09-13 11:16:11 -07:00
Elliott Hughes
5d0ad38c72 resolved conflicts for merge of ca2c6f75 to jb-mr1-dev-plus-aosp
Change-Id: If84f3c832a21ca1adf1a8009f50aa4a10f42a57e
2013-09-13 11:09:46 -07:00
Elliott Hughes
ca2c6f75a8 am 592c0708: am b30f6eb0: am 9e6104d5: resolved conflicts for merge of 05292dd6 to jb-mr1-dev
* commit '592c07084bf0d86b42e216002e5aaabf40023ea8':
  Upgrade pre-jb-mr2 releases to tzdata2013d.
2013-09-13 10:56:39 -07:00
Elliott Hughes
592c07084b am b30f6eb0: am 9e6104d5: resolved conflicts for merge of 05292dd6 to jb-mr1-dev
* commit 'b30f6eb026db05c969afacc758e529e73f0e314d':
  Upgrade pre-jb-mr2 releases to tzdata2013d.
2013-09-13 10:53:43 -07:00
Elliott Hughes
b30f6eb026 am 9e6104d5: resolved conflicts for merge of 05292dd6 to jb-mr1-dev
* commit '9e6104d54f541d43d3c1b785f2dfc1d2e09c0f2f':
  Upgrade pre-jb-mr2 releases to tzdata2013d.
2013-09-13 10:51:31 -07:00
Elliott Hughes
9e6104d54f resolved conflicts for merge of 05292dd6 to jb-mr1-dev
Change-Id: I051cad5dc3c985f11c52708f4487e64ea45ca617
2013-09-13 10:17:10 -07:00
Elliott Hughes
05292dd65b resolved conflicts for merge of cc7f0dc5 to jb-dev-plus-aosp
Change-Id: I812d0007ddd1576583a4749461b57ee33fb1eb15
2013-09-13 10:09:56 -07:00
Elliott Hughes
cc7f0dc5a1 Upgrade pre-jb-mr2 releases to tzdata2013d.
From the release notes:

  Changes affecting future time stamps:

    Morocco's midsummer transitions this year are July 7 and August 10,
    not July 9 and August 8.  (Thanks to Andrew Paprocki.)

    Israel now falls back on the last Sunday of October.
    (Thanks to Ephraim Silverberg.)

  Changes affecting past time stamps:

    Specify Jerusalem's location more precisely; this changes the pre-1880
    times by 2 s.

  Changing affecting metadata only:

    Fix typos in the entries for country codes BQ and SX.

Change-Id: I8caa139f0eecbe038643df43a27088278c6185cd
2013-09-13 09:43:15 -07:00
Brian Carlstrom
9a74e36f48 Use kernel default for initial thread size
Bug: 10697851

Change-Id: I8d980f5e0b584799536f6e6b891056c968d26cdf
2013-09-12 22:19:44 -07:00
The Android Automerger
25519f0fb0 merge in klp-release history after reset to klp-dev 2013-09-11 06:00:09 -07:00
Christopher Ferris
883ef2499c __memcpy_chk: Fix signed cmp of unsigned values.
I accidentally did a signed comparison of the size_t values passed in
for three of the _chk functions. Changing them to unsigned compares.

Add three new tests to verify this failure is fixed.

Bug: 10691831
Change-Id: Ia831071f7dffd5972a748d888dd506c7cc7ddba3
2013-09-10 17:34:03 -07:00
The Android Automerger
82a8fe37d7 merge in klp-release history after reset to klp-dev 2013-09-02 06:00:18 -07:00
Christopher Ferris
49c0d471a8 Merge "Fix all debug directives." into klp-dev 2013-08-29 21:21:20 +00:00
Christopher Ferris
05332f2ce7 Fix all debug directives.
The backtrace when a fortify check failed was not correct. This change
adds all of the necessary directives to get a correct backtrace.

Fix the strcmp directives and change all labels to local labels.

Testing:
- Verify that the runtime can decode the stack for __memcpy_chk, __memset_chk,
  __strcpy_chk, __strcat_chk fortify failures.
- Verify that gdb can decode the stack properly when hitting a fortify check.
- Verify that the runtime can decode the stack for a seg fault for all of the
  _chk functions and for memcpy/memset.
- Verify that gdb can decode the stack for a seg fault for all of the _chk
  functions and for memcpy/memset.
- Verify that the runtime can decode the stack for a seg fault for strcmp.
- Verify that gdb can decode the stack for a seg fault in strcmp.

Bug: 10342460
Bug: 10345269

Change-Id: I1dedadfee207dce4a285e17a21e8952bbc63786a
2013-08-28 15:42:05 -07:00
The Android Automerger
da4bedf52f merge in klp-release history after reset to klp-dev 2013-08-27 06:00:58 -07:00
Brian Carlstrom
6ab75bf41e Merge "Fix pthread_getcpuclockid." into klp-dev 2013-08-26 21:21:17 +00:00
Jeff Hao
e9e10c13ff Fix pthread_getcpuclockid.
clock_gettime was returning EINVAL for the values
produced by pthread_getcpuclockid.

Bug: 10346183

(cherry picked from commit 9b06cc3c1b)

Change-Id: Ib81a7024c218a4502f256c3002b9030e2aaa278d
2013-08-26 14:04:16 -07:00
The Android Automerger
8eca269b4b merge in klp-release history after reset to klp-dev 2013-08-26 06:00:41 -07:00
Robert Greenwalt
26ac803232 Merge "Change how DNS resolver handle no default iface" into klp-dev 2013-08-24 12:20:01 +00:00
Robert Greenwalt
d67662b9d6 Change how DNS resolver handle no default iface
We used to just try any iface we'd been told about as a
fallback, but that will end up mistakenly using a secondary
network's dns when we really don't have a default connection.

It also messed up our detection of whether we were doing the
lookup on the default or not (we'd get back our secondary net
iface as the default, do the compare and think we were on default).

Remove the lies and let dns fail if we don't have an iface for it.

bug:10132565

Conflicts:
	libc/netbsd/resolv/res_cache.c

Change-Id: I357a9c34dad83215f44c5e0dd41ce2a7d6fe8f3f
2013-08-23 11:48:26 -07:00
Elliott Hughes
345eb225ae Apply upstream commit 943a6621866e9d6e654f5cfe1494378c1fb8957a.
Author: Paul Eggert <eggert@cs.ucla.edu>
Date:   Thu Aug 22 12:47:51 2013 -0700

    * localtime.c: Fix another integer overflow bug in mktime.

    (time2sub): Avoid undefined behavior on time_t overflow.
    Reported by Elliott Hughes in
    <http://mm.icann.org/pipermail/tz/2013-August/019580.html>.

Bug: 10310929

(cherry picked from commit 713fe6463e)

Change-Id: I9ec79fd8d825e6b9e8bb5af549dbfc2182346c05
2013-08-22 14:29:07 -07:00
Elliott Hughes
f0c10a4a16 Work around tzcode's reliance on signed overflow.
I've mailed the tz list about this, and will switch to whatever upstream
fix comes along as soon as it's available.

Bug: 10310929

(cherry picked from commit 7843d44a59)

Change-Id: I205e2440703444c50cecd91d3458d33613ddbc59
2013-08-22 12:23:47 -07:00
The Android Automerger
13ea69528e merge in klp-release history after reset to klp-dev 2013-08-22 06:00:33 -07:00
Brian Carlstrom
9ef1fbb644 Make mips_relocate_got tolerate a missing got
Bug: 10094803

(cherry picked from commit 7ee26878065abb494600595349ce58b2b2db3709)

Change-Id: I9fbb65d20011f2f625fde3b15ac8c6887dd03ae4
2013-08-21 10:20:53 -07:00
The Android Automerger
948fbefa2a merge in klp-release history after reset to klp-dev 2013-08-21 06:01:31 -07:00
Christopher Ferris
5f7ccea3ff Update all debug directives.
The libcorkscrew stack unwinder does not understand cfi directives,
so add .save directives so that it can function properly.

Also add the directives in to strcmp.S and fix a missing set of
directives in cortex-a9/memcpy_base.S.

Bug: 10345269

Change-Id: I043f493e0bb6c45bd3f4906fbe1d9f628815b015
2013-08-20 11:22:34 -07:00
The Android Automerger
de19a0c55d merge in klp-release history after reset to klp-dev 2013-08-14 06:04:54 -07:00
Christopher Ferris
f0c3d90913 Create optimized __strcpy_chk/__strcat_chk.
This change pulls the memcpy code out into a new file so that the
__strcpy_chk and __strcat_chk can use it with an include.

The new versions of the two chk functions uses assembly versions
of strlen and memcpy to implement this check. This allows near
parity with the assembly versions of strcpy/strcat. It also means that
as memcpy implementations get faster, so do the chk functions.

Other included changes:
- Change all of the assembly labels to local labels. The other labels
  confuse gdb and mess up backtracing.
- Add .cfi_startproc and .cfi_endproc directives so that gdb is not
  confused when falling through from one function to another.
- Change all functions to use cfi directives since they are more powerful.
- Move the memcpy_chk fail code outside of the memcpy function definition
  so that backtraces work properly.
- Preserve lr before the calls to __fortify_chk_fail so that the backtrace
  actually works.

Testing:

- Ran the bionic unit tests. Verified all error messages in logs are set
  correctly.
- Ran libc_test, replacing strcpy with __strcpy_chk and replacing
  strcat with __strcat_chk.
- Ran the debugger on nexus10, nexus4, and old nexus7. Verified that the
  backtrace is correct for all fortify check failures. Also verify that
  when falling through from __memcpy_chk to memcpy that the backtrace is
  still correct. Also verified the same for __memset_chk and bzero.
  Verified the two different paths in the cortex-a9 memset routine that
  save variables to the stack still show the backtrace properly.

Bug: 9293744
Change-Id: Id5aec8c3cb14101d91bd125eaf3770c9c8aa3f57
(cherry picked from commit 2be91915dc)
2013-08-14 07:46:00 +00:00
Elliott Hughes
3912f90e56 Make ctype.h a little less unhygienic.
This caused trouble for stlport.

(cherry picked from commit 5e9b20f721)

Change-Id: I85d09c12c6de1e8502f83e0ef0f17747fdfe08a5
2013-08-13 14:42:43 -07:00
Elliott Hughes
5951e84646 Fix our missing abs/labs/llabs/imaxabs (and imaxdiv) symbols.
(cherry picked from commit aec2ffbc5a)

Change-Id: Ib61b52dc37e63493094a0a7af23bf89d4a9f0ce5
2013-08-13 14:41:07 -07:00
The Android Automerger
f63a467cdd merge in klp-release history after reset to klp-dev 2013-08-12 06:00:44 -07:00
Elliott Hughes
9e9d1e016f resolved conflicts for merge of 86125aca to klp-dev
Change-Id: I78622ecbad27301b285193a085fa04374aa60033
2013-08-08 18:08:33 -07:00
Elliott Hughes
ceb670cfc0 Merge branch 'klp-dev' of https://googleplex-android.googlesource.com/_direct/platform/bionic into klp-dev 2013-08-08 17:53:31 -07:00
Christopher Ferris
1036cd7939 am 6beb3ea6: (-s ours) am d7d5049d: (-s ours) am 632fd518: (-s ours) Merge "Fix strcpy.c that should have been strcpy.S. DO NOT MERGE"
* commit '6beb3ea6a1a49baef001ddd8c6872631f5e90f82':
  Fix strcpy.c that should have been strcpy.S. DO NOT MERGE
2013-08-08 17:53:19 -07:00
Christopher Ferris
5ec2ab68f9 am 21b4ffa7: (-s ours) am 5427eb5c: (-s ours) am e2066293: (-s ours) Merge "Optimize strcat/strcpy, small tweaks to strlen. DO NOT MERGE"
* commit '21b4ffa7372b029e5a4898b877feb843da2831e9':
  Optimize strcat/strcpy, small tweaks to strlen. DO NOT MERGE
2013-08-08 17:53:18 -07:00
Elliott Hughes
840a114eb1 Add futimens.
(cherry picked from commit d0be7c8f9a)

Bug: 10239370
Change-Id: I0087e85a94d83b6ce68ec6a0768c44cbe4bd0132
2013-08-08 17:52:06 -07:00
Elliott Hughes
86125acacd am dce94165: am ee48fed5: Merge "Add futimens."
* commit 'dce94165a5624935db9855e208420d36c763f771':
  Add futimens.
2013-08-08 17:45:45 -07:00
Christopher Ferris
6beb3ea6a1 am d7d5049d: (-s ours) am 632fd518: (-s ours) Merge "Fix strcpy.c that should have been strcpy.S. DO NOT MERGE"
* commit 'd7d5049d58427e23318fa1920d63712676fc7725':
  Fix strcpy.c that should have been strcpy.S. DO NOT MERGE
2013-08-08 17:45:45 -07:00
Christopher Ferris
21b4ffa737 am 5427eb5c: (-s ours) am e2066293: (-s ours) Merge "Optimize strcat/strcpy, small tweaks to strlen. DO NOT MERGE"
* commit '5427eb5c63417c7bc59bbfe112c97917dcef4e8c':
  Optimize strcat/strcpy, small tweaks to strlen. DO NOT MERGE
2013-08-08 17:45:44 -07:00
Elliott Hughes
dce94165a5 am ee48fed5: Merge "Add futimens."
* commit 'ee48fed51894f3db324e957058ed2ddcf23dddc7':
  Add futimens.
2013-08-08 17:41:15 -07:00
Christopher Ferris
d7d5049d58 am 632fd518: (-s ours) Merge "Fix strcpy.c that should have been strcpy.S. DO NOT MERGE"
* commit '632fd5183a611b80e009be36f881f572acc41619':
  Fix strcpy.c that should have been strcpy.S. DO NOT MERGE
2013-08-08 17:41:15 -07:00
Christopher Ferris
5427eb5c63 am e2066293: (-s ours) Merge "Optimize strcat/strcpy, small tweaks to strlen. DO NOT MERGE"
* commit 'e2066293e8279641d4abd13ec3fbdd6f42def83d':
  Optimize strcat/strcpy, small tweaks to strlen. DO NOT MERGE
2013-08-08 17:41:14 -07:00
The Android Automerger
b683cf117d merge in klp-release history after reset to klp-dev 2013-08-08 07:53:11 -07:00
Colin Cross
7f4074d17d bionic: name malloc'd regions
Use the new __bionic_name_mem function to name malloc'd memory as
"libc_malloc" on kernels that support it.

Change-Id: I7235eae6918fa107010039b9ab8b7cb362212272
2013-08-08 00:42:39 +00:00
Colin Cross
6771b9cef6 bionic: add function to name memory
Only works on some kernels, and only on page-aligned regions of
anonymous memory.  It will show up in /proc/pid/maps as
[anon:<name>] and in /proc/pid/smaps as Name: <name>

Change-Id: If31667cf45ff41cc2a79a140ff68707526def80e
2013-08-07 15:41:30 -07:00
Christopher Ferris
7c860db074 Optimize __memset_chk, __memcpy_chk.
This change creates assembler versions of __memcpy_chk/__memset_chk
that is implemented in the memcpy/memset assembler code. This change
avoids an extra call to memcpy/memset, instead allowing a simple fall
through to occur from the chk code into the body of the real
implementation.

Testing:

- Ran the libc_test on __memcpy_chk/__memset_chk on all nexus devices.
- Wrote a small test executable that has three calls to __memcpy_chk and
  three calls to __memset_chk. First call dest_len is length + 1. Second
  call dest_len is length. Third call dest_len is length - 1.
  Verified that the first two calls pass, and the third fails. Examined
  the logcat output on all nexus devices to verify that the fortify
  error message was sent properly.
- I benchmarked the new __memcpy_chk and __memset_chk on all systems. For
  __memcpy_chk and large copies, the savings is relatively small (about 1%).
  For small copies, the savings is large on cortex-a15/krait devices
  (between 5% to 30%).
  For cortex-a9 and small copies, the speed up is present, but relatively
  small (about 3% to 5%).
  For __memset_chk and large copies, the savings is also small (about 1%).
  However, all processors show larger speed-ups on small copies (about 30% to
  100%).

Bug: 9293744

Change-Id: I8926d59fe2673e36e8a27629e02a7b7059ebbc98
2013-08-06 15:38:29 -07:00
The Android Automerger
2b899b04e9 merge in klp-release history after reset to master 2013-08-06 08:16:59 -07:00
Christopher Ferris
1ce6654163 Fix strcpy.c that should have been strcpy.S.
Change-Id: Ib4609baad3a14c8b0f37556269781fa2b06916dc
2013-08-05 17:08:06 -07:00
Christopher Ferris
e1857431e8 Merge "Optimize strcat/strcpy, small tweaks to strlen." 2013-08-05 23:32:06 +00:00
Elliott Hughes
e66ffef900 am cd927519: Merge "Fix stdint.h intptr_t/uintptr_t for x86_64/x32"
* commit 'cd927519a94939f2ebc307544f827baade529bc9':
  Fix stdint.h intptr_t/uintptr_t for x86_64/x32
2013-08-05 15:51:54 -07:00
Elliott Hughes
28e0ec8d61 am a0473d77: Merge "syslog needs a valid socket path for _PATH_LOG"
* commit 'a0473d77b2d3a6f26e29cc8c2fdaeb2a4b3ab8f8':
  syslog needs a valid socket path for _PATH_LOG
2013-08-05 15:51:53 -07:00
Robert Greenwalt
662bb875e4 am a9c5bb97: Merge "Fix the detection of alt-network in dns resolver."
* commit 'a9c5bb972df7cbb4e65cfb53673b26f9d42deacd':
  Fix the detection of alt-network in dns resolver.
2013-08-05 11:55:53 -07:00
The Android Automerger
1714c787b6 merge in klp-release history after reset to master 2013-08-05 06:00:46 -07:00
Elliott Hughes
49b24b4efb am 3287dccf: Merge "Add ssse3 implementation of __memcmp16."
* commit '3287dccf2ecced89bb39b857abc8eba997bc3f51':
  Add ssse3 implementation of __memcmp16.
2013-08-02 18:04:01 -07:00
Ben Cheng
b78f43579f am aa2733d1: Merge "Update the comments to reflect the current status."
* commit 'aa2733d17b87c607fccbd6e6a0f44d2d411ffd77':
  Update the comments to reflect the current status.
2013-08-02 17:58:47 -07:00
Elliott Hughes
d0313e7a2a am a6ed05c1: Merge "libgcc_compat: Introduce __aeabi_lasr for cortex-a9 and higher"
* commit 'a6ed05c1c4c787241b56df132e77512c64cbc595':
  libgcc_compat: Introduce __aeabi_lasr for cortex-a9 and higher
2013-08-02 17:58:46 -07:00
Christopher Ferris
d119b7b6f4 Optimize strcat/strcpy, small tweaks to strlen.
Create one version of strcat/strcpy/strlen for cortex-a15/krait and another
version for cortex-a9.

Tested with the libc_test strcat/strcpy/strlen tests.
Including new tests that verify that the src for strcat/strcpy do not
overread across page boundaries.

NOTE: The handling of unaligned strcpy (same code in strcat) could probably
be optimized further such that the src is read 64 bits at a time instead of
the partial reads occurring now.

strlen improves slightly since it was recently optimized.

Performance improvements for strcpy and strcat (using an empty dest string):

cortex-a9
- Small copies vary from about 5% to 20% as the size gets above 10 bytes.
- Copies >= 1024, about a 60% improvement.
- Unaligned copies, from about 40% improvement.

cortex-a15
- Most small copies exhibit a 100% improvement, a few copies only
  improve by 20%.
- Copies >= 1024, about 150% improvement.
- Unaligned copies, about 100% improvement.

krait
- Most small copies vary widely, but on average 20% improvement, then
  the performance gets better, hitting about a 100% improvement when
  copies 64 bytes of data.
- Copies >= 1024, about 100% improvement.
- When coping MBs of data, about 50% improvement.
- Unaligned copies, about 90% improvement.

As strcat destination strings get larger in size:

cortex-a9
- about 40% improvement for small dst strings (>= 32).
- about 250% improvement for dst strings >= 1024.

cortex-a15
- about 200% improvement for small dst strings (>=32).
- about 250% improvement for dst strings >= 1024.

krait
- about 25% improvement for small dst strings (>=32).
- about 100% improvement for dst strings >=1024.

Change-Id: Ifd091ebdbce70fe35a7c5d8f71d5914255f3af35
2013-08-02 10:31:51 -07:00
Robert Greenwalt
7e5d7485b7 am e6345f1a: Merge "Tell the dns resolver about our domains."
* commit 'e6345f1a1ec691690c69d5663ca8bb2b70240d93':
  Tell the dns resolver about our domains.
2013-07-31 17:57:45 -07:00
The Android Automerger
1d1fe3bb69 merge in klp-release history after reset to master 2013-07-30 11:08:39 -07:00
Elliott Hughes
abf3638317 am 101b5e1f: Merge "Define PTHREAD_KEYS_MAX and _POSIX_THREAD_KEYS_MAX in a POSIX-compliant way."
* commit '101b5e1f6cc4e24635760928b3d2c1e51c1e5774':
  Define PTHREAD_KEYS_MAX and _POSIX_THREAD_KEYS_MAX in a POSIX-compliant way.
2013-07-29 17:35:49 -07:00
Elliott Hughes
326b52760d am 9a73d08f: Merge "Bump the number of TLS slots to 128."
* commit '9a73d08f4c334c00fe06d583d37e038ebe063eba':
  Bump the number of TLS slots to 128.
2013-07-25 17:04:18 -07:00
Elliott Hughes
478314a109 am a9feb5e3: Merge "Avoid sign extension of the mmap offset."
* commit 'a9feb5e33a5261f45fb25fd5e90a56792c6a437e':
  Avoid sign extension of the mmap offset.
2013-07-25 10:51:00 -07:00
The Android Automerger
48161c898b merge in klp-release history after reset to master 2013-07-24 06:00:57 -07:00
Elliott Hughes
a59b7ed8c3 am bfba6aac: am a8d06766: Merge "[MIPS] __dso_handle.S and __dso_handle_so.S not needed."
* commit 'bfba6aac99115972fad3341aef595c0ca1f7258b':
  [MIPS] __dso_handle.S and __dso_handle_so.S not needed.
2013-07-23 18:10:51 -07:00
Rom Lemarchand
c847f749fe am c5749f1f: am 061246b6: Merge "Restore dlmalloc mmap threshold to 64k"
* commit 'c5749f1f4232e59e66737488036aba1f583867d5':
  Restore dlmalloc mmap threshold to 64k
2013-07-23 13:58:12 -07:00
The Android Automerger
58ccd60877 merge in klp-release history after reset to master 2013-07-22 06:00:33 -07:00
Elliott Hughes
aa9116f0ed am c2902edf: am 6fe4a58f: Merge "Move stuff only needed by pthread-timers.c into pthread-timers.c."
* commit 'c2902edfc4aaa02977eef7154d05d5369bc48281':
  Move stuff only needed by pthread-timers.c into pthread-timers.c.
2013-07-19 17:19:46 -07:00
Elliott Hughes
8b56ba8896 am 178c4185: am e8bd8c2e: Merge "Upgrade mktemp.c to the current upstream version."
* commit '178c41857321732259c3e22d73c86c22ae4359b5':
  Upgrade mktemp.c to the current upstream version.
2013-07-19 16:43:07 -07:00
Colin Cross
15d2784fc1 Merge "Kexec header generated from linux header 3.10" 2013-07-18 17:41:09 +00:00
The Android Automerger
00196d1a46 merge in klp-release history after reset to master 2013-07-18 06:00:28 -07:00
Elliott Hughes
3c212645a0 am 81b46980: am f8a66bb3: Merge "Remove some non-unused makefile generality."
* commit '81b4698059c37ac36aa74d1498bef5654580ad3f':
  Remove some non-unused makefile generality.
2013-07-17 17:45:03 -07:00
Elliott Hughes
ac74b8565a am b6b2375d: am 8fa9081f: Merge "[MIPS] Rewrite MIPS crtbegin* as C files."
* commit 'b6b2375df8ca63a5e349d8277d425ab58e16aeb1':
  [MIPS] Rewrite MIPS crtbegin* as C files.
2013-07-17 17:40:46 -07:00
Elliott Hughes
66f8452a14 am cbf07a25: am 2be511d4: Merge "Improve stack overflow diagnostics (take 2)."
* commit 'cbf07a25149cd924a348e4dc0395c5d08f86fd7f':
  Improve stack overflow diagnostics (take 2).
2013-07-17 13:53:06 -07:00
Elliott Hughes
4add6968be resolved conflicts for merge of e35d6c28 to master
Change-Id: I237bfc35d872a2e2ff10984012f9811488a5cea7
2013-07-17 13:28:30 -07:00
Elliott Hughes
a5a3b3bdb1 resolved conflicts for merge of 4763ef2b to master
Change-Id: I4d424f9fb438c2ed845bca0bbcae69b4d0f5e3dc
2013-07-17 13:18:43 -07:00
The Android Automerger
0976c97fe4 merge in klp-release history after reset to master 2013-07-17 06:00:13 -07:00
Guang Zhu
81b7df7315 am 6f08b865: am 2cf5a6f6: Merge "Revert "Improve stack overflow diagnostics.""
* commit '6f08b8659a3682b7e774af6ed68b1b613e147f1b':
  Revert "Improve stack overflow diagnostics."
2013-07-16 20:23:42 -07:00
Guang Zhu
dd4eb67a48 am 849bfd58: am 8c1b9668: Merge "Revert "Clean up our alternate signal stacks.""
* commit '849bfd58118e8c8a4b1ad8a7c3de74bb3cd13863':
  Revert "Clean up our alternate signal stacks."
2013-07-16 20:23:41 -07:00
Christopher Ferris
66cb2edba5 am 7ff868a6: am f63c28f0: Merge "Fix assembler errors in generic arm strlen.c."
* commit '7ff868a6307f0d5e63555b5d320b8ad6e490e3c4':
  Fix assembler errors in generic arm strlen.c.
2013-07-16 17:24:40 -07:00
Christopher Ferris
69205c5433 am b1d7fd49: am 6f4fed74: Merge "Add new optimized strlen for arm."
* commit 'b1d7fd4969fdd3d3402b500840561beb30962c1d':
  Add new optimized strlen for arm.
2013-07-16 17:24:40 -07:00
Elliott Hughes
152dcf3b3f am 79dfb1af: am f35e0c14: Merge "Clean up our alternate signal stacks."
* commit '79dfb1afda16565a0dd378eca7f72bfe81fae205':
  Clean up our alternate signal stacks.
2013-07-16 15:56:16 -07:00
Elliott Hughes
617a1e4977 am 10a954de: am 026867c7: Merge "Improve stack overflow diagnostics."
* commit '10a954dea6732232ed6cf56d3aa6ca38673dacbf':
  Improve stack overflow diagnostics.
2013-07-16 15:36:12 -07:00
Elliott Hughes
f2f6b2bad3 am d2acf124: am 9562d38d: Merge "Clean up __builtin_expect usage."
* commit 'd2acf124ed7ad18f8adb5159544c92234cade90e':
  Clean up __builtin_expect usage.
2013-07-16 15:36:12 -07:00
Elliott Hughes
62d6b7526a am 2a18ea14: am f152e386: Merge "EABI syscall cleanup."
* commit '2a18ea1462cf65cc51bfcb1a1c46972ee5af1d01':
  EABI syscall cleanup.
2013-07-16 15:36:11 -07:00
The Android Automerger
7256fbd9b2 merge in klp-release history after reset to master 2013-07-16 06:00:36 -07:00
Elliott Hughes
993ea1061b am 5148661f: am 67750c85: Merge "Fix pthread_getattr_np, pthread_attr_setguardsize, and pthread_attr_setstacksize."
* commit '5148661f8d2be514d0e3c191bc1e489157ae1154':
  Fix pthread_getattr_np, pthread_attr_setguardsize, and pthread_attr_setstacksize.
2013-07-15 16:45:54 -07:00
Christopher Ferris
d8d10a8994 Fix assembler errors in generic arm strlen.c.
Tested using a static version of the strlen libc_test program
on a nexus7 that uses the generic code.

Change-Id: If04d15dcb6c0b18f27f2fefadca5510ed49016c5
2013-07-15 13:56:45 -07:00
Szymon Starzycki
674be7e0fc Kexec header generated from linux header 3.10
Change-Id: Iac26fcc6e0e25905ab52dba91bec16a4fb479d43
2013-07-15 13:51:56 -07:00
Christopher Ferris
67e9f47476 Merge "Add new optimized strlen for arm." 2013-07-15 19:44:26 +00:00
Christopher Ferris
2fc0717977 Add new optimized strlen for arm.
This optimized version is primarily targeted at cortex-a15.

Tested on all nexus devices using the system/extras/libc_test strlen test.
Tested alignments from 1 to 32 that are powers of 2.
Tested that strlen does not cross page boundaries at all alignments.

Speed improvements listed below:

cortex-a15
- Sizes >= 32 bytes, ~75% improvement.
- Sizes >= 1024 bytes, ~250% improvement.

cortex-a9
- Sizes >= 32 bytes, ~75% improvement.
- Sizes >= 1024 bytes, ~85% improvement.

krait
- Sizes >= 32 bytes, ~95% improvement.
- Sizes >= 1024 bytes, ~160% improvement.

Change-Id: I361b1a36ed89ab991f2a8f0abbf0d7416d39c8f5
2013-07-15 12:37:51 -07:00
Elliott Hughes
fc2ada9741 am f384be3b: am 59ed029b: Merge "Upgrade to tzcode2013d."
* commit 'f384be3b5c2062e7ef4e7449b466bf2f24f7bcc8':
  Upgrade to tzcode2013d.
2013-07-15 10:15:45 -07:00
The Android Automerger
2d7d92e811 merge in klp-release history after reset to master 2013-07-15 06:00:50 -07:00
Elliott Hughes
d3522051ce am 7e56f462: am 3db1f359: Merge "Add a trivial gmtime(3) test."
* commit '7e56f462ad19791d7b270e297fc994d18df43252':
  Add a trivial gmtime(3) test.
2013-07-12 14:35:19 -07:00
Elliott Hughes
47c7e33ccb am ff20b911: am 8a363692: Merge "Add TCP_INFO state enum values."
* commit 'ff20b9110659e67433ce641a6224cdc9ccc01301':
  Add TCP_INFO state enum values.
2013-07-11 18:57:42 -07:00
Nick Kralevich
4fa5d6a5db am ef49e99d: am d30877ae: Merge "syslog.h: add __printflike to syslog functions"
* commit 'ef49e99d92597a4e9fddbba0e1e3feddc06fee53':
  syslog.h: add __printflike to syslog functions
2013-07-11 18:57:41 -07:00
Geremy Condra
bb17967761 Merge "Add marking of DNS sockets for mark based routing" 2013-07-11 22:10:31 +00:00
Elliott Hughes
f9a1d1cf5f am 09f561b3: am b7f49237: Merge "Fix MIPS build."
* commit '09f561b38b880e551097b807585d0e037fa36442':
  Fix MIPS build.
2013-07-11 10:16:33 -07:00
Elliott Hughes
1087e0df4f am 731f7c2d: am 9d476716: Merge "Add <sys/statvfs.h>."
* commit '731f7c2d0e531d5e0ecdd771d743053f8d093e16':
  Add <sys/statvfs.h>.
2013-07-11 10:16:32 -07:00
Chad Brubaker
c39214e0ac Add marking of DNS sockets for mark based routing
Adds an extra mark parameter to android_getaddrinfoforiface,
android_gethostbyaddrforiface and android_gethostbynameforiface that if set
will cause all packets sent by DNS requests to have that mark

Change-Id: I6f72390e4ce5bfc3cc73183f9b2fb3705a11685f
2013-07-09 13:16:22 -07:00
The Android Automerger
b89a334df8 merge in klp-release history after reset to master 2013-07-09 06:00:16 -07:00
Elliott Hughes
273df910b5 am f3f72e7f: am 4fc8a0c1: Merge "Remove <netinet/icmp6.h> ni_* macros."
* commit 'f3f72e7f277215e9fede7c6f6695654cf7aa0c63':
  Remove <netinet/icmp6.h> ni_* macros.
2013-07-08 15:13:35 -07:00
Elliott Hughes
4df412cba6 am 74b06f8d: am ff145277: Merge "Upgrade to tzdata2013d."
* commit '74b06f8ddcaaa48c7bab418d15aacaf513423ac3':
  Upgrade to tzdata2013d.
2013-07-08 15:09:57 -07:00
Elliott Hughes
f33dce1ab6 am 233050b1: am e31c45c9: Merge "Make bionic\'s <netinet/icmp6.h> standalone, like glibc\'s."
* commit '233050b15ec3ce0db534ec6cc24a6061559993d2':
  Make bionic's <netinet/icmp6.h> standalone, like glibc's.
2013-07-08 11:27:53 -07:00
Elliott Hughes
b1397f97f1 am 62bdd031: am 6b33f31b: Merge "Fix IPv6 filtering definitions in netinet/icmp6.h."
* commit '62bdd03120286708d8c1562eadf5dda00e24911c':
  Fix IPv6 filtering definitions in netinet/icmp6.h.
2013-07-08 10:38:41 -07:00
Elliott Hughes
b611d36c3a am 24400ac1: am e63ea6ac: Merge "Clean up <sys/mount.h>/<linux/fs.h> duplication."
* commit '24400ac1e390615ebcb45deacc1c9213b00f75ff':
  Clean up <sys/mount.h>/<linux/fs.h> duplication.
2013-07-08 10:17:38 -07:00
The Android Automerger
1456ec759c merge in klp-release history after reset to master 2013-07-08 06:00:29 -07:00
Nick Kralevich
20cb10824b am 601f968c: am 84983592: Merge "bionic_atomic_arm.h: Remove < ARMv6 support"
* commit '601f968cedf015c060de8dcf21e7e10bf596901f':
  bionic_atomic_arm.h: Remove < ARMv6 support
2013-07-03 14:33:22 -07:00
Elliott Hughes
1f75ee8606 am a8b954c5: am de2781d9: Merge changes I01345c23,I3b57517c
* commit 'a8b954c51edd9ec8c09a5d1dccacaadf5869d78a':
  Include linux/termios.h from sys/ioctl.h.
  Update linux/types.h to linux 2.6.20.
2013-07-03 13:45:45 -07:00
Elliott Hughes
be438a4c40 am fac9199c: am ebc8ce1d: Merge "libc/arch-arm/bionic/memcpy.a9.S: memcpy from cortex-strings."
* commit 'fac9199c7698481805dd9b1adaf89a2584719f4c':
  libc/arch-arm/bionic/memcpy.a9.S: memcpy from cortex-strings.
2013-07-03 10:28:19 -07:00
Elliott Hughes
997368d60d am 833dc584: am 87b4286f: Merge "Expose dn_comp and dn_expand to system C code."
* commit '833dc584d4d02ab8e396b877b38a8a5ad8ba4882':
  Expose dn_comp and dn_expand to system C code.
2013-07-02 16:05:34 -07:00
Elliott Hughes
742aad3584 am 7c808b29: am feec97a7: Merge "Fix inttypes.h PRI?PTR and SCN?PTR macros."
* commit '7c808b29d5cea61e5bda90a1b0f2f0e669ee135e':
  Fix inttypes.h PRI?PTR and SCN?PTR macros.
2013-07-02 15:50:36 -07:00
Nick Kralevich
e4723161d5 Merge "mmap: Don't call madvise if mmap fails" 2013-07-02 19:52:44 +00:00
Elliott Hughes
2aac0fcc20 am dcd237a8: am 1ba3a2c2: Merge "Update icmp6.h to current NetBSD."
* commit 'dcd237a89707357ead904a2476bb2210e251c173':
  Update icmp6.h to current NetBSD.
2013-07-02 12:41:37 -07:00
Nick Kralevich
553a5ec407 mmap: Don't call madvise if mmap fails
Fix improper check of return value from __mmap2. On a failed
mmap(), it returns MAP_FAILED, not 0. This ended up clobbering errno
when madvise subsequently failed.

Change-Id: I364fb2f158fe258c55a73e552195384b2c11c193
2013-07-02 12:31:07 -07:00
The Android Automerger
9db12e44af merge in klp-release history after reset to master 2013-07-02 07:07:20 -07:00
Christopher Ferris
c6ac3ae269 am 269daac2: am 7c14d67b: Merge "libc/arch-arm/bionic/memcpy.a9.S: memcpy from cortex-strings."
* commit '269daac2f1d76a478b83ba4cbb57d28b47eef5ec':
  libc/arch-arm/bionic/memcpy.a9.S: memcpy from cortex-strings.
2013-07-01 10:39:08 -07:00
Nick Kralevich
4b17283c98 am 28d298a6: am 413eef71: Merge "More FORTIFY_SOURCE functions under clang"
* commit '28d298a673da4367f27f428db5e12d7dad3d8e83':
  More FORTIFY_SOURCE functions under clang
2013-07-01 10:04:18 -07:00
The Android Automerger
5da8df2840 merge in klp-release history after reset to master 2013-07-01 07:07:20 -07:00
Nick Kralevich
22570f51a5 am a289964b: am 227b47a4: Merge "resolv_private.h: remove #define b64_ntop and b64_pton"
* commit 'a289964bca39c591b54e0c336da1a6730e85cd61':
  resolv_private.h: remove #define b64_ntop and b64_pton
2013-06-28 13:37:08 -07:00
Nick Kralevich
fda0c06605 am 2018cfa8: am 394df35e: Merge "Reorganize FORTIFY_SOURCE tests."
* commit '2018cfa85d4c7f36316376f5b090be5f0d3d13dc':
  Reorganize FORTIFY_SOURCE tests.
2013-06-28 13:15:39 -07:00
Nick Kralevich
9a268a10bb am f9ef0106: am 78a7bf99: Merge "stdio.h: enable vs?printf clang FORTIFY_SOURCE"
* commit 'f9ef0106da43d21e6cb68d87b86d806f63b215fd':
  stdio.h: enable vs?printf clang FORTIFY_SOURCE
2013-06-27 10:18:17 -07:00
The Android Automerger
e4450b447e merge in klp-release history after reset to master 2013-06-26 07:07:28 -07:00
Colin Cross
2f76830a01 am 146d79c2: am fbec57d4: Merge changes Ib496e818,I074204e9
* commit '146d79c22a70d772defc63acfa6ac6128102a15f':
  bionic: add compatibility mode for properties
  bionic: use the size of the file to determine property area size
2013-06-25 18:29:14 -07:00
Elliott Hughes
9145ae66d7 am db6dd600: am b116bf76: Merge "Switch to current upstream getopt_long."
* commit 'db6dd600d23eafb1742e5114bae7a4b8be4c04e1':
  Switch to current upstream getopt_long.
2013-06-25 17:02:11 -07:00
Rom Lemarchand
6937468d37 am baa61864: am 995f17e6: Merge "libc: add swapon and swapoff syscalls"
* commit 'baa61864c515a56d4dbeac46b149b4317b01797b':
  libc: add swapon and swapoff syscalls
2013-06-25 17:02:06 -07:00
Elliott Hughes
43508014c4 am 51371ee0: am c76550b3: Merge "Update x86 machine/endian.h from upstream"
* commit '51371ee0d897285b869aa2af670e153ead471e03':
  Update x86 machine/endian.h from upstream
2013-06-25 17:01:53 -07:00
Elliott Hughes
d9643a3119 am d31287d6: am 7d624e9a: Merge "Kernel dso support for \'dl_iterate_phdr\' function"
* commit 'd31287d6017475209cfee2fea0532bdc8c0f4aac':
  Kernel dso support for 'dl_iterate_phdr' function
2013-06-25 17:01:47 -07:00
Nick Kralevich
caad18c7d1 am 71802135: am bfacb603: Merge "libc: enable FORTIFY_SOURCE snprintf under clang"
* commit '7180213557f3120b391053b4f5861037eda6ebb6':
  libc: enable FORTIFY_SOURCE snprintf under clang
2013-06-25 16:30:53 -07:00
Colin Cross
4fc4c9be84 am a99e29e6: (-s ours) am 1642edb5: Merge changes Ib074192d,I6df3afed,I69070455,Icbe31908,Id3fa4526,I038d451f
* commit 'a99e29e61090da9c21c17cae54211083a2268d6e':
  bionic: store property names as variable-length strings
  bionic: prevent root processes from calling __system_property_add
  bionic: revert to a single (larger) property area
  bionic: reimplement property area as hybrid trie/binary tree
  bionic: add missing memory barriers to system properties
  bionic: make property area expandable
2013-06-25 16:30:34 -07:00
Colin Cross
ad76c85b9c bionic: add compatibility mode for properties
Allow a new bionic to work with an old init property area by supporting
the old format.

Change-Id: I9268214b2f8930e75e3b5c26afe94fa92068bf0b
2013-06-25 13:34:45 -07:00
Colin Cross
285b42a04c bionic: use the size of the file to determine property area size
On the reader size, don't assume that the property size is PA_SIZE,
read it from the size of the file.  Allows init to use a different
property size without recompiling statically linked executables.

Change-Id: I87fb0bf40c4724e3759a583fd9ea1f49492bc958
2013-06-25 13:34:45 -07:00
Greg Hackmann
4fe82929eb bionic: store property names as variable-length strings
Names are immutable, so the fixed-sized arrays can be replaced with
variable-length ones to save memory (especially on internal tree nodes).

Change-Id: Iddf7856fba579b97f355e9ad4b3663a78767b96d
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2013-06-25 13:34:42 -07:00
Colin Cross
fc761f8cc0 bionic: prevent root processes from calling __system_property_add
If a root process other than init calls __system_property_add, which
it should never do, it will break the design assumption that there is
only one mutator.

Pass O_EXCL to open() in map_prop_region_rw to ensure that only one
process ever has the property pages open for write.

Change-Id: I8233bfe0beaa40a5003ad53b98c661536b15f6b7
2013-06-25 13:34:36 -07:00
Greg Hackmann
be30c7a78a bionic: revert to a single (larger) property area
d329697 is too complicated.  Change the multiple property pages back to
a single 128K property area that's mapped in entirely at initialization
(the memory will not get allocated until the pages are touched).

d329697 has other changes useful for testing (moving property area
initialization inside bionic and adding __system_property_set_filename)
so undo the change manually rather than with git revert.

Change-Id: Icd137669a4f8bc248e9dd2c1e8cc54e9193c9a6d
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2013-06-25 13:34:32 -07:00
Greg Hackmann
d5276422ca bionic: add hierarchical properties test
Deliberately put items several levels deep in the trie hierarchy to test
the trie traversal

Change-Id: I995a1cdd3b5e74162fb5d25bc0f65140bdf2f719
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2013-06-25 13:34:29 -07:00
Greg Hackmann
4482d85139 bionic: reimplement property area as hybrid trie/binary tree
See the comments for an explanation of how properties are stored.

The trie structure is designed to scale better than the previous
array-based implementation.  Searching an array with n properties
required average O(n) string compares of the entire key; searching the
trie requires average O(log n) string compares of each token (substrings
between '.' characters).

Change-Id: Ic28b3c5246004a3c502eb02d6e1c9b512884d872
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2013-06-25 13:34:24 -07:00
The Android Automerger
4261a08409 merge in klp-release history after reset to master 2013-06-25 07:07:12 -07:00
Nick Kralevich
5f7f7fca27 am 95448039: am 0ea1d5c0: Merge "libc: enable sprintf FORTIFY_SOURCE under clang"
* commit '954480393f4539f62cdc3f6cb83c562050ea4f51':
  libc: enable sprintf FORTIFY_SOURCE under clang
2013-06-25 05:59:32 -07:00
Greg Hackmann
c79de97ccc bionic: replace 4K property pages with 32K property pages
Fixes apps compiled statically against new libc but running with old
init

Bug: 9558625
Change-Id: I79e6f02575d278d4c7d8e8546d772ed0529bcaab
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2013-06-24 19:23:34 -07:00
Greg Hackmann
de76bafb21 bionic: replace 4K property pages with 32K property pages
Fixes apps compiled statically against new libc but running with old
init

Bug: 9558625
Change-Id: I79e6f02575d278d4c7d8e8546d772ed0529bcaab
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2013-06-24 18:41:46 -07:00
Greg Hackmann
44c273c293 Revert "bionic: reimplement property area as hybrid trie/binary tree"
This reverts commit 6ac8e6a46d.
2013-06-24 18:05:20 -07:00
Greg Hackmann
890aa0d937 Revert "bionic: add hierarchical properties test"
This reverts commit 0f76e2340c.
2013-06-24 18:05:18 -07:00
Greg Hackmann
fa8cc0629f Revert "bionic: revert to a single (larger) property area"
This reverts commit 5f05348c18.
2013-06-24 18:05:16 -07:00
Greg Hackmann
b938756eb3 Revert "bionic: prevent root processes from calling __system_property_add"
This reverts commit fb9b7b436f.
2013-06-24 18:05:14 -07:00
Greg Hackmann
982463d99b Revert "bionic: store property names as variable-length strings"
This reverts commit 492ce95d9f.
2013-06-24 18:05:10 -07:00
Greg Hackmann
492ce95d9f bionic: store property names as variable-length strings
Names are immutable, so the fixed-sized arrays can be replaced with
variable-length ones to save memory (especially on internal tree nodes).

Change-Id: Iee77874b4b55b0f9c5e531d1334be7f7f40086d2
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2013-06-24 16:15:52 -07:00
Colin Cross
fb9b7b436f bionic: prevent root processes from calling __system_property_add
If a root process other than init calls __system_property_add, which
it should never do, it will break the design assumption that there is
only one mutator.

Pass O_EXCL to open() in map_prop_region_rw to ensure that only one
process ever has the property pages open for write.

Change-Id: I6b7c118e5e2fd2b92a2b168b8454fe9707325462
2013-06-24 16:15:52 -07:00
Greg Hackmann
5f05348c18 bionic: revert to a single (larger) property area
d329697 is too complicated.  Change the multiple property pages back to
a single 128K property area that's mapped in entirely at initialization
(the memory will not get allocated until the pages are touched).

d329697 has other changes useful for testing (moving property area
initialization inside bionic and adding __system_property_set_filename)
so undo the change manually rather than with git revert.

Change-Id: I0ecb27843404f93af5489f15bfe657d65175e4f0
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2013-06-24 16:15:52 -07:00
Greg Hackmann
0f76e2340c bionic: add hierarchical properties test
Deliberately put items several levels deep in the trie hierarchy to test
the trie traversal

Change-Id: Id3cbd2e7d3500216b1ac8025eac70c0939622903
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2013-06-24 13:14:10 -07:00
Greg Hackmann
6ac8e6a46d bionic: reimplement property area as hybrid trie/binary tree
See the comments for an explanation of how properties are stored.

The trie structure is designed to scale better than the previous
array-based implementation.  Searching an array with n properties
required average O(n) string compares of the entire key; searching the
trie requires average O(log n) string compares of each token (substrings
between '.' characters).

Change-Id: I491305bc7aca59609abcd871a5f33d97f89ce714
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2013-06-24 13:14:09 -07:00
Greg Hackmann
a823883548 Merge "bionic: add missing memory barriers to system properties" 2013-06-24 17:15:43 +00:00
The Android Automerger
22476056b0 merge in klp-release history after reset to master 2013-06-24 09:44:30 -07:00
Nick Kralevich
ae9353387d am 100d6784: am 53ddcc90: Merge "linker: Emit a warning on text relocations"
* commit '100d678438f222ad6ef8f3dc0646911b218c50a9':
  linker: Emit a warning on text relocations
2013-06-21 16:01:02 -07:00
Nick Kralevich
cf3c9ce0f5 am cb25359a: am 68197731: Merge "libc_logging: don\'t keep file descriptors open forever"
* commit 'cb25359a2e20489a3a9f65795a2079abc8fe0b65':
  libc_logging: don't keep file descriptors open forever
2013-06-21 15:15:22 -07:00
Greg Hackmann
5bfa3ee8b3 bionic: add missing memory barriers to system properties
1) Reading the value must finish before checking whether it's intact

2) Setting the serial's dirty bit must visible before modifying the
value

3) The modified value must be visible before clearing the serial's dirty
bit

4) New properties and their TOC entries must be visible before updating
the property count

Change-Id: I26c680ec025fdb72362d5f618ec0d2b93d381233
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2013-06-20 14:41:58 -07:00
Nick Kralevich
33ae76abf3 am 5fed0eea: am 0ce28d20: Merge "libc: enable FORTIFY_SOURCE clang strlcpy"
* commit '5fed0eeabd88bfe241c416f2c2f44a14b6e447fa':
  libc: enable FORTIFY_SOURCE clang strlcpy
2013-06-20 12:34:11 -07:00
Elliott Hughes
cb4fd62762 am 33df38a0: am 4eed6509: Merge "stdint.h header is not fully compatible with C99(ISO9899:1999)"
* commit '33df38a04c31de0fca431c549469edb6d2de75e2':
  stdint.h header is not fully compatible with C99(ISO9899:1999)
2013-06-19 12:57:39 -07:00
Greg Hackmann
d32969701b bionic: make property area expandable
The property area is initially one 4K region, automatically expanding as
needed up to 64 regions.

To avoid duplicating code, __system_property_area_init() now allocates
and initializes the first region (previously it was allocated in init's
init_property_area() and initialized in bionic).  For testing purposes,
__system_property_set_filename() may be used to override the file used
to map in regions.

Change-Id: Ibe00ef52464bfa590953c4699a6d98383b0142b1
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2013-06-19 11:02:15 -07:00
Nick Kralevich
373ea006ce am 1d174a9c: am 02ca0e31: Merge "Fix FORTIFY_SOURCE unittests."
* commit '1d174a9c17f645a27d766a66e7477d797f955e90':
  Fix FORTIFY_SOURCE unittests.
2013-06-19 10:40:46 -07:00
Colin Cross
700b548738 am f4250508: am 3225f498: Merge "bionic: add __system_property_foreach"
* commit 'f4250508d5de415e200888ffdf143f870dc0f829':
  bionic: add __system_property_foreach
2013-06-19 10:31:11 -07:00
The Android Automerger
6e06d4b106 merge in klp-release history after reset to master 2013-06-19 07:40:48 -07:00
Greg Hackmann
577418403d bionic: add __system_property_foreach
find_nth() will be inefficient on a trie.  Since find_nth() is only used
internally and only for enumerating properties, we can add a foreach()
function to do this directly.

Change-Id: I66bde9926c193073d74b244cce9fffd52108fff8
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2013-06-18 15:38:31 -07:00
Geremy Condra
1791cb0001 Merge "Fix remove_uidiface_info failing on first entry" 2013-06-18 21:43:52 +00:00
Elliott Hughes
fb11350c81 am 13e23302: am c656d732: Merge "Always use v1 for MIPS TLS access."
* commit '13e23302c93fdd8b52c606277f32dec0627ddbbd':
  Always use v1 for MIPS TLS access.
2013-06-18 14:00:59 -07:00
Nick Kralevich
83476f0747 am d98d35c5: am 0846109c: Merge "libc: Rename fortify error functions."
* commit 'd98d35c5380ce398038d3062d40bc4fe082dce80':
  libc: Rename fortify error functions.
2013-06-18 13:31:56 -07:00
Nick Kralevich
227079bb67 am 3bf62790: am dd0880fe: Merge "libc: add limited FORTIFY_SOURCE support for clang"
* commit '3bf6279034e6a92c3550fae31c5c136bec61344a':
  libc: add limited FORTIFY_SOURCE support for clang
2013-06-18 13:31:56 -07:00
Elliott Hughes
6a87df87a2 am 45ef218b: am 6807af77: Merge "Make LD_PRELOAD failures just warnings."
* commit '45ef218bde353df455062aa3c9a9f84ffed769fc':
  Make LD_PRELOAD failures just warnings.
2013-06-18 13:31:55 -07:00
Colin Cross
bf03f1b4d6 am e421bd71: am 02002443: Merge "bionic: fix deleting property arrays in property benchmark"
* commit 'e421bd71c32e35b8f39f2e51f2d534d2f21f139f':
  bionic: fix deleting property arrays in property benchmark
2013-06-18 13:27:29 -07:00
Nick Kralevich
ce7c2f28c6 am ba6c021a: am e2fb05b4: Merge "libc: Introduce __errordecl()"
* commit 'ba6c021a53376c75993cc9866deb7c7ff6e1750d':
  libc: Introduce __errordecl()
2013-06-18 13:21:00 -07:00
Colin Cross
3b599c1dde am 1a38e063: am 0005b354: Merge "bionic: change properties benchmarks to read a single property"
* commit '1a38e063830924efb8a6d9d7a6135ef54460cb9b':
  bionic: change properties benchmarks to read a single property
2013-06-18 13:07:58 -07:00
The Android Automerger
cb83bdfa6b merge in master-release history after reset to master 2013-06-18 07:49:19 -07:00
Colin Cross
66a061c8b5 am f6e6e5e7: am 977a3313: Merge changes Iac00ce10,I192d3825
* commit 'f6e6e5e72774e302c461767ca0c194f25502108e':
  bionic: add tests for properties
  bionic: move system property writing from init to bionic
2013-06-17 18:33:50 -07:00
Elliott Hughes
9edf071a5d am d2dbf163: am 5995bf88: Merge "don\'t hardcode register r0/v1 when reading the TLS"
* commit 'd2dbf16358bee4777a3e4937cf316fa8bb905559':
  don't hardcode register r0/v1 when reading the TLS
2013-06-17 14:56:04 -07:00
Colin Cross
37d9f75dde bionic: add tests for properties
Change-Id: I09b212966f1c9624631653ef2c7a71de78bbbec1
2013-06-17 12:58:18 -07:00
Colin Cross
dc1038b790 bionic: move system property writing from init to bionic
Move the implementation of writing to the system property area
from init to bionic, next to the reader implementation.  This
will allow full property testing to be added to bionic tests.

Add new accessor and waiting functions to hide the implementation
from watchprops and various bionic users.

Also hide some of the implementation details of the property area
from init by moving them into _system_properties.h, and other details
from everybody by moving them into system_properties.h.

Change-Id: I9026e604109e30546b2849b60cab2e7e5ff00ba5
2013-06-17 12:44:34 -07:00
Elliott Hughes
a658ed09e5 am afd4e299: am 657d0da7: Merge "Slight script cleanup; make gensyscalls work from any directory."
* commit 'afd4e2999c3e726498c407fcaf9cccdcd4d24637':
  Slight script cleanup; make gensyscalls work from any directory.
2013-06-17 11:22:01 -07:00
The Android Automerger
31d61f13ab merge in master-release history after reset to master 2013-06-17 07:49:47 -07:00
Chad Brubaker
638503b515 Fix remove_uidiface_info failing on first entry
Change-Id: Ic23506581ff835a6b679e1593eab550a84548056
2013-06-14 15:25:42 -07:00
Elliott Hughes
8f5440c486 am c1e4183c: am 560e9f7e: Merge "Ensure that <stdint.h> defines SIZE_MAX and friends."
* commit 'c1e4183c7ad6943f9cc44fe0b769884370a739cd':
  Ensure that <stdint.h> defines SIZE_MAX and friends.
2013-06-13 18:04:19 -07:00
Elliott Hughes
fa3af2dd67 am af975b07: am c843a3e7: Merge "Fix the qsort copyright notice (fixed upstream this afternoon)."
* commit 'af975b076f79b35cb115c0f77fc8fc0e5d3dba67':
  Fix the qsort copyright notice (fixed upstream this afternoon).
2013-06-12 17:51:25 -07:00
Elliott Hughes
050374836f am ddbf561e: am c843d766: Merge "Handles spurious wake-ups in pthread_join()"
* commit 'ddbf561e5ee8f16fc15d26b085d19ce6abf7e4e0':
  Handles spurious wake-ups in pthread_join()
2013-06-12 17:38:26 -07:00
Elliott Hughes
de1b73dd70 am 7ae23868: am 92e841d0: Merge "Take upstream libm changes."
* commit '7ae23868b4741f9b1af874ebbb13ec3ba930d679':
  Take upstream libm changes.
2013-06-12 17:35:02 -07:00
Elliott Hughes
b0cd876974 am 5065eef8: am 6a44d227: Merge "Take some fixed upstream copyright headers and regenerate NOTICE."
* commit '5065eef801aa78a8a64a016fcf644a6ca91a8133':
  Take some fixed upstream copyright headers and regenerate NOTICE.
2013-06-12 16:23:33 -07:00
Elliott Hughes
3267163200 am 5f4d2df2: am 55189a0f: Merge "Switch to current upstream stdio makebuf.c and setvbuf.c."
* commit '5f4d2df2fcddfe62f9e08d1607a8c4e029f01b3d':
  Switch to current upstream stdio makebuf.c and setvbuf.c.
2013-06-12 16:03:49 -07:00
Elliott Hughes
460b70d063 am dc5f5f85: am f1867d47: Merge "Revert "Add SIZE_MAX to <stdint.h> in a way that might actually work.""
* commit 'dc5f5f857c7bf218d33212044539eb73b3fab5f1':
  Revert "Add SIZE_MAX to <stdint.h> in a way that might actually work."
2013-06-12 15:26:46 -07:00
Elliott Hughes
7e06ab5655 am b0a2262c: am 55c5ec64: Merge "Add SIZE_MAX to <stdint.h> in a way that might actually work."
* commit 'b0a2262c3f91085e79c3fd491379e45821254427':
  Add SIZE_MAX to <stdint.h> in a way that might actually work.
2013-06-12 15:11:12 -07:00
Elliott Hughes
7ac852fb05 am 3da47942: am 944ea1a3: Merge "Clean up abort."
* commit '3da47942d3fdeb6f39cf84b03c75cfeb69f91449':
  Clean up abort.
2013-06-12 15:02:34 -07:00
Elliott Hughes
1e88a7abca am 834f83de: am 5cde15eb: Merge "<stdint.h> should expose SIZE_MAX."
* commit '834f83de3f3363090385963eef1cd9a053a51a71':
  <stdint.h> should expose SIZE_MAX.
2013-06-12 11:05:18 -07:00
The Android Automerger
2df16acc42 merge in master-release history after reset to master 2013-06-12 07:49:39 -07:00
Nick Kralevich
6d88e4e96b am 26cc1d68: am b6e88020: Merge "fix unittests."
* commit '26cc1d6838c0c4fd18abbf6ea5a38d24aea93893':
  fix unittests.
2013-06-11 16:03:32 -07:00
The Android Automerger
4a0c222bb1 merge in master-release history after reset to master 2013-06-11 07:49:16 -07:00
Ben Cheng
d20a04c5cf am 77f90de7: am fc104f89: Merge "Fix abort(3) to raise SIGABRT rather than causing SIGSEGV."
* commit '77f90de728b9fa60b83b7f12a45c1113f3189cb2':
  Fix abort(3) to raise SIGABRT rather than causing SIGSEGV.
2013-06-10 17:28:46 -07:00
Brian Carlstrom
b181747aa1 am d978d21d: am 8252b8e4: Merge "Honor p_vaddr if set"
* commit 'd978d21d195976fa3f257b8d17ec2fe18fb436a7':
  Honor p_vaddr if set
2013-06-10 15:44:13 -07:00
Geremy Condra
72254952e1 Merge "Add clearing of resolv uid and pid interface maps" 2013-06-10 18:45:01 +00:00
The Android Automerger
5074892e0a merge in master-release history after reset to master 2013-06-10 09:52:26 -07:00
Elliott Hughes
efc78bbb9f am 6bcf71c9: am 2fbc9dda: Merge "bionic/x86: Optimization for string routines"
* commit '6bcf71c9ac8395038ca243160d4367759be8dd80':
  bionic/x86: Optimization for string routines
2013-06-07 17:52:16 -07:00
Elliott Hughes
1b14c72420 am fc6f5a08: am 157c4299: Merge "Revert "libc x86: Remove strcat.S""
* commit 'fc6f5a086557f81fce2542b7015268bff697d10c':
  Revert "libc x86: Remove strcat.S"
2013-06-07 17:48:53 -07:00
Christopher Ferris
b3a7db2dc2 am 83245ba4: am 9647f797: Merge "Implement malloc_usable_size for debug impls."
* commit '83245ba45facf0caff3beb18a27e6604df9094ba':
  Implement malloc_usable_size for debug impls.
2013-06-07 17:36:50 -07:00
Chad Brubaker
87594a32b8 Add clearing of resolv uid and pid interface maps
Cleanup uid interface map variable names

Change-Id: I712dd83276bb23b149af4180515ef33a1bade5ea
2013-06-07 13:03:23 -07:00
Christopher Ferris
3d594c2580 Implement malloc_usable_size for debug impls.
- Implemented chk_memalign.
- Fixed a few bugs in leak_memalign.
- Implemented {leak,fill,check,qemu}_malloc_usable_size.
- Make malloc_usable_size update at run time.
- Add malloc_test.cpp as a small set of tests for the
  malloc debug routines.
- Fix the qemu routines since it's been broken since it moved to C++.
- Add support for the %u format to the out_vformat in libc_logging.cpp.
  This is used by the emulator code.

Tested using the bionic-unit-tests with setprop libc.debug.malloc
set to 1, 5, and 10.

I tested as much as possible on the emulator, but tracing doesn't appear
to be working properly.

Bug: 6143477

Change-Id: Ieba99b58c2228c88d80afd264501004a4dadd212
2013-06-07 12:56:09 -07:00
Geremy Condra
a24d14c05d Merge "Add per UID interface support to resolv cache" 2013-06-06 20:48:44 +00:00
Chad Brubaker
0c9bb49a9d Add per UID interface support to resolv cache
Add methods to attach/detach UID ranges to a specific dns cache/interface.

This mirrors the already existing code for attaching specific processes to
specific interfaces but will be used to push all processes from a given
user to a specific cache/interface.

Change-Id: Ic24391e92d3ca46fcb46cc4fc53e13984dec40b3
2013-06-06 12:31:16 -07:00
Elliott Hughes
b166e699dc am e84cfbef: am b7b4f5b8: Merge "update signal.h to be C90 compatable"
* commit 'e84cfbefd82f552490c580d35a54db4f53b6e5fb':
  update signal.h to be C90 compatable
2013-06-05 18:14:30 -07:00
Elliott Hughes
e51cd6f9c9 am 5a6a0a94: am 18af4503: Merge "Ensure header files using __BEGIN_DECLS include sys/cdefs.h."
* commit '5a6a0a9445d80bf2bd847088921f6d1d99315552':
  Ensure header files using __BEGIN_DECLS include sys/cdefs.h.
2013-06-05 18:11:05 -07:00
Elliott Hughes
0ecb96c3a2 am b9e2dae4: am c5bfb624: Merge "sys/personality.h: include <sys/cdefs.h>"
* commit 'b9e2dae427ef1e1cfdbb3faa1442d4a66a2d3bcd':
  sys/personality.h: include <sys/cdefs.h>
2013-06-05 17:32:20 -07:00
Elliott Hughes
bedd8e3de1 am ce208f33: am 8d36050a: Merge "Clean up useless declaration in thread_private.h"
* commit 'ce208f3389769026df02f7aebd85c8f5d3e74c73':
  Clean up useless declaration in thread_private.h
2013-06-05 17:06:50 -07:00
The Android Automerger
a7b5635e60 merge in master-release history after reset to master 2013-06-05 07:49:30 -07:00
Elliott Hughes
8ed5aec934 am 4b47d9f9: am 4c001859: Merge "Fix declaration of malloc_usable_size()"
* commit '4b47d9f978296e5bb2eaabb8069960eb6f207c80':
  Fix declaration of malloc_usable_size()
2013-06-04 19:02:21 -07:00
Nick Kralevich
f1b25d0788 am ae533cb1: am a24e81ef: Merge "Add tests for __strcpy_chk()"
* commit 'ae533cb1118be39a3a0587da46fa95bb4d8ee494':
  Add tests for __strcpy_chk()
2013-06-04 12:14:19 -07:00
The Android Automerger
680e3f94a0 merge in master-release history after reset to master 2013-06-04 07:49:30 -07:00
Brian Carlstrom
20b0fec8ab am 81bfade8: am 06713930: Merge "Small cleanup of soinfo_elf_lookup."
* commit '81bfade818f1b76cf822f0e7e0862fe61e7c580a':
  Small cleanup of soinfo_elf_lookup.
2013-06-03 20:43:30 -07:00
Rom Lemarchand
8ea08d3ff9 Merge "mmap: Reinstate passing MADV_MERGEABLE on private anonymous maps" 2013-06-03 19:40:21 +00:00
The Android Automerger
b472f50057 merge in master-release history after reset to master 2013-06-03 07:49:38 -07:00
Ben Cheng
7ca9057f53 am 72ce296f: am 404d491e: Merge "Use bl instead of blx to support interworking properly."
* commit '72ce296f282803cb026aff5ab180e8a43656612e':
  Use bl instead of blx to support interworking properly.
2013-06-01 09:51:29 -07:00
Ben Cheng
dc1782b156 Merge "Use bl instead of blx to support interworking properly." 2013-05-31 21:36:55 +00:00
Ben Cheng
9e1905794b Use bl instead of blx to support interworking properly.
BUG: 9227177
Change-Id: I742c2f2ecbe332f9c9743e3f4bde8de791a1d289
2013-05-31 14:25:48 -07:00
Nick Kralevich
75c9e17682 am 027a8fae: am 8539961f: Merge "FORTIFY_SOURCE: strcat / strncat optimize"
* commit '027a8fae7750855af2ec0f8dd655e4a48ebf9352':
  FORTIFY_SOURCE: strcat / strncat optimize
2013-05-31 11:21:18 -07:00
Rom Lemarchand
c702a90467 mmap: Reinstate passing MADV_MERGEABLE on private anonymous maps
Reinstate mmap calling madvise(MADV_MERGEABLE) removed in
635df850e5

Change-Id: I290bc5ac6bb32735a3f61dd21e2fce1dfb6dfd4b
Signed-off-by: Rom Lemarchand <romlem@google.com>
2013-05-31 10:05:50 -07:00
Nick Kralevich
b5aa654be6 am d9349abf: am 72f59c84: Merge "Add strncpy FORTIFY_SOURCE tests."
* commit 'd9349abf29506529790abf83cd239b77fa771038':
  Add strncpy FORTIFY_SOURCE tests.
2013-05-30 17:02:01 -07:00
Nick Kralevich
9b7ae336ee am 5630e54c: am d515f468: Merge "libc x86: Remove strcat.S"
* commit '5630e54c3b1a90ee741bbcff129d0c711160ba02':
  libc x86: Remove strcat.S
2013-05-30 17:02:01 -07:00
The Android Automerger
fe09748a5f merge in master-release history after reset to master 2013-05-27 07:50:00 -07:00
Nick Kralevich
3010061a53 am cf342653: am 8d79fd1c: Merge "libc x86: Remove index.S, strcpy.S, strchr.S"
* commit 'cf342653388682c96b3c4eec6a5ed4dbcb6112ef':
  libc x86: Remove index.S, strcpy.S, strchr.S
2013-05-24 13:02:11 -07:00
Nick Kralevich
af5d6029e5 am 080d2aa8: am 2317275f: Merge "libc: delete x86 memchr.S"
* commit '080d2aa8dc0ae318a12f7a424f9bca32b1216791':
  libc: delete x86 memchr.S
2013-05-24 13:02:06 -07:00
The Android Automerger
88cc328c17 merge in master-release history after reset to master 2013-05-22 07:49:33 -07:00
Brian Carlstrom
47b2e046cd am 46bf467a: am f5f29de6: Merge "Fix bionic linker to support segments with zero p_filesz"
* commit '46bf467a151eafaf37f6e3578d8d9bad705b8e44':
  Fix bionic linker to support segments with zero p_filesz
2013-05-21 17:28:40 -07:00
The Android Automerger
33cf35317b merge in master-release history after reset to master 2013-05-20 07:49:40 -07:00
Erik Gilling
d5234a3b08 am 4c8eba6f: am 2e317075: Merge "libc/arm: add cortex-a8 cpu variant"
* commit '4c8eba6f2aaf351e29881ca4dc2ec47fc0246446':
  libc/arm: add cortex-a8 cpu variant
2013-05-16 13:20:53 -07:00
The Android Open Source Project
0ae3304f83 am 5b75f3bf: (-s ours) Reconcile with jb-mr2-release - do not merge
* commit '5b75f3bfa1a8f380ce213a0088afec7a7901a25b':
2013-05-16 05:44:28 -07:00
The Android Automerger
231ea5a414 merge in master-release history after reset to master 2013-05-15 07:49:27 -07:00
Elliott Hughes
217c816480 am 0a7fe991: am 5217fb52: Merge "Fix sysconf(3) for _SC_GETGR_R_SIZE_MAX and _SC_GETPW_R_SIZE_MAX."
* commit '0a7fe991530308fbae9ca033c0045bfc27a7f4c1':
  Fix sysconf(3) for _SC_GETGR_R_SIZE_MAX and _SC_GETPW_R_SIZE_MAX.
2013-05-14 18:11:57 -07:00
Elliott Hughes
543f3f0ec4 am 975d4464: am 6f502bc7: Merge "Add more __restricts, clean up __format__ attributes."
* commit '975d4464cef774768cf99a68f3537cfc0678e3f7':
  Add more __restricts, clean up __format__ attributes.
2013-05-14 16:59:34 -07:00
Elliott Hughes
940e30cf34 am 20516923: am 349ef893: Merge "Pull upstream FreeBSD revision 249810."
* commit '20516923f59b859f8ca1bfdb3927bc23819ecdb3':
  Pull upstream FreeBSD revision 249810.
2013-05-14 16:26:42 -07:00
Elliott Hughes
0128b2c752 am 01678789: am 5b7b2809: Merge "epoll: add EPOLLRDHUP, EPOLLWAKEUP, and EPOLLONESHOT events"
* commit '01678789bca18d1a4894ae7f987f847b5ae0ce62':
  epoll: add EPOLLRDHUP, EPOLLWAKEUP, and EPOLLONESHOT events
2013-05-14 15:01:33 -07:00
Elliott Hughes
7c7f098995 am 562804ff: am f0f4fa3f: Merge "libc: add timerfd calls"
* commit '562804ff878ede5d0ce0cb0c79ffb9b26777bf76':
  libc: add timerfd calls
2013-05-14 15:01:32 -07:00
Elliott Hughes
d3d014da91 am 31366236: am e1c58ab5: Merge "libc: remove obsolete CLOCK_REALTIME_HR and CLOCK_MONOTONIC_HR"
* commit '3136623600a9488859ed7c1681b084ea8315ed50':
  libc: remove obsolete CLOCK_REALTIME_HR and CLOCK_MONOTONIC_HR
2013-05-14 15:01:32 -07:00
Elliott Hughes
47e46ed157 am 91cc8014: am 7cb82791: Merge "libc: add clock ids CLOCK_REALTIME_ALARM and CLOCK_BOOTTIME_ALARM"
* commit '91cc8014e8cbc5ebfa90708f77f4f319e553a904':
  libc: add clock ids CLOCK_REALTIME_ALARM and CLOCK_BOOTTIME_ALARM
2013-05-14 15:01:31 -07:00
Elliott Hughes
ff5fb5cc4b am 509fc806: am d8a9cccb: Merge "Fix all printf warnings in res_send.c."
* commit '509fc8069757aa6091e044f659f76da0bf59723c':
  Fix all printf warnings in res_send.c.
2013-05-14 11:13:39 -07:00
The Android Automerger
46fa11a0ae merge in master-release history after reset to master 2013-05-14 07:49:17 -07:00
Todd Poynor
d1ad4f6dab epoll: add EPOLLRDHUP, EPOLLWAKEUP, and EPOLLONESHOT events
Change-Id: I4a579fc4a74adaee57911b3974ec2f93d9321e8b
2013-05-13 12:06:36 -07:00
Todd Poynor
04c0ac14a4 libc: add timerfd calls
Change-Id: Id63b907266d5b87c7422a51d393a1430551ca33d
2013-05-13 12:06:15 -07:00
Todd Poynor
60e5144ca3 libc: remove obsolete CLOCK_REALTIME_HR and CLOCK_MONOTONIC_HR
Add CLOCK_MONOTONIC_RAW, CLOCK_REALTIME_COARSE, and CLOCK_MONOTONIC_COARSE
as supported by recent linux kernels.

Bug: 8895727
Change-Id: I3d415a2edbcf2928dd855e876337bf2239ac134a
2013-05-13 11:00:07 -07:00
Todd Poynor
b928bda83d libc: add clock ids CLOCK_REALTIME_ALARM and CLOCK_BOOTTIME_ALARM
Change-Id: I3bf934ab207e39b435e6b41a5fbe7eb318496dc0
2013-05-13 11:00:06 -07:00
The Android Automerger
5ff2b9aafd merge in master-release history after reset to master 2013-05-13 07:49:31 -07:00
Elliott Hughes
a28cb8bd35 am 30d7485d: am 738370d9: Don\'t fail to run DT_INIT and DT_INIT_ARRAY constructors if a shared library has DT_PREINIT_ARRAY constructors.
* commit '30d7485dd30a06e2fb7b8134b6e1a3ecb0ac7ba7':
  Don't fail to run DT_INIT and DT_INIT_ARRAY constructors if a shared library has DT_PREINIT_ARRAY constructors.
2013-05-10 03:06:52 -07:00
Elliott Hughes
a74e6c21e7 am 58f3dbda: am 98f7659d: Merge "Don\'t fail to run DT_INIT and DT_INIT_ARRAY constructors if a shared library has DT_PREINIT_ARRAY constructors."
* commit '58f3dbdacd496838661affce358518e0b3a4f7f6':
  Don't fail to run DT_INIT and DT_INIT_ARRAY constructors if a shared library has DT_PREINIT_ARRAY constructors.
2013-05-09 17:56:31 -07:00
Ben Cheng
3c2ab6ffbb am ca54ae44: am 262b7384: Adjust PC value in ARM stack trace.
* commit 'ca54ae44a4c8764028b3092f9f1cfdd619a94fa6':
  Adjust PC value in ARM stack trace.
2013-05-09 09:41:18 -07:00
The Android Automerger
0d4e9fe58a merge in master-release history after reset to master 2013-05-09 07:49:16 -07:00
Ben Cheng
a078f9dcf0 am 49f6e970: am ff220f70: Merge "Remove a spurious FIXME and unnecessary type cast."
* commit '49f6e9706202b5caef3a68690153a96baa14cab1':
  Remove a spurious FIXME and unnecessary type cast.
2013-05-08 15:04:56 -07:00
Ben Cheng
77a2932836 am 3353e653: am b9256ada: Merge "Adjust PC value in ARM stack trace."
* commit '3353e6535a6964c92c280c36c99e1493befa9dc0':
  Adjust PC value in ARM stack trace.
2013-05-08 15:04:56 -07:00
Nick Kralevich
f8867a5632 am 37cd8800: am d541ba17: Merge "Use restrict pointers for various libc functions."
* commit '37cd8800d532e5901cc3b332bc39d8580f2ba9ab':
  Use restrict pointers for various libc functions.
2013-05-08 15:04:55 -07:00
The Android Automerger
237ac7be01 merge in master-release history after reset to master 2013-05-06 07:49:08 -07:00
Christopher Ferris
a14f7933f4 Merge "Tune the memcpy for krait." 2013-05-03 23:12:18 +00:00
The Android Automerger
e68c711e78 merge in master-release history after reset to master 2013-05-03 07:49:10 -07:00
Nick Kralevich
f0c9683e17 am c9757ac8: am b01f7afd: Merge "Use __predict_false on some fortify methods."
* commit 'c9757ac81eb48f9cfee0ba7833fed8a3363ecee2':
  Use __predict_false on some fortify methods.
2013-05-02 15:00:41 -07:00
Nick Kralevich
137a9ad176 am 4f614a70: am e4ac8feb: Merge "libc: cleanup strchr"
* commit '4f614a7036b37480695884a4be3f3fe70188cd60':
  libc: cleanup strchr
2013-05-02 14:28:18 -07:00
Christopher Ferris
4d8fe5177e Tune the memcpy for krait.
Streamline the memcpy a bit removing some unnecessary instructions.

The biggest speed improvement comes from changing the size of
the preload. On krait, the sweet spot for the preload in the main
loop is twice the L1 cache line size.

In most cases, these small tweaks yield > 1000MB/s speed ups. As
the size of the memcpy approaches about 1MB, the speed improvement
disappears.

Change-Id: Ief79694d65324e2db41bee4707dae19b8c24be62
2013-05-02 14:04:31 -07:00
The Android Automerger
2a9966da82 merge in master-release history after reset to master 2013-05-02 07:49:13 -07:00
Nick Kralevich
240bc95be1 am 65fe3ea7: am 5e3b502b: Merge "keep test names consistent with other tests."
* commit '65fe3ea708bf16ebaa354080b90b6e6c83a24e70':
  keep test names consistent with other tests.
2013-05-01 15:11:32 -07:00
Nick Kralevich
874ea191de am b9aab3a4: am 8c00c91a: Merge "add strrchr -D_FORTIFY_SOURCE=2 test."
* commit 'b9aab3a462efb79cdae83d9b819e299216f9cf5f':
  add strrchr -D_FORTIFY_SOURCE=2 test.
2013-05-01 15:11:32 -07:00
The Android Automerger
33cd3f6848 merge in master-release history after reset to master 2013-05-01 07:49:28 -07:00
Nick Kralevich
6c6949fc00 am 8355ab55: am bee0ab16: Merge "libc: upgrade strrchr to FORTIFY_SOURCE=2"
* commit '8355ab5524557da2737ea9084a8131c1015ae14f':
  libc: upgrade strrchr to FORTIFY_SOURCE=2
2013-04-30 16:30:20 -07:00
Nick Kralevich
c9bf778112 am 2ff94a09: am c4687130: Merge "libc: upgrade some libc functions to _FORTIFY_SOURCE=2"
* commit '2ff94a096427a5b5e729ae356c98463c9a9dabf1':
  libc: upgrade some libc functions to _FORTIFY_SOURCE=2
2013-04-30 11:57:22 -07:00
The Android Automerger
3fa53b5978 merge in master-release history after reset to master 2013-04-30 10:23:01 -07:00
Nick Kralevich
d411fbd497 am aed0c3ac: am b94b2851: Merge "libc: upgrade sprintf to _FORTIFY_SOURCE=2"
* commit 'aed0c3ac54fa944b1f8512938277e7dc6b6fa2ee':
  libc: upgrade sprintf to _FORTIFY_SOURCE=2
2013-04-30 08:54:30 -07:00
Nick Kralevich
90a293f7d3 am 56a1b492: am 382a7753: Merge "strncpy: implement _FORTIFY_SOURCE=2"
* commit '56a1b492c40b51204ad1b46a6b46819775c8912a':
  strncpy: implement _FORTIFY_SOURCE=2
2013-04-30 08:54:28 -07:00
Nick Kralevich
780cf25bf4 am 89357dc7: am c6dc62f0: Merge "[NETFILTER]: Fix iptables ABI breakage"
* commit '89357dc730f6bfd532c4aed80373c84904cc3319':
  [NETFILTER]: Fix iptables ABI breakage
2013-04-30 08:46:47 -07:00
Andrew Hsieh
cfb0b8bd5e am 83966db8: am f7153fd1: Merge "Remove redundant space within square brackets"
* commit '83966db80b9cccc3417db7566242d30a330cde29':
  Remove redundant space within square brackets
2013-04-25 21:26:46 -07:00
Elliott Hughes
b03dc7cfa3 am 9aa57e09: am 9ff1ffd8: Merge "Improve diagnostics in the face of bad tzdata."
* commit '9aa57e09ef7234b6d82ffa4a4889508e64e424b9':
  Improve diagnostics in the face of bad tzdata.
2013-04-25 21:19:48 -07:00
Nick Kralevich
95a46909c7 am ed572aaa: am 5f28fde8: Merge "linker: only re-open std* for setuid programs."
* commit 'ed572aaa0d275eed753afd4b92e05991310e76ac':
  linker: only re-open std* for setuid programs.
2013-04-25 21:19:48 -07:00
The Android Automerger
59f27ec089 merge in master-release history after reset to master 2013-04-25 07:49:12 -07:00
Elliott Hughes
baa836baa4 am eb22fc33: am 389b5c1e: Upgrade to tzdata2013c.
* commit 'eb22fc331ed1bff5ee146c252fb4b9fa7f198523':
  Upgrade to tzdata2013c.
2013-04-24 14:28:10 -07:00
Elliott Hughes
537e1aa9c6 am b6e895e8: am 87efcd2e: Merge "Don\'t avoid IPv6 when looking for new tzdata."
* commit 'b6e895e80f96301b3921a2ec7327c337ab988b41':
  Don't avoid IPv6 when looking for new tzdata.
2013-04-24 11:01:28 -07:00
The Android Automerger
70ef50862c merge in master-release history after reset to master 2013-04-23 07:49:08 -07:00
Elliott Hughes
14cbb15b99 am 41dcafc2: am c705daa0: Merge "Disable IPv6 when looking for tzdata updates."
* commit '41dcafc27627dbc79e492056799b3cde4056d412':
  Disable IPv6 when looking for tzdata updates.
2013-04-22 16:57:46 -07:00
Elliott Hughes
dd15d3cb28 am dc7e8b89: am 2c60c18c: Merge "Upgrade to tzdata2013c."
* commit 'dc7e8b892db0e997c12a6574ee2468cb3f8a6a2c':
  Upgrade to tzdata2013c.
2013-04-22 12:29:42 -07:00
Elliott Hughes
6180ab7850 am 4f89ab31: am bda2fb5e: Merge "Add signature checking to HTTP tzdata updates."
* commit '4f89ab3166586378d448ca8d5eb4688ab33bb28b':
  Add signature checking to HTTP tzdata updates.
2013-04-22 12:14:04 -07:00
Elliott Hughes
652c68c50e am 9f10e6a9: am 70e0bd3a: Merge "Rename the tzdata update tool, and add HTTP support."
* commit '9f10e6a96afbe85239d18c1cffb560c4f6ae9b4d':
  Rename the tzdata update tool, and add HTTP support.
2013-04-22 11:36:51 -07:00
The Android Automerger
c689ed1ef7 merge in master-release history after reset to master 2013-04-16 07:49:11 -07:00
Elliott Hughes
9a41d425ea am d23a87d3: am 8c181aa8: Merge "Use hidden visibility for internal-use-only functions"
* commit 'd23a87d3b1c7269a4b55f082555790a3003ba228':
  Use hidden visibility for internal-use-only functions
2013-04-15 11:26:47 -07:00
The Android Automerger
94dcdb0352 merge in master-release history after reset to master 2013-04-15 07:49:20 -07:00
Christopher Ferris
5274339979 am 39e4ed96: am 516a8970: Merge "Rewrite memset for cortexa15 to use strd."
* commit '39e4ed969948fd738d7b670b099c0b2c25351d95':
  Rewrite memset for cortexa15 to use strd.
2013-04-12 12:33:57 -07:00
Elliott Hughes
35a2a61d49 am cf4a5302: am b3c8c4d8: Merge "Switch to current FreeBSD qsort."
* commit 'cf4a53020d85b0017799c31dc41823f9e775a1c5':
  Switch to current FreeBSD qsort.
2013-04-12 12:33:56 -07:00
The Android Automerger
5703eb8007 merge in master-release history after reset to master 2013-04-12 07:49:26 -07:00
Elliott Hughes
a1826f6e59 am 5fe62e50: am ed36d95f: Merge "Start moving to current FreeBSD stdio."
* commit '5fe62e50f61b353657e1cd9cc6b1b1fc02870c9b':
  Start moving to current FreeBSD stdio.
2013-04-11 14:58:37 -07:00
The Android Automerger
651b3e1f9e merge in master-release history after reset to master 2013-04-11 09:22:10 -07:00
The Android Open Source Project
6c48aca345 am ab911a02: Reconcile with jb-mr2-release - do not merge
* commit 'ab911a02af2a5c3977b55cb0994f74635edc7c3a':
2013-04-11 07:47:08 -07:00
Elliott Hughes
980d21745c am 76db50dd: am b632857a: Merge "Add missing include and function prototype for sched_getaffinity."
* commit '76db50ddc948541d39bfc351666ba910bd8e6bab':
  Add missing include and function prototype for sched_getaffinity.
2013-04-10 18:22:50 -07:00
Christopher Ferris
b9cfe21c6e am 101dadf6: am fc76c7d3: Merge "Add missing branch in memcpy.S dst aligned case."
* commit '101dadf6a6a689b53f6db809578627448a14bff8':
  Add missing branch in memcpy.S dst aligned case.
2013-04-10 18:22:48 -07:00
Christopher Ferris
dbc23ea51c resolved conflicts for merge of 3fe5b109 to master
Change-Id: Ifeecc0f8b0935ee1df057e944fc135d5047e248d
2013-04-10 17:54:53 -07:00
Eric Laurent
61735a9069 am 55c015cd: am ccaa0fa6: sound: Add ALSA compressed API headers
* commit '55c015cddd4d8d14e58e7134ae077d637ff5388e':
  sound: Add ALSA compressed API headers
2013-04-10 11:34:31 -07:00
The Android Automerger
7b1d164a4e merge in master-release history after reset to master 2013-04-10 07:49:16 -07:00
Christopher Ferris
e27483c788 Merge "Rewrite memset for cortexa15 to use strd." 2013-04-09 22:58:26 +00:00
Christopher Ferris
7ffad9c120 Rewrite memset for cortexa15 to use strd.
Change-Id: Iac3af55f7813bd2b40a41bd19403f2b4dca5224b
2013-04-08 18:48:46 -07:00
The Android Open Source Project
bc37bf00f8 am bb9842b6: Reconcile with jb-mr2-release - do not merge
* commit 'bb9842b61e188ed70cf9bfb0415f2ba8fb406937':
2013-04-08 13:40:28 -07:00
The Android Automerger
cad988dafb merge in master-release history after reset to master 2013-04-08 07:49:30 -07:00
Elliott Hughes
8bed98c3ce am fe7f46c0: am 7b4d77e4: Make abort messages available to debuggerd.
* commit 'fe7f46c088f303ea2cb9f6b218cc0f46f5385d43':
  Make abort messages available to debuggerd.
2013-04-05 16:07:15 -07:00
Elliott Hughes
f89ce5b518 am 9c7b510a: am 240fb862: Merge "Make abort messages available to debuggerd."
* commit '9c7b510a408740b5b53f8d14b8f43bf2f2d36ae6':
  Make abort messages available to debuggerd.
2013-04-05 11:47:00 -07:00
The Android Automerger
291f5c1e4b merge in master-release history after reset to master 2013-04-04 07:49:14 -07:00
The Android Open Source Project
9207e5aed8 am cd6f4804: Reconcile with jb-mr2-release - do not merge
* commit 'cd6f4804d22a119c1aaf915d70a53924b1666777':
2013-04-03 18:05:26 -07:00
Elliott Hughes
fbfedc7a7c am 13ab5591: am 014c75c7: Merge "Prevent name conflict for eventfd.cpp and eventfd.s when building libc.a"
* commit '13ab55918a0a114ce1d5c67eeca9c94ce08803ee':
  Prevent name conflict for eventfd.cpp and eventfd.s when building libc.a
2013-04-03 12:40:33 -07:00
Elliott Hughes
acec23561e am f5dc9086: am 14c840df: Merge "Fix the SYSCALLS.TXT documentation and remove a dead script."
* commit 'f5dc908695ad4e513504e1a29613d797b95adbf0':
  Fix the SYSCALLS.TXT documentation and remove a dead script.
2013-04-03 12:40:33 -07:00
Kito Cheng
98ac1d64bd am 4bc54686: am 9b84824d: Prevent name conflict for eventfd.cpp and eventfd.s when building libc.a
* commit '4bc546860ec36f7ed86ee1a6a7e2bf6db028f02a':
  Prevent name conflict for eventfd.cpp and eventfd.s when building libc.a
2013-04-03 12:40:32 -07:00
Elliott Hughes
f3810dbb0a am 57148994: am a69103ff: Fix the SYSCALLS.TXT documentation and remove a dead script.
* commit '57148994df6c3ca0d3c60abe2e1e891e7e12b39c':
  Fix the SYSCALLS.TXT documentation and remove a dead script.
2013-04-03 12:40:31 -07:00
The Android Automerger
c099884c7c merge in master-release history after reset to master 2013-04-03 07:49:14 -07:00
Elliott Hughes
168486f073 am fe51d25e: am 162b4411: Merge "Stop using unreasonable numbers of map entries."
* commit 'fe51d25e83a8487386c653493e587aa1686503aa':
  Stop using unreasonable numbers of map entries.
2013-04-02 19:25:21 -07:00
Elliott Hughes
a0340cf139 am 40147728: am 1fe11375: Stop using unreasonable numbers of map entries.
* commit '40147728d24a5a85b0ae0ee366b0a3cadb1ea65a':
  Stop using unreasonable numbers of map entries.
2013-04-02 19:25:19 -07:00
Kenny Root
4ea3580749 Merge branch 'master' of https://googleplex-android.googlesource.com/_direct/platform/bionic 2013-04-02 11:06:24 -07:00
Christopher Ferris
5014f417ea Merge "Add missing branch in memcpy.S dst aligned case." 2013-04-02 18:05:54 +00:00
The Android Open Source Project
6517d138fd am cc91c517: Reconcile with jb-mr2-release - do not merge
* commit 'cc91c517bf00431f098b7ca371113dc108071a45':
2013-04-02 11:04:15 -07:00
Lorenzo Colitti
5a3cc2018c am 9ef66e84: am 309e107f: Merge "Update getaddrinfo to RFC6724" into jb-mr2-dev
* commit '9ef66e842f28f58abfbc8458973a2511a055db0c':
  Update getaddrinfo to RFC6724
2013-04-02 11:04:09 -07:00
Christopher Ferris
6ffaa931c3 Add missing branch in memcpy.S dst aligned case.
Change-Id: I0651e46dc5d9b49a997c0c6d099b75097eedb504
2013-04-02 09:19:00 -07:00
The Android Automerger
02dc65183b merge in master-release history after reset to master 2013-04-02 09:17:13 -07:00
Christopher Ferris
50bc9395e4 Merge "Update to latest cortexa15 memcpy code." 2013-04-02 02:04:47 +00:00
Elliott Hughes
7506673f63 am 8dd195c5: am 7a29f404: Merge "Update getaddrinfo to RFC6724"
* commit '8dd195c509eed45d1e4b5ab91ddc2ef56fcb0737':
  Update getaddrinfo to RFC6724
2013-04-01 18:21:58 -07:00
The Android Automerger
1ec2cf5ba8 merge in master-release history after reset to master 2013-04-01 11:31:26 -07:00
Christopher Ferris
21ede92d79 Update to latest cortexa15 memcpy code.
This uses the new code original submitted as memcpy.a15.S as
the base. However, the old code handled unaligned src/dst better
so that was spliced in. I optimized the original unaligned code by
removing a few unnecessary instructions. I optimized the a15 code by
rewriting the pre and post code. I also modified the main loop to add
a pld so that larger copies would not stall waiting for memory.

Test cases for the new memcpy:

- Copy all sized values from 0 to 1024 bytes, using whatever alignment
  is returned by malloc.
For each alignment case described below, the test copied from 0 to 128
bytes.
- Src and dst pointers are both aligned to the same value, starting
  at one going through every power of two up to and including 128.
- Src aligned to double word boundary, dst aligned to word boundary.
- Src aligned to word boundary, dst aligned to double word boundary.
- Src aligned to 16 bit boundary, dst aligned to word boundary.
- Src aligned to word boundary, dst aligned to 16 byte boundary.
- Src aligned to word boundary, dst aligned to 1 byte from a word
  boundary.
- Src aligned to word boundary, dst aligned to 2 bytes from a word
  boundary.
- Src aligned to word boundary, dst aligned to 3 bytes from a word
  boundary.
- Src aligned to 1 byte from a word boundary, dst aligned to a word
  boundary.
- Src aligned to 2 bytes from a word boundary, dst aligned to a word
  boundary.
- Src aligned to 3 bytes from a word boundary, dst aligned to a word
  boundary.

Cases to verify the unaligned source code properly aligns to a 16 bit
boundary.
- Src aligned to 1 byte from a 128 bit boundary, dst aligned to
  4 + 128 bit boundary.
- Src aligned to 1 byte from a 128 bit boundary, dst aligned to
  8 + 128 bit boundary.
- Src aligned to 1 byte from a 128 bit boundary, dst aligned to
  12 + 128 bit boundary.
- Src aligned to 1 byte from a 128 bit boundary, dst aligned to
  16 + 128 bit boundary.

In all cases, a two byte fencepost was placed at the end of the
destination to verify that only the requested number of bytes were copied.

Bug: 8005082
Change-Id: I700b2fab81941959d301ab1934c18fbd8ee3eee4
2013-03-30 14:32:49 -07:00
Elliott Hughes
c099b270c6 am e2bce303: am 96449b3d: Extra logging in pthread_create.
* commit 'e2bce30360a46fa3a235d1e9874d35891673826f':
  Extra logging in pthread_create.
2013-03-29 17:58:38 -07:00
Nick Kralevich
62bb090f8e resolved conflicts for merge of 5b661481 to master
Change-Id: Ifc68a87a95187b61f7f42a0217af43e14db6d4f8
2013-03-29 17:36:52 -07:00
Elliott Hughes
113054c4eb am e59ecd32: am 6bb17dfa: Merge "Extra logging in pthread_create."
* commit 'e59ecd32798b08e59b4813b3ed8859e5dac5297c':
  Extra logging in pthread_create.
2013-03-29 16:58:02 -07:00
The Android Open Source Project
2903a0bac3 am f9e4a6e9: (-s ours) Reconcile with jb-mr2-release - do not merge
* commit 'f9e4a6e93b2d0ca6f2fd01547a04b63a94257a29':
2013-03-29 09:50:35 -07:00
The Android Automerger
0f7607f372 merge in master-release history after reset to master 2013-03-28 11:32:29 -07:00
Jean-Baptiste Queru
a3ce0bb1ad am a3de6b47: am d02dd19d: am 267290b3: am 74b324ac: Merge "Update processed linux/fs.h header file"
* commit 'a3de6b47bf444c6efbf386e01e70bc61f9c559de':
  Update processed linux/fs.h header file
2013-03-28 09:02:06 -07:00
Ken Sumrall
6ed55e06fd am 024f418a: am 887049e4: Merge "Update processed linux/fs.h header file" into jb-mr2-dev
* commit '024f418af284d79e2d307489f33d67b6c564a112':
  Update processed linux/fs.h header file
2013-03-27 14:18:37 -07:00
The Android Open Source Project
416d231f97 am fd59d4d3: (-s ours) Reconcile with jb-mr2-release - do not merge
* commit 'fd59d4d3eaccb9b181f8a2b9c88ffe5060f1e528':
2013-03-26 12:17:40 -07:00
The Android Automerger
47a46646f0 merge in master-release history after reset to master 2013-03-26 07:49:18 -07:00
Elliott Hughes
d74b3bb1cb am c813182d: am da2c1586: am 8a6abe38: am bd014c2e: Merge "Remove some dead script code and fix a script comment."
* commit 'c813182d20fa853d944cb9b4dc5c3f1a4d1c7728':
  Remove some dead script code and fix a script comment.
2013-03-25 21:40:33 +00:00
Elliott Hughes
69684aa312 am 94510371: am 999dff0e: am a850ad4c: am e51d75a9: Merge "Clarify the dlmalloc USAGE_ERROR."
* commit '94510371951bc28f97cdb55df74be26fcebdc1e4':
  Clarify the dlmalloc USAGE_ERROR.
2013-03-25 21:12:59 +00:00
Dima Zavin
e24ec2ad4c am bb06498d: am 369f9234: Merge "libc/arm: add cortex-a7 cpu variant" into jb-mr2-dev
* commit 'bb06498d89dd002a17bad6666276580c94da1749':
  libc/arm: add cortex-a7 cpu variant
2013-03-25 19:44:54 +00:00
Elliott Hughes
7a7d39c3f0 am c538edc1: am c82b339a: am 3c1504d9: am 48f25cef: Merge "Stop generating <sys/linux-syscalls.h>."
* commit 'c538edc1e85b7df35852cf9fbc472b29683fc4a3':
  Stop generating <sys/linux-syscalls.h>.
2013-03-25 17:31:28 +00:00
Elliott Hughes
263be8b1a0 am 053ceea1: am 9386a33e: am 93f3811b: am a4075118: Merge "Unhide __set_errno for backwards compatibility."
* commit '053ceea1172a399b9fddf0ab010cff535c65be0e':
  Unhide __set_errno for backwards compatibility.
2013-03-25 17:31:27 +00:00
The Android Automerger
a500fdb18e merge in master-release history after reset to master 2013-03-25 07:49:24 -07:00
Elliott Hughes
4584721b5a am 9792b2d1: am ba61bb55: am a3fe475c: am c019345a: Merge "Use the correct names for the __ARM_NR_* syscalls."
* commit '9792b2d16062c3fa334a47501a1cde9bfbedb5c2':
  Use the correct names for the __ARM_NR_* syscalls.
2013-03-22 22:13:44 +00:00
Elliott Hughes
cf3fc45376 am dce1b3e2: am e0e5b2f6: am 65163750: am c37dd599: Merge "Fix builds where _FORTIFY_SOURCE is off."
* commit 'dce1b3e26a9f85fcc9a768cc69919299fcb2b5a5':
  Fix builds where _FORTIFY_SOURCE is off.
2013-03-22 18:26:45 +00:00
Elliott Hughes
749a9e022c am fbb41988: am b826ebf4: am 85598626: am 34895c1b: Merge "Replace unnecessary ARM uses of <sys/linux-syscalls.h> with <asm/unistd.h>."
* commit 'fbb4198857374b816a6c444a52cb3209101e02c9':
  Replace unnecessary ARM uses of <sys/linux-syscalls.h> with <asm/unistd.h>.
2013-03-22 18:17:51 +00:00
Elliott Hughes
74c7d3ff03 am f30ff61e: am b44f9600: am b80a05fa: am 5c5f303e: Merge "Replace unnecessary MIPS uses of <sys/linux-syscalls.h> with <asm/unistd.h>."
* commit 'f30ff61ef61f3d8b73257e89e4635fc1436f4bbc':
  Replace unnecessary MIPS uses of <sys/linux-syscalls.h> with <asm/unistd.h>.
2013-03-22 16:47:49 +00:00
Elliott Hughes
90763e0aee am f0fc7b9b: am a0dcecc5: am bc0d7f73: am e7cb795c: Merge "Replace unnecessary x86 uses of <sys/linux-syscalls.h> with <asm/unistd.h>."
* commit 'f0fc7b9bf93029e2e0e2a21ac037d14c7f4db7a2':
  Replace unnecessary x86 uses of <sys/linux-syscalls.h> with <asm/unistd.h>.
2013-03-22 16:47:48 +00:00
The Android Automerger
847a62270f merge in master-release history after reset to master 2013-03-22 07:49:16 -07:00
Elliott Hughes
1d509cc043 am 472d7115: am ddda044a: am 5686bb30: am 3323628d: Merge "The SYS_ constants should cover all __NR_ values."
* commit '472d7115f1ec8968b645d72d18222687d39f189e':
  The SYS_ constants should cover all __NR_ values.
2013-03-22 05:57:05 +00:00
Elliott Hughes
731381ad5f am dfde829f: am c8ded7c6: am a3167257: am babb72dc: Merge "Fix pthread_setname_np\'s behavior on invalid pthread_ts."
* commit 'dfde829fc1c97fe3fbdaf244d2444562b7c2fbfe':
  Fix pthread_setname_np's behavior on invalid pthread_ts.
2013-03-22 05:25:17 +00:00
Elliott Hughes
bd43b613b8 am 3a6178f8: am 1e40ace4: am a596aa6a: am 26c815c4: Merge "Drop magic number in strrchr and strchr"
* commit '3a6178f8b9498ece5383fac9feb692e8ed2d4ce0':
  Drop magic number in strrchr and strchr
2013-03-22 03:03:15 +00:00
Elliott Hughes
06a06d5091 am 71afd315: am 17a0d191: am 01c0e19e: am 612333f6: Merge "Don\'t #define SYS_ constants unless they make sense for the current architecture."
* commit '71afd3153544a2795fcb74c86fd895df59aa5feb':
  Don't #define SYS_ constants unless they make sense for the current architecture.
2013-03-22 03:03:15 +00:00
Elliott Hughes
2810ec5464 am 5bed5501: am 3077d883: am c48968d2: am 4453c51c: Merge "Drop unnecessary execution permission for .cpp/.c/.h"
* commit '5bed5501d7048acc77f5365e87fd8487b21ef1f6':
  Drop unnecessary execution permission for .cpp/.c/.h
2013-03-22 02:43:23 +00:00
Elliott Hughes
b11037a42a am 455637f2: am 5c9a25cc: am f977d2dc: am 800ad824: Merge "Provide glibc-compatible SYS_* aliases for the __NR_* constants."
* commit '455637f25180709f7baf261715873f4a0109583c':
  Provide glibc-compatible SYS_* aliases for the __NR_* constants.
2013-03-22 01:55:26 +00:00
Elliott Hughes
a2e42c3798 am 6d460efe: am c9edc079: am 39e2a408: am 6eb978c9: Merge "Expose wait4 as wait4 rather than __wait4."
* commit '6d460efed94e3d5825b5c842c112aa6b26357d93':
  Expose wait4 as wait4 rather than __wait4.
2013-03-21 23:25:38 +00:00
Christopher Ferris
e269711a1b am 774266bf: am f46e1454: am 9088af19: am 86c31849: Merge "Create arch specific versions of strcmp."
* commit '774266bfa281880e16c2447555177c037575cdaf':
  Create arch specific versions of strcmp.
2013-03-20 22:40:13 +00:00
The Android Open Source Project
fd56f2a3cc am bad0c4d8: (-s ours) Reconcile with jb-mr2-release - do not merge
* commit 'bad0c4d8bb85d91affb7274022f671b40b0a9305':
  am 2e7b8d63: am f861bc5c: Merge "Don\'t search off the end of the index for bad Olson ids."
2013-03-20 16:42:00 +00:00
The Android Automerger
1565771b2a merge in master-release history after reset to master 2013-03-18 07:49:11 -07:00
Elliott Hughes
6380d21a05 am 92a197f3: am d7dc414a: am 987fc5a3: am adeec096: Merge "Hide various symbols that shouldn\'t be exposed."
* commit '92a197f3051c5befd5e40ec7f23c0643999da259':
  Hide various symbols that shouldn't be exposed.
2013-03-16 00:11:52 +00:00
Elliott Hughes
90f7546c68 am cf23cbb1: am 12ea8005: am 5f829205: am c1416647: Merge "Clean up internal libc logging."
* commit 'cf23cbb1d4826ac579fae28e4fe796a6e4e1ddfd':
  Clean up internal libc logging.
2013-03-15 23:43:01 +00:00
Elliott Hughes
cc71361ed6 am 270595f4: am e1b0db13: am 50d42294: am e23ed8c6: Merge "Remove useless workaround for HTC RIL bugs."
* commit '270595f4c976a86033ac099a283299c2ec53f24a':
  Remove useless workaround for HTC RIL bugs.
2013-03-15 18:49:50 +00:00
The Android Automerger
9d6a2c28a5 merge in master-release history after reset to master 2013-03-15 07:49:25 -07:00
Elliott Hughes
045e01caed am c204b501: am 9ede4549: am f8d689bc: am 4d696eb4: Merge "Fix a bug in ZoneCompactor that meant the zonetab offset was wrong."
* commit 'c204b501f44d7b08e2be06693322d5426b3f85ef':
  Fix a bug in ZoneCompactor that meant the zonetab offset was wrong.
2013-03-15 00:45:09 +00:00
Christopher Ferris
18fcfa79d3 am 8dcbb90d: am f85fc022: am f694ed1c: am d30b9f09: Merge "Remove unused arm defines."
* commit '8dcbb90dea22a876d9cc517f382bb82c98d87450':
  Remove unused arm defines.
2013-03-14 23:43:26 +00:00
Elliott Hughes
4982e345cf am 2d48d0ea: am c9358706: am 2e7b8d63: am f861bc5c: Merge "Don\'t search off the end of the index for bad Olson ids."
* commit '2d48d0ea36395da9af4537195483b006900bf7bd':
  Don't search off the end of the index for bad Olson ids.
2013-03-14 22:35:28 +00:00
Christopher Ferris
65461bbe25 Merge "Create arch specific versions of strcmp." 2013-03-14 21:18:20 +00:00
The Android Automerger
e450d655ba merge in master-release history after reset to master 2013-03-13 07:49:07 -07:00
Elliott Hughes
a00988312b am 76ade2ed: am f557e90b: am 2f44c05b: am ec706c24: Merge "Use the kernel\'s MAX_ERRNO in the syscall stubs."
* commit '76ade2ed6077fec0a4978ef7e7e2a99578512c39':
  Use the kernel's MAX_ERRNO in the syscall stubs.
2013-03-13 01:00:12 +00:00
Christopher Ferris
f0cd52305a am 8cca0154: am b0b974c1: am 2a66ccf1: am 980508b0: Merge "Break bionic implementations into arch versions."
* commit '8cca015403f2f021d557fc81a0423a04a551448a':
  Break bionic implementations into arch versions.
2013-03-12 22:45:21 +00:00
Elliott Hughes
4f73423c68 am 0052a618: am b4d6f28c: am a3214c65: am 94a34010: Merge "Support large errno values on ARM."
* commit '0052a6188ba20c3a9ea99f974bce0c143bd379cb':
  Support large errno values on ARM.
2013-03-12 19:24:10 +00:00
Elliott Hughes
6734451334 am 60414ba1: am 746f1286: am 5d998b4a: am f21aa3b6: Merge "Use more types than just \'unsigned\' in the linker."
* commit '60414ba165da87e427aef45b651ec7d4f26b084f':
  Use more types than just 'unsigned' in the linker.
2013-03-12 19:07:18 +00:00
Elliott Hughes
947695bd9b am 5487ecb5: am e9cdce33: am 3c9afb5e: am 6b4c77f8: Merge "Use Elf32_Addr instead of unsigned in linker"
* commit '5487ecb52a328906b81635f8c8018f48031c19a1':
  Use Elf32_Addr instead of unsigned in linker
2013-03-12 17:43:55 +00:00
Christopher Ferris
a9a5870d16 Create arch specific versions of strcmp.
This uses the new strcmp.a15.S code as the basis for new versions
of strcmp.S.

The cortex-a15 code is the performance optimized version of strcmp.a15.S
taken with only the addition of a few pld instructions.
The cortex-a9 code is the same as the cortex-a15 code except that the
unaligned strcmp code was taken from the original strcmp.S.
The krait code is the same as the cortex-a15 code except that one path
in the unaligned strcmp code was taken from the original strcmp.S code
(the 2 byte overlap case).
The generic code is the original unmodified strmp.S from the bionic
subdirectory.

All three new versions underwent these test cases:

Strings the same, all same size:
- Both pointers double word aligned.
- One pointer double word aligned, one pointer word aligned.
- Both pointers word aligned.
- One pointer double word aligned, one pointer 1 off a word alignment.
- One pointer double word aligned, one pointer 2 off a word alignment.
- One pointer double word aligned, one pointer 3 off a word alignment.
- One pointer word aligned, one pointer 1 off a word alignment.
- One pointer word aligned, one pointer 2 off a word alignment.
- One pointer word aligned, one pointer 3 off a word alignment.
For all cases where it made sense, the two pointers were also tested
swapped.

Different strings, all same size:
- Single difference at double word boundary.
- Single difference at word boudary.
- Single difference at 1 off a word alignment.
- Single difference at 2 off a word alignment.
- Single difference at 3 off a word alignment.

Different sized strings, strings the same until the end:
- Shorter string ends on a double word boundary.
- Shorter string ends on word boundary.
- Shorter string ends at 1 off a word boundary.
- Shorter string ends at 2 off a word boundary.
- Shorter string ends at 3 off a word boundary.

For all different cases, run them through the same pointer alignment
cases when the strings are the same size.
For all cases the two pointers were also tested swapped.

Bug: 8005082
Change-Id: I5f3dc02b48afba2cb9c13332ab45c828ff171a1c
2013-03-12 10:25:11 -07:00
The Android Automerger
1a6e73d0ac merge in master-release history after reset to master 2013-03-12 07:49:24 -07:00
The Android Open Source Project
70d97ae3d0 am 7c8af225: (-s ours) Reconcile with jb-mr2-release - do not merge
* commit '7c8af2252a5814a34f30922ac7d5d63bd891e525':
2013-03-12 14:16:36 +00:00
Elliott Hughes
3284773891 am 03e71235: am 8c73f69c: am 36cb88b7: am 53630c0e: Merge "Cache the most-recently used timezone for mktime_tz and localtime_tz."
* commit '03e712357d1f4de204ac9ad5cbef53acba48db9d':
  Cache the most-recently used timezone for mktime_tz and localtime_tz.
2013-03-12 01:50:53 +00:00
Jean-Baptiste Queru
23167e7556 am 1467dfa5: (-s ours) am a60f3818: am b2525ba8: am 7915b22e: am a4b20d71: am b8e1033c: (-s ours) am e5412a9a: (-s ours) Reconcile with jb-mr1-release - do not merge
* commit '1467dfa5cd28b8b4e07cfe86b020a07bd0d0da24':
2013-03-11 19:51:51 +00:00
Elliott Hughes
3d0bf2b30c am 9969b48d: am 60ac09bd: am 6d6f5e61: am 4b032ee9: Merge "Let bionic use the correct definition of ssize_t."
* commit '9969b48d235e71f87be67549fdd274c8e82f3f6f':
  Let bionic use the correct definition of ssize_t.
2013-03-11 19:41:19 +00:00
Elliott Hughes
cd9c4cfae3 am 022d7c50: am bf32ffcf: am 0b765862: am 62c5cd07: Merge "Upgrade to tzdata2013b."
* commit '022d7c50db28fbf90e197f0c88b23b7e3a74a07b':
  Upgrade to tzdata2013b.
2013-03-11 18:39:13 +00:00
The Android Automerger
568eb7bd76 merge in master-release history after reset to master 2013-03-08 07:49:16 -08:00
Elliott Hughes
5bb64976a0 am 7a9749ec: am 8a015722: resolved conflicts for merge of 4706606c to jb-mr2-dev
* commit '7a9749eca06816ba3b63e55660bc1c2b7285dc52':
  Regenerate NOTICE files.
2013-03-07 21:25:35 +00:00
The Android Automerger
a7a3bcef75 merge in master-release history after reset to master 2013-03-07 07:49:10 -08:00
Elliott Hughes
30be06bc7a am 0f644ccf: am 0a2ee475: am ad7c275e: am c9f80814: Merge "Upgrade to current NetBSD popen/pclose."
* commit '0f644ccf6dfb4f00473fc90f369d842e09ab13df':
  Upgrade to current NetBSD popen/pclose.
2013-03-07 01:09:36 +00:00
Brian Carlstrom
4bf33991b2 am 6b89c634: am c7b9f954: am 91392116: am 33031fed: Merge "Fix typo of DT_NEEDED for DT_NULL"
* commit '6b89c6341f2d805b7d9913d69ef6038b60b2af7b':
  Fix typo of DT_NEEDED for DT_NULL
2013-03-07 00:18:45 +00:00
Elliott Hughes
85598b9668 am 165825e3: am 9c0c056b: am 6b1aa1b1: am db794197: Merge "Fix debug malloc."
* commit '165825e3e83fb2ae43b60b1b5ef44cbc55f7979f':
  Fix debug malloc.
2013-03-06 23:29:12 +00:00
Elliott Hughes
6646adeac0 am bbef1f57: am bac72aba: am 50a2cd86: am 0b4a85bf: Merge "Fix TIMING/STATS/COUNT_PAGES dynamic linker build"
* commit 'bbef1f57509504ca11f26968beafd4aa0cfd4643':
  Fix TIMING/STATS/COUNT_PAGES dynamic linker build
2013-03-06 17:52:39 +00:00
Brian Carlstrom
01b5c0f126 am 8f4880e2: am 2527a8b5: am 9043202b: am 20958207: Merge "Fix MIPS linker build"
* commit '8f4880e2c66d60283d443f6c9b5ef4136d2c6621':
  Fix MIPS linker build
2013-03-06 16:53:22 +00:00
Elliott Hughes
0864ade9de am 5673f9f7: am c1a5d20d: am 9a0b658c: am c41dcad0: Merge "More linker cleanup."
* commit '5673f9f73b545c8b4801c1494600ff2220bf8dca':
  More linker cleanup.
2013-03-06 16:53:22 +00:00
The Android Automerger
bc08713ba4 merge in master-release history after reset to master 2013-03-06 07:49:13 -08:00
Brian Carlstrom
d18e5bb412 am a2cfd1a2: am 8c65a1e4: am a2517de3: am 036f9097: Merge "Minor linker cleanup, primarily to use Elf32_Dyn"
* commit 'a2cfd1a27fe552a42d668c708d98ca3f8bee90b9':
  Minor linker cleanup, primarily to use Elf32_Dyn
2013-03-06 01:27:56 +00:00
Elliott Hughes
074a94c01e am b3b00378: am 97a8217a: am 3f7b1cd3: am be21fe7a: Merge "Upgrade to tzdata2013a."
* commit 'b3b0037884e9b0bcba787e84448815f2a4b4dccd':
  Upgrade to tzdata2013a.
2013-03-05 22:29:17 +00:00
Ben Cheng
fbb281b15d am 7eaed030: am 6ad68558: am e5e6e17c: am 133d97e4: Merge "Add stack unwinding directives to memcpy."
* commit '7eaed030deacb14a6fe628e229af6c9a3a620f3c':
  Add stack unwinding directives to memcpy.
2013-03-05 21:24:43 +00:00
Elliott Hughes
c6ef78e83e am 136e00d6: am c96ad9bc: am 7b69ac53: am cf9a9604: Merge "Switch to upstream-freebsd for the unmolested wchar code."
* commit '136e00d6e9bc19617e49a6b7bf81f749ff8a48e3':
  Switch to upstream-freebsd for the unmolested wchar code.
2013-03-05 21:14:04 +00:00
The Android Open Source Project
69a278f679 am adff4e86: (-s ours) Reconcile with jb-mr2-release - do not merge
* commit 'adff4e8630e8d468253255b521caecfbb161dbbe':
2013-03-05 15:58:51 +00:00
The Android Automerger
ee84789761 merge in master-release history after reset to master 2013-03-05 07:49:15 -08:00
Elliott Hughes
3f794facd3 am 7ef3ccb7: am 81e0f35a: am 2125c155: am d392e044: Merge "Move realpath.c to upstream-freebsd."
* commit '7ef3ccb7bb5f334e4ca8911a5d0eca7dd0da6b92':
  Move realpath.c to upstream-freebsd.
2013-03-04 23:59:47 +00:00
The Android Open Source Project
781c4b19f4 am 98650e04: (-s ours) Reconcile with jb-mr2-release - do not merge
* commit '98650e04e6d87e0b2c82151eacbe483ac15949d9':
  Avoid changing the C++ ABI with ssize_t.
2013-03-04 19:10:07 +00:00
The Android Automerger
e290a7e348 merge in master-release history after reset to master 2013-03-04 07:49:05 -08:00
Christopher Ferris
0a1ab287ff am 29cc4946: (-s ours) Merge "Remove unused arm defines. DO NOT MERGE" into jb-mr2-dev
* commit '29cc4946ac8ac89fa0c49e5da8b5b328065d4b2c':
  Remove unused arm defines. DO NOT MERGE
2013-03-02 01:19:47 +00:00
Ben Cheng
f85e173616 am b9ef7f4e: am 52b3aed7: am c5c6cb3f: am 66273ac2: Merge "Adding strcmp tuned for Cortex-A15."
* commit 'b9ef7f4e122bee55110ac703f391ab961484f3d8':
  Adding strcmp tuned for Cortex-A15.
2013-03-01 18:34:45 +00:00
Ben Cheng
89d7f5e482 am ae280bcd: am 55fc93a9: am 8f149da0: am b3b1ab62: Merge "Adding memcpy tuned for Cortex-A15."
* commit 'ae280bcdbee8d31096c1b332b20fa32f941ef12f':
  Adding memcpy tuned for Cortex-A15.
2013-03-01 18:34:45 +00:00
Nick Kralevich
1f415124ec am 04190c53: am cc646773: am 305a9995: am 8fa924e5: Merge "unistd.h: don\'t include sys/capability.h"
* commit '04190c53e3ac2958322a603d7bfb9b07b92d595e':
  unistd.h: don't include sys/capability.h
2013-03-01 18:34:44 +00:00
The Android Automerger
424f21b6a7 merge in master-release history after reset to master 2013-03-01 07:49:10 -08:00
Christopher Ferris
c7f9669226 am 7c83a1ed: (-s ours) Break bionic implementations into arch versions. DO NOT MERGE
* commit '7c83a1ed81a15f3e75836c1ac7d500a952f02e10':
  Break bionic implementations into arch versions. DO NOT MERGE
2013-03-01 02:36:41 +00:00
Elliott Hughes
bfc25aa33c am 04766565: am 9c102ccf: am 7fe8229b: am 9c1912c4: Merge "Avoid changing the C++ ABI with ssize_t."
* commit '04766565d3743d70f679ca180d7fcc35321143b8':
  Avoid changing the C++ ABI with ssize_t.
2013-02-28 22:38:45 +00:00
Sasha Levitskiy
fbae9f3c30 Bionic: Libc: Resolv: Stricter function signatures, unitialized return bug fix.
Stricter input parameters help avoid ugly casting when passing
	pointers to immutable protobuf data.
	While at it: an int return was dropped from 2 functions whose users
	never used the result; one of the return paths was returning an
	uninitialized value.
	Size_t for portablity and warning supression, misc warnings addressed.

Change-Id: I2d5cbdaf0c9b6c4621a7d397772da13da5dc0943
2013-02-28 18:46:54 +00:00
The Android Automerger
de8481bcf7 merge in master-release history after reset to master 2013-02-28 07:49:07 -08:00
Christopher Ferris
6e1a5cf31b Remove unused arm defines.
The defines HAVE_32_BYTE_CACHE_LINES and ARCH_ARM_USE_NON_NEON_MEMCPY
are not used by any code. The previous memcpy code that used these
has been split into different architecture versions to avoid the need
for them.

Bug: 8005082
Change-Id: I14e0368c5bb4c3a80e72520f7cfd97e359918cce
2013-02-27 16:26:41 -08:00
The Android Automerger
e9ca2d80ed merge in master-release history after reset to master 2013-02-27 07:49:09 -08:00
Christopher Ferris
acdde8c1cf Break bionic implementations into arch versions.
Move arch specific code for arm, mips, x86 into separate
makefiles.
In addition, add different arm cpu versions of memcpy/memset.

Bug: 8005082
Change-Id: I04f3d0715104fab618e1abf7cf8f7eec9bec79df
2013-02-26 16:04:34 -08:00
The Android Automerger
c453d42e20 merge in master-release history after reset to master 2013-02-26 07:49:08 -08:00
The Android Automerger
a6cef2de96 merge in master-release history after reset to master 2013-02-25 07:49:15 -08:00
The Android Automerger
d2a3e69c26 merge in master-release history after reset to master 2013-02-22 07:49:20 -08:00
The Android Automerger
8f8bc0664a merge in master-release history after reset to master 2013-02-21 08:30:27 -08:00
The Android Automerger
27b8421a15 merge in master-release history after reset to master 2013-01-16 07:49:04 -08:00
The Android Automerger
e7cc7957ac merge in master-release history after reset to master 2013-01-15 07:49:22 -08:00
53 changed files with 1279 additions and 645 deletions

View File

@@ -104,6 +104,7 @@ libc_common_src_files := \
bionic/md5.c \
bionic/memmem.c \
bionic/memswap.c \
bionic/name_mem.c \
bionic/openat.c \
bionic/open.c \
bionic/pathconf.c \
@@ -519,8 +520,7 @@ endif # !arm
ifeq ($(TARGET_ARCH),x86)
libc_common_cflags += -DSOFTFLOAT
libc_crt_target_cflags := -m32
libc_crt_target_ldflags := -melf_i386
libc_crt_target_cflags :=
ifeq ($(ARCH_X86_HAVE_SSE2),true)
libc_crt_target_cflags += -DUSE_SSE2=1
endif
@@ -650,7 +650,7 @@ ALL_GENERATED_SOURCES += $(GEN)
GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static1.o $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
@mkdir -p $(dir $@)
$(hide) $(TARGET_LD) $(libc_crt_target_ldflags) -r -o $@ $^
$(hide) $(TARGET_LD) -r -o $@ $^
ALL_GENERATED_SOURCES += $(GEN)
GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic1.o
@@ -665,7 +665,7 @@ ALL_GENERATED_SOURCES += $(GEN)
GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic1.o $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
@mkdir -p $(dir $@)
$(hide) $(TARGET_LD) $(libc_crt_target_ldflags) -r -o $@ $^
$(hide) $(TARGET_LD) -r -o $@ $^
ALL_GENERATED_SOURCES += $(GEN)
# We rename crtend.o to crtend_android.o to avoid a

26
libc/CAVEATS Normal file
View File

@@ -0,0 +1,26 @@
Bionic is a very small C library because we have decided to *not* implement various features
of the POSIX standard. we only add functions on a as-needed basis, and there are a few things
we wish we'll never put in there.
this file is here to document explicitely what we don't want to support in Bionic:
- C++ exceptions are not supported. on embedded systems, they lead to extremely larger and
slower code for no good reason (even when so-called zero-cost exception schemes are
implemented, they enforce very large numbers of registers spills to the stack, even
in functions that do not throw an exception themselves).
- pthread cancellation is *not* supported. this seemingly simple "feature" is the source
of much bloat and complexity in a C library. Besides, you'd better write correct
multi-threaded code instead of relying on this stuff.
- pthread_once() doesn't support C++ exceptions thrown from the init function, or the init
function doing a fork().
- locales and wide characters are not supported. we use ICU for all this i18n stuff, which
is much better than the ill-designed related C libraries functions.
- at the moment, several user-account-related functions like getpwd are stubbed and return
the values corresponding to root. this will be fixed when we'll be able to have distinct
users on the Android filesystem. :-(
see bionic/stubs.c for the details

View File

@@ -21,11 +21,10 @@ _LIBC_ARCH_COMMON_SRC_FILES := \
# These are used by the static and dynamic versions of the libc
# respectively.
_LIBC_ARCH_STATIC_SRC_FILES := \
arch-arm/bionic/exidx_static.c \
bionic/dl_iterate_phdr_static.c \
arch-arm/bionic/exidx_static.c
_LIBC_ARCH_DYNAMIC_SRC_FILES := \
arch-arm/bionic/exidx_dynamic.c \
arch-arm/bionic/exidx_dynamic.c
# Remove the C++ fortify function implementations for which there is an
# arm assembler version.

View File

@@ -32,7 +32,7 @@ extern int __cxa_atexit(void (*)(void*), void*, void* );
/* The "C++ ABI for ARM" document states that static C++ constructors,
* which are called from the .init_array, should manually call
* __aeabi_atexit() to register static destructors explicitly.
* __aeabi_atexit() to register static destructors explicitely.
*
* Note that 'dso_handle' is the address of a magic linker-generate
* variable from the shared object that contains the constructor/destructor

View File

@@ -41,13 +41,15 @@ ENTRY(__strcat_chk)
.cfi_startproc
pld [r0, #0]
push {r0, lr}
.save {r0, lr}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
.cfi_rel_offset lr, 4
push {r4, r5}
.save {r4, r5}
.cfi_adjust_cfa_offset 8
.cfi_rel_offset r4, 0
.cfi_rel_offset r5, 0
.cfi_rel_offset r5, 4
mov lr, r2
@@ -178,7 +180,7 @@ ENTRY(__strcat_chk)
.L_strlen_done:
add r2, r3, r4
cmp r2, lr
bgt .L_fortify_check_failed
bhi __strcat_chk_failed
// Set up the registers for the memcpy code.
mov r1, r5
@@ -186,13 +188,23 @@ ENTRY(__strcat_chk)
mov r2, r4
add r0, r0, r3
pop {r4, r5}
.cfi_adjust_cfa_offset -8
.cfi_restore r4
.cfi_restore r5
#include "memcpy_base.S"
.cfi_endproc
END(__strcat_chk)
.L_fortify_check_failed:
#define MEMCPY_BASE __strcat_chk_memcpy_base
#define MEMCPY_BASE_ALIGNED __strcat_chk_memcpy_base_aligned
#include "memcpy_base.S"
ENTRY(__strcat_chk_failed)
.cfi_startproc
.save {r0, lr}
.save {r4, r5}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
.cfi_rel_offset lr, 4
.cfi_adjust_cfa_offset 8
.cfi_rel_offset r4, 0
.cfi_rel_offset r5, 4
@@ -208,7 +220,7 @@ error_message:
.word error_string-(1b+4)
.cfi_endproc
END(__strcat_chk)
END(__strcat_chk_failed)
.data
error_string:

View File

@@ -40,6 +40,7 @@ ENTRY(__strcpy_chk)
.cfi_startproc
pld [r0, #0]
push {r0, lr}
.save {r0, lr}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
.cfi_rel_offset lr, 4
@@ -150,14 +151,25 @@ ENTRY(__strcpy_chk)
pld [r1, #64]
ldr r0, [sp]
cmp r3, lr
bge .L_fortify_check_failed
bhs __strcpy_chk_failed
// Add 1 for copy length to get the string terminator.
add r2, r3, #1
#include "memcpy_base.S"
.cfi_endproc
END(__strcpy_chk)
#define MEMCPY_BASE __strcpy_chk_memcpy_base
#define MEMCPY_BASE_ALIGNED __strcpy_chk_memcpy_base_aligned
#include "memcpy_base.S"
ENTRY(__strcpy_chk_failed)
.cfi_startproc
.save {r0, lr}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
.cfi_rel_offset lr, 4
.L_fortify_check_failed:
ldr r0, error_message
ldr r1, error_code
1:
@@ -169,7 +181,7 @@ error_message:
.word error_string-(1b+4)
.cfi_endproc
END(__strcpy_chk)
END(__strcpy_chk_failed)
.data
error_string:

View File

@@ -65,7 +65,7 @@
ENTRY(__memcpy_chk)
.cfi_startproc
cmp r2, r3
bgt __memcpy_chk_fail
bhi __memcpy_chk_fail
// Fall through to memcpy...
.cfi_endproc
@@ -75,18 +75,23 @@ ENTRY(memcpy)
.cfi_startproc
pld [r1, #64]
push {r0, lr}
.save {r0, lr}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
.cfi_rel_offset lr, 4
#include "memcpy_base.S"
.cfi_endproc
END(memcpy)
#define MEMCPY_BASE __memcpy_base
#define MEMCPY_BASE_ALIGNED __memcpy_base_aligned
#include "memcpy_base.S"
ENTRY(__memcpy_chk_fail)
.cfi_startproc
__memcpy_chk_fail:
// Preserve lr for backtrace.
push {lr}
.save {lr}
.cfi_def_cfa_offset 4
.cfi_rel_offset lr, 0
@@ -100,6 +105,7 @@ error_code:
error_message:
.word error_string-(1b+8)
.cfi_endproc
END(__memcpy_chk_fail)
.data
error_string:

View File

@@ -53,6 +53,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
ENTRY(MEMCPY_BASE)
.cfi_startproc
.save {r0, lr}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
.cfi_rel_offset lr, 4
// Assumes that n >= 0, and dst, src are valid pointers.
// For any sizes less than 832 use the neon code that doesn't
// care about the src alignment. This avoids any checks
@@ -67,8 +74,10 @@
cmp r2, #16
blo .L_copy_less_than_16_unknown_align
cmp r2, #832
bge .L_check_alignment
// TODO: The aligned copy code is extremely slow copying some large
// buffers so always go through the unaligned path for now.
//cmp r2, #832
//bge .L_check_alignment
.L_copy_unknown_alignment:
// Unknown alignment of src and dst.
@@ -162,20 +171,34 @@
ands r3, r3, #0x3
bne .L_copy_unknown_alignment
.cfi_endproc
END(MEMCPY_BASE)
ENTRY(MEMCPY_BASE_ALIGNED)
.cfi_startproc
.save {r0, lr}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
.cfi_rel_offset lr, 4
// To try and improve performance, stack layout changed,
// i.e., not keeping the stack looking like users expect
// (highest numbered register at highest address).
// TODO: Add debug frame directives.
// We don't need exception unwind directives, because the code below
// does not throw any exceptions and does not call any other functions.
// Generally, newlib functions like this lack debug information for
// assembler source.
.save {r4, r5}
strd r4, r5, [sp, #-8]!
.save {r6, r7}
.save {r4, r5}
.cfi_adjust_cfa_offset 8
.cfi_rel_offset r4, 0
.cfi_rel_offset r5, 4
strd r6, r7, [sp, #-8]!
.save {r8, r9}
.save {r6, r7}
.cfi_adjust_cfa_offset 8
.cfi_rel_offset r6, 0
.cfi_rel_offset r7, 0
strd r8, r9, [sp, #-8]!
.save {r8, r9}
.cfi_adjust_cfa_offset 8
.cfi_rel_offset r8, 0
.cfi_rel_offset r9, 4
// Optimized for already aligned dst code.
ands ip, r0, #3
@@ -301,3 +324,6 @@
// Src is guaranteed to be at least word aligned by this point.
b .L_word_aligned
.cfi_endproc
END(MEMCPY_BASE_ALIGNED)

View File

@@ -45,6 +45,7 @@ ENTRY(__memset_chk)
bls .L_done
// Preserve lr for backtrace.
.save {lr}
push {lr}
.cfi_def_cfa_offset 4
.cfi_rel_offset lr, 0
@@ -73,6 +74,7 @@ END(bzero)
ENTRY(memset)
.cfi_startproc
.save {r0}
stmfd sp!, {r0}
.cfi_def_cfa_offset 4
.cfi_rel_offset r0, 0

View File

@@ -123,8 +123,13 @@ ENTRY(strcmp)
.macro init
/* Macro to save temporary registers and prepare magic values. */
subs sp, sp, #16
.cfi_def_cfa_offset 16
strd r4, r5, [sp, #8]
.cfi_rel_offset r4, 0
.cfi_rel_offset r5, 4
strd r6, r7, [sp]
.cfi_rel_offset r6, 8
.cfi_rel_offset r7, 12
mvn r6, #0 /* all F */
mov r7, #0 /* all 0 */
.endm /* init */
@@ -165,18 +170,20 @@ ENTRY(strcmp)
#endif /* not __ARMEB__ */
.endm /* setup_return */
.cfi_startproc
pld [r0, #0]
pld [r1, #0]
/* Are both strings double-word aligned? */
orr ip, r0, r1
tst ip, #7
bne do_align
bne .L_do_align
/* Fast path. */
.save {r4-r7}
init
doubleword_aligned:
.L_doubleword_aligned:
/* Get here when the strings to compare are double-word aligned. */
/* Compare two words in every iteration. */
@@ -189,14 +196,14 @@ doubleword_aligned:
ldrd r2, r3, [r0], #8
ldrd r4, r5, [r1], #8
magic_compare_and_branch w1=r2, w2=r4, label=return_24
magic_compare_and_branch w1=r3, w2=r5, label=return_35
magic_compare_and_branch w1=r2, w2=r4, label=.L_return_24
magic_compare_and_branch w1=r3, w2=r5, label=.L_return_35
b 2b
do_align:
.L_do_align:
/* Is the first string word-aligned? */
ands ip, r0, #3
beq word_aligned_r0
beq .L_word_aligned_r0
/* Fast compare byte by byte until the first string is word-aligned. */
/* The offset of r0 from a word boundary is in ip. Thus, the number of bytes
@@ -204,58 +211,58 @@ do_align:
bic r0, r0, #3
ldr r2, [r0], #4
lsls ip, ip, #31
beq byte2
bcs byte3
beq .L_byte2
bcs .L_byte3
byte1:
.L_byte1:
ldrb ip, [r1], #1
uxtb r3, r2, ror #BYTE1_OFFSET
subs ip, r3, ip
bne fast_return
m_cbz reg=r3, label=fast_return
bne .L_fast_return
m_cbz reg=r3, label=.L_fast_return
byte2:
.L_byte2:
ldrb ip, [r1], #1
uxtb r3, r2, ror #BYTE2_OFFSET
subs ip, r3, ip
bne fast_return
m_cbz reg=r3, label=fast_return
bne .L_fast_return
m_cbz reg=r3, label=.L_fast_return
byte3:
.L_byte3:
ldrb ip, [r1], #1
uxtb r3, r2, ror #BYTE3_OFFSET
subs ip, r3, ip
bne fast_return
m_cbnz reg=r3, label=word_aligned_r0
bne .L_fast_return
m_cbnz reg=r3, label=.L_word_aligned_r0
fast_return:
.L_fast_return:
mov r0, ip
bx lr
word_aligned_r0:
.L_word_aligned_r0:
init
/* The first string is word-aligned. */
/* Is the second string word-aligned? */
ands ip, r1, #3
bne strcmp_unaligned
bne .L_strcmp_unaligned
word_aligned:
.L_word_aligned:
/* The strings are word-aligned. */
/* Is the first string double-word aligned? */
tst r0, #4
beq doubleword_aligned_r0
beq .L_doubleword_aligned_r0
/* If r0 is not double-word aligned yet, align it by loading
and comparing the next word from each string. */
ldr r2, [r0], #4
ldr r4, [r1], #4
magic_compare_and_branch w1=r2 w2=r4 label=return_24
magic_compare_and_branch w1=r2 w2=r4 label=.L_return_24
doubleword_aligned_r0:
.L_doubleword_aligned_r0:
/* Get here when r0 is double-word aligned. */
/* Is r1 doubleword_aligned? */
tst r1, #4
beq doubleword_aligned
beq .L_doubleword_aligned
/* Get here when the strings to compare are word-aligned,
r0 is double-word aligned, but r1 is not double-word aligned. */
@@ -271,9 +278,9 @@ doubleword_aligned_r0:
/* Load the next double-word from each string and compare. */
ldrd r2, r3, [r0], #8
magic_compare_and_branch w1=r2 w2=r5 label=return_25
magic_compare_and_branch w1=r2 w2=r5 label=.L_return_25
ldrd r4, r5, [r1], #8
magic_compare_and_branch w1=r3 w2=r4 label=return_34
magic_compare_and_branch w1=r3 w2=r4 label=.L_return_34
b 3b
.macro miscmp_word offsetlo offsethi
@@ -297,47 +304,47 @@ doubleword_aligned_r0:
and r2, r3, r6, S2LOMEM #\offsetlo
it eq
cmpeq r2, r5
bne return_25
bne .L_return_25
ldr r5, [r1], #4
cmp ip, #0
eor r3, r2, r3
S2HIMEM r2, r5, #\offsethi
it eq
cmpeq r3, r2
bne return_32
bne .L_return_32
b 7b
.endm /* miscmp_word */
strcmp_unaligned:
.L_strcmp_unaligned:
/* r0 is word-aligned, r1 is at offset ip from a word. */
/* Align r1 to the (previous) word-boundary. */
bic r1, r1, #3
/* Unaligned comparison word by word using LDRs. */
cmp ip, #2
beq miscmp_word_16 /* If ip == 2. */
bge miscmp_word_24 /* If ip == 3. */
beq .L_miscmp_word_16 /* If ip == 2. */
bge .L_miscmp_word_24 /* If ip == 3. */
miscmp_word offsetlo=8 offsethi=24 /* If ip == 1. */
miscmp_word_16: miscmp_word offsetlo=16 offsethi=16
miscmp_word_24: miscmp_word offsetlo=24 offsethi=8
.L_miscmp_word_16: miscmp_word offsetlo=16 offsethi=16
.L_miscmp_word_24: miscmp_word offsetlo=24 offsethi=8
return_32:
.L_return_32:
setup_return w1=r3, w2=r2
b do_return
return_34:
b .L_do_return
.L_return_34:
setup_return w1=r3, w2=r4
b do_return
return_25:
b .L_do_return
.L_return_25:
setup_return w1=r2, w2=r5
b do_return
return_35:
b .L_do_return
.L_return_35:
setup_return w1=r3, w2=r5
b do_return
return_24:
b .L_do_return
.L_return_24:
setup_return w1=r2, w2=r4
do_return:
.L_do_return:
#ifdef __ARMEB__
mov r0, ip
@@ -349,11 +356,16 @@ do_return:
ldrd r6, r7, [sp]
ldrd r4, r5, [sp, #8]
adds sp, sp, #16
.cfi_def_cfa_offset 0
.cfi_restore r4
.cfi_restore r5
.cfi_restore r6
.cfi_restore r7
/* There is a zero or a different byte between r1 and r2. */
/* r0 contains a mask of all-zero bytes in r1. */
/* Using r0 and not ip here because cbz requires low register. */
m_cbz reg=r0, label=compute_return_value
m_cbz reg=r0, label=.L_compute_return_value
clz r0, r0
/* r0 contains the number of bits on the left of the first all-zero byte in r1. */
rsb r0, r0, #24
@@ -361,7 +373,7 @@ do_return:
lsr r1, r1, r0
lsr r2, r2, r0
compute_return_value:
.L_compute_return_value:
movs r0, #1
cmp r1, r2
/* The return value is computed as follows.
@@ -374,4 +386,5 @@ compute_return_value:
it ls
sbcls r0, r0, r0
bx lr
.cfi_endproc
END(strcmp)

View File

@@ -41,10 +41,12 @@ ENTRY(__strcat_chk)
.cfi_startproc
pld [r0, #0]
push {r0, lr}
.save {r0, lr}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
.cfi_rel_offset lr, 4
push {r4, r5}
.save {r4, r5}
.cfi_adjust_cfa_offset 8
.cfi_rel_offset r4, 0
.cfi_rel_offset r5, 4
@@ -181,7 +183,7 @@ ENTRY(__strcat_chk)
.L_strlen_done:
add r2, r3, r4
cmp r2, lr
bgt .L_fortify_check_failed
bhi __strcat_chk_fail
// Set up the registers for the memcpy code.
mov r1, r5
@@ -189,13 +191,23 @@ ENTRY(__strcat_chk)
mov r2, r4
add r0, r0, r3
pop {r4, r5}
.cfi_adjust_cfa_offset -8
.cfi_restore r4
.cfi_restore r5
#include "memcpy_base.S"
// Fall through into the memcpy_base function.
.cfi_endproc
END(__strcat_chk)
.L_fortify_check_failed:
#define MEMCPY_BASE __strcat_chk_memcpy_base
#define MEMCPY_BASE_ALIGNED __strcat_chk_memcpy_base_aligned
#include "memcpy_base.S"
ENTRY(__strcat_chk_fail)
.cfi_startproc
.save {r0, lr}
.save {r4, r5}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
.cfi_rel_offset lr, 4
.cfi_adjust_cfa_offset 8
.cfi_rel_offset r4, 0
.cfi_rel_offset r5, 4
@@ -211,7 +223,7 @@ error_message:
.word error_string-(1b+4)
.cfi_endproc
END(__strcat_chk)
END(__strcat_chk_fail)
.data
error_string:

View File

@@ -40,6 +40,7 @@ ENTRY(__strcpy_chk)
.cfi_startproc
pld [r0, #0]
push {r0, lr}
.save {r0, lr}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
.cfi_rel_offset lr, 4
@@ -152,26 +153,41 @@ ENTRY(__strcpy_chk)
pld [r1, #64]
ldr r0, [sp]
cmp r3, lr
bge .L_fortify_check_failed
bhs __strcpy_chk_fail
// Add 1 for copy length to get the string terminator.
add r2, r3, #1
#include "memcpy_base.S"
.cfi_endproc
// Fall through into the memcpy_base function.
END(__strcpy_chk)
#define MEMCPY_BASE __strcpy_chk_memcpy_base
#define MEMCPY_BASE_ALIGNED __strcpy_chk_memcpy_base_aligned
#include "memcpy_base.S"
ENTRY(__strcpy_chk_fail)
.cfi_startproc
.save {r0, lr}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
.cfi_rel_offset lr, 4
.L_fortify_check_failed:
ldr r0, error_message
ldr r1, error_code
1:
add r0, pc
bl __fortify_chk_fail
error_code:
.word BIONIC_EVENT_STRCPY_BUFFER_OVERFLOW
error_message:
.word error_string-(1b+4)
.cfi_endproc
END(__strcpy_chk)
END(__strcpy_chk_fail)
.data
error_string:

View File

@@ -43,7 +43,7 @@
ENTRY(__memcpy_chk)
.cfi_startproc
cmp r2, r3
bgt __memcpy_chk_fail
bhi __memcpy_chk_fail
// Fall through to memcpy...
.cfi_endproc
@@ -51,21 +51,27 @@ END(__memcpy_chk)
ENTRY(memcpy)
.cfi_startproc
pld [r1, #0]
stmfd sp!, {r0, lr}
.save {r0, lr}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
.cfi_rel_offset lr, 4
pld [r1, #64]
#include "memcpy_base.S"
.cfi_endproc
END(memcpy)
#define MEMCPY_BASE __memcpy_base
#define MEMCPY_BASE_ALIGNED __memcpy_base_aligned
#include "memcpy_base.S"
ENTRY(__memcpy_chk_fail)
.cfi_startproc
__memcpy_chk_fail:
// Preserve lr for backtrace.
push {lr}
.save {lr}
.cfi_def_cfa_offset 4
.cfi_rel_offset lr, 0
@@ -79,6 +85,7 @@ error_code:
error_message:
.word error_string-(1b+4)
.cfi_endproc
END(__memcpy_chk_fail)
.data
error_string:

View File

@@ -32,15 +32,21 @@
* cache line.
*/
ENTRY(MEMCPY_BASE)
.cfi_startproc
.save {r0, lr}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
.cfi_rel_offset lr, 4
// Check so divider is at least 16 bytes, needed for alignment code.
cmp r2, #16
blo 5f
/* check if buffers are aligned. If so, run arm-only version */
eor r3, r0, r1
ands r3, r3, #0x3
beq 11f
beq __memcpy_base_aligned
/* Check the upper size limit for Neon unaligned memory access in memcpy */
cmp r2, #224
@@ -131,9 +137,27 @@
ldmfd sp!, {r0, lr}
bx lr
11:
.cfi_endproc
END(MEMCPY_BASE)
ENTRY(MEMCPY_BASE_ALIGNED)
.cfi_startproc
.save {r0, lr}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
.cfi_rel_offset lr, 4
/* Simple arm-only copy loop to handle aligned copy operations */
stmfd sp!, {r4, r5, r6, r7, r8}
stmfd sp!, {r4-r8}
.save {r4-r8}
.cfi_adjust_cfa_offset 20
.cfi_rel_offset r4, 0
.cfi_rel_offset r5, 4
.cfi_rel_offset r6, 8
.cfi_rel_offset r7, 12
.cfi_rel_offset r8, 16
pld [r1, #(32 * 4)]
/* Check alignment */
@@ -202,5 +226,8 @@
ldrbne r3, [r1] /* last byte */
strbne r3, [r0]
6:
ldmfd sp!, {r4, r5, r6, r7, r8}
ldmfd sp!, {r4-r8}
ldmfd sp!, {r0, pc}
.cfi_endproc
END(MEMCPY_BASE_ALIGNED)

View File

@@ -44,6 +44,7 @@ ENTRY(__memset_chk)
// Preserve lr for backtrace.
push {lr}
.save {lr}
.cfi_def_cfa_offset 4
.cfi_rel_offset lr, 0
@@ -73,11 +74,13 @@ END(bzero)
/* memset() returns its first argument. */
ENTRY(memset)
.cfi_startproc
# The neon memset only wins for less than 132.
cmp r2, #132
bhi 11f
bhi __memset_large_copy
stmfd sp!, {r0}
.save {r0}
.cfi_def_cfa_offset 4
.cfi_rel_offset r0, 0
@@ -112,12 +115,18 @@ ENTRY(memset)
strcsb r1, [r0], #1
ldmfd sp!, {r0}
bx lr
11:
.cfi_endproc
END(memset)
ENTRY(__memset_large_copy)
.cfi_startproc
/* compute the offset to align the destination
* offset = (4-(src&3))&3 = -src & 3
*/
stmfd sp!, {r0, r4-r7, lr}
.save {r0, r4-r7, lr}
.cfi_def_cfa_offset 24
.cfi_rel_offset r0, 0
.cfi_rel_offset r4, 4
@@ -188,7 +197,7 @@ ENTRY(memset)
ldmfd sp!, {r0, r4-r7, lr}
bx lr
.cfi_endproc
END(memset)
END(__memset_large_copy)
.data
error_string:

View File

@@ -123,8 +123,13 @@ ENTRY(strcmp)
.macro init
/* Macro to save temporary registers and prepare magic values. */
subs sp, sp, #16
.cfi_def_cfa_offset 16
strd r4, r5, [sp, #8]
.cfi_rel_offset r4, 0
.cfi_rel_offset r5, 4
strd r6, r7, [sp]
.cfi_rel_offset r6, 8
.cfi_rel_offset r7, 12
mvn r6, #0 /* all F */
mov r7, #0 /* all 0 */
.endm /* init */
@@ -165,18 +170,20 @@ ENTRY(strcmp)
#endif /* not __ARMEB__ */
.endm /* setup_return */
.cfi_startproc
pld [r0, #0]
pld [r1, #0]
/* Are both strings double-word aligned? */
orr ip, r0, r1
tst ip, #7
bne do_align
bne .L_do_align
/* Fast path. */
.save {r4-r7}
init
doubleword_aligned:
.L_doubleword_aligned:
/* Get here when the strings to compare are double-word aligned. */
/* Compare two words in every iteration. */
@@ -189,14 +196,14 @@ doubleword_aligned:
ldrd r2, r3, [r0], #8
ldrd r4, r5, [r1], #8
magic_compare_and_branch w1=r2, w2=r4, label=return_24
magic_compare_and_branch w1=r3, w2=r5, label=return_35
magic_compare_and_branch w1=r2, w2=r4, label=.L_return_24
magic_compare_and_branch w1=r3, w2=r5, label=.L_return_35
b 2b
do_align:
.L_do_align:
/* Is the first string word-aligned? */
ands ip, r0, #3
beq word_aligned_r0
beq .L_word_aligned_r0
/* Fast compare byte by byte until the first string is word-aligned. */
/* The offset of r0 from a word boundary is in ip. Thus, the number of bytes
@@ -204,58 +211,58 @@ do_align:
bic r0, r0, #3
ldr r2, [r0], #4
lsls ip, ip, #31
beq byte2
bcs byte3
beq .L_byte2
bcs .L_byte3
byte1:
.L_byte1:
ldrb ip, [r1], #1
uxtb r3, r2, ror #BYTE1_OFFSET
subs ip, r3, ip
bne fast_return
m_cbz reg=r3, label=fast_return
bne .L_fast_return
m_cbz reg=r3, label=.L_fast_return
byte2:
.L_byte2:
ldrb ip, [r1], #1
uxtb r3, r2, ror #BYTE2_OFFSET
subs ip, r3, ip
bne fast_return
m_cbz reg=r3, label=fast_return
bne .L_fast_return
m_cbz reg=r3, label=.L_fast_return
byte3:
.L_byte3:
ldrb ip, [r1], #1
uxtb r3, r2, ror #BYTE3_OFFSET
subs ip, r3, ip
bne fast_return
m_cbnz reg=r3, label=word_aligned_r0
bne .L_fast_return
m_cbnz reg=r3, label=.L_word_aligned_r0
fast_return:
.L_fast_return:
mov r0, ip
bx lr
word_aligned_r0:
.L_word_aligned_r0:
init
/* The first string is word-aligned. */
/* Is the second string word-aligned? */
ands ip, r1, #3
bne strcmp_unaligned
bne .L_strcmp_unaligned
word_aligned:
.L_word_aligned:
/* The strings are word-aligned. */
/* Is the first string double-word aligned? */
tst r0, #4
beq doubleword_aligned_r0
beq .L_doubleword_aligned_r0
/* If r0 is not double-word aligned yet, align it by loading
and comparing the next word from each string. */
ldr r2, [r0], #4
ldr r4, [r1], #4
magic_compare_and_branch w1=r2 w2=r4 label=return_24
magic_compare_and_branch w1=r2 w2=r4 label=.L_return_24
doubleword_aligned_r0:
.L_doubleword_aligned_r0:
/* Get here when r0 is double-word aligned. */
/* Is r1 doubleword_aligned? */
tst r1, #4
beq doubleword_aligned
beq .L_doubleword_aligned
/* Get here when the strings to compare are word-aligned,
r0 is double-word aligned, but r1 is not double-word aligned. */
@@ -271,9 +278,9 @@ doubleword_aligned_r0:
/* Load the next double-word from each string and compare. */
ldrd r2, r3, [r0], #8
magic_compare_and_branch w1=r2 w2=r5 label=return_25
magic_compare_and_branch w1=r2 w2=r5 label=.L_return_25
ldrd r4, r5, [r1], #8
magic_compare_and_branch w1=r3 w2=r4 label=return_34
magic_compare_and_branch w1=r3 w2=r4 label=.L_return_34
b 3b
.macro miscmp_word offsetlo offsethi
@@ -297,33 +304,33 @@ doubleword_aligned_r0:
and r2, r3, r6, S2LOMEM #\offsetlo
it eq
cmpeq r2, r5
bne return_25
bne .L_return_25
ldr r5, [r1], #4
cmp ip, #0
eor r3, r2, r3
S2HIMEM r2, r5, #\offsethi
it eq
cmpeq r3, r2
bne return_32
bne .L_return_32
b 7b
.endm /* miscmp_word */
return_32:
.L_return_32:
setup_return w1=r3, w2=r2
b do_return
return_34:
b .L_do_return
.L_return_34:
setup_return w1=r3, w2=r4
b do_return
return_25:
b .L_do_return
.L_return_25:
setup_return w1=r2, w2=r5
b do_return
return_35:
b .L_do_return
.L_return_35:
setup_return w1=r3, w2=r5
b do_return
return_24:
b .L_do_return
.L_return_24:
setup_return w1=r2, w2=r4
do_return:
.L_do_return:
#ifdef __ARMEB__
mov r0, ip
@@ -335,11 +342,16 @@ do_return:
ldrd r6, r7, [sp]
ldrd r4, r5, [sp, #8]
adds sp, sp, #16
.cfi_def_cfa_offset 0
.cfi_restore r4
.cfi_restore r5
.cfi_restore r6
.cfi_restore r7
/* There is a zero or a different byte between r1 and r2. */
/* r0 contains a mask of all-zero bytes in r1. */
/* Using r0 and not ip here because cbz requires low register. */
m_cbz reg=r0, label=compute_return_value
m_cbz reg=r0, label=.L_compute_return_value
clz r0, r0
/* r0 contains the number of bits on the left of the first all-zero byte in r1. */
rsb r0, r0, #24
@@ -347,7 +359,7 @@ do_return:
lsr r1, r1, r0
lsr r2, r2, r0
compute_return_value:
.L_compute_return_value:
movs r0, #1
cmp r1, r2
/* The return value is computed as follows.
@@ -367,7 +379,7 @@ compute_return_value:
* bionic/libc/arch-arm/cortex-a15/bionic/strcmp.S for the unedited
* version of the code.
*/
strcmp_unaligned:
.L_strcmp_unaligned:
wp1 .req r0
wp2 .req r1
b1 .req r2
@@ -520,6 +532,11 @@ strcmp_unaligned:
ldrd r6, r7, [sp]
ldrd r4, r5, [sp, #8]
adds sp, sp, #16
.cfi_def_cfa_offset 0
.cfi_restore r4
.cfi_restore r5
.cfi_restore r6
.cfi_restore r7
bx lr
@@ -541,4 +558,5 @@ strcmp_unaligned:
adds sp, sp, #16
bx lr
.cfi_endproc
END(strcmp)

View File

@@ -41,10 +41,12 @@ ENTRY(__strcat_chk)
.cfi_startproc
pld [r0, #0]
push {r0, lr}
.save {r0, lr}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
.cfi_rel_offset lr, 4
push {r4, r5}
.save {r4, r5}
.cfi_adjust_cfa_offset 8
.cfi_rel_offset r4, 0
.cfi_rel_offset r5, 4
@@ -178,7 +180,7 @@ ENTRY(__strcat_chk)
.L_strlen_done:
add r2, r3, r4
cmp r2, lr
bgt .L_fortify_check_failed
bhi __strcat_chk_failed
// Set up the registers for the memcpy code.
mov r1, r5
@@ -186,13 +188,21 @@ ENTRY(__strcat_chk)
mov r2, r4
add r0, r0, r3
pop {r4, r5}
.cfi_adjust_cfa_offset -8
.cfi_restore r4
.cfi_restore r5
#include "memcpy_base.S"
.cfi_endproc
END(__strcat_chk)
.L_fortify_check_failed:
#define MEMCPY_BASE __strcat_chk_memcpy_base
#define MEMCPY_BASE_ALIGNED __strcat_chk_memcpy_base_aligned
#include "memcpy_base.S"
ENTRY(__strcat_chk_failed)
.cfi_startproc
.save {r0, lr}
.save {r4, r5}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
.cfi_rel_offset lr, 4
.cfi_adjust_cfa_offset 8
.cfi_rel_offset r4, 0
.cfi_rel_offset r5, 4
@@ -208,7 +218,7 @@ error_message:
.word error_string-(1b+4)
.cfi_endproc
END(__strcat_chk)
END(__strcat_chk_failed)
.data
error_string:

View File

@@ -40,6 +40,7 @@ ENTRY(__strcpy_chk)
.cfi_startproc
pld [r0, #0]
push {r0, lr}
.save {r0, lr}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
.cfi_rel_offset lr, 4
@@ -150,14 +151,25 @@ ENTRY(__strcpy_chk)
pld [r1, #64]
ldr r0, [sp]
cmp r3, lr
bge .L_fortify_check_failed
bhs __strcpy_chk_failed
// Add 1 for copy length to get the string terminator.
add r2, r3, #1
#include "memcpy_base.S"
.cfi_endproc
END(__strcpy_chk)
#define MEMCPY_BASE __strcpy_chk_memcpy_base
#define MEMCPY_BASE_ALIGNED __strcpy_chk_memcpy_base_aligned
#include "memcpy_base.S"
ENTRY(__strcpy_chk_failed)
.cfi_startproc
.save {r0, lr}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
.cfi_rel_offset lr, 4
.L_fortify_check_failed:
ldr r0, error_message
ldr r1, error_code
1:
@@ -168,7 +180,7 @@ error_code:
error_message:
.word error_string-(1b+4)
.cfi_endproc
END(__strcpy_chk)
END(__strcpy_chk_failed)
.data
error_string:

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2008 The Android Open Source Project
* Copyright (C) 2013 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -46,7 +46,7 @@
ENTRY(__memcpy_chk)
.cfi_startproc
cmp r2, r3
bgt __memcpy_chk_fail
bhi __memcpy_chk_fail
// Fall through to memcpy...
.cfi_endproc
@@ -56,18 +56,22 @@ ENTRY(memcpy)
.cfi_startproc
pld [r1, #64]
stmfd sp!, {r0, lr}
.save {r0, lr}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
.cfi_rel_offset lr, 4
#include "memcpy_base.S"
.cfi_endproc
END(memcpy)
#define MEMCPY_BASE __memcpy_base
#define MEMCPY_BASE_ALIGNED __memcpy_base_aligned
#include "memcpy_base.S"
ENTRY(__memcpy_chk_fail)
.cfi_startproc
__memcpy_chk_fail:
// Preserve lr for backtrace.
push {lr}
.save {lr}
.cfi_def_cfa_offset 4
.cfi_rel_offset lr, 0
@@ -81,6 +85,7 @@ error_code:
error_message:
.word error_string-(1b+4)
.cfi_endproc
END(__memcpy_chk_fail)
.data
error_string:

View File

@@ -35,6 +35,13 @@
// Assumes neon instructions and a cache line size of 32 bytes.
ENTRY(MEMCPY_BASE)
.cfi_startproc
.save {r0, lr}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
.cfi_rel_offset lr, 4
/* do we have at least 16-bytes to copy (needed for alignment below) */
cmp r2, #16
blo 5f
@@ -72,7 +79,7 @@
1: /* The main loop copies 64 bytes at a time */
vld1.8 {d0 - d3}, [r1]!
vld1.8 {d4 - d7}, [r1]!
pld [r1, #(32*2)]
pld [r1, #(32*8)]
subs r2, r2, #64
vst1.8 {d0 - d3}, [r0, :128]!
vst1.8 {d4 - d7}, [r0, :128]!
@@ -115,3 +122,6 @@
ldmfd sp!, {r0, lr}
bx lr
.cfi_endproc
END(MEMCPY_BASE)

View File

@@ -44,6 +44,7 @@ ENTRY(__memset_chk)
bls .L_done
// Preserve lr for backtrace.
.save {lr}
push {lr}
.cfi_def_cfa_offset 4
.cfi_rel_offset lr, 0
@@ -74,6 +75,7 @@ END(bzero)
/* memset() returns its first argument. */
ENTRY(memset)
.cfi_startproc
.save {r0}
stmfd sp!, {r0}
.cfi_def_cfa_offset 4
.cfi_rel_offset r0, 0

View File

@@ -123,8 +123,13 @@ ENTRY(strcmp)
.macro init
/* Macro to save temporary registers and prepare magic values. */
subs sp, sp, #16
.cfi_def_cfa_offset 16
strd r4, r5, [sp, #8]
.cfi_rel_offset r4, 0
.cfi_rel_offset r5, 4
strd r6, r7, [sp]
.cfi_rel_offset r6, 8
.cfi_rel_offset r7, 12
mvn r6, #0 /* all F */
mov r7, #0 /* all 0 */
.endm /* init */
@@ -165,18 +170,20 @@ ENTRY(strcmp)
#endif /* not __ARMEB__ */
.endm /* setup_return */
.cfi_startproc
pld [r0, #0]
pld [r1, #0]
/* Are both strings double-word aligned? */
orr ip, r0, r1
tst ip, #7
bne do_align
bne .L_do_align
/* Fast path. */
.save {r4-r7}
init
doubleword_aligned:
.L_doubleword_aligned:
/* Get here when the strings to compare are double-word aligned. */
/* Compare two words in every iteration. */
@@ -189,14 +196,14 @@ doubleword_aligned:
ldrd r2, r3, [r0], #8
ldrd r4, r5, [r1], #8
magic_compare_and_branch w1=r2, w2=r4, label=return_24
magic_compare_and_branch w1=r3, w2=r5, label=return_35
magic_compare_and_branch w1=r2, w2=r4, label=.L_return_24
magic_compare_and_branch w1=r3, w2=r5, label=.L_return_35
b 2b
do_align:
.L_do_align:
/* Is the first string word-aligned? */
ands ip, r0, #3
beq word_aligned_r0
beq .L_word_aligned_r0
/* Fast compare byte by byte until the first string is word-aligned. */
/* The offset of r0 from a word boundary is in ip. Thus, the number of bytes
@@ -204,58 +211,58 @@ do_align:
bic r0, r0, #3
ldr r2, [r0], #4
lsls ip, ip, #31
beq byte2
bcs byte3
beq .L_byte2
bcs .L_byte3
byte1:
.L_byte1:
ldrb ip, [r1], #1
uxtb r3, r2, ror #BYTE1_OFFSET
subs ip, r3, ip
bne fast_return
m_cbz reg=r3, label=fast_return
bne .L_fast_return
m_cbz reg=r3, label=.L_fast_return
byte2:
.L_byte2:
ldrb ip, [r1], #1
uxtb r3, r2, ror #BYTE2_OFFSET
subs ip, r3, ip
bne fast_return
m_cbz reg=r3, label=fast_return
bne .L_fast_return
m_cbz reg=r3, label=.L_fast_return
byte3:
.L_byte3:
ldrb ip, [r1], #1
uxtb r3, r2, ror #BYTE3_OFFSET
subs ip, r3, ip
bne fast_return
m_cbnz reg=r3, label=word_aligned_r0
bne .L_fast_return
m_cbnz reg=r3, label=.L_word_aligned_r0
fast_return:
.L_fast_return:
mov r0, ip
bx lr
word_aligned_r0:
.L_word_aligned_r0:
init
/* The first string is word-aligned. */
/* Is the second string word-aligned? */
ands ip, r1, #3
bne strcmp_unaligned
bne .L_strcmp_unaligned
word_aligned:
.L_word_aligned:
/* The strings are word-aligned. */
/* Is the first string double-word aligned? */
tst r0, #4
beq doubleword_aligned_r0
beq .L_doubleword_aligned_r0
/* If r0 is not double-word aligned yet, align it by loading
and comparing the next word from each string. */
ldr r2, [r0], #4
ldr r4, [r1], #4
magic_compare_and_branch w1=r2 w2=r4 label=return_24
magic_compare_and_branch w1=r2 w2=r4 label=.L_return_24
doubleword_aligned_r0:
.L_doubleword_aligned_r0:
/* Get here when r0 is double-word aligned. */
/* Is r1 doubleword_aligned? */
tst r1, #4
beq doubleword_aligned
beq .L_doubleword_aligned
/* Get here when the strings to compare are word-aligned,
r0 is double-word aligned, but r1 is not double-word aligned. */
@@ -271,9 +278,9 @@ doubleword_aligned_r0:
/* Load the next double-word from each string and compare. */
ldrd r2, r3, [r0], #8
magic_compare_and_branch w1=r2 w2=r5 label=return_25
magic_compare_and_branch w1=r2 w2=r5 label=.L_return_25
ldrd r4, r5, [r1], #8
magic_compare_and_branch w1=r3 w2=r4 label=return_34
magic_compare_and_branch w1=r3 w2=r4 label=.L_return_34
b 3b
.macro miscmp_word offsetlo offsethi
@@ -297,46 +304,46 @@ doubleword_aligned_r0:
and r2, r3, r6, S2LOMEM #\offsetlo
it eq
cmpeq r2, r5
bne return_25
bne .L_return_25
ldr r5, [r1], #4
cmp ip, #0
eor r3, r2, r3
S2HIMEM r2, r5, #\offsethi
it eq
cmpeq r3, r2
bne return_32
bne .L_return_32
b 7b
.endm /* miscmp_word */
strcmp_unaligned:
.L_strcmp_unaligned:
/* r0 is word-aligned, r1 is at offset ip from a word. */
/* Align r1 to the (previous) word-boundary. */
bic r1, r1, #3
/* Unaligned comparison word by word using LDRs. */
cmp ip, #2
beq miscmp_word_16 /* If ip == 2. */
bge miscmp_word_24 /* If ip == 3. */
beq .L_miscmp_word_16 /* If ip == 2. */
bge .L_miscmp_word_24 /* If ip == 3. */
miscmp_word offsetlo=8 offsethi=24 /* If ip == 1. */
miscmp_word_24: miscmp_word offsetlo=24 offsethi=8
.L_miscmp_word_24: miscmp_word offsetlo=24 offsethi=8
return_32:
.L_return_32:
setup_return w1=r3, w2=r2
b do_return
return_34:
b .L_do_return
.L_return_34:
setup_return w1=r3, w2=r4
b do_return
return_25:
b .L_do_return
.L_return_25:
setup_return w1=r2, w2=r5
b do_return
return_35:
b .L_do_return
.L_return_35:
setup_return w1=r3, w2=r5
b do_return
return_24:
b .L_do_return
.L_return_24:
setup_return w1=r2, w2=r4
do_return:
.L_do_return:
#ifdef __ARMEB__
mov r0, ip
@@ -348,11 +355,16 @@ do_return:
ldrd r6, r7, [sp]
ldrd r4, r5, [sp, #8]
adds sp, sp, #16
.cfi_def_cfa_offset 0
.cfi_restore r4
.cfi_restore r5
.cfi_restore r6
.cfi_restore r7
/* There is a zero or a different byte between r1 and r2. */
/* r0 contains a mask of all-zero bytes in r1. */
/* Using r0 and not ip here because cbz requires low register. */
m_cbz reg=r0, label=compute_return_value
m_cbz reg=r0, label=.L_compute_return_value
clz r0, r0
/* r0 contains the number of bits on the left of the first all-zero byte in r1. */
rsb r0, r0, #24
@@ -360,7 +372,7 @@ do_return:
lsr r1, r1, r0
lsr r2, r2, r0
compute_return_value:
.L_compute_return_value:
movs r0, #1
cmp r1, r2
/* The return value is computed as follows.
@@ -380,7 +392,7 @@ compute_return_value:
* previous version. See bionic/libc/arch-arm/cortex-a15/bionic/strcmp.S
* for the unedited version of this code.
*/
miscmp_word_16:
.L_miscmp_word_16:
wp1 .req r0
wp2 .req r1
b1 .req r2
@@ -453,6 +465,11 @@ miscmp_word_16:
ldrd r6, r7, [sp]
ldrd r4, r5, [sp, #8]
adds sp, sp, #16
.cfi_def_cfa_offset 0
.cfi_restore r4
.cfi_restore r5
.cfi_restore r6
.cfi_restore r7
bx lr
@@ -472,6 +489,12 @@ miscmp_word_16:
ldrd r6, r7, [sp]
ldrd r4, r5, [sp, #8]
adds sp, sp, #16
.cfi_def_cfa_offset 0
.cfi_restore r4
.cfi_restore r5
.cfi_restore r6
.cfi_restore r7
bx lr
.cfi_endproc
END(strcmp)

View File

@@ -72,7 +72,7 @@ _LIBC_ARCH_COMMON_SRC_FILES += \
arch-x86/string/bzero.S \
bionic/memrchr.c \
bionic/memchr.c \
bionic/strchr.cpp \
string/strchr.cpp \
string/strrchr.c \
string/index.c \
bionic/strnlen.c \

View File

@@ -41,51 +41,13 @@
* This strncpy check is called if _FORTIFY_SOURCE is defined and
* greater than 0.
*/
extern "C" char* __strncpy_chk(char* __restrict dest, const char* __restrict src,
extern "C" char *__strncpy_chk (char *dest, const char *src,
size_t len, size_t dest_len)
{
if (__predict_false(len > dest_len)) {
__fortify_chk_fail("strncpy dest buffer overflow",
BIONIC_EVENT_STRNCPY_BUFFER_OVERFLOW);
}
return strncpy(dest, src, len);
}
/*
* __strncpy_chk2
*
* This is a variant of __strncpy_chk, but it also checks to make
* sure we don't read beyond the end of "src". The code for this is
* based on the original version of strncpy, but modified to check
* how much we read from "src" at the end of the copy operation.
*/
extern "C" char* __strncpy_chk2(char* __restrict dst, const char* __restrict src,
size_t n, size_t dest_len, size_t src_len)
{
if (__predict_false(n > dest_len)) {
__fortify_chk_fail("strncpy dest buffer overflow",
BIONIC_EVENT_STRNCPY_BUFFER_OVERFLOW);
}
if (n != 0) {
char* d = dst;
const char* s = src;
do {
if ((*d++ = *s++) == 0) {
/* NUL pad the remaining n-1 bytes */
while (--n != 0) {
*d++ = 0;
}
break;
}
} while (--n != 0);
size_t s_copy_len = static_cast<size_t>(s - src);
if (__predict_false(s_copy_len > src_len)) {
__fortify_chk_fail("strncpy read beyond end of src buffer", 0);
if (__predict_false(len > dest_len)) {
__fortify_chk_fail("strncpy buffer overflow",
BIONIC_EVENT_STRNCPY_BUFFER_OVERFLOW);
}
}
return dst;
return strncpy(dest, src, len);
}

View File

@@ -16,6 +16,7 @@
#include "dlmalloc.h"
#include "private/bionic_name_mem.h"
#include "private/libc_logging.h"
// Send dlmalloc errors to the log.
@@ -25,6 +26,11 @@ static void __bionic_heap_usage_error(const char* function, void* address);
#define CORRUPTION_ERROR_ACTION(m) __bionic_heap_corruption_error(__FUNCTION__)
#define USAGE_ERROR_ACTION(m,p) __bionic_heap_usage_error(__FUNCTION__, p)
/* Bionic named anonymous memory declarations */
static void* named_anonymous_mmap(size_t length);
#define MMAP(s) named_anonymous_mmap(s)
#define DIRECT_MMAP(s) named_anonymous_mmap(s)
// Ugly inclusion of C file so that bionic specific #defines configure dlmalloc.
#include "../upstream-dlmalloc/malloc.c"
@@ -42,3 +48,15 @@ static void __bionic_heap_usage_error(const char* function, void* address) {
// TODO: improve the debuggerd protocol so we can tell it to dump an address when we abort.
*((int**) 0xdeadbaad) = (int*) address;
}
static void* named_anonymous_mmap(size_t length)
{
void* ret;
ret = mmap(NULL, length, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
if (ret == MAP_FAILED)
return ret;
__bionic_name_mem(ret, length, "libc_malloc");
return ret;
}

View File

@@ -37,6 +37,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/auxv.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
#include "atexit.h"
@@ -62,6 +64,21 @@ uintptr_t __stack_chk_guard = 0;
unsigned int __page_size = PAGE_SIZE;
unsigned int __page_shift = PAGE_SHIFT;
static size_t get_stack_size() {
const size_t minimal_stack_size = 128 * 1024;
size_t stack_size = minimal_stack_size;
struct rlimit stack_limit;
int rlimit_result = getrlimit(RLIMIT_STACK, &stack_limit);
if ((rlimit_result == 0) && (stack_limit.rlim_cur != RLIM_INFINITY)) {
stack_size = stack_limit.rlim_cur;
stack_size = (stack_size & ~(PAGE_SIZE - 1));
if (stack_size < minimal_stack_size) {
stack_size = minimal_stack_size;
}
}
return stack_size;
}
/* Init TLS for the initial thread. Called by the linker _before_ libc is mapped
* in memory. Beware: all writes to libc globals from this function will
* apply to linker-private copies and will not be visible from libc later on.
@@ -76,9 +93,9 @@ unsigned int __page_shift = PAGE_SHIFT;
void __libc_init_tls(KernelArgumentBlock& args) {
__libc_auxv = args.auxv;
unsigned stack_top = (__get_sp() & ~(PAGE_SIZE - 1)) + PAGE_SIZE;
unsigned stack_size = 128 * 1024;
unsigned stack_bottom = stack_top - stack_size;
uintptr_t stack_top = (__get_sp() & ~(PAGE_SIZE - 1)) + PAGE_SIZE;
size_t stack_size = get_stack_size();
uintptr_t stack_bottom = stack_top - stack_size;
static void* tls[BIONIC_TLS_SLOTS];
static pthread_internal_t thread;

53
libc/bionic/name_mem.c Normal file
View File

@@ -0,0 +1,53 @@
/*
* Copyright (C) 2013 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "private/bionic_name_mem.h"
/*
* Local definitions of custom prctl arguments to set a vma name in some kernels
*/
#define BIONIC_PR_SET_VMA 0x53564d41
#define BIONIC_PR_SET_VMA_ANON_NAME 0
/*
* Names a region of memory. The name is expected to show up in /proc/pid/maps
* and /proc/pid/smaps. There is no guarantee that it will work, and it if it
* does work it is likely to only work on memory that was allocated with
* mmap(MAP_ANONYMOUS), and only on regions that are page aligned. name should
* be a pointer to a string that is valid for as long as the memory is mapped,
* preferably a compile-time constant string.
*
* Returns -1 on error and sets errno. If it returns an error naming page
* aligned anonymous memory the kernel doesn't support naming, and an alternate
* method of naming memory should be used (like ashmem).
*/
int __bionic_name_mem(void *addr, size_t len, const char *name)
{
return prctl(BIONIC_PR_SET_VMA, BIONIC_PR_SET_VMA_ANON_NAME,
addr, len, name);
}

View File

@@ -325,8 +325,6 @@ static void *to_prop_obj(prop_off_t off)
{
if (off > pa_data_size)
return NULL;
if (!__system_property_area__)
return NULL;
return __system_property_area__->data + off;
}
@@ -386,8 +384,6 @@ static const prop_info *find_property(prop_bt *trie, const char *name,
{
const char *remaining_name = name;
if (!trie) return NULL;
while (true) {
char *sep = strchr(remaining_name, '.');
bool want_subtree = (sep != NULL);

View File

@@ -43,11 +43,11 @@ struct dl_phdr_info {
ElfW(Half) dlpi_phnum;
};
int dl_iterate_phdr(int (*cb)(struct dl_phdr_info*, size_t, void*), void*);
#ifdef __arm__
typedef long unsigned int* _Unwind_Ptr;
_Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr pc, int* pcount);
#else
int dl_iterate_phdr(int (*cb)(struct dl_phdr_info*, size_t, void*), void*);
#endif
__END_DECLS

View File

@@ -207,13 +207,13 @@ void endprotoent(void);
void endservent(void);
void freehostent(struct hostent *);
struct hostent *gethostbyaddr(const void *, socklen_t, int);
struct hostent *android_gethostbyaddrforiface(const void *, socklen_t, int, const char*);
struct hostent *android_gethostbyaddrforiface(const void *, socklen_t, int, const char*, int);
int gethostbyaddr_r(const void *, int, int, struct hostent *, char *, size_t, struct hostent **, int *);
struct hostent *gethostbyname(const char *);
int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
struct hostent *gethostbyname2(const char *, int);
int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *);
struct hostent *android_gethostbynameforiface(const char *, int, const char *);
struct hostent *android_gethostbynameforiface(const char *, int, const char *, int);
struct hostent *gethostent(void);
int gethostent_r(struct hostent *, char *, size_t, struct hostent **, int *);
struct hostent *getipnodebyaddr(const void *, size_t, int, int *);
@@ -241,9 +241,9 @@ void sethostent(int);
void setnetent(int);
void setprotoent(int);
int getaddrinfo(const char *, const char *, const struct addrinfo *, struct addrinfo **);
int android_getaddrinfoforiface(const char *, const char *, const struct addrinfo *, const char *, struct addrinfo **);
int android_getaddrinfoforiface(const char *, const char *, const struct addrinfo *, const char *, int, struct addrinfo **);
int getnameinfo(const struct sockaddr *, socklen_t, char *, size_t, char *, size_t, int);
int android_getnameinfoforiface(const struct sockaddr *, socklen_t, char *, size_t, char *, size_t, int, const char *);
int android_getnameinfoforiface(const struct sockaddr *, socklen_t, char *, size_t, char *, size_t, int, const char *, int);
void freeaddrinfo(struct addrinfo *);
const char *gai_strerror(int);
void setnetgrent(const char *);

View File

@@ -46,8 +46,6 @@ extern void memswap(void *, void *, size_t);
extern char* index(const char *, int) __purefunc;
extern char* strchr(const char *, int) __purefunc;
extern char* __strchr_chk(const char *, int, size_t);
extern char* strrchr(const char *, int) __purefunc;
extern size_t strlen(const char *) __purefunc;
@@ -96,8 +94,8 @@ __BIONIC_FORTIFY_INLINE
void* memcpy(void* __restrict dest, const void* __restrict src, size_t copy_amount) {
char *d = (char *) dest;
const char *s = (const char *) src;
size_t s_len = __bos0(s);
size_t d_len = __bos0(d);
size_t s_len = __builtin_object_size(s, 0);
size_t d_len = __builtin_object_size(d, 0);
if (__builtin_constant_p(copy_amount) && (copy_amount > d_len)) {
__memcpy_dest_size_error();
@@ -112,7 +110,7 @@ void* memcpy(void* __restrict dest, const void* __restrict src, size_t copy_amou
__BIONIC_FORTIFY_INLINE
void* memmove(void *dest, const void *src, size_t len) {
return __builtin___memmove_chk(dest, src, len, __bos0(dest));
return __builtin___memmove_chk(dest, src, len, __builtin_object_size (dest, 0));
}
__BIONIC_FORTIFY_INLINE
@@ -121,26 +119,14 @@ char* strcpy(char* __restrict dest, const char* __restrict src) {
}
__errordecl(__strncpy_error, "strncpy called with size bigger than buffer");
extern char* __strncpy_chk2(char* __restrict, const char* __restrict, size_t, size_t, size_t);
__BIONIC_FORTIFY_INLINE
char* strncpy(char* __restrict dest, const char* __restrict src, size_t n) {
size_t bos_dest = __bos(dest);
size_t bos_src = __bos(src);
if (__builtin_constant_p(n) && (n > bos_dest)) {
size_t bos = __bos(dest);
if (__builtin_constant_p(n) && (n > bos)) {
__strncpy_error();
}
if (bos_src == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
return __builtin___strncpy_chk(dest, src, n, bos_dest);
}
size_t slen = __builtin_strlen(src);
if (__builtin_constant_p(slen)) {
return __builtin___strncpy_chk(dest, src, n, bos_dest);
}
return __strncpy_chk2(dest, src, n, bos_dest, bos_src);
return __builtin___strncpy_chk(dest, src, n, bos);
}
__BIONIC_FORTIFY_INLINE
@@ -155,7 +141,7 @@ char *strncat(char* __restrict dest, const char* __restrict src, size_t n) {
__BIONIC_FORTIFY_INLINE
void* memset(void *s, int c, size_t n) {
return __builtin___memset_chk(s, c, n, __bos0(s));
return __builtin___memset_chk(s, c, n, __builtin_object_size (s, 0));
}
extern size_t __strlcpy_real(char* __restrict, const char* __restrict, size_t)
@@ -240,6 +226,8 @@ size_t strlen(const char *s) {
return __strlen_chk(s, bos);
}
extern char* __strchr_chk(const char *, int, size_t);
__BIONIC_FORTIFY_INLINE
char* strchr(const char *s, int c) {
size_t bos = __bos(s);

View File

@@ -526,14 +526,6 @@
#define __BIONIC__ 1
#include <android/api-level.h>
/*
* When _FORTIFY_SOURCE is defined, automatic bounds checking is
* added to commonly used libc functions. If a buffer overrun is
* detected, the program is safely aborted.
*
* See
* http://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html for details.
*/
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
#define __BIONIC_FORTIFY 1
#if _FORTIFY_SOURCE == 2
@@ -541,7 +533,6 @@
#else
#define __bos(s) __builtin_object_size((s), 0)
#endif
#define __bos0(s) __builtin_object_size((s), 0)
#define __BIONIC_FORTIFY_INLINE \
extern inline \

File diff suppressed because it is too large Load Diff

View File

@@ -1,24 +0,0 @@
/****************************************************************************
****************************************************************************
***
*** This header was automatically generated from a Linux kernel header
*** of the same name, to make information necessary for userspace to
*** call into the kernel available to libc. It contains only constants,
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef LINUX_KEXEC_H
#define LINUX_KEXEC_H
struct pt_regs;
struct task_struct;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif

View File

@@ -0,0 +1,49 @@
/****************************************************************************
****************************************************************************
***
*** This header was automatically generated from a Linux kernel header
*** of the same name, to make information necessary for userspace to
*** call into the kernel available to libc. It contains only constants,
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef _UAPILINUX_KEXEC_H
#define _UAPILINUX_KEXEC_H
#include <linux/types.h>
#define KEXEC_ON_CRASH 0x00000001
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define KEXEC_PRESERVE_CONTEXT 0x00000002
#define KEXEC_ARCH_MASK 0xffff0000
#define KEXEC_ARCH_DEFAULT ( 0 << 16)
#define KEXEC_ARCH_386 ( 3 << 16)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define KEXEC_ARCH_X86_64 (62 << 16)
#define KEXEC_ARCH_PPC (20 << 16)
#define KEXEC_ARCH_PPC64 (21 << 16)
#define KEXEC_ARCH_IA_64 (50 << 16)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define KEXEC_ARCH_ARM (40 << 16)
#define KEXEC_ARCH_S390 (22 << 16)
#define KEXEC_ARCH_SH (42 << 16)
#define KEXEC_ARCH_MIPS_LE (10 << 16)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define KEXEC_ARCH_MIPS ( 8 << 16)
#define KEXEC_SEGMENT_MAX 16
struct kexec_segment {
const void *buf;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
size_t bufsz;
const void *mem;
size_t memsz;
};
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif

View File

@@ -126,7 +126,7 @@ static struct hostent *_gethtbyname2(const char *, int);
static int _dns_gethtbyaddr(void *, void *, va_list);
static int _dns_gethtbyname(void *, void *, va_list);
static struct hostent *gethostbyname_internal(const char *, int, res_state, const char *);
static struct hostent *gethostbyname_internal(const char *, int, res_state, const char *, int);
static const ns_src default_dns_files[] = {
{ NSSRC_FILES, NS_SUCCESS },
@@ -497,13 +497,13 @@ gethostbyname(const char *name)
/* try IPv6 first - if that fails do IPv4 */
if (res->options & RES_USE_INET6) {
hp = gethostbyname_internal(name, AF_INET6, res, NULL);
hp = gethostbyname_internal(name, AF_INET6, res, NULL, 0);
if (hp) {
__res_put_state(res);
return hp;
}
}
hp = gethostbyname_internal(name, AF_INET, res, NULL);
hp = gethostbyname_internal(name, AF_INET, res, NULL, 0);
__res_put_state(res);
return hp;
}
@@ -511,18 +511,18 @@ gethostbyname(const char *name)
struct hostent *
gethostbyname2(const char *name, int af)
{
return android_gethostbynameforiface(name, af, NULL);
return android_gethostbynameforiface(name, af, NULL, 0);
}
struct hostent *
android_gethostbynameforiface(const char *name, int af, const char *iface)
android_gethostbynameforiface(const char *name, int af, const char *iface, int mark)
{
struct hostent *hp;
res_state res = __res_get_state();
if (res == NULL)
return NULL;
hp = gethostbyname_internal(name, af, res, iface);
hp = gethostbyname_internal(name, af, res, iface, mark);
__res_put_state(res);
return hp;
}
@@ -741,7 +741,7 @@ gethostbyname_internal_real(const char *name, int af, res_state res)
// very similar in proxy-ness to android_getaddrinfo_proxy
static struct hostent *
gethostbyname_internal(const char *name, int af, res_state res, const char *iface)
gethostbyname_internal(const char *name, int af, res_state res, const char *iface, int mark)
{
const char *cache_mode = getenv("ANDROID_DNS_MODE");
FILE* proxy = NULL;
@@ -749,6 +749,7 @@ gethostbyname_internal(const char *name, int af, res_state res, const char *ifac
if (cache_mode != NULL && strcmp(cache_mode, "local") == 0) {
res_setiface(res, iface);
res_setmark(res, mark);
return gethostbyname_internal_real(name, af, res);
}
@@ -780,7 +781,7 @@ exit:
struct hostent *
android_gethostbyaddrforiface_proxy(const void *addr,
socklen_t len, int af, const char* iface)
socklen_t len, int af, const char* iface, int mark)
{
struct hostent *result = NULL;
FILE* proxy = android_open_proxy();
@@ -810,7 +811,7 @@ exit:
struct hostent *
android_gethostbyaddrforiface_real(const void *addr,
socklen_t len, int af, const char* iface)
socklen_t len, int af, const char* iface, int mark)
{
const u_char *uaddr = (const u_char *)addr;
socklen_t size;
@@ -858,28 +859,28 @@ android_gethostbyaddrforiface_real(const void *addr,
hp = NULL;
h_errno = NETDB_INTERNAL;
if (nsdispatch(&hp, dtab, NSDB_HOSTS, "gethostbyaddr",
default_dns_files, uaddr, len, af, iface) != NS_SUCCESS)
default_dns_files, uaddr, len, af, iface, mark) != NS_SUCCESS)
return NULL;
h_errno = NETDB_SUCCESS;
return hp;
}
struct hostent *
android_gethostbyaddrforiface(const void *addr, socklen_t len, int af, const char* iface)
android_gethostbyaddrforiface(const void *addr, socklen_t len, int af, const char* iface, int mark)
{
const char *cache_mode = getenv("ANDROID_DNS_MODE");
if (cache_mode == NULL || strcmp(cache_mode, "local") != 0) {
return android_gethostbyaddrforiface_proxy(addr, len, af, iface);
return android_gethostbyaddrforiface_proxy(addr, len, af, iface, mark);
} else {
return android_gethostbyaddrforiface_real(addr,len, af,iface);
return android_gethostbyaddrforiface_real(addr,len, af, iface, mark);
}
}
struct hostent *
gethostbyaddr(const void *addr, socklen_t len, int af)
{
return android_gethostbyaddrforiface(addr, len, af, NULL);
return android_gethostbyaddrforiface(addr, len, af, NULL, 0);
}
@@ -1315,6 +1316,7 @@ _dns_gethtbyaddr(void *rv, void *cb_data, va_list ap)
int len, af, advance;
res_state res;
const char* iface;
int mark;
res_static rs = __res_get_static();
assert(rv != NULL);
@@ -1323,6 +1325,7 @@ _dns_gethtbyaddr(void *rv, void *cb_data, va_list ap)
len = va_arg(ap, int);
af = va_arg(ap, int);
iface = va_arg(ap, char *);
mark = va_arg(ap, int);
switch (af) {
case AF_INET:
@@ -1365,6 +1368,7 @@ _dns_gethtbyaddr(void *rv, void *cb_data, va_list ap)
return NS_NOTFOUND;
}
res_setiface(res, iface);
res_setmark(res, mark);
n = res_nquery(res, qbuf, C_IN, T_PTR, buf->buf, sizeof(buf->buf));
if (n < 0) {
free(buf);

View File

@@ -215,7 +215,7 @@ struct res_target {
static int str2number(const char *);
static int explore_fqdn(const struct addrinfo *, const char *,
const char *, struct addrinfo **, const char *iface);
const char *, struct addrinfo **, const char *iface, int mark);
static int explore_null(const struct addrinfo *,
const char *, struct addrinfo **);
static int explore_numeric(const struct addrinfo *, const char *,
@@ -578,12 +578,12 @@ int
getaddrinfo(const char *hostname, const char *servname,
const struct addrinfo *hints, struct addrinfo **res)
{
return android_getaddrinfoforiface(hostname, servname, hints, NULL, res);
return android_getaddrinfoforiface(hostname, servname, hints, NULL, 0, res);
}
int
android_getaddrinfoforiface(const char *hostname, const char *servname,
const struct addrinfo *hints, const char *iface, struct addrinfo **res)
const struct addrinfo *hints, const char *iface, int mark, struct addrinfo **res)
{
struct addrinfo sentinel;
struct addrinfo *cur;
@@ -762,7 +762,7 @@ android_getaddrinfoforiface(const char *hostname, const char *servname,
pai->ai_protocol = ex->e_protocol;
error = explore_fqdn(pai, hostname, servname,
&cur->ai_next, iface);
&cur->ai_next, iface, mark);
while (cur && cur->ai_next)
cur = cur->ai_next;
@@ -795,7 +795,7 @@ android_getaddrinfoforiface(const char *hostname, const char *servname,
*/
static int
explore_fqdn(const struct addrinfo *pai, const char *hostname,
const char *servname, struct addrinfo **res, const char *iface)
const char *servname, struct addrinfo **res, const char *iface, int mark)
{
struct addrinfo *result;
struct addrinfo *cur;
@@ -821,7 +821,7 @@ explore_fqdn(const struct addrinfo *pai, const char *hostname,
return 0;
switch (nsdispatch(&result, dtab, NSDB_HOSTS, "getaddrinfo",
default_dns_files, hostname, pai, iface)) {
default_dns_files, hostname, pai, iface, mark)) {
case NS_TRYAGAIN:
error = EAI_AGAIN;
goto free;
@@ -1892,10 +1892,12 @@ _dns_getaddrinfo(void *rv, void *cb_data, va_list ap)
struct res_target q, q2;
res_state res;
const char* iface;
int mark;
name = va_arg(ap, char *);
pai = va_arg(ap, const struct addrinfo *);
iface = va_arg(ap, char *);
mark = va_arg(ap, int);
//fprintf(stderr, "_dns_getaddrinfo() name = '%s'\n", name);
memset(&q, 0, sizeof(q));
@@ -1983,6 +1985,7 @@ _dns_getaddrinfo(void *rv, void *cb_data, va_list ap)
* and have a cache hit that would be wasted, so we do the rest there on miss
*/
res_setiface(res, iface);
res_setmark(res, mark);
if (res_searchN(name, &q, res) < 0) {
__res_put_state(res);
free(buf);

View File

@@ -93,7 +93,7 @@ struct sockinet {
};
static int getnameinfo_inet(const struct sockaddr *, socklen_t, char *,
socklen_t, char *, socklen_t, int, const char*);
socklen_t, char *, socklen_t, int, const char*, int);
#ifdef INET6
static int ip6_parsenumeric(const struct sockaddr *, const char *, char *,
socklen_t, int);
@@ -108,16 +108,16 @@ static int getnameinfo_local(const struct sockaddr *, socklen_t, char *,
*/
int getnameinfo(const struct sockaddr* sa, socklen_t salen, char* host, size_t hostlen, char* serv, size_t servlen, int flags)
{
return android_getnameinfoforiface(sa, salen, host, hostlen, serv, servlen, flags, NULL);
return android_getnameinfoforiface(sa, salen, host, hostlen, serv, servlen, flags, NULL, 0);
}
int android_getnameinfoforiface(const struct sockaddr* sa, socklen_t salen, char* host, size_t hostlen, char* serv, size_t servlen, int flags, const char* iface)
int android_getnameinfoforiface(const struct sockaddr* sa, socklen_t salen, char* host, size_t hostlen, char* serv, size_t servlen, int flags, const char* iface, int mark)
{
switch (sa->sa_family) {
case AF_INET:
case AF_INET6:
return getnameinfo_inet(sa, salen, host, hostlen,
serv, servlen, flags, iface);
serv, servlen, flags, iface, mark);
case AF_LOCAL:
return getnameinfo_local(sa, salen, host, hostlen,
serv, servlen, flags);
@@ -158,10 +158,10 @@ getnameinfo_local(const struct sockaddr *sa, socklen_t salen,
* the address. On failure -1 is returned in which case
* normal execution flow shall continue. */
static int
android_gethostbyaddr_proxy(char* nameBuf, size_t nameBufLen, const void *addr, socklen_t addrLen, int addrFamily, const char* iface)
android_gethostbyaddr_proxy(char* nameBuf, size_t nameBufLen, const void *addr, socklen_t addrLen, int addrFamily, const char* iface, int mark)
{
struct hostent *hostResult =
android_gethostbyaddrforiface_proxy(addr, addrLen, addrFamily, iface);
android_gethostbyaddrforiface_proxy(addr, addrLen, addrFamily, iface, mark);
if (hostResult == NULL) return 0;
@@ -179,7 +179,7 @@ static int
getnameinfo_inet(const struct sockaddr* sa, socklen_t salen,
char *host, socklen_t hostlen,
char *serv, socklen_t servlen,
int flags, const char* iface)
int flags, const char* iface, int mark)
{
const struct afd *afd;
struct servent *sp;
@@ -321,14 +321,15 @@ getnameinfo_inet(const struct sockaddr* sa, socklen_t salen,
char android_proxy_buf[MAXDNAME];
int hostnamelen = android_gethostbyaddr_proxy(android_proxy_buf,
MAXDNAME, addr, afd->a_addrlen, afd->a_af, iface);
MAXDNAME, addr, afd->a_addrlen, afd->a_af, iface, mark);
if (hostnamelen > 0) {
hp = &android_proxy_hostent;
hp->h_name = android_proxy_buf;
} else if (!hostnamelen) {
hp = NULL;
} else {
hp = android_gethostbyaddrforiface(addr, afd->a_addrlen, afd->a_af, iface);
hp = android_gethostbyaddrforiface(addr, afd->a_addrlen, afd->a_af,
iface, mark);
}
if (hp) {

View File

@@ -1258,6 +1258,12 @@ typedef struct resolv_pidiface_info {
char ifname[IF_NAMESIZE + 1];
struct resolv_pidiface_info* next;
} PidIfaceInfo;
typedef struct resolv_uidiface_info {
int uid_start;
int uid_end;
char ifname[IF_NAMESIZE + 1];
struct resolv_uidiface_info* next;
} UidIfaceInfo;
#define HTABLE_VALID(x) ((x) != NULL && (x) != HTABLE_DELETED)
@@ -1796,6 +1802,9 @@ static struct resolv_cache_info _res_cache_list;
// List of pid iface pairs
static struct resolv_pidiface_info _res_pidiface_list;
// List of uid iface pairs
static struct resolv_uidiface_info _res_uidiface_list;
// name of the current default inteface
static char _res_default_ifname[IF_NAMESIZE + 1];
@@ -1805,6 +1814,9 @@ static pthread_mutex_t _res_cache_list_lock;
// lock protecting the _res_pid_iface_list
static pthread_mutex_t _res_pidiface_list_lock;
// lock protecting the _res_uidiface_list
static pthread_mutex_t _res_uidiface_list_lock;
/* lookup the default interface name */
static char *_get_default_iface_locked();
/* find the first cache that has an associated interface and return the name of the interface */
@@ -1833,12 +1845,17 @@ static struct in_addr* _get_addr_locked(const char * ifname);
/* return 1 if the provided list of name servers differs from the list of name servers
* currently attached to the provided cache_info */
static int _resolv_is_nameservers_equal_locked(struct resolv_cache_info* cache_info,
char** servers, int numservers);
const char** servers, int numservers);
/* remove a resolv_pidiface_info structure from _res_pidiface_list */
static void _remove_pidiface_info_locked(int pid);
/* get a resolv_pidiface_info structure from _res_pidiface_list with a certain pid */
static struct resolv_pidiface_info* _get_pid_iface_info_locked(int pid);
/* remove a resolv_pidiface_info structure from _res_uidiface_list */
static int _remove_uidiface_info_locked(const char* iface, int uid_start, int uid_end);
/* get a resolv_uidiface_info structure from _res_uidiface_list with a certain uid */
static struct resolv_uidiface_info* _get_uid_iface_info_locked(int uid);
static void
_res_cache_init(void)
{
@@ -1852,8 +1869,10 @@ _res_cache_init(void)
memset(&_res_default_ifname, 0, sizeof(_res_default_ifname));
memset(&_res_cache_list, 0, sizeof(_res_cache_list));
memset(&_res_pidiface_list, 0, sizeof(_res_pidiface_list));
memset(&_res_uidiface_list, 0, sizeof(_res_uidiface_list));
pthread_mutex_init(&_res_cache_list_lock, NULL);
pthread_mutex_init(&_res_pidiface_list_lock, NULL);
pthread_mutex_init(&_res_uidiface_list_lock, NULL);
}
struct resolv_cache*
@@ -2076,7 +2095,7 @@ _resolv_set_default_iface(const char* ifname)
}
void
_resolv_set_nameservers_for_iface(const char* ifname, char** servers, int numservers,
_resolv_set_nameservers_for_iface(const char* ifname, const char** servers, int numservers,
const char *domains)
{
int i, rt, index;
@@ -2149,7 +2168,7 @@ _resolv_set_nameservers_for_iface(const char* ifname, char** servers, int numser
static int
_resolv_is_nameservers_equal_locked(struct resolv_cache_info* cache_info,
char** servers, int numservers)
const char** servers, int numservers)
{
int i;
char** ns;
@@ -2271,8 +2290,8 @@ _resolv_set_addr_of_iface(const char* ifname, struct in_addr* addr)
memcpy(&cache_info->ifaddr, addr, sizeof(*addr));
if (DEBUG) {
char* addr_s = inet_ntoa(cache_info->ifaddr);
XLOG("address of interface %s is %s\n", ifname, addr_s);
XLOG("address of interface %s is %s\n",
ifname, inet_ntoa(cache_info->ifaddr));
}
}
pthread_mutex_unlock(&_res_cache_list_lock);
@@ -2411,20 +2430,157 @@ _resolv_get_pids_associated_interface(int pid, char* buff, int buffLen)
return len;
}
int
_resolv_get_default_iface(char* buff, int buffLen)
static int
_remove_uidiface_info_locked(const char* ifname, int uid_start, int uid_end) {
struct resolv_uidiface_info* result = _res_uidiface_list.next;
struct resolv_uidiface_info* prev = &_res_uidiface_list;
while (result != NULL && !(result->uid_start == uid_start && result->uid_end == uid_end &&
!strcmp(result->ifname, ifname))) {
prev = result;
result = result->next;
}
if (prev != NULL && result != NULL) {
prev->next = result->next;
free(result);
return 0;
}
errno = EINVAL;
return -1;
}
static struct resolv_uidiface_info*
_get_uid_iface_info_locked(int uid)
{
struct resolv_uidiface_info* result = _res_uidiface_list.next;
while (result != NULL && !(result->uid_start <= uid && result->uid_end >= uid)) {
result = result->next;
}
return result;
}
void
_resolv_clear_iface_uid_range_mapping()
{
pthread_once(&_res_cache_once, _res_cache_init);
pthread_mutex_lock(&_res_uidiface_list_lock);
struct resolv_uidiface_info *current = _res_uidiface_list.next;
struct resolv_uidiface_info *next;
while (current != NULL) {
next = current->next;
free(current);
current = next;
}
_res_uidiface_list.next = NULL;
pthread_mutex_unlock(&_res_uidiface_list_lock);
}
void
_resolv_clear_iface_pid_mapping()
{
pthread_once(&_res_cache_once, _res_cache_init);
pthread_mutex_lock(&_res_pidiface_list_lock);
struct resolv_pidiface_info *current = _res_pidiface_list.next;
struct resolv_pidiface_info *next;
while (current != NULL) {
next = current->next;
free(current);
current = next;
}
_res_pidiface_list.next = NULL;
pthread_mutex_unlock(&_res_pidiface_list_lock);
}
int
_resolv_set_iface_for_uid_range(const char* ifname, int uid_start, int uid_end)
{
int rv = 0;
struct resolv_uidiface_info* uidiface_info;
// make sure the uid iface list is created
pthread_once(&_res_cache_once, _res_cache_init);
if (uid_start > uid_end) {
errno = EINVAL;
return -1;
}
pthread_mutex_lock(&_res_uidiface_list_lock);
uidiface_info = calloc(sizeof(*uidiface_info), 1);
if (uidiface_info) {
uidiface_info->uid_start = uid_start;
uidiface_info->uid_end = uid_end;
int len = sizeof(uidiface_info->ifname);
strncpy(uidiface_info->ifname, ifname, len - 1);
uidiface_info->ifname[len - 1] = '\0';
uidiface_info->next = _res_uidiface_list.next;
_res_uidiface_list.next = uidiface_info;
XLOG("_resolv_set_iface_for_uid_range: [%d,%d], iface %s\n", uid_start, uid_end,
ifname);
} else {
XLOG("_resolv_set_iface_for_uid_range failing calloc\n");
rv = -1;
errno = EINVAL;
}
pthread_mutex_unlock(&_res_uidiface_list_lock);
return rv;
}
int
_resolv_clear_iface_for_uid_range(const char* ifname, int uid_start, int uid_end)
{
pthread_once(&_res_cache_once, _res_cache_init);
pthread_mutex_lock(&_res_uidiface_list_lock);
int rv = _remove_uidiface_info_locked(ifname, uid_start, uid_end);
XLOG("_resolv_clear_iface_for_uid_range: [%d,%d] iface %s\n", uid_start, uid_end, ifname);
pthread_mutex_unlock(&_res_uidiface_list_lock);
return rv;
}
int
_resolv_get_uids_associated_interface(int uid, char* buff, int buffLen)
{
char* ifname;
int len = 0;
if (!buff || buffLen == 0) {
if (!buff) {
return -1;
}
pthread_once(&_res_cache_once, _res_cache_init);
pthread_mutex_lock(&_res_uidiface_list_lock);
struct resolv_uidiface_info* uidiface_info = _get_uid_iface_info_locked(uid);
buff[0] = '\0';
if (uidiface_info) {
len = strlen(uidiface_info->ifname);
if (len < buffLen) {
strncpy(buff, uidiface_info->ifname, len);
buff[len] = '\0';
}
}
XLOG("_resolv_get_uids_associated_interface buff: %s\n", buff);
pthread_mutex_unlock(&_res_uidiface_list_lock);
return len;
}
size_t
_resolv_get_default_iface(char* buff, size_t buffLen)
{
if (!buff || buffLen == 0) {
return 0;
}
pthread_once(&_res_cache_once, _res_cache_init);
pthread_mutex_lock(&_res_cache_list_lock);
ifname = _get_default_iface_locked(); // never null, but may be empty
char* ifname = _get_default_iface_locked(); // never null, but may be empty
// if default interface not set give up.
if (ifname[0] == '\0') {
@@ -2432,7 +2588,7 @@ _resolv_get_default_iface(char* buff, int buffLen)
return 0;
}
len = strlen(ifname);
size_t len = strlen(ifname);
if (len < buffLen) {
strncpy(buff, ifname, len);
buff[len] = '\0';
@@ -2445,28 +2601,32 @@ _resolv_get_default_iface(char* buff, int buffLen)
return len;
}
int
void
_resolv_populate_res_for_iface(res_state statp)
{
int nserv;
struct resolv_cache_info* info = NULL;
if (statp == NULL) {
return;
}
if (statp) {
if (statp->iface[0] == '\0') { // no interface set assign default
size_t if_len = _resolv_get_default_iface(statp->iface, sizeof(statp->iface));
if (if_len + 1 > sizeof(statp->iface)) {
XLOG("%s: INTERNAL_ERROR: can't fit interface name into statp->iface.\n", __FUNCTION__);
return;
}
if (if_len == 0) {
XLOG("%s: INTERNAL_ERROR: can't find any suitable interfaces.\n", __FUNCTION__);
return;
}
}
pthread_once(&_res_cache_once, _res_cache_init);
pthread_mutex_lock(&_res_cache_list_lock);
struct resolv_cache_info* info = _find_cache_info_locked(statp->iface);
if (info != NULL) {
int nserv;
struct addrinfo* ai;
if (statp->iface[0] == '\0') { // no interface set assign default
_resolv_get_default_iface(statp->iface, sizeof(statp->iface));
}
pthread_once(&_res_cache_once, _res_cache_init);
pthread_mutex_lock(&_res_cache_list_lock);
info = _find_cache_info_locked(statp->iface);
if (info == NULL) {
pthread_mutex_unlock(&_res_cache_list_lock);
return 0;
}
XLOG("_resolv_populate_res_for_iface: %s\n", statp->iface);
for (nserv = 0; nserv < MAXNS; nserv++) {
ai = info->nsaddrinfo[nserv];
@@ -2500,8 +2660,6 @@ _resolv_populate_res_for_iface(res_state statp)
while (pp < statp->dnsrch + MAXDNSRCH && *p != -1) {
*pp++ = &statp->defdname + *p++;
}
pthread_mutex_unlock(&_res_cache_list_lock);
}
return nserv;
pthread_mutex_unlock(&_res_cache_list_lock);
}

View File

@@ -806,4 +806,11 @@ void res_setiface(res_state statp, const char* iface)
}
}
}
void res_setmark(res_state statp, int mark)
{
if (statp != NULL) {
statp->_mark = mark;
}
}
#endif /* ANDROID_CHANGES */

View File

@@ -272,6 +272,15 @@ res_nsearch(res_state statp,
(dots && !trailing_dot && (statp->options & RES_DNSRCH) != 0U)) {
int done = 0;
/* Unfortunately we need to load interface info
* (dns servers, search domains) before
* the domain stuff is tried. Will have a better
* fix after thread pools are used as this will
* be loaded once for the thread instead of each
* time a query is tried.
*/
_resolv_populate_res_for_iface(statp);
for (domain = (const char * const *)statp->dnsrch;
*domain && !done;
domain++) {

View File

@@ -762,10 +762,13 @@ send_vc(res_state statp,
if (statp->_vcsock >= 0 && (statp->_flags & RES_F_VC) != 0) {
struct sockaddr_storage peer;
socklen_t size = sizeof peer;
int old_mark;
int mark_size = sizeof(old_mark);
if (getpeername(statp->_vcsock,
(struct sockaddr *)(void *)&peer, &size) < 0 ||
!sock_eq((struct sockaddr *)(void *)&peer, nsap)) {
!sock_eq((struct sockaddr *)(void *)&peer, nsap) ||
getsockopt(statp->_vcsock, SOL_SOCKET, SO_MARK, &old_mark, &mark_size) < 0 ||
old_mark != statp->_mark) {
res_nclose(statp);
statp->_flags &= ~RES_F_VC;
}
@@ -795,6 +798,14 @@ send_vc(res_state statp,
return (-1);
}
}
if (statp->_mark != 0) {
if (setsockopt(statp->_vcsock, SOL_SOCKET,
SO_MARK, &statp->_mark, sizeof(statp->_mark)) < 0) {
*terrno = errno;
Perror(statp, stderr, "setsockopt", errno);
return -1;
}
}
errno = 0;
if (random_bind(statp->_vcsock,nsap->sa_family) < 0) {
*terrno = errno;
@@ -1070,6 +1081,14 @@ send_dg(res_state statp,
return (-1);
}
}
if (statp->_mark != 0) {
if (setsockopt(EXT(statp).nssocks[ns], SOL_SOCKET,
SO_MARK, &(statp->_mark), sizeof(statp->_mark)) < 0) {
res_nclose(statp);
return -1;
}
}
#ifndef CANNOT_CONNECT_DGRAM
/*
* On a 4.3BSD+ machine (client and server,
@@ -1097,6 +1116,7 @@ send_dg(res_state statp,
#endif /* !CANNOT_CONNECT_DGRAM */
Dprint(statp->options & RES_DEBUG,
(stdout, ";; new DG socket\n"))
}
s = EXT(statp).nssocks[ns];
#ifndef CANNOT_CONNECT_DGRAM

View File

@@ -0,0 +1,40 @@
/*
* Copyright (C) 2013 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _BIONIC_NAME_MEM_H
#define _BIONIC_NAME_MEM_H
#include <sys/cdefs.h>
#include <stddef.h>
__BEGIN_DECLS
int __bionic_name_mem(void *addr, size_t len, const char *name);
__END_DECLS
#endif

View File

@@ -28,6 +28,7 @@
#ifndef _RESOLV_CACHE_H_
#define _RESOLV_CACHE_H_
#include <stddef.h>
#include <sys/cdefs.h>
struct __res_state;
@@ -77,16 +78,17 @@ extern struct in_addr* _resolv_get_addr_of_default_iface();
__LIBC_HIDDEN__
extern struct in_addr* _resolv_get_addr_of_iface(const char* ifname);
/* Copy the name of the default interface to provided buffer.
* Return length of buffer on success on failure -1 is returned */
/* Copy the name of the default interface to the provided buffer.
* Returns the string length of the default interface,
* be that less or more than the buffLen, or 0 if nothing had been written */
__LIBC_HIDDEN__
extern int _resolv_get_default_iface(char* buff, int buffLen);
extern size_t _resolv_get_default_iface(char* buff, size_t buffLen);
/* sets the name server addresses to the provided res_state structure. The
* name servers are retrieved from the cache which is associated
* with the interface to which the res_state structure is associated */
__LIBC_HIDDEN__
extern int _resolv_populate_res_for_iface(struct __res_state* statp);
extern void _resolv_populate_res_for_iface(struct __res_state* statp);
typedef enum {
RESOLV_CACHE_UNSUPPORTED, /* the cache can't handle that kind of queries */

View File

@@ -48,7 +48,7 @@ __BEGIN_DECLS
extern void _resolv_set_default_iface(const char* ifname);
/* set name servers for an interface */
extern void _resolv_set_nameservers_for_iface(const char* ifname, char** servers, int numservers,
extern void _resolv_set_nameservers_for_iface(const char* ifname, const char** servers, int numservers,
const char *domains);
/* tell resolver of the address of an interface */
@@ -66,6 +66,9 @@ extern void _resolv_set_iface_for_pid(const char* ifname, int pid);
/* clear pid from being associated with an interface */
extern void _resolv_clear_iface_for_pid(int pid);
/* clear the entire mapping of pids to interfaces. */
extern void _resolv_clear_iface_pid_mapping();
/** Gets the name of the interface to which the pid is attached.
* On error, -1 is returned.
* If no interface is found, 0 is returned and buff is set to empty ('\0').
@@ -75,6 +78,27 @@ extern void _resolv_clear_iface_for_pid(int pid);
* buffLen Length of buff. An interface is at most IF_NAMESIZE in length */
extern int _resolv_get_pids_associated_interface(int pid, char* buff, int buffLen);
/** set a uid range to use the name servers of the specified interface */
extern int _resolv_set_iface_for_uid_range(const char* ifname, int uid_start, int uid_end);
/** Remove a mapping added by _resolv_set_iface_for_uid_range.
* If no such rule exists -1 is returned. */
extern int _resolv_clear_iface_for_uid_range(const char* ifname, int uid_start, int uid_end);
/* clear the entire mapping of uid ranges to interfaces. */
extern void _resolv_clear_iface_uid_range_mapping();
/** Gets the name of the interface to which the uid is attached.
* On error, -1 is returned.
* If no interface is found, 0 is returned and buff is set to empty ('\0').
* If an interface is found, the name is copied to buff and the length of the name is returned.
* If there are multiple rules covering uid the most recently added rule will be returned.
* Arguments: uid The uid to find an interface for
* buff A buffer to copy the result to
* buffLen Length of buff. An interface is at most IF_NAMESIZE in length */
extern int _resolv_get_uids_associated_interface(int uid, char* buff, int buffLen);
#endif /* _BIONIC_RESOLV_IFACE_FUNCTIONS_DECLARED */
__END_DECLS

View File

@@ -175,6 +175,7 @@ struct __res_state {
res_send_qhook qhook; /* query hook */
res_send_rhook rhook; /* response hook */
int res_h_errno; /* last one set for this context */
int _mark; /* If non-0 SET_MARK to _mark on all request sockets */
int _vcsock; /* PRIVATE: for res_send VC i/o */
u_int _flags; /* PRIVATE: see below */
u_int _pad; /* make _u 64 bit aligned */
@@ -490,6 +491,7 @@ int res_getservers(res_state,
union res_sockaddr_union *, int);
void res_setiface();
void res_setmark();
u_int res_randomid(void);
__END_DECLS

Binary file not shown.

View File

@@ -30,8 +30,12 @@ void android_update_LD_LIBRARY_PATH(const char* ld_library_path) { }
void *dl_unwind_find_exidx(void *pc, int *pcount) { return 0; }
#endif
#elif defined(__i386__) || defined(__mips__)
/* we munge the cb definition so we don't have to include any headers here.
* It won't affect anything since these are just symbols anyway */
int dl_iterate_phdr(int (*cb)(void *info, void *size, void *data), void *data) { return 0; }
#else
#error Unsupported architecture. Only mips, arm and x86 are supported.
#endif

View File

@@ -146,10 +146,11 @@ int dlclose(void* handle) {
}
#if defined(ANDROID_ARM_LINKER)
// 0000000 00011111 111112 22222222 2333333 3333444444444455555555556666666 6667777777777888 8888888
// 0123456 78901234 567890 12345678 9012345 6789012345678901234567890123456 7890123456789012 3456789
// 0000000 00011111 111112 22222222 2333333 3333444444444455555555556666666 6667
// 0123456 78901234 567890 12345678 9012345 6789012345678901234567890123456 7890
#define ANDROID_LIBDL_STRTAB \
"dlopen\0dlclose\0dlsym\0dlerror\0dladdr\0android_update_LD_LIBRARY_PATH\0dl_iterate_phdr\0dl_unwind_find_exidx\0"
"dlopen\0dlclose\0dlsym\0dlerror\0dladdr\0android_update_LD_LIBRARY_PATH\0dl_unwind_find_exidx\0"
#elif defined(ANDROID_X86_LINKER) || defined(ANDROID_MIPS_LINKER)
// 0000000 00011111 111112 22222222 2333333 3333444444444455555555556666666 6667
// 0123456 78901234 567890 12345678 9012345 6789012345678901234567890123456 7890
@@ -180,9 +181,10 @@ static Elf32_Sym gLibDlSymtab[] = {
ELF32_SYM_INITIALIZER(21, &dlerror, 1),
ELF32_SYM_INITIALIZER(29, &dladdr, 1),
ELF32_SYM_INITIALIZER(36, &android_update_LD_LIBRARY_PATH, 1),
ELF32_SYM_INITIALIZER(67, &dl_iterate_phdr, 1),
#if defined(ANDROID_ARM_LINKER)
ELF32_SYM_INITIALIZER(83, &dl_unwind_find_exidx, 1),
ELF32_SYM_INITIALIZER(67, &dl_unwind_find_exidx, 1),
#elif defined(ANDROID_X86_LINKER) || defined(ANDROID_MIPS_LINKER)
ELF32_SYM_INITIALIZER(67, &dl_iterate_phdr, 1),
#endif
};
@@ -205,11 +207,7 @@ static Elf32_Sym gLibDlSymtab[] = {
// Note that adding any new symbols here requires
// stubbing them out in libdl.
static unsigned gLibDlBuckets[1] = { 1 };
#if defined(ANDROID_ARM_LINKER)
static unsigned gLibDlChains[9] = { 0, 2, 3, 4, 5, 6, 7, 8, 0 };
#else
static unsigned gLibDlChains[8] = { 0, 2, 3, 4, 5, 6, 7, 0 };
#endif
// This is used by the dynamic linker. Every process gets these symbols for free.
soinfo libdl_info = {
@@ -225,8 +223,8 @@ soinfo libdl_info = {
strtab: ANDROID_LIBDL_STRTAB,
symtab: gLibDlSymtab,
nbucket: sizeof(gLibDlBuckets)/sizeof(unsigned),
nchain: sizeof(gLibDlChains)/sizeof(unsigned),
nbucket: 1,
nchain: 8,
bucket: gLibDlBuckets,
chain: gLibDlChains,

View File

@@ -414,7 +414,7 @@ _Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr pc, int *pcount)
return NULL;
}
#endif
#elif defined(ANDROID_X86_LINKER) || defined(ANDROID_MIPS_LINKER)
/* Here, we only have to provide a callback to iterate across all the
* loaded libraries. gcc_eh does the rest. */
@@ -437,6 +437,8 @@ dl_iterate_phdr(int (*cb)(dl_phdr_info *info, size_t size, void *data),
return rv;
}
#endif
static Elf32_Sym* soinfo_elf_lookup(soinfo* si, unsigned hash, const char* name) {
Elf32_Sym* symtab = si->symtab;
const char* strtab = si->strtab;

View File

@@ -147,8 +147,7 @@ bool ElfReader::ReadElfHeader() {
return false;
}
if (rc != sizeof(header_)) {
DL_ERR("\"%s\" is too small to be an ELF executable. Expected at least %d bytes, only found %d bytes.",
name_, sizeof(header_), rc);
DL_ERR("\"%s\" is too small to be an ELF executable", name_);
return false;
}
return true;

View File

@@ -48,19 +48,6 @@ TEST(DEATHTEST, strncpy_fortified2) {
}
#endif
#ifndef __clang__
// This test is disabled in clang because clang doesn't properly detect
// this buffer overflow. TODO: Fix clang.
TEST(DEATHTEST, strncpy2_fortified2) {
::testing::FLAGS_gtest_death_test_style = "threadsafe";
foo myfoo;
memset(&myfoo, 0, sizeof(myfoo));
myfoo.one[0] = 'A'; // not null terminated string
ASSERT_EXIT(strncpy(myfoo.b, myfoo.one, sizeof(myfoo.b)),
testing::KilledBySignal(SIGABRT), "");
}
#endif
#ifndef __clang__
// This test is disabled in clang because clang doesn't properly detect
// this buffer overflow. TODO: Fix clang.
@@ -494,14 +481,6 @@ TEST(DEATHTEST, strncpy_fortified) {
ASSERT_EXIT(strncpy(bufb, bufa, n), testing::KilledBySignal(SIGABRT), "");
}
TEST(DEATHTEST, strncpy2_fortified) {
::testing::FLAGS_gtest_death_test_style = "threadsafe";
char dest[11];
char src[10];
memcpy(src, "0123456789", sizeof(src)); // src is not null terminated
ASSERT_EXIT(strncpy(dest, src, sizeof(dest)), testing::KilledBySignal(SIGABRT), "");
}
TEST(DEATHTEST, snprintf_fortified) {
::testing::FLAGS_gtest_death_test_style = "threadsafe";
char bufa[15];
@@ -679,41 +658,56 @@ TEST(TEST_NAME, strcat2) {
ASSERT_EQ('\0', buf[9]);
}
TEST(TEST_NAME, strncpy) {
char src[10];
char dst[10];
memcpy(src, "0123456789", sizeof(src)); // non null terminated string
strncpy(dst, src, sizeof(dst));
ASSERT_EQ('0', dst[0]);
ASSERT_EQ('1', dst[1]);
ASSERT_EQ('2', dst[2]);
ASSERT_EQ('3', dst[3]);
ASSERT_EQ('4', dst[4]);
ASSERT_EQ('5', dst[5]);
ASSERT_EQ('6', dst[6]);
ASSERT_EQ('7', dst[7]);
ASSERT_EQ('8', dst[8]);
ASSERT_EQ('9', dst[9]);
TEST(TEST_NAME, strcat_chk_max_int_size) {
char buf[10];
memset(buf, 'A', sizeof(buf));
buf[0] = 'a';
buf[1] = '\0';
char* res = __strcat_chk(buf, "01234567", (size_t)-1);
ASSERT_EQ(buf, res);
ASSERT_EQ('a', buf[0]);
ASSERT_EQ('0', buf[1]);
ASSERT_EQ('1', buf[2]);
ASSERT_EQ('2', buf[3]);
ASSERT_EQ('3', buf[4]);
ASSERT_EQ('4', buf[5]);
ASSERT_EQ('5', buf[6]);
ASSERT_EQ('6', buf[7]);
ASSERT_EQ('7', buf[8]);
ASSERT_EQ('\0', buf[9]);
}
TEST(TEST_NAME, strncpy2) {
char src[10];
char dst[15];
memcpy(src, "012345678\0", sizeof(src));
strncpy(dst, src, sizeof(dst));
ASSERT_EQ('0', dst[0]);
ASSERT_EQ('1', dst[1]);
ASSERT_EQ('2', dst[2]);
ASSERT_EQ('3', dst[3]);
ASSERT_EQ('4', dst[4]);
ASSERT_EQ('5', dst[5]);
ASSERT_EQ('6', dst[6]);
ASSERT_EQ('7', dst[7]);
ASSERT_EQ('8', dst[8]);
ASSERT_EQ('\0', dst[9]);
ASSERT_EQ('\0', dst[10]);
ASSERT_EQ('\0', dst[11]);
ASSERT_EQ('\0', dst[12]);
ASSERT_EQ('\0', dst[13]);
ASSERT_EQ('\0', dst[14]);
extern "C" char* __strcpy_chk(char*, const char*, size_t);
TEST(TEST_NAME, strcpy_chk_max_int_size) {
char buf[10];
char* res = __strcpy_chk(buf, "012345678", (size_t)-1);
ASSERT_EQ(buf, res);
ASSERT_EQ('0', buf[0]);
ASSERT_EQ('1', buf[1]);
ASSERT_EQ('2', buf[2]);
ASSERT_EQ('3', buf[3]);
ASSERT_EQ('4', buf[4]);
ASSERT_EQ('5', buf[5]);
ASSERT_EQ('6', buf[6]);
ASSERT_EQ('7', buf[7]);
ASSERT_EQ('8', buf[8]);
ASSERT_EQ('\0', buf[9]);
}
extern "C" void* __memcpy_chk(void*, const void*, size_t, size_t);
TEST(TEST_NAME, memcpy_chk_max_int_size) {
char buf[10];
void* res = __memcpy_chk(buf, "012345678", sizeof(buf), (size_t)-1);
ASSERT_EQ((void*)buf, res);
ASSERT_EQ('0', buf[0]);
ASSERT_EQ('1', buf[1]);
ASSERT_EQ('2', buf[2]);
ASSERT_EQ('3', buf[3]);
ASSERT_EQ('4', buf[4]);
ASSERT_EQ('5', buf[5]);
ASSERT_EQ('6', buf[6]);
ASSERT_EQ('7', buf[7]);
ASSERT_EQ('8', buf[8]);
ASSERT_EQ('\0', buf[9]);
}

View File

@@ -198,6 +198,84 @@ TEST(properties, find_nth) {
ASSERT_EQ((const prop_info *)NULL, __system_property_find_nth(247));
}
static void hierarchical_test_callback(const prop_info *pi, void *cookie) {
bool (*ok)[8][8] = static_cast<bool (*)[8][8]>(cookie);
char name[PROP_NAME_MAX];
char value[PROP_VALUE_MAX];
__system_property_read(pi, name, value);
int name_i, name_j, name_k;
int value_i, value_j, value_k;
ASSERT_EQ(3, sscanf(name, "property_%d.%d.%d", &name_i, &name_j, &name_k));
ASSERT_EQ(3, sscanf(value, "value_%d.%d.%d", &value_i, &value_j, &value_k));
ASSERT_EQ(name_i, value_i);
ASSERT_GE(name_i, 0);
ASSERT_LT(name_i, 8);
ASSERT_EQ(name_j, value_j);
ASSERT_GE(name_j, 0);
ASSERT_LT(name_j, 8);
ASSERT_EQ(name_k, value_k);
ASSERT_GE(name_k, 0);
ASSERT_LT(name_k, 8);
ok[name_i][name_j][name_k] = true;
}
TEST(properties, fill_hierarchical) {
LocalPropertyTestState pa;
ASSERT_TRUE(pa.valid);
char prop_name[PROP_NAME_MAX];
char prop_value[PROP_VALUE_MAX];
char prop_value_ret[PROP_VALUE_MAX];
int ret;
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
for (int k = 0; k < 8; k++) {
ret = snprintf(prop_name, PROP_NAME_MAX - 1, "property_%d.%d.%d", i, j, k);
memset(prop_name + ret, 'a', PROP_NAME_MAX - 1 - ret);
ret = snprintf(prop_value, PROP_VALUE_MAX - 1, "value_%d.%d.%d", i, j, k);
memset(prop_value + ret, 'b', PROP_VALUE_MAX - 1 - ret);
prop_name[PROP_NAME_MAX - 1] = 0;
prop_value[PROP_VALUE_MAX - 1] = 0;
ASSERT_EQ(0, __system_property_add(prop_name, PROP_NAME_MAX - 1, prop_value, PROP_VALUE_MAX - 1));
}
}
}
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
for (int k = 0; k < 8; k++) {
ret = snprintf(prop_name, PROP_NAME_MAX - 1, "property_%d.%d.%d", i, j, k);
memset(prop_name + ret, 'a', PROP_NAME_MAX - 1 - ret);
ret = snprintf(prop_value, PROP_VALUE_MAX - 1, "value_%d.%d.%d", i, j, k);
memset(prop_value + ret, 'b', PROP_VALUE_MAX - 1 - ret);
prop_name[PROP_NAME_MAX - 1] = 0;
prop_value[PROP_VALUE_MAX - 1] = 0;
memset(prop_value_ret, '\0', PROP_VALUE_MAX);
ASSERT_EQ(PROP_VALUE_MAX - 1, __system_property_get(prop_name, prop_value_ret));
ASSERT_EQ(0, memcmp(prop_value, prop_value_ret, PROP_VALUE_MAX));
}
}
}
bool ok[8][8][8];
memset(ok, 0, sizeof(ok));
__system_property_foreach(hierarchical_test_callback, ok);
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
for (int k = 0; k < 8; k++) {
ASSERT_TRUE(ok[i][j][k]);
}
}
}
}
TEST(properties, errors) {
LocalPropertyTestState pa;
ASSERT_TRUE(pa.valid);