Loading adb/client/adb_install.cpp +32 −27 Original line number Diff line number Diff line Loading @@ -638,20 +638,24 @@ int install_multi_package(int argc, const char** argv) { fprintf(stdout, "Created child session ID %d.\n", session_id); session_ids.push_back(session_id); // Support splitAPKs by allowing the notation split1.apk:split2.apk:split3.apk as argument. std::vector<std::string> splits = android::base::Split(file, ":"); for (const std::string& split : splits) { struct stat sb; if (stat(file, &sb) == -1) { fprintf(stderr, "adb: failed to stat %s: %s\n", file, strerror(errno)); if (stat(split.c_str(), &sb) == -1) { fprintf(stderr, "adb: failed to stat %s: %s\n", split.c_str(), strerror(errno)); goto finalize_multi_package_session; } std::string cmd = android::base::StringPrintf("%s install-write -S %" PRIu64 " %d %d_%s -", install_cmd.c_str(), static_cast<uint64_t>(sb.st_size), session_id, i, android::base::Basename(file).c_str()); std::string cmd = android::base::StringPrintf( "%s install-write -S %" PRIu64 " %d %d_%s -", install_cmd.c_str(), static_cast<uint64_t>(sb.st_size), session_id, i, android::base::Basename(split).c_str()); unique_fd local_fd(adb_open(file, O_RDONLY | O_CLOEXEC)); unique_fd local_fd(adb_open(split.c_str(), O_RDONLY | O_CLOEXEC)); if (local_fd < 0) { fprintf(stderr, "adb: failed to open %s: %s\n", file, strerror(errno)); fprintf(stderr, "adb: failed to open %s: %s\n", split.c_str(), strerror(errno)); goto finalize_multi_package_session; } Loading @@ -666,11 +670,11 @@ int install_multi_package(int argc, const char** argv) { read_status_line(remote_fd.get(), buf, sizeof(buf)); if (strncmp("Success", buf, 7)) { fprintf(stderr, "adb: failed to write %s\n", file); fprintf(stderr, "adb: failed to write %s\n", split.c_str()); fputs(buf, stderr); goto finalize_multi_package_session; } } all_session_ids += android::base::StringPrintf(" %d", session_id); } Loading Loading @@ -718,6 +722,7 @@ finalize_multi_package_session: fputs(buf, stderr); } session_ids.push_back(parent_session_id); // try to abandon all remaining sessions for (std::size_t i = 0; i < session_ids.size(); i++) { service = android::base::StringPrintf("%s install-abandon %d", install_cmd.c_str(), Loading fs_mgr/Android.bp +32 −0 Original line number Diff line number Diff line Loading @@ -111,3 +111,35 @@ cc_library_static { "libgsi_headers", ], } cc_binary { name: "remount", defaults: ["fs_mgr_defaults"], static_libs: [ "libavb_user", ], shared_libs: [ "libbootloader_message", "libbase", "libcrypto", "libfec", "libfs_mgr", ], header_libs: [ "libcutils_headers", ], srcs: [ "fs_mgr_remount.cpp", ], cppflags: [ "-DALLOW_ADBD_DISABLE_VERITY=0", ], product_variables: { debuggable: { cppflags: [ "-UALLOW_ADBD_DISABLE_VERITY", "-DALLOW_ADBD_DISABLE_VERITY=1", ], }, }, } fs_mgr/README.overlayfs.md +1 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ 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 kernel is higher than 4.6. if kernel is 4.4 or higher. 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 Loading fs_mgr/fs_mgr.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -1089,7 +1089,7 @@ int fs_mgr_mount_all(Fstab* fstab, int mount_mode) { // Skips mounting the device. continue; } } else if (!current_entry.avb_key.empty()) { } else if (!current_entry.avb_keys.empty()) { if (AvbHandle::SetUpStandaloneAvbHashtree(¤t_entry) == AvbHashtreeResult::kFail) { LERROR << "Failed to set up AVB on standalone partition: " << current_entry.mount_point << ", skipping!"; Loading Loading @@ -1320,7 +1320,7 @@ static int fs_mgr_do_mount_helper(Fstab* fstab, const std::string& n_name, // Skips mounting the device. continue; } } else if (!fstab_entry.avb_key.empty()) { } else if (!fstab_entry.avb_keys.empty()) { if (AvbHandle::SetUpStandaloneAvbHashtree(&fstab_entry) == AvbHashtreeResult::kFail) { LERROR << "Failed to set up AVB on standalone partition: " << fstab_entry.mount_point << ", skipping!"; Loading fs_mgr/fs_mgr_fstab.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -325,8 +325,8 @@ void ParseFsMgrFlags(const std::string& flags, FstabEntry* entry) { } } else if (StartsWith(flag, "zram_backing_dev_path=")) { entry->zram_backing_dev_path = arg; } else if (StartsWith(flag, "avb_key=")) { entry->avb_key = arg; } else if (StartsWith(flag, "avb_keys=")) { entry->avb_keys = arg; } else { LWARNING << "Warning: unknown flag: " << flag; } Loading Loading @@ -759,7 +759,8 @@ FstabEntry BuildGsiSystemFstabEntry() { .fs_type = "ext4", .flags = MS_RDONLY, .fs_options = "barrier=1", .avb_key = "/gsi.avbpubkey", // could add more keys separated by ':'. .avb_keys = "/avb/gsi.avbpubkey:", .logical_partition_name = "system"}; system.fs_mgr_flags.wait = true; system.fs_mgr_flags.logical = true; Loading Loading
adb/client/adb_install.cpp +32 −27 Original line number Diff line number Diff line Loading @@ -638,20 +638,24 @@ int install_multi_package(int argc, const char** argv) { fprintf(stdout, "Created child session ID %d.\n", session_id); session_ids.push_back(session_id); // Support splitAPKs by allowing the notation split1.apk:split2.apk:split3.apk as argument. std::vector<std::string> splits = android::base::Split(file, ":"); for (const std::string& split : splits) { struct stat sb; if (stat(file, &sb) == -1) { fprintf(stderr, "adb: failed to stat %s: %s\n", file, strerror(errno)); if (stat(split.c_str(), &sb) == -1) { fprintf(stderr, "adb: failed to stat %s: %s\n", split.c_str(), strerror(errno)); goto finalize_multi_package_session; } std::string cmd = android::base::StringPrintf("%s install-write -S %" PRIu64 " %d %d_%s -", install_cmd.c_str(), static_cast<uint64_t>(sb.st_size), session_id, i, android::base::Basename(file).c_str()); std::string cmd = android::base::StringPrintf( "%s install-write -S %" PRIu64 " %d %d_%s -", install_cmd.c_str(), static_cast<uint64_t>(sb.st_size), session_id, i, android::base::Basename(split).c_str()); unique_fd local_fd(adb_open(file, O_RDONLY | O_CLOEXEC)); unique_fd local_fd(adb_open(split.c_str(), O_RDONLY | O_CLOEXEC)); if (local_fd < 0) { fprintf(stderr, "adb: failed to open %s: %s\n", file, strerror(errno)); fprintf(stderr, "adb: failed to open %s: %s\n", split.c_str(), strerror(errno)); goto finalize_multi_package_session; } Loading @@ -666,11 +670,11 @@ int install_multi_package(int argc, const char** argv) { read_status_line(remote_fd.get(), buf, sizeof(buf)); if (strncmp("Success", buf, 7)) { fprintf(stderr, "adb: failed to write %s\n", file); fprintf(stderr, "adb: failed to write %s\n", split.c_str()); fputs(buf, stderr); goto finalize_multi_package_session; } } all_session_ids += android::base::StringPrintf(" %d", session_id); } Loading Loading @@ -718,6 +722,7 @@ finalize_multi_package_session: fputs(buf, stderr); } session_ids.push_back(parent_session_id); // try to abandon all remaining sessions for (std::size_t i = 0; i < session_ids.size(); i++) { service = android::base::StringPrintf("%s install-abandon %d", install_cmd.c_str(), Loading
fs_mgr/Android.bp +32 −0 Original line number Diff line number Diff line Loading @@ -111,3 +111,35 @@ cc_library_static { "libgsi_headers", ], } cc_binary { name: "remount", defaults: ["fs_mgr_defaults"], static_libs: [ "libavb_user", ], shared_libs: [ "libbootloader_message", "libbase", "libcrypto", "libfec", "libfs_mgr", ], header_libs: [ "libcutils_headers", ], srcs: [ "fs_mgr_remount.cpp", ], cppflags: [ "-DALLOW_ADBD_DISABLE_VERITY=0", ], product_variables: { debuggable: { cppflags: [ "-UALLOW_ADBD_DISABLE_VERITY", "-DALLOW_ADBD_DISABLE_VERITY=1", ], }, }, }
fs_mgr/README.overlayfs.md +1 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ 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 kernel is higher than 4.6. if kernel is 4.4 or higher. 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 Loading
fs_mgr/fs_mgr.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -1089,7 +1089,7 @@ int fs_mgr_mount_all(Fstab* fstab, int mount_mode) { // Skips mounting the device. continue; } } else if (!current_entry.avb_key.empty()) { } else if (!current_entry.avb_keys.empty()) { if (AvbHandle::SetUpStandaloneAvbHashtree(¤t_entry) == AvbHashtreeResult::kFail) { LERROR << "Failed to set up AVB on standalone partition: " << current_entry.mount_point << ", skipping!"; Loading Loading @@ -1320,7 +1320,7 @@ static int fs_mgr_do_mount_helper(Fstab* fstab, const std::string& n_name, // Skips mounting the device. continue; } } else if (!fstab_entry.avb_key.empty()) { } else if (!fstab_entry.avb_keys.empty()) { if (AvbHandle::SetUpStandaloneAvbHashtree(&fstab_entry) == AvbHashtreeResult::kFail) { LERROR << "Failed to set up AVB on standalone partition: " << fstab_entry.mount_point << ", skipping!"; Loading
fs_mgr/fs_mgr_fstab.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -325,8 +325,8 @@ void ParseFsMgrFlags(const std::string& flags, FstabEntry* entry) { } } else if (StartsWith(flag, "zram_backing_dev_path=")) { entry->zram_backing_dev_path = arg; } else if (StartsWith(flag, "avb_key=")) { entry->avb_key = arg; } else if (StartsWith(flag, "avb_keys=")) { entry->avb_keys = arg; } else { LWARNING << "Warning: unknown flag: " << flag; } Loading Loading @@ -759,7 +759,8 @@ FstabEntry BuildGsiSystemFstabEntry() { .fs_type = "ext4", .flags = MS_RDONLY, .fs_options = "barrier=1", .avb_key = "/gsi.avbpubkey", // could add more keys separated by ':'. .avb_keys = "/avb/gsi.avbpubkey:", .logical_partition_name = "system"}; system.fs_mgr_flags.wait = true; system.fs_mgr_flags.logical = true; Loading