Merge "Fix cow v3 size estimation errors" into main
diff --git a/debuggerd/libdebuggerd/scudo.cpp b/debuggerd/libdebuggerd/scudo.cpp
index 837f406..ea8dff4 100644
--- a/debuggerd/libdebuggerd/scudo.cpp
+++ b/debuggerd/libdebuggerd/scudo.cpp
@@ -78,7 +78,8 @@
}
__scudo_get_error_info(&error_info_, process_info.maybe_tagged_fault_address, stack_depot.get(),
- region_info.get(), ring_buffer.get(), memory.get(), memory_tags.get(),
+ __scudo_get_stack_depot_size(), region_info.get(), ring_buffer.get(),
+ process_info.scudo_ring_buffer_size, memory.get(), memory_tags.get(),
memory_begin, memory_end - memory_begin);
}
diff --git a/fastboot/task_test.cpp b/fastboot/task_test.cpp
index 9cde1a8..81154c6 100644
--- a/fastboot/task_test.cpp
+++ b/fastboot/task_test.cpp
@@ -354,7 +354,7 @@
const std::vector<std::unique_ptr<Task>>& tasks) {
bool contains_optimized_task = false;
for (auto& task : tasks) {
- if (auto optimized_task = task->AsOptimizedFlashSuperTask()) {
+ if (task->AsOptimizedFlashSuperTask()) {
contains_optimized_task = true;
}
if (auto flash_task = task->AsFlashTask()) {
diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp
index 35c8c63..a94a274 100644
--- a/fs_mgr/fs_mgr.cpp
+++ b/fs_mgr/fs_mgr.cpp
@@ -1244,17 +1244,27 @@
};
std::string fs_mgr_find_bow_device(const std::string& block_device) {
- if (block_device.substr(0, 5) != "/dev/") {
- LOG(ERROR) << "Expected block device, got " << block_device;
- return std::string();
+ // handle symlink such as "/dev/block/mapper/userdata"
+ std::string real_path;
+ if (!android::base::Realpath(block_device, &real_path)) {
+ real_path = block_device;
}
- std::string sys_dir = std::string("/sys/") + block_device.substr(5);
-
+ struct stat st;
+ if (stat(real_path.c_str(), &st) < 0) {
+ PLOG(ERROR) << "stat failed: " << real_path;
+ return std::string();
+ }
+ if (!S_ISBLK(st.st_mode)) {
+ PLOG(ERROR) << real_path << " is not block device";
+ return std::string();
+ }
+ std::string sys_dir = android::base::StringPrintf("/sys/dev/block/%u:%u", major(st.st_rdev),
+ minor(st.st_rdev));
for (;;) {
std::string name;
if (!android::base::ReadFileToString(sys_dir + "/dm/name", &name)) {
- PLOG(ERROR) << block_device << " is not dm device";
+ PLOG(ERROR) << real_path << " is not dm device";
return std::string();
}