Merge "liblog: remove visibility macros"
diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp
index 6700b6c..8528752 100644
--- a/bootstat/bootstat.cpp
+++ b/bootstat/bootstat.cpp
@@ -1019,6 +1019,7 @@
auto stageTimingValues = android::base::Split(stageTiming, ":");
DCHECK_EQ(2U, stageTimingValues.size());
+ if (stageTimingValues.size() < 2) continue;
std::string stageName = stageTimingValues[0];
int32_t time_ms;
if (android::base::ParseInt(stageTimingValues[1], &time_ms)) {
diff --git a/fs_mgr/README.overlayfs.md b/fs_mgr/README.overlayfs.md
index 8784c94..2aac260 100644
--- a/fs_mgr/README.overlayfs.md
+++ b/fs_mgr/README.overlayfs.md
@@ -74,7 +74,7 @@
When *overlayfs* logic is feasible, it will use either the
**/cache/overlay/** directory for non-A/B devices, or the
**/mnt/scratch/overlay** directory for A/B devices that have
-access to *Logical Resizeable Android Partitions*.
+access to *Logical Resizable Android Partitions*.
The backing store is used as soon as possible in the boot
process and can occur at first stage init, or at the
mount_all init rc commands.
@@ -94,12 +94,17 @@
and thus free dynamic partition space.
- Kernel must have CONFIG_OVERLAY_FS=y and will need to be patched
with "*overlayfs: override_creds=off option bypass creator_cred*"
- if higher than 4.6.
+ if kernel is higher than 4.6.
+ The patch is available on the upstream mailing list and the latest as of
+ Feb 8 2019 is https://lore.kernel.org/patchwork/patch/1009299/.
+ This patch adds an override_creds _mount_ option to overlayfs that
+ permits legacy behavior for systems that do not have overlapping
+ sepolicy rules, principals of least privilege, which is how Android behaves.
- *adb enable-verity* will free up overlayfs and as a bonus the
device will be reverted pristine to before any content was updated.
Update engine does not take advantage of this, will perform a full OTA.
- Update engine may not run if *fs_mgr_overlayfs_is_setup*() reports
- true as adb remount overrides are incompatable with an OTA resources.
+ true as adb remount overrides are incompatible with an OTA resources.
- For implementation simplicity on retrofit dynamic partition devices,
take the whole alternate super (eg: if "*a*" slot, then the whole of
"*system_b*").
diff --git a/libcutils/fs_config.cpp b/libcutils/fs_config.cpp
index 6184813..f1dcd50 100644
--- a/libcutils/fs_config.cpp
+++ b/libcutils/fs_config.cpp
@@ -95,9 +95,7 @@
{ 00755, AID_ROOT, AID_ROOT, 0, "system/etc/ppp" },
{ 00755, AID_ROOT, AID_SHELL, 0, "system/vendor" },
{ 00751, AID_ROOT, AID_SHELL, 0, "system/xbin" },
- // TODO(b/123743953): eliminate the APEX name with better pattern matching
- { 00755, AID_ROOT, AID_SHELL, 0, "system/apex/com.android.runtime.debug/bin" },
- { 00755, AID_ROOT, AID_SHELL, 0, "system/apex/com.android.runtime.release/bin" },
+ { 00755, AID_ROOT, AID_SHELL, 0, "system/apex/*/bin" },
{ 00751, AID_ROOT, AID_SHELL, 0, "vendor/bin" },
{ 00755, AID_ROOT, AID_SHELL, 0, "vendor" },
{ 00755, AID_ROOT, AID_ROOT, 0, 0 },
@@ -224,9 +222,7 @@
{ 00755, AID_ROOT, AID_ROOT, 0, "system/lib/valgrind/*" },
{ 00755, AID_ROOT, AID_ROOT, 0, "system/lib64/valgrind/*" },
{ 00755, AID_ROOT, AID_SHELL, 0, "system/xbin/*" },
- // TODO(b/123743953): eliminate the APEX name with better pattern matching
- { 00755, AID_ROOT, AID_SHELL, 0, "system/apex/com.android.runtime.debug/bin/*" },
- { 00755, AID_ROOT, AID_SHELL, 0, "system/apex/com.android.runtime.release/bin/*" },
+ { 00755, AID_ROOT, AID_SHELL, 0, "system/apex/*/bin/*" },
{ 00755, AID_ROOT, AID_SHELL, 0, "vendor/bin/*" },
{ 00755, AID_ROOT, AID_SHELL, 0, "vendor/xbin/*" },
{ 00644, AID_ROOT, AID_ROOT, 0, 0 },
diff --git a/libmeminfo/libdmabufinfo/Android.bp b/libmeminfo/libdmabufinfo/Android.bp
index 3d5f2e7..4aed45c 100644
--- a/libmeminfo/libdmabufinfo/Android.bp
+++ b/libmeminfo/libdmabufinfo/Android.bp
@@ -17,9 +17,11 @@
name: "dmabufinfo_defaults",
static_libs: [
"libbase",
- "liblog",
"libprocinfo",
],
+ shared_libs: [
+ "liblog",
+ ],
cflags: [
"-Wall",
@@ -30,10 +32,9 @@
cc_library_static {
name: "libdmabufinfo",
+ vendor_available: true,
defaults: ["dmabufinfo_defaults"],
export_include_dirs: ["include"],
- static_libs: ["libc++fs"],
-
srcs: [
"dmabufinfo.cpp",
],
diff --git a/libmeminfo/libdmabufinfo/dmabufinfo.cpp b/libmeminfo/libdmabufinfo/dmabufinfo.cpp
index 0212cd2..439cf68 100644
--- a/libmeminfo/libdmabufinfo/dmabufinfo.cpp
+++ b/libmeminfo/libdmabufinfo/dmabufinfo.cpp
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#include <dmabufinfo/dmabufinfo.h>
-
+#include <dirent.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
@@ -35,6 +34,8 @@
#include <android-base/strings.h>
#include <procinfo/process_map.h>
+#include <dmabufinfo/dmabufinfo.h>
+
namespace android {
namespace dmabufinfo {
@@ -80,16 +81,42 @@
return true;
}
+// TODO: std::filesystem::is_symlink fails to link on vendor code,
+// forcing this workaround.
+// Move back to libc++fs once it is vendor-available. See b/124012728
+static bool is_symlink(const char *filename)
+{
+ struct stat p_statbuf;
+ if (lstat(filename, &p_statbuf) < 0) {
+ return false;
+ }
+ if (S_ISLNK(p_statbuf.st_mode) == 1) {
+ return true;
+ }
+ return false;
+}
+
static bool ReadDmaBufFdRefs(pid_t pid, std::vector<DmaBuffer>* dmabufs) {
std::string fdpath = ::android::base::StringPrintf("/proc/%d/fd", pid);
- for (auto& de : std::filesystem::directory_iterator(fdpath)) {
- if (!std::filesystem::is_symlink(de.path())) {
+
+ std::unique_ptr<DIR, int (*)(DIR*)> dir(opendir(fdpath.c_str()), closedir);
+ if (!dir) {
+ LOG(ERROR) << "Failed to open " << fdpath << " directory" << std::endl;
+ return false;
+ }
+ struct dirent* dent;
+ while ((dent = readdir(dir.get()))) {
+ std::string path =
+ ::android::base::StringPrintf("%s/%s", fdpath.c_str(), dent->d_name);
+
+ if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..") ||
+ !is_symlink(path.c_str())) {
continue;
}
std::string target;
- if (!::android::base::Readlink(de.path().string(), &target)) {
- LOG(ERROR) << "Failed to find target for symlink: " << de.path().string();
+ if (!::android::base::Readlink(path, &target)) {
+ LOG(ERROR) << "Failed to find target for symlink: " << path;
return false;
}
@@ -98,8 +125,8 @@
}
int fd;
- if (!::android::base::ParseInt(de.path().filename().string(), &fd)) {
- LOG(ERROR) << "Dmabuf fd: " << de.path().string() << " is invalid";
+ if (!::android::base::ParseInt(dent->d_name, &fd)) {
+ LOG(ERROR) << "Dmabuf fd: " << path << " is invalid";
return false;
}
@@ -109,13 +136,13 @@
std::string exporter = "<unknown>";
uint64_t count = 0;
if (!ReadDmaBufFdInfo(pid, fd, &name, &exporter, &count)) {
- LOG(ERROR) << "Failed to read fdinfo for: " << de.path().string();
+ LOG(ERROR) << "Failed to read fdinfo for: " << path;
return false;
}
struct stat sb;
- if (stat(de.path().c_str(), &sb) < 0) {
- PLOG(ERROR) << "Failed to stat: " << de.path().string();
+ if (stat(path.c_str(), &sb) < 0) {
+ PLOG(ERROR) << "Failed to stat: " << path;
return false;
}
diff --git a/libmeminfo/libdmabufinfo/tools/Android.bp b/libmeminfo/libdmabufinfo/tools/Android.bp
index 339583e..0af3c48 100644
--- a/libmeminfo/libdmabufinfo/tools/Android.bp
+++ b/libmeminfo/libdmabufinfo/tools/Android.bp
@@ -22,10 +22,9 @@
srcs: ["dmabuf_dump.cpp"],
shared_libs: [
"libbase",
- "libmeminfo",
],
static_libs: [
"libdmabufinfo",
- "libc++fs",
],
+ soc_specific: true,
}
\ No newline at end of file
diff --git a/libmeminfo/libdmabufinfo/tools/dmabuf_dump.cpp b/libmeminfo/libdmabufinfo/tools/dmabuf_dump.cpp
index 5ee9c3d..0851fb3 100644
--- a/libmeminfo/libdmabufinfo/tools/dmabuf_dump.cpp
+++ b/libmeminfo/libdmabufinfo/tools/dmabuf_dump.cpp
@@ -150,8 +150,8 @@
if (show_all) {
if (!ReadDmaBufInfo(&bufs)) {
- std::cerr << "Unable to read DEBUGFS dmabuf info" << std::endl;
- exit(EXIT_FAILURE);
+ std::cerr << "debugfs entry for dmabuf not available, skipping" << std::endl;
+ bufs.clear();
}
std::unique_ptr<DIR, int (*)(DIR*)> dir(opendir("/proc"), closedir);
if (!dir) {
diff --git a/libnativeloader/Android.bp b/libnativeloader/Android.bp
index 2802d36..1ec21e9 100644
--- a/libnativeloader/Android.bp
+++ b/libnativeloader/Android.bp
@@ -23,6 +23,10 @@
"llndk.libraries.txt",
"vndksp.libraries.txt",
],
+ stubs: {
+ symbol_file: "libnativeloader.map.txt",
+ versions: ["1"],
+ },
}
cc_library_headers {