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
diff --git a/libc/Android.bp b/libc/Android.bp
index 3ec75ee..cba86dd 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -1402,6 +1402,7 @@
"bionic/wmempcpy.cpp",
"system_properties/context_node.cpp",
"system_properties/contexts_split.cpp",
+ "system_properties/contexts_serialized.cpp",
"system_properties/prop_area.cpp",
"system_properties/prop_info.cpp",
"system_properties/system_properties.cpp",
@@ -1423,6 +1424,7 @@
cflags: ["-D__ANDROID_TREBLE__"],
},
},
+ whole_static_libs: ["libpropertyinfoparser"],
cppflags: ["-Wold-style-cast"],
local_include_dirs: ["stdio"],
include_dirs: ["bionic/libstdc++/include"],