Commit graph

21 commits

Author SHA1 Message Date
dimitry
7f04880820 Enable native_bridge_support
Enable native bridge support for bionic libraries.
Makes it possible to use them in binaries for translated
architectures.

Bug: http://b/77159578
Test: make
Change-Id: Iccd4ad7aecfa5260cc15f09ca975d2e18987278a
2019-05-06 17:13:51 +02:00
Elliott Hughes
3019d78d4a libasync_safe: stop clobbering other folks' identifiers.
The log priorities and ids are in an NDK header, available to everyone.

Move CHECK into its own header for now. This would be better if it was
more like the <android-base/logging.h> CHECK family, but I don't have an
easy way to do that without lots of copy & paste, so punting for now.

Bug: https://issuetracker.google.com/issues/119713191
Test: boots
Change-Id: I4566be8a0a024fede0e2d257c98b908ec67af2a8
2019-02-14 14:23:13 -08:00
Elliott Hughes
5e62b34c0d Clean up bionic_macros.h a bit.
Use <android-base/macros.h> instead where possible, and move the bionic
macros out of the way of the libbase ones. Yes, there are folks who manage
to end up with both included at once (thanks OpenGL!), and cleaning that
up doesn't seem nearly as practical as just making this change.

Bug: N/A
Test: builds
Change-Id: I23fc544f39d5addf81dc61471771a5438778895b
2018-10-25 11:00:00 -07:00
Elliott Hughes
99d54656bd Add PR_SET_VMA and PR_SET_VMA_ANON_NAME to <sys/prctl.h>.
We've copied & pasted these to too many places. And if we're going to
have another go at upstreaming these, that's probably yet another reason
to have the *values* in just one place. (Even if upstream wants different
names, we'll likely keep the legacy names around for a while for source
compatibility.)

Bug: http://b/111903542
Test: ran tests
Change-Id: I8ccc557453d69530e5b74f865cbe0b458c84e3ba
2018-08-22 10:36:23 -07:00
Yi Kong
32bc0fcf69 Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.

Test: m
Bug: 68236239
Change-Id: I5b4123bc6709641315120a191e36cc57541349b2
2018-08-02 18:09:44 -07:00
Ryan Prichard
d91285f166 Fix PROP_FILENAME_MAX overflow handling
Bug: b/79117743
Test: /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Change-Id: Idd5aa4d195abc13c06d3e5b57aef69a68c2a9a9d
2018-05-01 18:19:21 -07:00
Tom Cherry
ee8e3dd67c Remove non-trivial constructors/destructors from SystemProperties
With the goal of disallowing exit time destructors, SystemProperties's
non-trivial destructor needs to be removed.  This means replacing the
union hack with yet another hack as we don't want to allocate anything
despite relying on some polymorphism.

Bug: 73485611
Test: boot bullhead
Change-Id: I64223714c9b26c9724bfb8f3e2b0168e47b56bc8
2018-02-21 15:10:17 -08:00
Elliott Hughes
cbc80ba9d8 Switch the rest of our internal headers to #pragma once.
We've been using #pragma once for new internal files, but let's be more bold.

Bug: N/A
Test: builds
Change-Id: I7e2ee2730043bd884f9571cdbd8b524043030c07
2018-02-13 14:27:17 -08:00
Bowgo Tsai
a9fc82fefe Renames nonplat_property_contexts to vendor_property_contexts
Bug: 64240127
Test: build
Change-Id: Ifff956fa1a0557d7d10e1012b29d16f25bb80e8f
2018-02-01 23:32:24 +08:00
Elliott Hughes
5cec377f49 Address a bunch of clang-tidy complaints.
There were a bunch more unreasonable/incorrect ones, but these ones
seemed legit. Nothing very interesting, though.

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

Bug: 62197783
Test: boot devices, ensure properties work
Test: system property unit tests and benchmarks
Change-Id: I9ae6e1b56c62f51a4d3fdb5b62b8926cef545649
2017-12-18 15:17:55 -08:00
Tom Cherry
721a5305e2 Merge "Revert "Don't use serialized propertyinfo"" 2017-12-18 22:02:35 +00:00
Tom Cherry
8be995b6ac Revert "Don't use serialized propertyinfo"
This reverts commit e149f3c1d7.

Reason for revert: This is ready to be enabled now.

Bug: 36001741

Change-Id: I418d3a498ff0712ce9a1857924c6d0039026a664
2017-12-14 01:58:49 +00:00
Robert Greenwalt
4ca6b87847 Merge "Don't use serialized propertyinfo" 2017-12-13 21:40:47 +00:00
Treehugger Robot
894e6f12ad Merge "Include what we use." 2017-12-13 21:32:49 +00:00
Tom Cherry
e149f3c1d7 Don't use serialized propertyinfo
This needs more work before it can be enabled.

Bug: 36001741
Test: boot, check that we're using old style properties
Change-Id: I7032f4b4224758b187cf4e8a53fd8845466a5d4a
2017-12-13 02:48:23 -08:00
Dan Albert
3429c090f5 Include what we use.
Test: mma
Bug: None
Change-Id: I259468e829052bf27fab599ff951a5a2638d35aa
Exempt-From-Owner-Approval: trivial cleanup
2017-12-12 15:43:09 -08:00
Tom Cherry
79b724ca5a Add support for serialized property contexts
This adds support for reading a serialized
/dev/__properties__/property_info file, which contains a
serialized trie that maps property names to the SELinux context to
which they belong.

Performance wise on walleye, this change reduces the start up cost in
libc from ~3000us to ~430us.  On a benchmark that calls
__system_property_find() for each property set on the system, it
reduces the time per iteration from ~650us to ~292us.

Bug: 36001741
Test: Boot bullhead, walleye, run unit tests
Test: Benchmark initialization and lookup performance

Change-Id: I0887a3a7da88eb51b6d1bd494fa5bce593423599
2017-12-12 00:36:20 -08:00
Tom Cherry
8d366a81a3 Fix static classes in system properties
Previously, the functionality for mapping properties to contexts were
broken into a set of classes, each statically defined in
system_properties.cpp to prevent using new/malloc.  This is a mistake
however, since system property initialization happens before static
initialization, so it is possible for the Constructors of these
classes to clobber the initialized data.

This change fixes that by placing them in a Union and having that
Union have a no-op constructor.  The individual classes will be
initialized via placement new before they are used as is typically
done with classes in a union.

Test: boot bullhead
Change-Id: Ideb9d6ad8b6fc768811d8615d005cd4b8d134bce
2017-11-30 16:26:34 -08:00
Tom Cherry
f76bbf5384 Remove some globals from system_properties
pa_size should be static to prop_area, so make it so.

__system_property_area__ was reused for various purposes, but
realistically is a deprecated symbol and this finally separates us
from it.

Bug: 36001741
Test: boot bullhead, system property unit tests
Change-Id: I39663cc3b613093fa4c728b21d8ba58754f8e105
2017-11-14 08:55:27 -08:00
Tom Cherry
fd44b9f8d8 Split system_properties.cpp into its component pieces
system_properties.cpp is a little bit unmanageable in its current
form, and is overdue for a refactoring into more clearly defined
components.

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

Bug: 36001741
Test: boot bullhead, system property unit tests
Change-Id: Ie75ec6fea1a95f90813918f54669d533e51327c6
2017-11-14 08:50:52 -08:00