summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--adb/daemon/usb_ffs.cpp2
-rw-r--r--fastboot/fuzzy_fastboot/Android.bp2
-rwxr-xr-xfs_mgr/fs_mgr.cpp42
-rw-r--r--fs_mgr/include/fs_mgr.h5
-rw-r--r--fs_mgr/libdm/Android.bp2
-rw-r--r--fs_mgr/libdm/dm_target.cpp18
-rw-r--r--fs_mgr/libdm/dm_test.cpp34
-rw-r--r--fs_mgr/libdm/include/libdm/dm_target.h5
-rw-r--r--fs_mgr/libfiemap/Android.bp2
-rw-r--r--fs_mgr/liblp/Android.bp2
-rw-r--r--fs_mgr/liblp/liblp_test.xml1
-rw-r--r--fs_mgr/libsnapshot/Android.bp2
-rw-r--r--fs_mgr/tests/fs_mgr_test.cpp4
-rw-r--r--init/first_stage_init.cpp13
-rw-r--r--libcutils/Android.bp2
-rw-r--r--libmodprobe/include/modprobe/modprobe.h2
-rw-r--r--libmodprobe/libmodprobe.cpp4
-rw-r--r--libstats/pull/Android.bp5
-rw-r--r--libstats/socket/Android.bp1
-rw-r--r--rootdir/init.rc6
20 files changed, 78 insertions, 76 deletions
diff --git a/adb/daemon/usb_ffs.cpp b/adb/daemon/usb_ffs.cpp
index 7bd611b66..e538ca885 100644
--- a/adb/daemon/usb_ffs.cpp
+++ b/adb/daemon/usb_ffs.cpp
@@ -300,7 +300,6 @@ bool open_functionfs(android::base::unique_fd* out_control, android::base::uniqu
}
// Signal only when writing the descriptors to ffs
android::base::SetProperty("sys.usb.ffs.ready", "1");
- *out_control = std::move(control);
}
bulk_out.reset(adb_open(USB_FFS_ADB_OUT, O_RDONLY));
@@ -315,6 +314,7 @@ bool open_functionfs(android::base::unique_fd* out_control, android::base::uniqu
return false;
}
+ *out_control = std::move(control);
*out_bulk_in = std::move(bulk_in);
*out_bulk_out = std::move(bulk_out);
return true;
diff --git a/fastboot/fuzzy_fastboot/Android.bp b/fastboot/fuzzy_fastboot/Android.bp
index bb54fd983..aa449b2fb 100644
--- a/fastboot/fuzzy_fastboot/Android.bp
+++ b/fastboot/fuzzy_fastboot/Android.bp
@@ -49,6 +49,6 @@ cc_test_host {
auto_gen_config: false,
test_suites: [
"general-tests",
- "vts-core",
+ "vts",
],
}
diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp
index a590b2155..d080b6cd8 100755
--- a/fs_mgr/fs_mgr.cpp
+++ b/fs_mgr/fs_mgr.cpp
@@ -97,7 +97,6 @@
using android::base::Basename;
using android::base::GetBoolProperty;
using android::base::GetUintProperty;
-using android::base::Readlink;
using android::base::Realpath;
using android::base::SetProperty;
using android::base::StartsWith;
@@ -1589,8 +1588,8 @@ static std::chrono::milliseconds GetMillisProperty(const std::string& name,
return std::chrono::milliseconds(std::move(value));
}
-static bool fs_mgr_unmount_all_data_mounts(const std::string& block_device) {
- LINFO << __FUNCTION__ << "(): about to umount everything on top of " << block_device;
+static bool fs_mgr_unmount_all_data_mounts(const std::string& data_block_device) {
+ LINFO << __FUNCTION__ << "(): about to umount everything on top of " << data_block_device;
Timer t;
auto timeout = GetMillisProperty("init.userspace_reboot.userdata_remount.timeoutmillis", 5s);
while (true) {
@@ -1602,7 +1601,13 @@ static bool fs_mgr_unmount_all_data_mounts(const std::string& block_device) {
}
// Now proceed with other bind mounts on top of /data.
for (const auto& entry : proc_mounts) {
- if (entry.blk_device == block_device) {
+ std::string block_device;
+ if (StartsWith(entry.blk_device, "/dev/block") &&
+ !Realpath(entry.blk_device, &block_device)) {
+ PWARNING << __FUNCTION__ << "(): failed to realpath " << entry.blk_device;
+ block_device = entry.blk_device;
+ }
+ if (data_block_device == block_device) {
if (umount2(entry.mount_point.c_str(), 0) != 0) {
PERROR << __FUNCTION__ << "(): Failed to umount " << entry.mount_point;
umount_done = false;
@@ -1614,7 +1619,8 @@ static bool fs_mgr_unmount_all_data_mounts(const std::string& block_device) {
return true;
}
if (t.duration() > timeout) {
- LERROR << __FUNCTION__ << "(): Timed out unmounting all mounts on " << block_device;
+ LERROR << __FUNCTION__ << "(): Timed out unmounting all mounts on "
+ << data_block_device;
Fstab remaining_mounts;
if (!ReadFstabFromFile("/proc/mounts", &remaining_mounts)) {
LERROR << __FUNCTION__ << "(): Can't read /proc/mounts";
@@ -1653,14 +1659,11 @@ static bool UnwindDmDeviceStack(const std::string& block_device,
return true;
}
-FstabEntry* fs_mgr_get_mounted_entry_for_userdata(Fstab* fstab, const FstabEntry& mounted_entry) {
- if (mounted_entry.mount_point != "/data") {
- LERROR << mounted_entry.mount_point << " is not /data";
- return nullptr;
- }
+FstabEntry* fs_mgr_get_mounted_entry_for_userdata(Fstab* fstab,
+ const std::string& data_block_device) {
std::vector<std::string> dm_stack;
- if (!UnwindDmDeviceStack(mounted_entry.blk_device, &dm_stack)) {
- LERROR << "Failed to unwind dm-device stack for " << mounted_entry.blk_device;
+ if (!UnwindDmDeviceStack(data_block_device, &dm_stack)) {
+ LERROR << "Failed to unwind dm-device stack for " << data_block_device;
return nullptr;
}
for (auto& entry : *fstab) {
@@ -1674,15 +1677,15 @@ FstabEntry* fs_mgr_get_mounted_entry_for_userdata(Fstab* fstab, const FstabEntry
continue;
}
block_device = entry.blk_device;
- } else if (!Readlink(entry.blk_device, &block_device)) {
- PWARNING << "Failed to read link " << entry.blk_device;
+ } else if (!Realpath(entry.blk_device, &block_device)) {
+ PWARNING << "Failed to realpath " << entry.blk_device;
block_device = entry.blk_device;
}
if (std::find(dm_stack.begin(), dm_stack.end(), block_device) != dm_stack.end()) {
return &entry;
}
}
- LERROR << "Didn't find entry that was used to mount /data onto " << mounted_entry.blk_device;
+ LERROR << "Didn't find entry that was used to mount /data onto " << data_block_device;
return nullptr;
}
@@ -1693,14 +1696,17 @@ int fs_mgr_remount_userdata_into_checkpointing(Fstab* fstab) {
LERROR << "Can't read /proc/mounts";
return -1;
}
- std::string block_device;
auto mounted_entry = GetEntryForMountPoint(&proc_mounts, "/data");
if (mounted_entry == nullptr) {
LERROR << "/data is not mounted";
return -1;
}
- block_device = mounted_entry->blk_device;
- auto fstab_entry = fs_mgr_get_mounted_entry_for_userdata(fstab, *mounted_entry);
+ std::string block_device;
+ if (!Realpath(mounted_entry->blk_device, &block_device)) {
+ PERROR << "Failed to realpath " << mounted_entry->blk_device;
+ return -1;
+ }
+ auto fstab_entry = fs_mgr_get_mounted_entry_for_userdata(fstab, block_device);
if (fstab_entry == nullptr) {
LERROR << "Can't find /data in fstab";
return -1;
diff --git a/fs_mgr/include/fs_mgr.h b/fs_mgr/include/fs_mgr.h
index 9c75c160b..a8523618f 100644
--- a/fs_mgr/include/fs_mgr.h
+++ b/fs_mgr/include/fs_mgr.h
@@ -109,10 +109,9 @@ enum FsMgrUmountStatus : int {
// it destroys verity devices from device mapper after the device is unmounted.
int fs_mgr_umount_all(android::fs_mgr::Fstab* fstab);
-// Finds a entry in |fstab| that was used to mount a /data |mounted_entry| from
-// /proc/mounts.
+// Finds a entry in |fstab| that was used to mount a /data on |data_block_device|.
android::fs_mgr::FstabEntry* fs_mgr_get_mounted_entry_for_userdata(
- android::fs_mgr::Fstab* fstab, const android::fs_mgr::FstabEntry& mounted_entry);
+ android::fs_mgr::Fstab* fstab, const std::string& data_block_device);
int fs_mgr_remount_userdata_into_checkpointing(android::fs_mgr::Fstab* fstab);
// Finds the dm_bow device on which this block device is stacked, or returns
diff --git a/fs_mgr/libdm/Android.bp b/fs_mgr/libdm/Android.bp
index 910c4fc6b..d5b59cc50 100644
--- a/fs_mgr/libdm/Android.bp
+++ b/fs_mgr/libdm/Android.bp
@@ -79,7 +79,7 @@ cc_test {
cc_test {
name: "vts_libdm_test",
defaults: ["libdm_test_defaults"],
- test_suites: ["vts-core"],
+ test_suites: ["vts"],
test_min_api_level: 29,
}
diff --git a/fs_mgr/libdm/dm_target.cpp b/fs_mgr/libdm/dm_target.cpp
index 29b103282..a59419877 100644
--- a/fs_mgr/libdm/dm_target.cpp
+++ b/fs_mgr/libdm/dm_target.cpp
@@ -243,20 +243,8 @@ std::string DmTargetCrypt::GetParameterString() const {
return android::base::Join(argv, " ");
}
-bool DmTargetDefaultKey::IsLegacy(bool* result) {
- DeviceMapper& dm = DeviceMapper::Instance();
- DmTargetTypeInfo info;
- if (!dm.GetTargetByName(kName, &info)) return false;
- // dm-default-key was modified to be like dm-crypt with version 2
- *result = !info.IsAtLeast(2, 0, 0);
- return true;
-}
-
bool DmTargetDefaultKey::Valid() const {
- bool real_is_legacy;
- if (!DmTargetDefaultKey::IsLegacy(&real_is_legacy)) return false;
- if (real_is_legacy != is_legacy_) return false;
- if (!is_legacy_ && !set_dun_) return false;
+ if (!use_legacy_options_format_ && !set_dun_) return false;
return true;
}
@@ -264,13 +252,13 @@ std::string DmTargetDefaultKey::GetParameterString() const {
std::vector<std::string> argv;
argv.emplace_back(cipher_);
argv.emplace_back(key_);
- if (!is_legacy_) {
+ if (!use_legacy_options_format_) {
argv.emplace_back("0"); // iv_offset
}
argv.emplace_back(blockdev_);
argv.push_back(std::to_string(start_sector_));
std::vector<std::string> extra_argv;
- if (is_legacy_) {
+ if (use_legacy_options_format_) {
if (set_dun_) { // v2 always sets the DUN.
extra_argv.emplace_back("set_dun");
}
diff --git a/fs_mgr/libdm/dm_test.cpp b/fs_mgr/libdm/dm_test.cpp
index 67af59a2c..41d3145bb 100644
--- a/fs_mgr/libdm/dm_test.cpp
+++ b/fs_mgr/libdm/dm_test.cpp
@@ -516,32 +516,22 @@ TEST(libdm, CryptArgs) {
}
TEST(libdm, DefaultKeyArgs) {
- DmTargetTypeInfo info;
+ DmTargetDefaultKey target(0, 4096, "aes-xts-plain64", "abcdef0123456789", "/dev/loop0", 0);
+ target.SetSetDun();
+ ASSERT_EQ(target.name(), "default-key");
+ ASSERT_TRUE(target.Valid());
+ // TODO: Add case for wrapped key enabled
+ ASSERT_EQ(target.GetParameterString(),
+ "aes-xts-plain64 abcdef0123456789 0 /dev/loop0 0 3 allow_discards sector_size:4096 "
+ "iv_large_sectors");
+}
- DeviceMapper& dm = DeviceMapper::Instance();
- if (!dm.GetTargetByName("default-key", &info)) {
- cout << "default-key module not enabled; skipping test" << std::endl;
- return;
- }
- bool is_legacy;
- ASSERT_TRUE(DmTargetDefaultKey::IsLegacy(&is_legacy));
- // set_dun only in the non-is_legacy case
+TEST(libdm, DefaultKeyLegacyArgs) {
DmTargetDefaultKey target(0, 4096, "AES-256-XTS", "abcdef0123456789", "/dev/loop0", 0);
- if (is_legacy) {
- target.SetIsLegacy();
- } else {
- target.SetSetDun();
- }
+ target.SetUseLegacyOptionsFormat();
ASSERT_EQ(target.name(), "default-key");
ASSERT_TRUE(target.Valid());
- if (is_legacy) {
- ASSERT_EQ(target.GetParameterString(), "AES-256-XTS abcdef0123456789 /dev/loop0 0");
- } else {
- // TODO: Add case for wrapped key enabled
- ASSERT_EQ(target.GetParameterString(),
- "AES-256-XTS abcdef0123456789 0 /dev/loop0 0 3 allow_discards sector_size:4096 "
- "iv_large_sectors");
- }
+ ASSERT_EQ(target.GetParameterString(), "AES-256-XTS abcdef0123456789 /dev/loop0 0");
}
TEST(libdm, DeleteDeviceWithTimeout) {
diff --git a/fs_mgr/libdm/include/libdm/dm_target.h b/fs_mgr/libdm/include/libdm/dm_target.h
index 050d0b645..57096ce2f 100644
--- a/fs_mgr/libdm/include/libdm/dm_target.h
+++ b/fs_mgr/libdm/include/libdm/dm_target.h
@@ -290,8 +290,7 @@ class DmTargetDefaultKey final : public DmTarget {
std::string name() const override { return kName; }
bool Valid() const override;
std::string GetParameterString() const override;
- static bool IsLegacy(bool* result);
- void SetIsLegacy() { is_legacy_ = true; }
+ void SetUseLegacyOptionsFormat() { use_legacy_options_format_ = true; }
void SetSetDun() { set_dun_ = true; }
void SetWrappedKeyV0() { is_hw_wrapped_ = true; }
@@ -302,7 +301,7 @@ class DmTargetDefaultKey final : public DmTarget {
std::string key_;
std::string blockdev_;
uint64_t start_sector_;
- bool is_legacy_ = false;
+ bool use_legacy_options_format_ = false;
bool set_dun_ = false;
bool is_hw_wrapped_ = false;
};
diff --git a/fs_mgr/libfiemap/Android.bp b/fs_mgr/libfiemap/Android.bp
index 2fd463c3f..f6c2b5aa0 100644
--- a/fs_mgr/libfiemap/Android.bp
+++ b/fs_mgr/libfiemap/Android.bp
@@ -80,7 +80,7 @@ cc_test {
"fiemap_writer_test.cpp",
],
- test_suites: ["vts-core", "device-tests"],
+ test_suites: ["vts", "device-tests"],
auto_gen_config: true,
test_min_api_level: 29,
require_root: true,
diff --git a/fs_mgr/liblp/Android.bp b/fs_mgr/liblp/Android.bp
index ea0fca83f..20349dc03 100644
--- a/fs_mgr/liblp/Android.bp
+++ b/fs_mgr/liblp/Android.bp
@@ -97,7 +97,7 @@ cc_test {
cc_test {
name: "vts_core_liblp_test",
defaults: ["liblp_test_defaults"],
- test_suites: ["vts-core"],
+ test_suites: ["vts"],
auto_gen_config: true,
test_min_api_level: 29,
require_root: true,
diff --git a/fs_mgr/liblp/liblp_test.xml b/fs_mgr/liblp/liblp_test.xml
index d9ee12eac..98414b109 100644
--- a/fs_mgr/liblp/liblp_test.xml
+++ b/fs_mgr/liblp/liblp_test.xml
@@ -19,7 +19,6 @@
<option name="cleanup" value="true" />
<option name="push" value="liblp_test->/data/local/tmp/liblp_test" />
</target_preparer>
- <option name="test-suite-tag" value="vts-core" />
<test class="com.android.tradefed.testtype.GTest" >
<option name="native-test-device-path" value="/data/local/tmp" />
<option name="module-name" value="liblp_test" />
diff --git a/fs_mgr/libsnapshot/Android.bp b/fs_mgr/libsnapshot/Android.bp
index 996fbcae6..a209ea635 100644
--- a/fs_mgr/libsnapshot/Android.bp
+++ b/fs_mgr/libsnapshot/Android.bp
@@ -182,7 +182,7 @@ cc_defaults {
"libstorage_literals_headers",
],
test_suites: [
- "vts-core",
+ "vts",
"device-tests"
],
test_min_api_level: 29,
diff --git a/fs_mgr/tests/fs_mgr_test.cpp b/fs_mgr/tests/fs_mgr_test.cpp
index 16e38f157..46f1c590c 100644
--- a/fs_mgr/tests/fs_mgr_test.cpp
+++ b/fs_mgr/tests/fs_mgr_test.cpp
@@ -1006,6 +1006,8 @@ TEST(fs_mgr, UserdataMountedFromDefaultFstab) {
ASSERT_TRUE(ReadFstabFromFile("/proc/mounts", &proc_mounts)) << "Failed to read /proc/mounts";
auto mounted_entry = GetEntryForMountPoint(&proc_mounts, "/data");
ASSERT_NE(mounted_entry, nullptr) << "/data is not mounted";
- ASSERT_NE(nullptr, fs_mgr_get_mounted_entry_for_userdata(&fstab, *mounted_entry))
+ std::string block_device;
+ ASSERT_TRUE(android::base::Realpath(mounted_entry->blk_device, &block_device));
+ ASSERT_NE(nullptr, fs_mgr_get_mounted_entry_for_userdata(&fstab, block_device))
<< "/data wasn't mounted from default fstab";
}
diff --git a/init/first_stage_init.cpp b/init/first_stage_init.cpp
index bd71cb554..ad546bf07 100644
--- a/init/first_stage_init.cpp
+++ b/init/first_stage_init.cpp
@@ -107,7 +107,7 @@ void StartConsole() {
return;
}
int fd = -1;
- int tries = 10;
+ int tries = 50; // should timeout after 5s
// The device driver for console may not be ready yet so retry for a while in case of failure.
while (tries--) {
fd = open("/dev/console", O_RDWR);
@@ -234,7 +234,16 @@ int FirstStageMain(int argc, char** argv) {
old_root_dir.reset();
}
- Modprobe m({"/lib/modules"});
+ std::string module_load_file = "modules.load";
+ if (IsRecoveryMode() && !ForceNormalBoot(cmdline)) {
+ struct stat fileStat;
+ std::string recovery_load_path = "/lib/modules/modules.load.recovery";
+ if (!stat(recovery_load_path.c_str(), &fileStat)) {
+ module_load_file = "modules.load.recovery";
+ }
+ }
+
+ Modprobe m({"/lib/modules"}, module_load_file);
auto want_console = ALLOW_FIRST_STAGE_CONSOLE && FirstStageConsole(cmdline);
if (!m.LoadListedModules(!want_console)) {
if (want_console) {
diff --git a/libcutils/Android.bp b/libcutils/Android.bp
index fc06c1d1b..c9eebfe7a 100644
--- a/libcutils/Android.bp
+++ b/libcutils/Android.bp
@@ -327,7 +327,7 @@ cc_test {
cc_test {
name: "KernelLibcutilsTest",
- test_suites: ["general-tests", "vts-core"],
+ test_suites: ["general-tests", "vts"],
defaults: ["libcutils_test_static_defaults"],
test_config: "KernelLibcutilsTest.xml",
}
diff --git a/libmodprobe/include/modprobe/modprobe.h b/libmodprobe/include/modprobe/modprobe.h
index ee6ae7a45..297036e41 100644
--- a/libmodprobe/include/modprobe/modprobe.h
+++ b/libmodprobe/include/modprobe/modprobe.h
@@ -24,7 +24,7 @@
class Modprobe {
public:
- Modprobe(const std::vector<std::string>&);
+ Modprobe(const std::vector<std::string>&, const std::string load_file = "modules.load");
bool LoadListedModules(bool strict = true);
bool LoadWithAliases(const std::string& module_name, bool strict,
diff --git a/libmodprobe/libmodprobe.cpp b/libmodprobe/libmodprobe.cpp
index f22bbf18b..d19379676 100644
--- a/libmodprobe/libmodprobe.cpp
+++ b/libmodprobe/libmodprobe.cpp
@@ -312,7 +312,7 @@ void Modprobe::ParseKernelCmdlineOptions(void) {
}
}
-Modprobe::Modprobe(const std::vector<std::string>& base_paths) {
+Modprobe::Modprobe(const std::vector<std::string>& base_paths, const std::string load_file) {
using namespace std::placeholders;
for (const auto& base_path : base_paths) {
@@ -326,7 +326,7 @@ Modprobe::Modprobe(const std::vector<std::string>& base_paths) {
ParseCfg(base_path + "/modules.softdep", softdep_callback);
auto load_callback = std::bind(&Modprobe::ParseLoadCallback, this, _1);
- ParseCfg(base_path + "/modules.load", load_callback);
+ ParseCfg(base_path + "/" + load_file, load_callback);
auto options_callback = std::bind(&Modprobe::ParseOptionsCallback, this, _1);
ParseCfg(base_path + "/modules.options", options_callback);
diff --git a/libstats/pull/Android.bp b/libstats/pull/Android.bp
index a7b5d9154..ef1c5c5bd 100644
--- a/libstats/pull/Android.bp
+++ b/libstats/pull/Android.bp
@@ -30,11 +30,11 @@ cc_defaults {
shared_libs: [
"libbinder_ndk",
"liblog",
- "statsd-aidl-ndk_platform",
"libstatssocket",
],
static_libs: [
"libutils",
+ "statsd-aidl-ndk_platform",
],
}
cc_library_shared {
@@ -53,6 +53,9 @@ cc_library_shared {
"com.android.os.statsd",
"test_com.android.os.statsd",
],
+
+ stl: "libc++_static",
+
// TODO(b/151102177): Enable it when the build error is fixed.
header_abi_checker: {
enabled: false,
diff --git a/libstats/socket/Android.bp b/libstats/socket/Android.bp
index b02ab42b2..c86d65031 100644
--- a/libstats/socket/Android.bp
+++ b/libstats/socket/Android.bp
@@ -54,6 +54,7 @@ cc_library {
},
},
},
+ stl: "libc++_static",
// enumerate stable entry points for APEX use
stubs: {
diff --git a/rootdir/init.rc b/rootdir/init.rc
index a46c618ff..a3efc89a8 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -1080,6 +1080,12 @@ on userspace-reboot-fs-remount
start vold
exec - system system -- /system/bin/vdc checkpoint resetCheckpoint
exec - system system -- /system/bin/vdc checkpoint markBootAttempt
+ # Unmount /data_mirror mounts in the reverse order of corresponding mounts.
+ umount /data_mirror/data_ce/null/0
+ umount /data_mirror/data_ce/null
+ umount /data_mirror/data_de/null
+ umount /data_mirror/cur_profiles
+ umount /data_mirror
remount_userdata
start bootanim