OSDN Git Service

android-x86/bionic.git
11 years agoam a289964b: am 227b47a4: Merge "resolv_private.h: remove #define b64_ntop and b64_pton"
Nick Kralevich [Fri, 28 Jun 2013 20:37:08 +0000 (13:37 -0700)]
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

11 years agoam 227b47a4: Merge "resolv_private.h: remove #define b64_ntop and b64_pton"
Nick Kralevich [Fri, 28 Jun 2013 20:32:43 +0000 (13:32 -0700)]
am 227b47a4: Merge "resolv_private.h: remove #define b64_ntop and b64_pton"

* commit '227b47a461b27d746b373feb66001cdddc9ba1db':
  resolv_private.h: remove #define b64_ntop and b64_pton

11 years agoMerge "resolv_private.h: remove #define b64_ntop and b64_pton"
Nick Kralevich [Fri, 28 Jun 2013 20:31:11 +0000 (20:31 +0000)]
Merge "resolv_private.h: remove #define b64_ntop and b64_pton"

11 years agoresolv_private.h: remove #define b64_ntop and b64_pton
Nick Kralevich [Fri, 28 Jun 2013 20:18:32 +0000 (13:18 -0700)]
resolv_private.h: remove #define b64_ntop and b64_pton

This was gated off of "#ifndef ADNROID_CHANGES" (note mispelling)
and is unconditionally defined in libc/include/resolv.h
(which this file includes). No need for duplicate definitions.

Change-Id: I00719bcf39eaa26eb96ab4274f171f3d2b5bae61

11 years agoam 2018cfa8: am 394df35e: Merge "Reorganize FORTIFY_SOURCE tests."
Nick Kralevich [Fri, 28 Jun 2013 20:15:39 +0000 (13:15 -0700)]
am 2018cfa8: am 394df35e: Merge "Reorganize FORTIFY_SOURCE tests."

* commit '2018cfa85d4c7f36316376f5b090be5f0d3d13dc':
  Reorganize FORTIFY_SOURCE tests.

11 years agoam 394df35e: Merge "Reorganize FORTIFY_SOURCE tests."
Nick Kralevich [Fri, 28 Jun 2013 20:11:14 +0000 (13:11 -0700)]
am 394df35e: Merge "Reorganize FORTIFY_SOURCE tests."

* commit '394df35e641816a3b9f0e065840b673dec9c73e5':
  Reorganize FORTIFY_SOURCE tests.

11 years agoMerge "Reorganize FORTIFY_SOURCE tests."
Nick Kralevich [Fri, 28 Jun 2013 20:05:57 +0000 (20:05 +0000)]
Merge "Reorganize FORTIFY_SOURCE tests."

11 years agoReorganize FORTIFY_SOURCE tests.
Nick Kralevich [Fri, 28 Jun 2013 17:34:09 +0000 (10:34 -0700)]
Reorganize FORTIFY_SOURCE tests.

Get rid of a lot of the duplication in the various FORTIFY_SOURCE
tests. Instead, we build 4 separate static libraries, with
4 different compile time options, and link them into the final test
binary.

Change-Id: Idb0b7cccc8dd837adb037bf4ddfe8942ae138230

11 years agoam f9ef0106: am 78a7bf99: Merge "stdio.h: enable vs?printf clang FORTIFY_SOURCE"
Nick Kralevich [Thu, 27 Jun 2013 17:18:17 +0000 (10:18 -0700)]
am f9ef0106: am 78a7bf99: Merge "stdio.h: enable vs?printf clang FORTIFY_SOURCE"

* commit 'f9ef0106da43d21e6cb68d87b86d806f63b215fd':
  stdio.h: enable vs?printf clang FORTIFY_SOURCE

11 years agoam 78a7bf99: Merge "stdio.h: enable vs?printf clang FORTIFY_SOURCE"
Nick Kralevich [Thu, 27 Jun 2013 17:15:31 +0000 (10:15 -0700)]
am 78a7bf99: Merge "stdio.h: enable vs?printf clang FORTIFY_SOURCE"

* commit '78a7bf998d2d29592504984fcf419cd2701c6c54':
  stdio.h: enable vs?printf clang FORTIFY_SOURCE

11 years agoMerge "stdio.h: enable vs?printf clang FORTIFY_SOURCE"
Nick Kralevich [Thu, 27 Jun 2013 17:13:25 +0000 (17:13 +0000)]
Merge "stdio.h: enable vs?printf clang FORTIFY_SOURCE"

11 years agostdio.h: enable vs?printf clang FORTIFY_SOURCE
Nick Kralevich [Thu, 27 Jun 2013 15:58:14 +0000 (08:58 -0700)]
stdio.h: enable vs?printf clang FORTIFY_SOURCE

Enable FORTIFY_SOURCE protections under clang for the following
functions:

  * vsprintf
  * vsnprintf

and add unittests.

Change-Id: I90f8a27f7b202c78b5dd8ebf53050bf9e33496f7

11 years agoam 146d79c2: am fbec57d4: Merge changes Ib496e818,I074204e9
Colin Cross [Wed, 26 Jun 2013 01:29:14 +0000 (18:29 -0700)]
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

11 years agoam fbec57d4: Merge changes Ib496e818,I074204e9
Colin Cross [Wed, 26 Jun 2013 00:08:48 +0000 (17:08 -0700)]
am fbec57d4: Merge changes Ib496e818,I074204e9

* commit 'fbec57d46c42460b2381484d1610ff21922d162e':
  bionic: add compatibility mode for properties
  bionic: use the size of the file to determine property area size

11 years agoMerge changes Ib496e818,I074204e9
Colin Cross [Wed, 26 Jun 2013 00:03:24 +0000 (00:03 +0000)]
Merge changes Ib496e818,I074204e9

* changes:
  bionic: add compatibility mode for properties
  bionic: use the size of the file to determine property area size

11 years agoam db6dd600: am b116bf76: Merge "Switch to current upstream getopt_long."
Elliott Hughes [Wed, 26 Jun 2013 00:02:11 +0000 (17:02 -0700)]
am db6dd600: am b116bf76: Merge "Switch to current upstream getopt_long."

* commit 'db6dd600d23eafb1742e5114bae7a4b8be4c04e1':
  Switch to current upstream getopt_long.

11 years agoam baa61864: am 995f17e6: Merge "libc: add swapon and swapoff syscalls"
Rom Lemarchand [Wed, 26 Jun 2013 00:02:06 +0000 (17:02 -0700)]
am baa61864: am 995f17e6: Merge "libc: add swapon and swapoff syscalls"

* commit 'baa61864c515a56d4dbeac46b149b4317b01797b':
  libc: add swapon and swapoff syscalls

11 years agoam 51371ee0: am c76550b3: Merge "Update x86 machine/endian.h from upstream"
Elliott Hughes [Wed, 26 Jun 2013 00:01:53 +0000 (17:01 -0700)]
am 51371ee0: am c76550b3: Merge "Update x86 machine/endian.h from upstream"

* commit '51371ee0d897285b869aa2af670e153ead471e03':
  Update x86 machine/endian.h from upstream

11 years agoam d31287d6: am 7d624e9a: Merge "Kernel dso support for \'dl_iterate_phdr\' function"
Elliott Hughes [Wed, 26 Jun 2013 00:01:47 +0000 (17:01 -0700)]
am d31287d6: am 7d624e9a: Merge "Kernel dso support for \'dl_iterate_phdr\' function"

* commit 'd31287d6017475209cfee2fea0532bdc8c0f4aac':
  Kernel dso support for 'dl_iterate_phdr' function

11 years agobionic: add compatibility mode for properties
Colin Cross [Tue, 25 Jun 2013 01:36:39 +0000 (18:36 -0700)]
bionic: add compatibility mode for properties

Allow a new bionic to work with an old init property area by supporting
the old format.

(cherry picked from commit ad76c85b9ca587084089d086f954158bc0eae905)

Change-Id: Ib496e818a62a5834d40c71eb4745783d998be893

11 years agobionic: use the size of the file to determine property area size
Colin Cross [Tue, 25 Jun 2013 01:42:21 +0000 (18:42 -0700)]
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.

(cherry picked from commit 285b42a04cbe8e627a75c9bfb3c7cb3f7b539267)

Change-Id: I074204e9e6591b35faf7c1c58fb11ec162aff7bf

11 years agoam 71802135: am bfacb603: Merge "libc: enable FORTIFY_SOURCE snprintf under clang"
Nick Kralevich [Tue, 25 Jun 2013 23:30:53 +0000 (16:30 -0700)]
am 71802135: am bfacb603: Merge "libc: enable FORTIFY_SOURCE snprintf under clang"

* commit '7180213557f3120b391053b4f5861037eda6ebb6':
  libc: enable FORTIFY_SOURCE snprintf under clang

11 years agoam a99e29e6: (-s ours) am 1642edb5: Merge changes Ib074192d,I6df3afed,I69070455,Icbe3...
Colin Cross [Tue, 25 Jun 2013 23:30:34 +0000 (16:30 -0700)]
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

11 years agoam b116bf76: Merge "Switch to current upstream getopt_long."
Elliott Hughes [Tue, 25 Jun 2013 22:58:53 +0000 (15:58 -0700)]
am b116bf76: Merge "Switch to current upstream getopt_long."

* commit 'b116bf76286178a7d552c4d0a72b79212c8c93d1':
  Switch to current upstream getopt_long.

11 years agoMerge "Switch to current upstream getopt_long."
Elliott Hughes [Tue, 25 Jun 2013 22:56:59 +0000 (22:56 +0000)]
Merge "Switch to current upstream getopt_long."

11 years agoam 995f17e6: Merge "libc: add swapon and swapoff syscalls"
Rom Lemarchand [Tue, 25 Jun 2013 22:28:21 +0000 (15:28 -0700)]
am 995f17e6: Merge "libc: add swapon and swapoff syscalls"

* commit '995f17e6a9a9903f03f542192da9a83b1cabc684':
  libc: add swapon and swapoff syscalls

11 years agoMerge "libc: add swapon and swapoff syscalls"
Rom Lemarchand [Tue, 25 Jun 2013 22:25:30 +0000 (22:25 +0000)]
Merge "libc: add swapon and swapoff syscalls"

11 years agoSwitch to current upstream getopt_long.
Elliott Hughes [Tue, 25 Jun 2013 21:48:10 +0000 (14:48 -0700)]
Switch to current upstream getopt_long.

Change-Id: I4c646dcb8be9e88dd54d069a03bbc5fbfd92de03

11 years agoam c76550b3: Merge "Update x86 machine/endian.h from upstream"
Elliott Hughes [Tue, 25 Jun 2013 21:22:14 +0000 (14:22 -0700)]
am c76550b3: Merge "Update x86 machine/endian.h from upstream"

* commit 'c76550b3377f50a2bc53536e2713e14edc8dbeac':
  Update x86 machine/endian.h from upstream

11 years agoMerge "Update x86 machine/endian.h from upstream"
Elliott Hughes [Tue, 25 Jun 2013 21:20:18 +0000 (21:20 +0000)]
Merge "Update x86 machine/endian.h from upstream"

11 years agoUpdate x86 machine/endian.h from upstream
Pavel Chupin [Fri, 19 Apr 2013 09:09:25 +0000 (13:09 +0400)]
Update x86 machine/endian.h from upstream

After download new version from upstream (OpenBSD 1.17) did the
following:
 * changed all u_int* types to uint*
 * add #include <sys/types.h>

All these changes are Android-specific and had been done before for
previous version (1.14).

Bug: http://code.google.com/p/android/issues/detail?id=54465
Change-Id: Ieb44e7fce4e794d997bb00ee0dd417fb61521720
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
11 years agobionic: add compatibility mode for properties
Colin Cross [Tue, 25 Jun 2013 01:36:39 +0000 (18:36 -0700)]
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

11 years agobionic: use the size of the file to determine property area size
Colin Cross [Tue, 25 Jun 2013 01:42:21 +0000 (18:42 -0700)]
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

11 years agobionic: store property names as variable-length strings
Greg Hackmann [Fri, 21 Jun 2013 20:02:38 +0000 (13:02 -0700)]
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>
11 years agobionic: prevent root processes from calling __system_property_add
Colin Cross [Sun, 16 Jun 2013 17:19:16 +0000 (10:19 -0700)]
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

11 years agobionic: revert to a single (larger) property area
Greg Hackmann [Wed, 19 Jun 2013 20:31:21 +0000 (13:31 -0700)]
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>
11 years agobionic: add hierarchical properties test
Greg Hackmann [Mon, 17 Jun 2013 19:37:09 +0000 (12:37 -0700)]
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>
11 years agobionic: reimplement property area as hybrid trie/binary tree
Greg Hackmann [Thu, 20 Jun 2013 18:27:56 +0000 (11:27 -0700)]
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>
11 years agolibc: add swapon and swapoff syscalls
Rom Lemarchand [Thu, 6 Jun 2013 21:29:40 +0000 (14:29 -0700)]
libc: add swapon and swapoff syscalls

Change-Id: Ie79dc8e3f2ff1cd427dd6d95e3850920c4b407b0
Signed-off-by: Rom Lemarchand <romlem@google.com>
11 years agoam 7d624e9a: Merge "Kernel dso support for \'dl_iterate_phdr\' function"
Elliott Hughes [Tue, 25 Jun 2013 20:17:37 +0000 (13:17 -0700)]
am 7d624e9a: Merge "Kernel dso support for \'dl_iterate_phdr\' function"

* commit '7d624e9aff4c6addea7f2275fe58ff0815d95c70':
  Kernel dso support for 'dl_iterate_phdr' function

11 years agoMerge "Kernel dso support for 'dl_iterate_phdr' function"
Elliott Hughes [Tue, 25 Jun 2013 20:15:29 +0000 (20:15 +0000)]
Merge "Kernel dso support for 'dl_iterate_phdr' function"

11 years agoKernel dso support for 'dl_iterate_phdr' function
Sergey Melnikov [Fri, 25 Jan 2013 12:40:13 +0000 (16:40 +0400)]
Kernel dso support for 'dl_iterate_phdr' function

Kernel provides virtual DSO for stack unwinding/exception handlind info for
signal usage case. Stack unwinding routines use 'dl_iterate_phdr' function
for additional DWARF info gathering from DSOs. Patch enables virtual DSO
enumeration via dl_iterate_phdr function.

Signed-off-by: Sergey Melnikov <sergey.melnikov@intel.com>
Change-Id: Ic2882b28f40b456a088bc1e63c50cbfda7e4a102

11 years agoam bfacb603: Merge "libc: enable FORTIFY_SOURCE snprintf under clang"
Nick Kralevich [Tue, 25 Jun 2013 17:34:20 +0000 (10:34 -0700)]
am bfacb603: Merge "libc: enable FORTIFY_SOURCE snprintf under clang"

* commit 'bfacb603e417c1e2c25ce8482b5c6e31b4db8c9b':
  libc: enable FORTIFY_SOURCE snprintf under clang

11 years agoMerge "libc: enable FORTIFY_SOURCE snprintf under clang"
Nick Kralevich [Tue, 25 Jun 2013 17:26:20 +0000 (17:26 +0000)]
Merge "libc: enable FORTIFY_SOURCE snprintf under clang"

11 years agolibc: enable FORTIFY_SOURCE snprintf under clang
Nick Kralevich [Tue, 25 Jun 2013 17:02:35 +0000 (10:02 -0700)]
libc: enable FORTIFY_SOURCE snprintf under clang

Change-Id: I8b8059782a720104722b0841994b38f873ed02aa

11 years agoam 95448039: am 0ea1d5c0: Merge "libc: enable sprintf FORTIFY_SOURCE under clang"
Nick Kralevich [Tue, 25 Jun 2013 12:59:32 +0000 (05:59 -0700)]
am 95448039: am 0ea1d5c0: Merge "libc: enable sprintf FORTIFY_SOURCE under clang"

* commit '954480393f4539f62cdc3f6cb83c562050ea4f51':
  libc: enable sprintf FORTIFY_SOURCE under clang

11 years agobionic: replace 4K property pages with 32K property pages
Greg Hackmann [Tue, 25 Jun 2013 01:41:46 +0000 (18:41 -0700)]
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>
11 years agoRevert "bionic: reimplement property area as hybrid trie/binary tree"
Greg Hackmann [Tue, 25 Jun 2013 01:05:20 +0000 (18:05 -0700)]
Revert "bionic: reimplement property area as hybrid trie/binary tree"

This reverts commit 6ac8e6a46d71a51bec16938efa89f275fa89cf7d.

11 years agoRevert "bionic: add hierarchical properties test"
Greg Hackmann [Tue, 25 Jun 2013 01:05:18 +0000 (18:05 -0700)]
Revert "bionic: add hierarchical properties test"

This reverts commit 0f76e2340ca53ce458a01f91627651dfe0112969.

11 years agoRevert "bionic: revert to a single (larger) property area"
Greg Hackmann [Tue, 25 Jun 2013 01:05:16 +0000 (18:05 -0700)]
Revert "bionic: revert to a single (larger) property area"

This reverts commit 5f05348c18286a2cea46eae8acf94ed5b7932fac.

11 years agoRevert "bionic: prevent root processes from calling __system_property_add"
Greg Hackmann [Tue, 25 Jun 2013 01:05:14 +0000 (18:05 -0700)]
Revert "bionic: prevent root processes from calling __system_property_add"

This reverts commit fb9b7b436f3ef94385f1b0c55ab81f246f0d96b8.

11 years agoRevert "bionic: store property names as variable-length strings"
Greg Hackmann [Tue, 25 Jun 2013 01:05:10 +0000 (18:05 -0700)]
Revert "bionic: store property names as variable-length strings"

This reverts commit 492ce95d9f6149137cb5b63c55cf2b3cdbe51e5e.

11 years agoam 1642edb5: Merge changes Ib074192d,I6df3afed,I69070455,Icbe31908,Id3fa4526,I038d451f
Colin Cross [Tue, 25 Jun 2013 00:10:16 +0000 (17:10 -0700)]
am 1642edb5: Merge changes Ib074192d,I6df3afed,I69070455,Icbe31908,Id3fa4526,I038d451f

* commit '1642edb5208fe02ef64d5734fffaf7c4a724fd2f':
  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

11 years agoMerge changes Ib074192d,I6df3afed,I69070455,Icbe31908,Id3fa4526,I038d451f
Colin Cross [Tue, 25 Jun 2013 00:07:53 +0000 (00:07 +0000)]
Merge changes Ib074192d,I6df3afed,I69070455,Icbe31908,Id3fa4526,I038d451f

* changes:
  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

11 years agobionic: store property names as variable-length strings
Greg Hackmann [Fri, 21 Jun 2013 20:02:38 +0000 (13:02 -0700)]
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).

Signed-off-by: Greg Hackmann <ghackmann@google.com>
(cherry picked from commit 492ce95d9f6149137cb5b63c55cf2b3cdbe51e5e)

Change-Id: Ib074192d1b71150233d78c58e9ffcf7ecf688b6b

11 years agobionic: prevent root processes from calling __system_property_add
Colin Cross [Sun, 16 Jun 2013 17:19:16 +0000 (10:19 -0700)]
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.

(cherry picked from commit fb9b7b436f3ef94385f1b0c55ab81f246f0d96b8)

Change-Id: I6df3afedbfb5d07891b095aa24b78278381a5aaf

11 years agobionic: revert to a single (larger) property area
Greg Hackmann [Wed, 19 Jun 2013 20:31:21 +0000 (13:31 -0700)]
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.

Signed-off-by: Greg Hackmann <ghackmann@google.com>
(cherry picked from commit 5f05348c18286a2cea46eae8acf94ed5b7932fac)

Change-Id: I690704552afc07a4dd410277893ca9c40bc13e5f

11 years agobionic: reimplement property area as hybrid trie/binary tree
Greg Hackmann [Thu, 20 Jun 2013 18:27:56 +0000 (11:27 -0700)]
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).

Signed-off-by: Greg Hackmann <ghackmann@google.com>
(cherry picked from commit 6ac8e6a46d71a51bec16938efa89f275fa89cf7d)

Change-Id: Icbe31908572f33b4d9b85d5b62ac837cbd0f85e0

11 years agobionic: add missing memory barriers to system properties
Greg Hackmann [Thu, 20 Jun 2013 17:33:28 +0000 (10:33 -0700)]
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

Signed-off-by: Greg Hackmann <ghackmann@google.com>
(cherry picked from commit 5bfa3ee8b37ef162154559575193018a6235acba)

Change-Id: Id3fa45261fc2df2ae493ab5194bc2b6bff04e966

11 years agobionic: make property area expandable
Greg Hackmann [Wed, 13 Feb 2013 22:41:48 +0000 (14:41 -0800)]
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.

Signed-off-by: Greg Hackmann <ghackmann@google.com>
(cherry picked from commit d32969701be070c0161c2643ee3c3df16066bbb8)

Change-Id: I038d451fe8849b0c4863663eec6f57f6521bf4a7

11 years agobionic: store property names as variable-length strings
Greg Hackmann [Fri, 21 Jun 2013 20:02:38 +0000 (13:02 -0700)]
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>
11 years agobionic: prevent root processes from calling __system_property_add
Colin Cross [Sun, 16 Jun 2013 17:19:16 +0000 (10:19 -0700)]
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

11 years agobionic: revert to a single (larger) property area
Greg Hackmann [Wed, 19 Jun 2013 20:31:21 +0000 (13:31 -0700)]
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>
11 years agoam 0ea1d5c0: Merge "libc: enable sprintf FORTIFY_SOURCE under clang"
Nick Kralevich [Mon, 24 Jun 2013 22:20:39 +0000 (15:20 -0700)]
am 0ea1d5c0: Merge "libc: enable sprintf FORTIFY_SOURCE under clang"

* commit '0ea1d5c0ae94ee581c72451b20813c028f51090c':
  libc: enable sprintf FORTIFY_SOURCE under clang

11 years agoMerge "libc: enable sprintf FORTIFY_SOURCE under clang"
Nick Kralevich [Mon, 24 Jun 2013 22:15:12 +0000 (22:15 +0000)]
Merge "libc: enable sprintf FORTIFY_SOURCE under clang"

11 years agolibc: enable sprintf FORTIFY_SOURCE under clang
Nick Kralevich [Mon, 24 Jun 2013 18:44:00 +0000 (11:44 -0700)]
libc: enable sprintf FORTIFY_SOURCE under clang

clang doesn't support __builtin_va_arg_pack(), so we have
to use #define instead.

Change-Id: I2ee75e6267d60cdf997fee6b9b0547bf68f062a1

11 years agobionic: add hierarchical properties test
Greg Hackmann [Mon, 17 Jun 2013 19:37:09 +0000 (12:37 -0700)]
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>
11 years agobionic: reimplement property area as hybrid trie/binary tree
Greg Hackmann [Thu, 20 Jun 2013 18:27:56 +0000 (11:27 -0700)]
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>
11 years agoMerge "bionic: add missing memory barriers to system properties"
Greg Hackmann [Mon, 24 Jun 2013 17:15:43 +0000 (17:15 +0000)]
Merge "bionic: add missing memory barriers to system properties"

11 years agoam 100d6784: am 53ddcc90: Merge "linker: Emit a warning on text relocations"
Nick Kralevich [Fri, 21 Jun 2013 23:01:02 +0000 (16:01 -0700)]
am 100d6784: am 53ddcc90: Merge "linker: Emit a warning on text relocations"

* commit '100d678438f222ad6ef8f3dc0646911b218c50a9':
  linker: Emit a warning on text relocations

11 years agoam 53ddcc90: Merge "linker: Emit a warning on text relocations"
Nick Kralevich [Fri, 21 Jun 2013 22:39:21 +0000 (15:39 -0700)]
am 53ddcc90: Merge "linker: Emit a warning on text relocations"

* commit '53ddcc90701d86c7d809a84cf4710c651066e3c7':
  linker: Emit a warning on text relocations

11 years agoMerge "linker: Emit a warning on text relocations"
Nick Kralevich [Fri, 21 Jun 2013 22:36:50 +0000 (22:36 +0000)]
Merge "linker: Emit a warning on text relocations"

11 years agolinker: Emit a warning on text relocations
Nick Kralevich [Fri, 21 Jun 2013 19:31:33 +0000 (12:31 -0700)]
linker: Emit a warning on text relocations

Text relocations unnecessarily mark pages as dirty, preventing them
from being swapped out, wasting memory. Also, text relocations
prevent the code from running on certain hardened systems.

Print a message in logcat and stderr when we see a text relocation,
to encourage developers to fix their code.

Change-Id: I6051a7463911e090ae5727a355397d539669d5b9

11 years agoam cb25359a: am 68197731: Merge "libc_logging: don\'t keep file descriptors open...
Nick Kralevich [Fri, 21 Jun 2013 22:15:22 +0000 (15:15 -0700)]
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

11 years agoam 68197731: Merge "libc_logging: don\'t keep file descriptors open forever"
Nick Kralevich [Fri, 21 Jun 2013 21:33:48 +0000 (14:33 -0700)]
am 68197731: Merge "libc_logging: don\'t keep file descriptors open forever"

* commit '6819773103495a6fd81f024dc6711771320ae4ec':
  libc_logging: don't keep file descriptors open forever

11 years agoMerge "libc_logging: don't keep file descriptors open forever"
Nick Kralevich [Fri, 21 Jun 2013 21:26:09 +0000 (21:26 +0000)]
Merge "libc_logging: don't keep file descriptors open forever"

11 years agolibc_logging: don't keep file descriptors open forever
Nick Kralevich [Fri, 21 Jun 2013 20:28:42 +0000 (13:28 -0700)]
libc_logging: don't keep file descriptors open forever

Avoid keeping unnecessary file descriptors around when they're not
needed. Libc doesn't log so much that opening / closing overhead
matters.

Change-Id: I590ec5c27562db9bac025f781c48ec9a7724ce77

11 years agobionic: add missing memory barriers to system properties
Greg Hackmann [Thu, 20 Jun 2013 17:33:28 +0000 (10:33 -0700)]
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>
11 years agoam 5fed0eea: am 0ce28d20: Merge "libc: enable FORTIFY_SOURCE clang strlcpy"
Nick Kralevich [Thu, 20 Jun 2013 19:34:11 +0000 (12:34 -0700)]
am 5fed0eea: am 0ce28d20: Merge "libc: enable FORTIFY_SOURCE clang strlcpy"

* commit '5fed0eeabd88bfe241c416f2c2f44a14b6e447fa':
  libc: enable FORTIFY_SOURCE clang strlcpy

11 years agoam 0ce28d20: Merge "libc: enable FORTIFY_SOURCE clang strlcpy"
Nick Kralevich [Thu, 20 Jun 2013 19:29:38 +0000 (12:29 -0700)]
am 0ce28d20: Merge "libc: enable FORTIFY_SOURCE clang strlcpy"

* commit '0ce28d20ea5fde250576f355004dbcd741b0b884':
  libc: enable FORTIFY_SOURCE clang strlcpy

11 years agoMerge "libc: enable FORTIFY_SOURCE clang strlcpy"
Nick Kralevich [Thu, 20 Jun 2013 19:27:47 +0000 (19:27 +0000)]
Merge "libc: enable FORTIFY_SOURCE clang strlcpy"

11 years agolibc: enable FORTIFY_SOURCE clang strlcpy
Nick Kralevich [Thu, 20 Jun 2013 19:17:44 +0000 (12:17 -0700)]
libc: enable FORTIFY_SOURCE clang strlcpy

Change-Id: Idcfe08f5afc3dde592416df9eba83f64e130c7c2

11 years agoam 33df38a0: am 4eed6509: Merge "stdint.h header is not fully compatible with C99...
Elliott Hughes [Wed, 19 Jun 2013 19:57:39 +0000 (12:57 -0700)]
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)

11 years agoam 4eed6509: Merge "stdint.h header is not fully compatible with C99(ISO9899:1999)"
Elliott Hughes [Wed, 19 Jun 2013 19:46:40 +0000 (12:46 -0700)]
am 4eed6509: Merge "stdint.h header is not fully compatible with C99(ISO9899:1999)"

* commit '4eed65090b1f0d0d087f26bd7367da90a0cca92d':
  stdint.h header is not fully compatible with C99(ISO9899:1999)

11 years agoMerge "stdint.h header is not fully compatible with C99(ISO9899:1999)"
Elliott Hughes [Wed, 19 Jun 2013 19:45:09 +0000 (19:45 +0000)]
Merge "stdint.h header is not fully compatible with C99(ISO9899:1999)"

11 years agobionic: make property area expandable
Greg Hackmann [Wed, 13 Feb 2013 22:41:48 +0000 (14:41 -0800)]
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>
11 years agoam 1d174a9c: am 02ca0e31: Merge "Fix FORTIFY_SOURCE unittests."
Nick Kralevich [Wed, 19 Jun 2013 17:40:46 +0000 (10:40 -0700)]
am 1d174a9c: am 02ca0e31: Merge "Fix FORTIFY_SOURCE unittests."

* commit '1d174a9c17f645a27d766a66e7477d797f955e90':
  Fix FORTIFY_SOURCE unittests.

11 years agoam 02ca0e31: Merge "Fix FORTIFY_SOURCE unittests."
Nick Kralevich [Wed, 19 Jun 2013 17:36:55 +0000 (10:36 -0700)]
am 02ca0e31: Merge "Fix FORTIFY_SOURCE unittests."

* commit '02ca0e314219a4c7205a180a414c509651043f13':
  Fix FORTIFY_SOURCE unittests.

11 years agoMerge "Fix FORTIFY_SOURCE unittests."
Nick Kralevich [Wed, 19 Jun 2013 17:33:57 +0000 (17:33 +0000)]
Merge "Fix FORTIFY_SOURCE unittests."

11 years agoam f4250508: am 3225f498: Merge "bionic: add __system_property_foreach"
Colin Cross [Wed, 19 Jun 2013 17:31:11 +0000 (10:31 -0700)]
am f4250508: am 3225f498: Merge "bionic: add __system_property_foreach"

* commit 'f4250508d5de415e200888ffdf143f870dc0f829':
  bionic: add __system_property_foreach

11 years agoam 3225f498: Merge "bionic: add __system_property_foreach"
Colin Cross [Wed, 19 Jun 2013 17:27:23 +0000 (10:27 -0700)]
am 3225f498: Merge "bionic: add __system_property_foreach"

* commit '3225f4984837c4d9e6e9495d2154f2d9987cf457':
  bionic: add __system_property_foreach

11 years agoMerge "bionic: add __system_property_foreach"
Colin Cross [Wed, 19 Jun 2013 17:26:17 +0000 (17:26 +0000)]
Merge "bionic: add __system_property_foreach"

11 years agoFix FORTIFY_SOURCE unittests.
Nick Kralevich [Wed, 19 Jun 2013 17:25:44 +0000 (10:25 -0700)]
Fix FORTIFY_SOURCE unittests.

The compiler is too damn smart.

Change-Id: Ibef3ef41ec99f8cd9c06f1dbca535819f9a08197

11 years agostdint.h header is not fully compatible with C99(ISO9899:1999)
Sergey Melnikov [Thu, 22 Nov 2012 11:23:48 +0000 (15:23 +0400)]
stdint.h header is not fully compatible with C99(ISO9899:1999)

stdint.h provides macros with incorrect type:
  * UINT8_C
  * UINT16_C
  * UINT8_MAX
  * UINT16_MAX

Signed-off-by: Sergey Melnikov <sergey.melnikov@intel.com>
Change-Id: I2d130c782d4485bf6c9e9f068de0bdaa4ba7303f

11 years agobionic: add __system_property_foreach
Greg Hackmann [Wed, 13 Feb 2013 00:39:31 +0000 (16:39 -0800)]
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.

Signed-off-by: Greg Hackmann <ghackmann@google.com>
(cherry picked from commit 577418403d68e663fb33c7b0c8a90d862d9c00cf)

Change-Id: Iaca97d1182ce2c28863ba85241cbb5cf6185eb2f

11 years agobionic: add __system_property_foreach
Greg Hackmann [Wed, 13 Feb 2013 00:39:31 +0000 (16:39 -0800)]
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>
11 years agoMerge "Fix remove_uidiface_info failing on first entry"
Geremy Condra [Tue, 18 Jun 2013 21:43:52 +0000 (21:43 +0000)]
Merge "Fix remove_uidiface_info failing on first entry"

11 years agoam 13e23302: am c656d732: Merge "Always use v1 for MIPS TLS access."
Elliott Hughes [Tue, 18 Jun 2013 21:00:59 +0000 (14:00 -0700)]
am 13e23302: am c656d732: Merge "Always use v1 for MIPS TLS access."

* commit '13e23302c93fdd8b52c606277f32dec0627ddbbd':
  Always use v1 for MIPS TLS access.

11 years agoam c656d732: Merge "Always use v1 for MIPS TLS access."
Elliott Hughes [Tue, 18 Jun 2013 20:57:57 +0000 (13:57 -0700)]
am c656d732: Merge "Always use v1 for MIPS TLS access."

* commit 'c656d732c7712b0f73d9c560ccf3cb5ae47d219d':
  Always use v1 for MIPS TLS access.

11 years agoMerge "Always use v1 for MIPS TLS access."
Elliott Hughes [Tue, 18 Jun 2013 20:56:25 +0000 (20:56 +0000)]
Merge "Always use v1 for MIPS TLS access."