summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bootstat/bootstat.cpp1
-rw-r--r--fs_mgr/README.overlayfs.md11
-rw-r--r--libcutils/fs_config.cpp8
-rw-r--r--libmeminfo/libdmabufinfo/Android.bp7
-rw-r--r--libmeminfo/libdmabufinfo/dmabufinfo.cpp49
-rw-r--r--libmeminfo/libdmabufinfo/tools/Android.bp3
-rw-r--r--libmeminfo/libdmabufinfo/tools/dmabuf_dump.cpp4
-rw-r--r--libnativeloader/Android.bp4
8 files changed, 60 insertions, 27 deletions
diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp
index 6700b6cae..8528752fa 100644
--- a/bootstat/bootstat.cpp
+++ b/bootstat/bootstat.cpp
@@ -1019,6 +1019,7 @@ const BootloaderTimingMap GetBootLoaderTimings() {
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 8784c94b9..2aac2601a 100644
--- a/fs_mgr/README.overlayfs.md
+++ b/fs_mgr/README.overlayfs.md
@@ -74,7 +74,7 @@ a probe of the filesystem types and space remaining.
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 @@ Caveats
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 618481361..f1dcd5002 100644
--- a/libcutils/fs_config.cpp
+++ b/libcutils/fs_config.cpp
@@ -95,9 +95,7 @@ static const struct fs_path_config android_dirs[] = {
{ 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 @@ static const struct fs_path_config android_files[] = {
{ 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 3d5f2e707..4aed45c8c 100644
--- a/libmeminfo/libdmabufinfo/Android.bp
+++ b/libmeminfo/libdmabufinfo/Android.bp
@@ -17,9 +17,11 @@ cc_defaults {
name: "dmabufinfo_defaults",
static_libs: [
"libbase",
- "liblog",
"libprocinfo",
],
+ shared_libs: [
+ "liblog",
+ ],
cflags: [
"-Wall",
@@ -30,10 +32,9 @@ cc_defaults {
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 0212cd23a..439cf6873 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 @@ static bool ReadDmaBufFdInfo(pid_t pid, int fd, std::string* name, std::string*
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 @@ static bool ReadDmaBufFdRefs(pid_t pid, std::vector<DmaBuffer>* dmabufs) {
}
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 @@ static bool ReadDmaBufFdRefs(pid_t pid, std::vector<DmaBuffer>* dmabufs) {
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 339583e1f..0af3c487c 100644
--- a/libmeminfo/libdmabufinfo/tools/Android.bp
+++ b/libmeminfo/libdmabufinfo/tools/Android.bp
@@ -22,10 +22,9 @@ cc_binary {
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 5ee9c3d17..0851fb33c 100644
--- a/libmeminfo/libdmabufinfo/tools/dmabuf_dump.cpp
+++ b/libmeminfo/libdmabufinfo/tools/dmabuf_dump.cpp
@@ -150,8 +150,8 @@ int main(int argc, char* argv[]) {
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 2802d3611..1ec21e9d2 100644
--- a/libnativeloader/Android.bp
+++ b/libnativeloader/Android.bp
@@ -23,6 +23,10 @@ cc_library {
"llndk.libraries.txt",
"vndksp.libraries.txt",
],
+ stubs: {
+ symbol_file: "libnativeloader.map.txt",
+ versions: ["1"],
+ },
}
cc_library_headers {