Merge "liblog#__android_log_btwrite__android_logger_list_read fail"
diff --git a/adb/Android.bp b/adb/Android.bp
index 6cff0be..bccc71a 100644
--- a/adb/Android.bp
+++ b/adb/Android.bp
@@ -349,10 +349,6 @@
"libavb_user",
"libdiagnose_usb",
"libqemu_pipe",
-
- // `daemon/shell_service.cpp` uses selinux_android_setcon(), which is not exposed by
- // libselinux.
- "libselinux",
],
shared_libs: [
@@ -367,6 +363,7 @@
"libfs_mgr",
"liblog",
"libmdnssd",
+ "libselinux",
],
}
diff --git a/adb/daemon/remount_service.cpp b/adb/daemon/remount_service.cpp
index 76500d4..cf4d294 100644
--- a/adb/daemon/remount_service.cpp
+++ b/adb/daemon/remount_service.cpp
@@ -209,12 +209,8 @@
bool system_verified = !(android::base::GetProperty("partition.system.verified", "").empty());
bool vendor_verified = !(android::base::GetProperty("partition.vendor.verified", "").empty());
- std::vector<std::string> partitions{"/odm", "/oem", "/product_services", "/product", "/vendor"};
- if (android::base::GetBoolProperty("ro.build.system_root_image", false)) {
- partitions.push_back("/");
- } else {
- partitions.push_back("/system");
- }
+ std::vector<std::string> partitions{"/", "/odm", "/oem", "/product_services",
+ "/product", "/vendor"};
bool verity_enabled = (system_verified || vendor_verified);
diff --git a/base/include/android-base/macros.h b/base/include/android-base/macros.h
index 49cc0c9..1748665 100644
--- a/base/include/android-base/macros.h
+++ b/base/include/android-base/macros.h
@@ -170,7 +170,9 @@
//
// In either case this macro has no effect on runtime behavior and performance
// of code.
+#ifndef FALLTHROUGH_INTENDED
#define FALLTHROUGH_INTENDED [[clang::fallthrough]] // NOLINT
+#endif
// Current ABI string
#if defined(__arm__)
diff --git a/debuggerd/crash_dump.cpp b/debuggerd/crash_dump.cpp
index 93f7572..577e336 100644
--- a/debuggerd/crash_dump.cpp
+++ b/debuggerd/crash_dump.cpp
@@ -34,6 +34,7 @@
#include <android-base/file.h>
#include <android-base/logging.h>
+#include <android-base/macros.h>
#include <android-base/parseint.h>
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
@@ -282,6 +283,7 @@
switch (crash_info->header.version) {
case 2:
*fdsan_table_address = crash_info->data.v2.fdsan_table_address;
+ FALLTHROUGH_INTENDED;
case 1:
*abort_msg_address = crash_info->data.v1.abort_msg_address;
*siginfo = crash_info->data.v1.siginfo;
diff --git a/debuggerd/debuggerd_test.cpp b/debuggerd/debuggerd_test.cpp
index e2ea480..bea8b43 100644
--- a/debuggerd/debuggerd_test.cpp
+++ b/debuggerd/debuggerd_test.cpp
@@ -37,6 +37,7 @@
#include <android-base/macros.h>
#include <android-base/parseint.h>
#include <android-base/properties.h>
+#include <android-base/stringprintf.h>
#include <android-base/strings.h>
#include <android-base/test_utils.h>
#include <android-base/unique_fd.h>
@@ -587,9 +588,28 @@
"/system/etc/seccomp_policy/crash_dump." ABI_STRING ".policy";
static pid_t seccomp_fork_impl(void (*prejail)()) {
- unique_fd policy_fd(open(kDebuggerdSeccompPolicy, O_RDONLY | O_CLOEXEC));
- if (policy_fd == -1) {
- LOG(FATAL) << "failed to open policy " << kDebuggerdSeccompPolicy;
+ std::string policy;
+ if (!android::base::ReadFileToString(kDebuggerdSeccompPolicy, &policy)) {
+ PLOG(FATAL) << "failed to read policy file";
+ }
+
+ // Allow a bunch of syscalls used by the tests.
+ policy += "\nclone: 1";
+ policy += "\nsigaltstack: 1";
+ policy += "\nnanosleep: 1";
+
+ FILE* tmp_file = tmpfile();
+ if (!tmp_file) {
+ PLOG(FATAL) << "tmpfile failed";
+ }
+
+ unique_fd tmp_fd(dup(fileno(tmp_file)));
+ if (!android::base::WriteStringToFd(policy, tmp_fd.get())) {
+ PLOG(FATAL) << "failed to write policy to tmpfile";
+ }
+
+ if (lseek(tmp_fd.get(), 0, SEEK_SET) != 0) {
+ PLOG(FATAL) << "failed to seek tmp_fd";
}
ScopedMinijail jail{minijail_new()};
@@ -600,7 +620,7 @@
minijail_no_new_privs(jail.get());
minijail_log_seccomp_filter_failures(jail.get());
minijail_use_seccomp_filter(jail.get());
- minijail_parse_seccomp_filters_from_fd(jail.get(), policy_fd.release());
+ minijail_parse_seccomp_filters_from_fd(jail.get(), tmp_fd.release());
pid_t result = fork();
if (result == -1) {
@@ -735,6 +755,16 @@
ASSERT_BACKTRACE_FRAME(result, "raise_debugger_signal");
}
+extern "C" void foo() {
+ LOG(INFO) << "foo";
+ std::this_thread::sleep_for(1s);
+}
+
+extern "C" void bar() {
+ LOG(INFO) << "bar";
+ std::this_thread::sleep_for(1s);
+}
+
TEST_F(CrasherTest, seccomp_backtrace) {
int intercept_result;
unique_fd output_fd;
@@ -742,6 +772,11 @@
static const auto dump_type = kDebuggerdNativeBacktrace;
StartProcess(
[]() {
+ std::thread a(foo);
+ std::thread b(bar);
+
+ std::this_thread::sleep_for(100ms);
+
raise_debugger_signal(dump_type);
_exit(0);
},
@@ -756,6 +791,8 @@
std::string result;
ConsumeFd(std::move(output_fd), &result);
ASSERT_BACKTRACE_FRAME(result, "raise_debugger_signal");
+ ASSERT_BACKTRACE_FRAME(result, "foo");
+ ASSERT_BACKTRACE_FRAME(result, "bar");
}
TEST_F(CrasherTest, seccomp_crash_logcat) {
@@ -1017,3 +1054,42 @@
ASSERT_TRUE(android::base::ReadFully(output_fd.get(), outbuf, sizeof(outbuf)));
ASSERT_STREQ("any", outbuf);
}
+
+TEST(tombstoned, interceptless_backtrace) {
+ // Generate 50 backtraces, and then check to see that we haven't created 50 new tombstones.
+ auto get_tombstone_timestamps = []() -> std::map<int, time_t> {
+ std::map<int, time_t> result;
+ for (int i = 0; i < 99; ++i) {
+ std::string path = android::base::StringPrintf("/data/tombstones/tombstone_%02d", i);
+ struct stat st;
+ if (stat(path.c_str(), &st) == 0) {
+ result[i] = st.st_mtim.tv_sec;
+ }
+ }
+ return result;
+ };
+
+ auto before = get_tombstone_timestamps();
+ for (int i = 0; i < 50; ++i) {
+ raise_debugger_signal(kDebuggerdNativeBacktrace);
+ }
+ auto after = get_tombstone_timestamps();
+
+ int diff = 0;
+ for (int i = 0; i < 99; ++i) {
+ if (after.count(i) == 0) {
+ continue;
+ }
+ if (before.count(i) == 0) {
+ ++diff;
+ continue;
+ }
+ if (before[i] != after[i]) {
+ ++diff;
+ }
+ }
+
+ // We can't be sure that nothing's crash looping in the background.
+ // This should be good enough, though...
+ ASSERT_LT(diff, 10) << "too many new tombstones; is something crashing in the background?";
+}
diff --git a/debuggerd/handler/debuggerd_fallback.cpp b/debuggerd/handler/debuggerd_fallback.cpp
index 079a574..ed7423b 100644
--- a/debuggerd/handler/debuggerd_fallback.cpp
+++ b/debuggerd/handler/debuggerd_fallback.cpp
@@ -47,6 +47,7 @@
#include <unwindstack/Regs.h>
#include "debuggerd/handler.h"
+#include "handler/fallback.h"
#include "tombstoned/tombstoned.h"
#include "util.h"
@@ -187,7 +188,7 @@
static void trace_handler(siginfo_t* info, ucontext_t* ucontext) {
static std::atomic<uint64_t> trace_output(pack_thread_fd(-1, -1));
- if (info->si_value.sival_int == ~0) {
+ if (info->si_value.sival_ptr == kDebuggerdFallbackSivalPtrRequestDump) {
// Asked to dump by the original signal recipient.
uint64_t val = trace_output.load();
auto [tid, fd] = unpack_thread_fd(val);
@@ -259,7 +260,7 @@
siginfo_t siginfo = {};
siginfo.si_code = SI_QUEUE;
- siginfo.si_value.sival_int = ~0;
+ siginfo.si_value.sival_ptr = kDebuggerdFallbackSivalPtrRequestDump;
siginfo.si_pid = getpid();
siginfo.si_uid = getuid();
@@ -331,7 +332,7 @@
extern "C" void debuggerd_fallback_handler(siginfo_t* info, ucontext_t* ucontext,
void* abort_message) {
- if (info->si_signo == DEBUGGER_SIGNAL && info->si_value.sival_int != 0) {
+ if (info->si_signo == DEBUGGER_SIGNAL && info->si_value.sival_ptr != nullptr) {
return trace_handler(info, ucontext);
} else {
return crash_handler(info, ucontext, abort_message);
diff --git a/debuggerd/handler/debuggerd_handler.cpp b/debuggerd/handler/debuggerd_handler.cpp
index 15557b6..a064ca0 100644
--- a/debuggerd/handler/debuggerd_handler.cpp
+++ b/debuggerd/handler/debuggerd_handler.cpp
@@ -58,6 +58,8 @@
#include "dump_type.h"
#include "protocol.h"
+#include "handler/fallback.h"
+
using android::base::Pipe;
// We muck with our fds in a 'thread' that doesn't share the same fd table.
@@ -473,13 +475,15 @@
}
void* abort_message = nullptr;
+ uintptr_t si_val = reinterpret_cast<uintptr_t>(info->si_ptr);
if (signal_number == DEBUGGER_SIGNAL) {
if (info->si_code == SI_QUEUE && info->si_pid == __getpid()) {
// Allow for the abort message to be explicitly specified via the sigqueue value.
// Keep the bottom bit intact for representing whether we want a backtrace or a tombstone.
- uintptr_t value = reinterpret_cast<uintptr_t>(info->si_ptr);
- abort_message = reinterpret_cast<void*>(value & ~1);
- info->si_ptr = reinterpret_cast<void*>(value & 1);
+ if (si_val != kDebuggerdFallbackSivalUintptrRequestDump) {
+ abort_message = reinterpret_cast<void*>(si_val & ~1);
+ info->si_ptr = reinterpret_cast<void*>(si_val & 1);
+ }
}
} else {
if (g_callbacks.get_abort_message) {
@@ -492,7 +496,8 @@
// of a specific thread. It is possible that the prctl call might return 1,
// then return 0 in subsequent calls, so check the sival_int to determine if
// the fallback handler should be called first.
- if (info->si_value.sival_int == ~0 || prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0) == 1) {
+ if (si_val == kDebuggerdFallbackSivalUintptrRequestDump ||
+ prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0) == 1) {
// This check might be racy if another thread sets NO_NEW_PRIVS, but this should be unlikely,
// you can only set NO_NEW_PRIVS to 1, and the effect should be at worst a single missing
// ANR trace.
diff --git a/debuggerd/handler/fallback.h b/debuggerd/handler/fallback.h
new file mode 100644
index 0000000..597f582
--- /dev/null
+++ b/debuggerd/handler/fallback.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <stdint.h>
+
+static void* const kDebuggerdFallbackSivalPtrRequestDump = reinterpret_cast<void*>(~0UL);
+static const uintptr_t kDebuggerdFallbackSivalUintptrRequestDump = ~0UL;
diff --git a/debuggerd/tombstoned/tombstoned.cpp b/debuggerd/tombstoned/tombstoned.cpp
index 15ae406..ad92067 100644
--- a/debuggerd/tombstoned/tombstoned.cpp
+++ b/debuggerd/tombstoned/tombstoned.cpp
@@ -212,8 +212,13 @@
bool intercepted =
intercept_manager->GetIntercept(crash->crash_pid, crash->crash_type, &output_fd);
if (!intercepted) {
- std::tie(crash->crash_tombstone_path, output_fd) = CrashQueue::for_crash(crash)->get_output();
- crash->crash_tombstone_fd.reset(dup(output_fd.get()));
+ if (crash->crash_type == kDebuggerdNativeBacktrace) {
+ // Don't generate tombstones for native backtrace requests.
+ output_fd.reset(open("/dev/null", O_WRONLY | O_CLOEXEC));
+ } else {
+ std::tie(crash->crash_tombstone_path, output_fd) = CrashQueue::for_crash(crash)->get_output();
+ crash->crash_tombstone_fd.reset(dup(output_fd.get()));
+ }
}
TombstonedCrashPacket response = {
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index 817afd0..8e6c125 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -148,6 +148,11 @@
{ nullptr, "system_other.img", "system.sig", "system", true, ImageType::Normal },
{ "userdata", "userdata.img", "userdata.sig", "userdata", true, ImageType::Extra },
{ "vbmeta", "vbmeta.img", "vbmeta.sig", "vbmeta", true, ImageType::BootCritical },
+ { "vbmeta_mainline",
+ "vbmeta_mainline.img",
+ "vbmeta_mainline.sig",
+ "vbmeta_mainline",
+ true, ImageType::BootCritical },
{ "vendor", "vendor.img", "vendor.sig", "vendor", true, ImageType::Normal },
{ nullptr, "vendor_other.img", "vendor.sig", "vendor", true, ImageType::Normal },
// clang-format on
diff --git a/init/Android.mk b/init/Android.mk
index dc400ad..5554995 100644
--- a/init/Android.mk
+++ b/init/Android.mk
@@ -61,9 +61,9 @@
# Set up the same mount points on the ramdisk that system-as-root contains.
LOCAL_POST_INSTALL_CMD := \
mkdir -p $(TARGET_RAMDISK_OUT)/dev \
- mkdir -p $(TARGET_RAMDISK_OUT)/mnt \
- mkdir -p $(TARGET_RAMDISK_OUT)/proc \
- mkdir -p $(TARGET_RAMDISK_OUT)/sys \
+ $(TARGET_RAMDISK_OUT)/mnt \
+ $(TARGET_RAMDISK_OUT)/proc \
+ $(TARGET_RAMDISK_OUT)/sys \
LOCAL_STATIC_LIBRARIES := \
libfs_mgr \
diff --git a/init/first_stage_mount.cpp b/init/first_stage_mount.cpp
index fa3392e..79cfbcb 100644
--- a/init/first_stage_mount.cpp
+++ b/init/first_stage_mount.cpp
@@ -120,8 +120,14 @@
return is_android_dt_value_expected("vbmeta/compatible", "android,vbmeta");
}
-static bool inline IsRecoveryMode() {
- return access("/system/bin/recovery", F_OK) == 0;
+static bool IsRecoveryMode() {
+ static bool force_normal_boot = []() {
+ std::string cmdline;
+ android::base::ReadFileToString("/proc/cmdline", &cmdline);
+ return cmdline.find("androidboot.force_normal_boot=1") != std::string::npos;
+ }();
+
+ return !force_normal_boot && access("/system/bin/recovery", F_OK) == 0;
}
static inline bool IsDmLinearEnabled() {
@@ -362,14 +368,16 @@
// this case, we mount system first then pivot to it. From that point on,
// we are effectively identical to a system-as-root device.
auto system_partition =
- std::find_if(mount_fstab_recs_.begin(), mount_fstab_recs_.end(),
- [](const auto& rec) { return rec->mount_point == "/system"s; });
+ std::find_if(mount_fstab_recs_.begin(), mount_fstab_recs_.end(), [](const auto& rec) {
+ return rec->mount_point == "/system"s ||
+ rec->mount_point == "/system_recovery_mount"s;
+ });
if (system_partition != mount_fstab_recs_.end()) {
if (!MountPartition(*system_partition)) {
return false;
}
- SwitchRoot("/system");
+ SwitchRoot((*system_partition)->mount_point);
mount_fstab_recs_.erase(system_partition);
}
diff --git a/init/init.cpp b/init/init.cpp
index 3ab0a52..e5c1548 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -19,6 +19,7 @@
#include <dirent.h>
#include <fcntl.h>
#include <pthread.h>
+#include <seccomp_policy.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
@@ -40,6 +41,7 @@
#include <cutils/android_reboot.h>
#include <keyutils.h>
#include <libavb/libavb.h>
+#include <selinux/android.h>
#ifndef RECOVERY
#include <binder/ProcessState.h>
@@ -585,6 +587,43 @@
android::base::InitLogging(argv, &android::base::KernelLogger, InitAborter);
}
+static void GlobalSeccomp() {
+ import_kernel_cmdline(false, [](const std::string& key, const std::string& value,
+ bool in_qemu) {
+ if (key == "androidboot.seccomp" && value == "global" && !set_global_seccomp_filter()) {
+ LOG(FATAL) << "Failed to globally enable seccomp!";
+ }
+ });
+}
+
+static void SetupSelinux(char** argv) {
+ android::base::InitLogging(argv, &android::base::KernelLogger, [](const char*) {
+ RebootSystem(ANDROID_RB_RESTART2, "bootloader");
+ });
+
+ // Set up SELinux, loading the SELinux policy.
+ SelinuxSetupKernelLogging();
+ SelinuxInitialize();
+
+ // We're in the kernel domain and want to transition to the init domain. File systems that
+ // store SELabels in their xattrs, such as ext4 do not need an explicit restorecon here,
+ // but other file systems do. In particular, this is needed for ramdisks such as the
+ // recovery image for A/B devices.
+ if (selinux_android_restorecon("/system/bin/init", 0) == -1) {
+ PLOG(FATAL) << "restorecon failed of /system/bin/init failed";
+ }
+
+ setenv("SELINUX_INITIALIZED", "true", 1);
+
+ const char* path = "/system/bin/init";
+ const char* args[] = {path, nullptr};
+ execv(path, const_cast<char**>(args));
+
+ // execv() only returns if an error happened, in which case we
+ // panic and never return from this function.
+ PLOG(FATAL) << "execv(\"" << path << "\") failed";
+}
+
int main(int argc, char** argv) {
if (!strcmp(basename(argv[0]), "ueventd")) {
return ueventd_main(argc, argv);
@@ -600,9 +639,16 @@
InstallRebootSignalHandlers();
}
+ if (getenv("SELINUX_INITIALIZED") == nullptr) {
+ SetupSelinux(argv);
+ }
+
InitKernelLogging(argv);
LOG(INFO) << "init second stage started!";
+ // Enable seccomp if global boot option was passed (otherwise it is enabled in zygote).
+ GlobalSeccomp();
+
// Set up a session keyring that all processes will have access to. It
// will hold things like FBE encryption keys. No process should override
// its session keyring.
@@ -631,6 +677,7 @@
if (avb_version) property_set("ro.boot.avb_version", avb_version);
// Clean up our environment.
+ unsetenv("SELINUX_INITIALIZED");
unsetenv("INIT_STARTED_AT");
unsetenv("INIT_SELINUX_TOOK");
unsetenv("INIT_AVB_VERSION");
diff --git a/init/init_first_stage.cpp b/init/init_first_stage.cpp
index 466cde3..0c4a110 100644
--- a/init/init_first_stage.cpp
+++ b/init/init_first_stage.cpp
@@ -15,7 +15,6 @@
*/
#include <paths.h>
-#include <seccomp_policy.h>
#include <stdlib.h>
#include <sys/mount.h>
#include <sys/stat.h>
@@ -30,11 +29,9 @@
#include <android-base/logging.h>
#include <cutils/android_reboot.h>
#include <private/android_filesystem_config.h>
-#include <selinux/android.h>
#include "first_stage_mount.h"
#include "reboot_utils.h"
-#include "selinux.h"
#include "util.h"
using android::base::boot_clock;
@@ -42,15 +39,6 @@
namespace android {
namespace init {
-static void GlobalSeccomp() {
- import_kernel_cmdline(false, [](const std::string& key, const std::string& value,
- bool in_qemu) {
- if (key == "androidboot.seccomp" && value == "global" && !set_global_seccomp_filter()) {
- LOG(FATAL) << "Failed to globally enable seccomp!";
- }
- });
-}
-
int main(int argc, char** argv) {
if (REBOOT_BOOTLOADER_ON_PANIC) {
InstallRebootSignalHandlers();
@@ -130,22 +118,6 @@
SetInitAvbVersionInRecovery();
- // Does this need to be done in first stage init or can it be done later?
- // Enable seccomp if global boot option was passed (otherwise it is enabled in zygote).
- GlobalSeccomp();
-
- // Set up SELinux, loading the SELinux policy.
- SelinuxSetupKernelLogging();
- SelinuxInitialize();
-
- // We're in the kernel domain and want to transition to the init domain when we exec second
- // stage init. File systems that store SELabels in their xattrs, such as ext4 do not need an
- // explicit restorecon here, but other file systems do. In particular, this is needed for
- // ramdisks such as the recovery image for A/B devices.
- if (selinux_android_restorecon("/system/bin/init", 0) == -1) {
- PLOG(FATAL) << "restorecon failed of /system/bin/init failed";
- }
-
static constexpr uint32_t kNanosecondsPerMillisecond = 1e6;
uint64_t start_ms = start_time.time_since_epoch().count() / kNanosecondsPerMillisecond;
setenv("INIT_STARTED_AT", std::to_string(start_ms).c_str(), 1);
diff --git a/init/modalias_handler.cpp b/init/modalias_handler.cpp
index 1e0db57..c61c210 100644
--- a/init/modalias_handler.cpp
+++ b/init/modalias_handler.cpp
@@ -50,7 +50,7 @@
}
// Key is striped module name to match names in alias file
- std::size_t start = args[0].find_last_of("/");
+ std::size_t start = args[0].find_last_of('/');
std::size_t end = args[0].find(".ko:");
if ((end - start) <= 1) return Error() << "malformed dependency line";
auto mod_name = args[0].substr(start + 1, (end - start) - 1);
diff --git a/init/tokenizer.cpp b/init/tokenizer.cpp
index bb143f1..7e05a0a 100644
--- a/init/tokenizer.cpp
+++ b/init/tokenizer.cpp
@@ -1,5 +1,7 @@
#include "tokenizer.h"
+#include <android-base/macros.h>
+
namespace android {
namespace init {
@@ -106,6 +108,7 @@
continue;
}
x++;
+ FALLTHROUGH_INTENDED;
case '\n':
/* \ <lf> -> line continuation */
state->line++;
diff --git a/liblog/tests/liblog_test.cpp b/liblog/tests/liblog_test.cpp
index a20808e..383d0e7 100644
--- a/liblog/tests/liblog_test.cpp
+++ b/liblog/tests/liblog_test.cpp
@@ -30,6 +30,7 @@
#include <string>
#include <android-base/file.h>
+#include <android-base/macros.h>
#include <android-base/stringprintf.h>
#ifdef __ANDROID__ // includes sys/properties.h which does not exist outside
#include <cutils/properties.h>
@@ -2516,7 +2517,7 @@
#endif
elem.data.string = const_cast<char*>("<unknown>");
elem.len = strlen(elem.data.string);
- /* FALLTHRU */
+ FALLTHROUGH_INTENDED;
case EVENT_TYPE_STRING:
if (elem.len <= strOutLen) {
memcpy(strOut, elem.data.string, elem.len);
diff --git a/libpixelflinger/Android.mk b/libpixelflinger/Android.mk
index 14883f4..8c80f6a 100644
--- a/libpixelflinger/Android.mk
+++ b/libpixelflinger/Android.mk
@@ -73,6 +73,7 @@
LOCAL_CFLAGS := $(PIXELFLINGER_CFLAGS)
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
LOCAL_C_INCLUDES += $(LOCAL_EXPORT_C_INCLUDE_DIRS)
+LOCAL_HEADER_LIBRARIES := libbase_headers
LOCAL_SHARED_LIBRARIES := libcutils liblog libutils
include $(BUILD_SHARED_LIBRARY)
diff --git a/libpixelflinger/buffer.cpp b/libpixelflinger/buffer.cpp
index dcb95c5..ea9514c 100644
--- a/libpixelflinger/buffer.cpp
+++ b/libpixelflinger/buffer.cpp
@@ -18,6 +18,8 @@
#include <assert.h>
+#include <android-base/macros.h>
+
#include "buffer.h"
namespace android {
@@ -266,8 +268,11 @@
p = downshift_component(p, b, hbits, lbits, f->bh, f->bl, 0, 1, -1);
p = downshift_component(p, a, hbits, lbits, f->ah, f->al, 0, 1, -1);
switch (f->size) {
- case 1: p |= p << 8; // fallthrough
- case 2: p |= p << 16;
+ case 1:
+ p |= p << 8;
+ FALLTHROUGH_INTENDED;
+ case 2:
+ p |= p << 16;
}
return p;
}
diff --git a/libpixelflinger/codeflinger/blending.cpp b/libpixelflinger/codeflinger/blending.cpp
index a55dfe3..2cbb00f 100644
--- a/libpixelflinger/codeflinger/blending.cpp
+++ b/libpixelflinger/codeflinger/blending.cpp
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <sys/types.h>
+#include <android-base/macros.h>
#include <log/log.h>
#include "GGLAssembler.h"
@@ -301,7 +302,7 @@
return;
}
}
- // fall-through...
+ FALLTHROUGH_INTENDED;
case GGL_ONE_MINUS_DST_COLOR:
case GGL_DST_COLOR:
case GGL_ONE_MINUS_SRC_COLOR:
diff --git a/libprocessgroup/OWNERS b/libprocessgroup/OWNERS
new file mode 100644
index 0000000..bfa730a
--- /dev/null
+++ b/libprocessgroup/OWNERS
@@ -0,0 +1,2 @@
+ccross@google.com
+tomcherry@google.com
diff --git a/libprocessgroup/processgroup.cpp b/libprocessgroup/processgroup.cpp
index 1cebb5d..0a42053 100644
--- a/libprocessgroup/processgroup.cpp
+++ b/libprocessgroup/processgroup.cpp
@@ -185,7 +185,7 @@
// Erase all pids that will be killed when we kill the process groups.
for (auto it = pids.begin(); it != pids.end();) {
- pid_t pgid = getpgid(pid);
+ pid_t pgid = getpgid(*it);
if (pgids.count(pgid) == 1) {
it = pids.erase(it);
} else {
diff --git a/libsysutils/src/SocketClient.cpp b/libsysutils/src/SocketClient.cpp
index 0625db7..fe2f3d6 100644
--- a/libsysutils/src/SocketClient.cpp
+++ b/libsysutils/src/SocketClient.cpp
@@ -27,6 +27,8 @@
#include <sys/types.h>
#include <unistd.h>
+#include <android-base/file.h>
+#include <android-base/macros.h>
#include <log/log.h>
#include <sysutils/SocketClient.h>
@@ -145,7 +147,8 @@
switch (*arg) {
case '\\':
case '"':
- *(current++) = '\\'; // fallthrough
+ *(current++) = '\\';
+ FALLTHROUGH_INTENDED;
default:
*(current++) = *(arg++);
}
diff --git a/libunwindstack/DwarfCfa.cpp b/libunwindstack/DwarfCfa.cpp
index cd9ef61..0fa1638 100644
--- a/libunwindstack/DwarfCfa.cpp
+++ b/libunwindstack/DwarfCfa.cpp
@@ -21,6 +21,7 @@
#include <type_traits>
#include <vector>
+#include <android-base/macros.h>
#include <android-base/stringprintf.h>
#include <unwindstack/DwarfError.h>
@@ -154,13 +155,15 @@
break;
case DwarfCfaInfo::DWARF_DISPLAY_ADVANCE_LOC:
*cur_pc += value;
- // Fall through to log the value.
+ FALLTHROUGH_INTENDED;
+ // Fall through to log the value.
case DwarfCfaInfo::DWARF_DISPLAY_NUMBER:
string += " " + std::to_string(value);
break;
case DwarfCfaInfo::DWARF_DISPLAY_SET_LOC:
*cur_pc = value;
- // Fall through to log the value.
+ FALLTHROUGH_INTENDED;
+ // Fall through to log the value.
case DwarfCfaInfo::DWARF_DISPLAY_ADDRESS:
if (std::is_same<AddressType, uint32_t>::value) {
string += android::base::StringPrintf(" 0x%" PRIx32, static_cast<uint32_t>(value));
diff --git a/libunwindstack/DwarfSection.cpp b/libunwindstack/DwarfSection.cpp
index 6061f61..57a780e 100644
--- a/libunwindstack/DwarfSection.cpp
+++ b/libunwindstack/DwarfSection.cpp
@@ -461,6 +461,7 @@
if (reg == eval_info->cie->return_address_register) {
eval_info->return_address_undefined = true;
}
+ break;
default:
break;
}
diff --git a/libutils/Android.bp b/libutils/Android.bp
index 1c1bdf7..600c91c 100644
--- a/libutils/Android.bp
+++ b/libutils/Android.bp
@@ -59,6 +59,7 @@
"-Werror",
],
header_libs: [
+ "libbase_headers",
"libutils_headers",
],
export_header_lib_headers: [
diff --git a/libutils/RefBase.cpp b/libutils/RefBase.cpp
index 3f1e79a..ae10789 100644
--- a/libutils/RefBase.cpp
+++ b/libutils/RefBase.cpp
@@ -19,6 +19,8 @@
#include <memory>
+#include <android-base/macros.h>
+
#include <utils/RefBase.h>
#include <utils/CallStack.h>
@@ -479,7 +481,7 @@
case INITIAL_STRONG_VALUE:
refs->mStrong.fetch_sub(INITIAL_STRONG_VALUE,
std::memory_order_relaxed);
- // fall through...
+ FALLTHROUGH_INTENDED;
case 0:
refs->mBase->onFirstRef();
}
diff --git a/libutils/Unicode.cpp b/libutils/Unicode.cpp
index 82f650d..5f0a51f 100644
--- a/libutils/Unicode.cpp
+++ b/libutils/Unicode.cpp
@@ -16,8 +16,9 @@
#define LOG_TAG "unicode"
-#include <utils/Unicode.h>
+#include <android-base/macros.h>
#include <limits.h>
+#include <utils/Unicode.h>
#include <log/log.h>
@@ -105,8 +106,11 @@
switch (bytes)
{ /* note: everything falls through. */
case 4: *--dstP = (uint8_t)((srcChar | kByteMark) & kByteMask); srcChar >>= 6;
+ FALLTHROUGH_INTENDED;
case 3: *--dstP = (uint8_t)((srcChar | kByteMark) & kByteMask); srcChar >>= 6;
+ FALLTHROUGH_INTENDED;
case 2: *--dstP = (uint8_t)((srcChar | kByteMark) & kByteMask); srcChar >>= 6;
+ FALLTHROUGH_INTENDED;
case 1: *--dstP = (uint8_t)(srcChar | kFirstByteMark[bytes]);
}
}
diff --git a/libziparchive/zip_archive.cc b/libziparchive/zip_archive.cc
index add6e14..f8d1356 100644
--- a/libziparchive/zip_archive.cc
+++ b/libziparchive/zip_archive.cc
@@ -122,21 +122,36 @@
#endif
}
+static bool isZipStringEqual(const uint8_t* start, const ZipString& zip_string,
+ const ZipStringOffset& zip_string_offset) {
+ const ZipString from_offset = zip_string_offset.GetZipString(start);
+ return from_offset == zip_string;
+}
+
+/**
+ * Returns offset of ZipString#name from the start of the central directory in the memory map.
+ * For valid ZipStrings contained in the zip archive mmap, 0 < offset < 0xffffff.
+ */
+static inline uint32_t GetOffset(const uint8_t* name, const uint8_t* start) {
+ CHECK_GT(name, start);
+ CHECK_LT(name, start + 0xffffff);
+ return static_cast<uint32_t>(name - start);
+}
+
/*
* Convert a ZipEntry to a hash table index, verifying that it's in a
* valid range.
*/
-static int64_t EntryToIndex(const ZipString* hash_table, const uint32_t hash_table_size,
- const ZipString& name) {
+static int64_t EntryToIndex(const ZipStringOffset* hash_table, const uint32_t hash_table_size,
+ const ZipString& name, const uint8_t* start) {
const uint32_t hash = ComputeHash(name);
// NOTE: (hash_table_size - 1) is guaranteed to be non-negative.
uint32_t ent = hash & (hash_table_size - 1);
- while (hash_table[ent].name != NULL) {
- if (hash_table[ent] == name) {
+ while (hash_table[ent].name_offset != 0) {
+ if (isZipStringEqual(start, name, hash_table[ent])) {
return ent;
}
-
ent = (ent + 1) & (hash_table_size - 1);
}
@@ -147,8 +162,8 @@
/*
* Add a new entry to the hash table.
*/
-static int32_t AddToHash(ZipString* hash_table, const uint64_t hash_table_size,
- const ZipString& name) {
+static int32_t AddToHash(ZipStringOffset* hash_table, const uint64_t hash_table_size,
+ const ZipString& name, const uint8_t* start) {
const uint64_t hash = ComputeHash(name);
uint32_t ent = hash & (hash_table_size - 1);
@@ -156,20 +171,26 @@
* We over-allocated the table, so we're guaranteed to find an empty slot.
* Further, we guarantee that the hashtable size is not 0.
*/
- while (hash_table[ent].name != NULL) {
- if (hash_table[ent] == name) {
+ while (hash_table[ent].name_offset != 0) {
+ if (isZipStringEqual(start, name, hash_table[ent])) {
// We've found a duplicate entry. We don't accept it
ALOGW("Zip: Found duplicate entry %.*s", name.name_length, name.name);
return kDuplicateEntry;
}
ent = (ent + 1) & (hash_table_size - 1);
}
-
- hash_table[ent].name = name.name;
+ hash_table[ent].name_offset = GetOffset(name.name, start);
hash_table[ent].name_length = name.name_length;
return 0;
}
+#if defined(__BIONIC__)
+uint64_t GetOwnerTag(const ZipArchive* archive) {
+ return android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_ZIPARCHIVE,
+ reinterpret_cast<uint64_t>(archive));
+}
+#endif
+
ZipArchive::ZipArchive(const int fd, bool assume_ownership)
: mapped_zip(fd),
close_file(assume_ownership),
@@ -181,7 +202,7 @@
hash_table(nullptr) {
#if defined(__BIONIC__)
if (assume_ownership) {
- android_fdsan_exchange_owner_tag(fd, 0, reinterpret_cast<uint64_t>(this));
+ android_fdsan_exchange_owner_tag(fd, 0, GetOwnerTag(this));
}
#endif
}
@@ -199,7 +220,7 @@
ZipArchive::~ZipArchive() {
if (close_file && mapped_zip.GetFileDescriptor() >= 0) {
#if defined(__BIONIC__)
- android_fdsan_close_with_tag(mapped_zip.GetFileDescriptor(), reinterpret_cast<uint64_t>(this));
+ android_fdsan_close_with_tag(mapped_zip.GetFileDescriptor(), GetOwnerTag(this));
#else
close(mapped_zip.GetFileDescriptor());
#endif
@@ -209,7 +230,8 @@
}
static int32_t MapCentralDirectory0(const char* debug_file_name, ZipArchive* archive,
- off64_t file_length, off64_t read_amount, uint8_t* scan_buffer) {
+ off64_t file_length, off64_t read_amount,
+ uint8_t* scan_buffer) {
const off64_t search_start = file_length - read_amount;
if (!archive->mapped_zip.ReadAtOffset(scan_buffer, read_amount, search_start)) {
@@ -362,7 +384,7 @@
*/
archive->hash_table_size = RoundUpPower2(1 + (num_entries * 4) / 3);
archive->hash_table =
- reinterpret_cast<ZipString*>(calloc(archive->hash_table_size, sizeof(ZipString)));
+ reinterpret_cast<ZipStringOffset*>(calloc(archive->hash_table_size, sizeof(ZipStringOffset)));
if (archive->hash_table == nullptr) {
ALOGW("Zip: unable to allocate the %u-entry hash_table, entry size: %zu",
archive->hash_table_size, sizeof(ZipString));
@@ -418,7 +440,8 @@
ZipString entry_name;
entry_name.name = file_name;
entry_name.name_length = file_name_length;
- const int add_result = AddToHash(archive->hash_table, archive->hash_table_size, entry_name);
+ const int add_result = AddToHash(archive->hash_table, archive->hash_table_size, entry_name,
+ archive->central_directory.GetBasePtr());
if (add_result != 0) {
ALOGW("Zip: Error adding entry to hash table %d", add_result);
return add_result;
@@ -538,7 +561,9 @@
// Recover the start of the central directory entry from the filename
// pointer. The filename is the first entry past the fixed-size data,
// so we can just subtract back from that.
- const uint8_t* ptr = archive->hash_table[ent].name;
+ const ZipString from_offset =
+ archive->hash_table[ent].GetZipString(archive->central_directory.GetBasePtr());
+ const uint8_t* ptr = from_offset.name;
ptr -= sizeof(CentralDirectoryRecord);
// This is the base of our mmapped region, we have to sanity check that
@@ -648,8 +673,9 @@
ALOGW("Zip: failed reading lfh name from offset %" PRId64, static_cast<int64_t>(name_offset));
return kIoError;
}
-
- if (memcmp(archive->hash_table[ent].name, name_buf.data(), nameLen)) {
+ const ZipString from_offset =
+ archive->hash_table[ent].GetZipString(archive->central_directory.GetBasePtr());
+ if (memcmp(from_offset.name, name_buf.data(), nameLen)) {
return kInconsistentInformation;
}
@@ -747,19 +773,19 @@
return kInvalidEntryName;
}
- const int64_t ent = EntryToIndex(archive->hash_table, archive->hash_table_size, entryName);
-
+ const int64_t ent = EntryToIndex(archive->hash_table, archive->hash_table_size, entryName,
+ archive->central_directory.GetBasePtr());
if (ent < 0) {
ALOGV("Zip: Could not find entry %.*s", entryName.name_length, entryName.name);
return ent;
}
-
return FindEntry(archive, ent, data);
}
int32_t Next(void* cookie, ZipEntry* data, ZipString* name) {
IterationHandle* handle = reinterpret_cast<IterationHandle*>(cookie);
if (handle == NULL) {
+ ALOGW("Zip: Null ZipArchiveHandle");
return kInvalidHandle;
}
@@ -771,19 +797,19 @@
const uint32_t currentOffset = handle->position;
const uint32_t hash_table_length = archive->hash_table_size;
- const ZipString* hash_table = archive->hash_table;
-
+ const ZipStringOffset* hash_table = archive->hash_table;
for (uint32_t i = currentOffset; i < hash_table_length; ++i) {
- if (hash_table[i].name != NULL &&
- (handle->prefix.name_length == 0 || hash_table[i].StartsWith(handle->prefix)) &&
- (handle->suffix.name_length == 0 || hash_table[i].EndsWith(handle->suffix))) {
+ const ZipString from_offset =
+ hash_table[i].GetZipString(archive->central_directory.GetBasePtr());
+ if (hash_table[i].name_offset != 0 &&
+ (handle->prefix.name_length == 0 || from_offset.StartsWith(handle->prefix)) &&
+ (handle->suffix.name_length == 0 || from_offset.EndsWith(handle->suffix))) {
handle->position = (i + 1);
const int error = FindEntry(archive, i, data);
if (!error) {
- name->name = hash_table[i].name;
+ name->name = from_offset.name;
name->name_length = hash_table[i].name_length;
}
-
return error;
}
}
diff --git a/libziparchive/zip_archive_private.h b/libziparchive/zip_archive_private.h
index 0a73300..83cb11f 100644
--- a/libziparchive/zip_archive_private.h
+++ b/libziparchive/zip_archive_private.h
@@ -136,6 +136,26 @@
size_t length_;
};
+/**
+ * More space efficient string representation of strings in an mmaped zipped file than
+ * std::string_view or ZipString. Using ZipString as an entry in the ZipArchive hashtable wastes
+ * space. ZipString stores a pointer to a string (on 64 bit, 8 bytes) and the length to read from
+ * that pointer, 2 bytes. Because of alignment, the structure consumes 16 bytes, wasting 6 bytes.
+ * ZipStringOffset stores a 4 byte offset from a fixed location in the memory mapped file instead
+ * of the entire address, consuming 8 bytes with alignment.
+ */
+struct ZipStringOffset {
+ uint32_t name_offset;
+ uint16_t name_length;
+
+ const ZipString GetZipString(const uint8_t* start) const {
+ ZipString zip_string;
+ zip_string.name = start + name_offset;
+ zip_string.name_length = name_length;
+ return zip_string;
+ }
+};
+
struct ZipArchive {
// open Zip archive
mutable MappedZipFile mapped_zip;
@@ -154,7 +174,7 @@
// allocate so the maximum number entries can never be higher than
// ((4 * UINT16_MAX) / 3 + 1) which can safely fit into a uint32_t.
uint32_t hash_table_size;
- ZipString* hash_table;
+ ZipStringOffset* hash_table;
ZipArchive(const int fd, bool assume_ownership);
ZipArchive(void* address, size_t length);
diff --git a/logcat/logcat.cpp b/logcat/logcat.cpp
index 0f1badb..115b1a3 100644
--- a/logcat/logcat.cpp
+++ b/logcat/logcat.cpp
@@ -16,6 +16,7 @@
#include "logcat.h"
+#include <android-base/macros.h>
#include <arpa/inet.h>
#include <assert.h>
#include <ctype.h>
@@ -959,7 +960,7 @@
case 't':
got_t = true;
mode |= ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK;
- // FALLTHRU
+ FALLTHROUGH_INTENDED;
case 'T':
if (strspn(optarg, "0123456789") != strlen(optarg)) {
char* cp = parseTime(tail_time, optarg);
@@ -1009,7 +1010,7 @@
getLogSize = true;
break;
}
- // FALLTHRU
+ FALLTHROUGH_INTENDED;
case 'G': {
char* cp;
@@ -1023,15 +1024,15 @@
case 'g':
case 'G':
setLogSize *= 1024;
- // FALLTHRU
+ FALLTHROUGH_INTENDED;
case 'm':
case 'M':
setLogSize *= 1024;
- // FALLTHRU
+ FALLTHROUGH_INTENDED;
case 'k':
case 'K':
setLogSize *= 1024;
- // FALLTHRU
+ FALLTHROUGH_INTENDED;
case '\0':
break;
@@ -1051,7 +1052,7 @@
getPruneList = true;
break;
}
- // FALLTHRU
+ FALLTHROUGH_INTENDED;
case 'P':
setPruneList = optarg;
diff --git a/logcat/tests/logcat_test.cpp b/logcat/tests/logcat_test.cpp
index bebcc71..9483bb2 100644
--- a/logcat/tests/logcat_test.cpp
+++ b/logcat/tests/logcat_test.cpp
@@ -31,6 +31,7 @@
#include <string>
#include <android-base/file.h>
+#include <android-base/macros.h>
#include <android-base/stringprintf.h>
#include <gtest/gtest.h>
#include <log/event_tag_map.h>
@@ -572,13 +573,13 @@
switch (size_mult[0]) {
case 'G':
full_size *= 1024;
- /* FALLTHRU */
+ FALLTHROUGH_INTENDED;
case 'M':
full_size *= 1024;
- /* FALLTHRU */
+ FALLTHROUGH_INTENDED;
case 'K':
full_size *= 1024;
- /* FALLTHRU */
+ FALLTHROUGH_INTENDED;
case 'B':
break;
default:
@@ -588,13 +589,13 @@
switch (consumed_mult[0]) {
case 'G':
full_consumed *= 1024;
- /* FALLTHRU */
+ FALLTHROUGH_INTENDED;
case 'M':
full_consumed *= 1024;
- /* FALLTHRU */
+ FALLTHROUGH_INTENDED;
case 'K':
full_consumed *= 1024;
- /* FALLTHRU */
+ FALLTHROUGH_INTENDED;
case 'B':
break;
default:
@@ -1241,26 +1242,26 @@
switch (size_mult[0]) {
case 'G':
full_size *= 1024;
- /* FALLTHRU */
+ FALLTHROUGH_INTENDED;
case 'M':
full_size *= 1024;
- /* FALLTHRU */
+ FALLTHROUGH_INTENDED;
case 'K':
full_size *= 1024;
- /* FALLTHRU */
+ FALLTHROUGH_INTENDED;
case 'B':
break;
}
switch (consumed_mult[0]) {
case 'G':
full_consumed *= 1024;
- /* FALLTHRU */
+ FALLTHROUGH_INTENDED;
case 'M':
full_consumed *= 1024;
- /* FALLTHRU */
+ FALLTHROUGH_INTENDED;
case 'K':
full_consumed *= 1024;
- /* FALLTHRU */
+ FALLTHROUGH_INTENDED;
case 'B':
break;
}
diff --git a/logd/LogKlog.cpp b/logd/LogKlog.cpp
index e4393a3..513c0c3 100644
--- a/logd/LogKlog.cpp
+++ b/logd/LogKlog.cpp
@@ -475,9 +475,7 @@
static int convertKernelPrioToAndroidPrio(int pri) {
switch (pri & LOG_PRIMASK) {
case LOG_EMERG:
- // FALLTHRU
case LOG_ALERT:
- // FALLTHRU
case LOG_CRIT:
return ANDROID_LOG_FATAL;
@@ -488,9 +486,7 @@
return ANDROID_LOG_WARN;
default:
- // FALLTHRU
case LOG_NOTICE:
- // FALLTHRU
case LOG_INFO:
break;
diff --git a/rootdir/etc/ld.config.txt b/rootdir/etc/ld.config.txt
index f2892f8..d3e80c9 100644
--- a/rootdir/etc/ld.config.txt
+++ b/rootdir/etc/ld.config.txt
@@ -8,7 +8,6 @@
dir.system = /system/bin/
dir.system = /system/xbin/
dir.system = /%PRODUCT%/bin/
-dir.system = /%PRODUCT_SERVICES%/bin/
dir.vendor = /odm/bin/
dir.vendor = /vendor/bin/
@@ -78,9 +77,9 @@
namespace.default.asan.search.paths = /data/asan/system/${LIB}
namespace.default.asan.search.paths += /system/${LIB}
namespace.default.asan.search.paths += /data/asan/product/${LIB}
-namespace.default.asan.search.paths += /product/${LIB}
+namespace.default.asan.search.paths += /%PRODUCT%/${LIB}
namespace.default.asan.search.paths += /data/asan/product_services/${LIB}
-namespace.default.asan.search.paths += /product_services/${LIB}
+namespace.default.asan.search.paths += /%PRODUCT_SERVICES%/${LIB}
namespace.default.asan.permitted.paths = /data
namespace.default.asan.permitted.paths += /system/${LIB}/drm
@@ -345,7 +344,9 @@
namespace.system.asan.search.paths = /data/asan/system/${LIB}
namespace.system.asan.search.paths += /system/${LIB}
namespace.system.asan.search.paths += /data/asan/product/${LIB}
-namespace.system.asan.search.paths += /product/${LIB}
+namespace.system.asan.search.paths += /%PRODUCT%/${LIB}
+namespace.system.asan.search.paths += /data/asan/product_services/${LIB}
+namespace.system.asan.search.paths += /%PRODUCT_SERVICES%/${LIB}
###############################################################################
# Namespace config for binaries under /postinstall.
diff --git a/rootdir/etc/ld.config.vndk_lite.txt b/rootdir/etc/ld.config.vndk_lite.txt
index db65c14..7e354ac 100644
--- a/rootdir/etc/ld.config.vndk_lite.txt
+++ b/rootdir/etc/ld.config.vndk_lite.txt
@@ -7,7 +7,7 @@
# absolute path of an executable is selected.
dir.system = /system/bin/
dir.system = /system/xbin/
-dir.system = /product/bin/
+dir.system = /%PRODUCT%/bin/
dir.vendor = /odm/bin/
dir.vendor = /vendor/bin/
@@ -41,7 +41,8 @@
namespace.default.search.paths = /system/${LIB}
namespace.default.search.paths += /odm/${LIB}
namespace.default.search.paths += /vendor/${LIB}
-namespace.default.search.paths += /product/${LIB}
+namespace.default.search.paths += /%PRODUCT%/${LIB}
+namespace.default.search.paths += /%PRODUCT_SERVICES%/${LIB}
namespace.default.asan.search.paths = /data/asan/system/${LIB}
namespace.default.asan.search.paths += /system/${LIB}
@@ -50,7 +51,9 @@
namespace.default.asan.search.paths += /data/asan/vendor/${LIB}
namespace.default.asan.search.paths += /vendor/${LIB}
namespace.default.asan.search.paths += /data/asan/product/${LIB}
-namespace.default.asan.search.paths += /product/${LIB}
+namespace.default.asan.search.paths += /%PRODUCT%/${LIB}
+namespace.default.asan.search.paths += /data/asan/product_services/${LIB}
+namespace.default.asan.search.paths += /%PRODUCT_SERVICES%/${LIB}
###############################################################################
# "sphal" namespace
@@ -209,7 +212,8 @@
namespace.default.search.paths += /system/${LIB}/vndk%VNDK_VER%
namespace.default.search.paths += /system/${LIB}/vndk-sp%VNDK_VER%
namespace.default.search.paths += /system/${LIB}
-namespace.default.search.paths += /product/${LIB}
+namespace.default.search.paths += /%PRODUCT%/${LIB}
+namespace.default.search.paths += /%PRODUCT_SERVICES%/${LIB}
namespace.default.asan.search.paths = /data/asan/odm/${LIB}
namespace.default.asan.search.paths += /odm/${LIB}
@@ -230,7 +234,9 @@
namespace.default.asan.search.paths += /data/asan/system/${LIB}
namespace.default.asan.search.paths += /system/${LIB}
namespace.default.asan.search.paths += /data/asan/product/${LIB}
-namespace.default.asan.search.paths += /product/${LIB}
+namespace.default.asan.search.paths += /%PRODUCT%/${LIB}
+namespace.default.asan.search.paths += /data/asan/product_services/${LIB}
+namespace.default.asan.search.paths += /%PRODUCT_SERVICES%/${LIB}
###############################################################################
# Namespace config for binaries under /postinstall.
@@ -243,4 +249,5 @@
[postinstall]
namespace.default.isolated = false
namespace.default.search.paths = /system/${LIB}
-namespace.default.search.paths += /product/${LIB}
+namespace.default.search.paths += /%PRODUCT%/${LIB}
+namespace.default.search.paths += /%PRODUCT_SERVICES%/${LIB}
diff --git a/rootdir/etc/public.libraries.android.txt b/rootdir/etc/public.libraries.android.txt
index e20b95d..d8f6095 100644
--- a/rootdir/etc/public.libraries.android.txt
+++ b/rootdir/etc/public.libraries.android.txt
@@ -1,6 +1,7 @@
# See https://android.googlesource.com/platform/ndk/+/master/docs/PlatformApis.md
libandroid.so
libaaudio.so
+libbinder_ndk.so
libc.so
libcamera2ndk.so
libdl.so
diff --git a/rootdir/etc/public.libraries.iot.txt b/rootdir/etc/public.libraries.iot.txt
index ff0813d..20905bf 100644
--- a/rootdir/etc/public.libraries.iot.txt
+++ b/rootdir/etc/public.libraries.iot.txt
@@ -2,6 +2,7 @@
libandroid.so
libandroidthings.so
libaaudio.so
+libbinder_ndk.so
libc.so
libcamera2ndk.so
libdl.so
diff --git a/rootdir/etc/public.libraries.wear.txt b/rootdir/etc/public.libraries.wear.txt
index 3c46094..4ece5b5 100644
--- a/rootdir/etc/public.libraries.wear.txt
+++ b/rootdir/etc/public.libraries.wear.txt
@@ -1,6 +1,7 @@
# See https://android.googlesource.com/platform/ndk/+/master/docs/PlatformApis.md
libandroid.so
libaaudio.so
+libbinder_ndk.so
libc.so
libcamera2ndk.so
libdl.so
diff --git a/storaged/storaged_diskstats.cpp b/storaged/storaged_diskstats.cpp
index 1050033..8b5001d 100644
--- a/storaged/storaged_diskstats.cpp
+++ b/storaged/storaged_diskstats.cpp
@@ -129,6 +129,10 @@
bool success = false;
auto ret = service->getDiskStats([&success, stats](auto result, const auto& halStats) {
+ if (result == Result::NOT_SUPPORTED) {
+ LOG_TO(SYSTEM, DEBUG) << "getDiskStats is not supported on health HAL.";
+ return;
+ }
if (result != Result::SUCCESS || halStats.size() == 0) {
LOG_TO(SYSTEM, ERROR) << "getDiskStats failed with result " << toString(result)
<< " and size " << halStats.size();
diff --git a/storaged/storaged_info.cpp b/storaged/storaged_info.cpp
index 5605f66..8c0b3d1 100644
--- a/storaged/storaged_info.cpp
+++ b/storaged/storaged_info.cpp
@@ -370,8 +370,12 @@
void health_storage_info_t::report() {
auto ret = mHealth->getStorageInfo([this](auto result, const auto& halInfos) {
+ if (result == Result::NOT_SUPPORTED) {
+ LOG_TO(SYSTEM, DEBUG) << "getStorageInfo is not supported on health HAL.";
+ return;
+ }
if (result != Result::SUCCESS || halInfos.size() == 0) {
- LOG_TO(SYSTEM, DEBUG) << "getStorageInfo failed with result " << toString(result)
+ LOG_TO(SYSTEM, ERROR) << "getStorageInfo failed with result " << toString(result)
<< " and size " << halInfos.size();
return;
}
@@ -380,7 +384,7 @@
});
if (!ret.isOk()) {
- LOG_TO(SYSTEM, DEBUG) << "getStorageInfo failed with " << ret.description();
+ LOG_TO(SYSTEM, ERROR) << "getStorageInfo failed with " << ret.description();
}
}