Merge "Fix riscv64's crash glue."
diff --git a/debuggerd/crasher/arm/crashglue.S b/debuggerd/crasher/arm/crashglue.S
index 6f41b21..e4adf40 100644
--- a/debuggerd/crasher/arm/crashglue.S
+++ b/debuggerd/crasher/arm/crashglue.S
@@ -19,40 +19,6 @@
ldr r11, =0xa5a50011
ldr r12, =0xa5a50012
-
- fconstd d0, #0
- fconstd d1, #1
- fconstd d2, #2
- fconstd d3, #3
- fconstd d4, #4
- fconstd d5, #5
- fconstd d6, #6
- fconstd d7, #7
- fconstd d8, #8
- fconstd d9, #9
- fconstd d10, #10
- fconstd d11, #11
- fconstd d12, #12
- fconstd d13, #13
- fconstd d14, #14
- fconstd d15, #15
- fconstd d16, #16
- fconstd d17, #17
- fconstd d18, #18
- fconstd d19, #19
- fconstd d20, #20
- fconstd d21, #21
- fconstd d22, #22
- fconstd d23, #23
- fconstd d24, #24
- fconstd d25, #25
- fconstd d26, #26
- fconstd d27, #27
- fconstd d28, #28
- fconstd d29, #29
- fconstd d30, #30
- fconstd d31, #31
-
mov lr, #0
ldr lr, [lr]
b .
diff --git a/debuggerd/crasher/arm64/crashglue.S b/debuggerd/crasher/arm64/crashglue.S
index 014c98c..97c824e 100644
--- a/debuggerd/crasher/arm64/crashglue.S
+++ b/debuggerd/crasher/arm64/crashglue.S
@@ -37,39 +37,6 @@
ldr x28, =0xa5a50028
ldr x29, =0xa5a50029
- fmov d0, -1.0 // -1 is more convincing than 0.
- fmov d1, 1.0
- fmov d2, 2.0
- fmov d3, 3.0
- fmov d4, 4.0
- fmov d5, 5.0
- fmov d6, 6.0
- fmov d7, 7.0
- fmov d8, 8.0
- fmov d9, 9.0
- fmov d10, 10.0
- fmov d11, 11.0
- fmov d12, 12.0
- fmov d13, 13.0
- fmov d14, 14.0
- fmov d15, 15.0
- fmov d16, 16.0
- fmov d17, 17.0
- fmov d18, 18.0
- fmov d19, 19.0
- fmov d20, 20.0
- fmov d21, 21.0
- fmov d22, 22.0
- fmov d23, 23.0
- fmov d24, 24.0
- fmov d25, 25.0
- fmov d26, 26.0
- fmov d27, 27.0
- fmov d28, 28.0
- fmov d29, 29.0
- fmov d30, 30.0
- fmov d31, 31.0
-
mov x30, xzr
ldr x30, [x30]
b .
diff --git a/debuggerd/crasher/x86/crashglue.S b/debuggerd/crasher/x86/crashglue.S
index ffbd816..e8eb3a7 100644
--- a/debuggerd/crasher/x86/crashglue.S
+++ b/debuggerd/crasher/x86/crashglue.S
@@ -1,6 +1,4 @@
.globl crash1
-.globl crashnostack
-
crash1:
movl $0xa5a50000, %eax
movl $0xa5a50001, %ebx
@@ -10,6 +8,7 @@
jmp *%edx
+.globl crashnostack
crashnostack:
.cfi_startproc
movl %esp, %eax
diff --git a/debuggerd/crasher/x86_64/crashglue.S b/debuggerd/crasher/x86_64/crashglue.S
index 7e22118..8f67214 100644
--- a/debuggerd/crasher/x86_64/crashglue.S
+++ b/debuggerd/crasher/x86_64/crashglue.S
@@ -1,6 +1,4 @@
.globl crash1
-.globl crashnostack
-
crash1:
movl $0xa5a50000, %eax
movl $0xa5a50001, %ebx
@@ -10,6 +8,7 @@
jmp *%rdx
+.globl crashnostack
crashnostack:
.cfi_startproc
movq %rsp, %rax
diff --git a/debuggerd/libdebuggerd/include/libdebuggerd/utility.h b/debuggerd/libdebuggerd/include/libdebuggerd/utility.h
index 25b03af..198de37 100644
--- a/debuggerd/libdebuggerd/include/libdebuggerd/utility.h
+++ b/debuggerd/libdebuggerd/include/libdebuggerd/utility.h
@@ -51,7 +51,6 @@
HEADER,
THREAD,
REGISTERS,
- FP_REGISTERS,
BACKTRACE,
MAPS,
MEMORY,
diff --git a/debuggerd/libdebuggerd/utility.cpp b/debuggerd/libdebuggerd/utility.cpp
index 74a1423..d71fc6c 100644
--- a/debuggerd/libdebuggerd/utility.cpp
+++ b/debuggerd/libdebuggerd/utility.cpp
@@ -47,12 +47,7 @@
using android::base::unique_fd;
bool is_allowed_in_logcat(enum logtype ltype) {
- if ((ltype == HEADER)
- || (ltype == REGISTERS)
- || (ltype == BACKTRACE)) {
- return true;
- }
- return false;
+ return (ltype == HEADER) || (ltype == REGISTERS) || (ltype == BACKTRACE);
}
static bool should_write_to_kmsg() {
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index 15d1874..a9a822c 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -1159,6 +1159,12 @@
fb->GetVar("partition-type:vbmeta_b", &partition_type) == fastboot::SUCCESS;
}
+static bool is_vbmeta_partition(const std::string& partition) {
+ return android::base::EndsWith(partition, "vbmeta") ||
+ android::base::EndsWith(partition, "vbmeta_a") ||
+ android::base::EndsWith(partition, "vbmeta_b");
+}
+
// Note: this only works in userspace fastboot. In the bootloader, use
// should_flash_in_userspace().
bool is_logical(const std::string& partition) {
@@ -1251,7 +1257,8 @@
}
}
-static void flash_buf(const std::string& partition, struct fastboot_buffer* buf) {
+static void flash_buf(const std::string& partition, struct fastboot_buffer* buf,
+ const bool apply_vbmeta) {
if (partition == "boot" || partition == "boot_a" || partition == "boot_b" ||
partition == "init_boot" || partition == "init_boot_a" || partition == "init_boot_b" ||
partition == "recovery" || partition == "recovery_a" || partition == "recovery_b") {
@@ -1262,9 +1269,7 @@
if (g_disable_verity || g_disable_verification) {
// The vbmeta partition might have additional prefix if running in virtual machine
// e.g., guest_vbmeta_a.
- if (android::base::EndsWith(partition, "vbmeta") ||
- android::base::EndsWith(partition, "vbmeta_a") ||
- android::base::EndsWith(partition, "vbmeta_b")) {
+ if (apply_vbmeta) {
rewrite_vbmeta_buffer(buf, false /* vbmeta_in_boot */);
} else if (!has_vbmeta_partition() &&
(partition == "boot" || partition == "boot_a" || partition == "boot_b")) {
@@ -1499,7 +1504,7 @@
return partition;
}
-void do_flash(const char* pname, const char* fname) {
+void do_flash(const char* pname, const char* fname, const bool apply_vbmeta) {
verbose("Do flash %s %s", pname, fname);
struct fastboot_buffer buf;
@@ -1510,7 +1515,7 @@
fb->ResizePartition(pname, std::to_string(buf.image_size));
}
std::string flash_pname = repack_ramdisk(pname, &buf);
- flash_buf(flash_pname, &buf);
+ flash_buf(flash_pname, &buf, apply_vbmeta);
}
// Sets slot_override as the active slot. If slot_override is blank,
@@ -1729,7 +1734,8 @@
if (is_logical(partition_name)) {
fb->ResizePartition(partition_name, std::to_string(buf->image_size));
}
- flash_buf(partition_name.c_str(), buf);
+
+ flash_buf(partition_name.c_str(), buf, is_vbmeta_partition(partition_name));
};
do_for_partitions(image.part_name, slot, flash, false);
}
@@ -1904,7 +1910,7 @@
if (!load_buf_fd(std::move(fd), &buf)) {
die("Cannot read image: %s", strerror(errno));
}
- flash_buf(partition, &buf);
+ flash_buf(partition, &buf, is_vbmeta_partition(partition));
return;
failed:
@@ -1974,7 +1980,7 @@
auto image_path = temp_dir.path + "/"s + image_name;
auto flash = [&](const std::string& partition_name) {
- do_flash(partition_name.c_str(), image_path.c_str());
+ do_flash(partition_name.c_str(), image_path.c_str(), false);
};
do_for_partitions(partition, slot, flash, force_slot);
@@ -2295,7 +2301,8 @@
fname = find_item(pname);
}
if (fname.empty()) die("cannot determine image filename for '%s'", pname.c_str());
- FlashTask task(slot_override, pname, fname);
+
+ FlashTask task(slot_override, pname, fname, is_vbmeta_partition(pname));
task.Run();
} else if (command == "flash:raw") {
std::string partition = next_arg(&args);
diff --git a/fastboot/fastboot.h b/fastboot/fastboot.h
index ed33481..c954487 100644
--- a/fastboot/fastboot.h
+++ b/fastboot/fastboot.h
@@ -88,7 +88,7 @@
bool should_flash_in_userspace(const std::string& partition_name);
bool is_userspace_fastboot();
-void do_flash(const char* pname, const char* fname);
+void do_flash(const char* pname, const char* fname, const bool apply_vbmeta);
void do_for_partitions(const std::string& part, const std::string& slot,
const std::function<void(const std::string&)>& func, bool force_slot);
std::string find_item(const std::string& item);
diff --git a/fastboot/task.cpp b/fastboot/task.cpp
index c70139b..44008e5 100644
--- a/fastboot/task.cpp
+++ b/fastboot/task.cpp
@@ -21,12 +21,13 @@
using namespace std::string_literals;
-FlashTask::FlashTask(const std::string& slot, const std::string& pname)
- : pname_(pname), fname_(find_item(pname)), slot_(slot) {
+FlashTask::FlashTask(const std::string& slot, const std::string& pname, const bool apply_vbmeta)
+ : pname_(pname), fname_(find_item(pname)), slot_(slot), apply_vbmeta_(apply_vbmeta) {
if (fname_.empty()) die("cannot determine image filename for '%s'", pname_.c_str());
}
-FlashTask::FlashTask(const std::string& _slot, const std::string& _pname, const std::string& _fname)
- : pname_(_pname), fname_(_fname), slot_(_slot) {}
+FlashTask::FlashTask(const std::string& _slot, const std::string& _pname, const std::string& _fname,
+ const bool apply_vbmeta)
+ : pname_(_pname), fname_(_fname), slot_(_slot), apply_vbmeta_(apply_vbmeta) {}
void FlashTask::Run() {
auto flash = [&](const std::string& partition) {
@@ -39,7 +40,7 @@
"And try again. If you are intentionally trying to "
"overwrite a fixed partition, use --force.");
}
- do_flash(partition.c_str(), fname_.c_str());
+ do_flash(partition.c_str(), fname_.c_str(), apply_vbmeta_);
};
do_for_partitions(pname_, slot_, flash, true);
}
diff --git a/fastboot/task.h b/fastboot/task.h
index 149c34c..264e43f 100644
--- a/fastboot/task.h
+++ b/fastboot/task.h
@@ -32,8 +32,9 @@
class FlashTask : public Task {
public:
- FlashTask(const std::string& slot, const std::string& pname);
- FlashTask(const std::string& slot, const std::string& pname, const std::string& fname);
+ FlashTask(const std::string& slot, const std::string& pname, const bool apply_vbmeta);
+ FlashTask(const std::string& slot, const std::string& pname, const std::string& fname,
+ const bool apply_vbmeta);
void Run() override;
@@ -41,6 +42,7 @@
const std::string pname_;
const std::string fname_;
const std::string slot_;
+ const bool apply_vbmeta_;
};
class RebootTask : public Task {
diff --git a/fs_mgr/TEST_MAPPING b/fs_mgr/TEST_MAPPING
index b6710d5..db27cf0 100644
--- a/fs_mgr/TEST_MAPPING
+++ b/fs_mgr/TEST_MAPPING
@@ -28,9 +28,6 @@
"name": "vabc_legacy_tests"
},
{
- "name": "libsnapshot_fuzzer_test"
- },
- {
"name": "cow_api_test"
}
],
diff --git a/healthd/healthd_mode_charger.cpp b/healthd/healthd_mode_charger.cpp
index 1ce174b..a0527e8 100644
--- a/healthd/healthd_mode_charger.cpp
+++ b/healthd/healthd_mode_charger.cpp
@@ -88,7 +88,7 @@
#define POWER_ON_KEY_TIME (2 * MSEC_PER_SEC)
#define UNPLUGGED_SHUTDOWN_TIME (10 * MSEC_PER_SEC)
#define UNPLUGGED_DISPLAY_TIME (3 * MSEC_PER_SEC)
-#define MAX_BATT_LEVEL_WAIT_TIME (3 * MSEC_PER_SEC)
+#define MAX_BATT_LEVEL_WAIT_TIME (5 * MSEC_PER_SEC)
#define UNPLUGGED_SHUTDOWN_TIME_PROP "ro.product.charger.unplugged_shutdown_time"
#define LAST_KMSG_MAX_SZ (32 * 1024)
diff --git a/init/Android.bp b/init/Android.bp
index 1aba4b3..7b52903 100644
--- a/init/Android.bp
+++ b/init/Android.bp
@@ -502,11 +502,13 @@
"libbase",
"libcutils",
"libselinux",
- "libhidl-gen-utils",
"liblog",
"libprocessgroup",
"libprotobuf-cpp-lite",
],
+ static_libs: [
+ "libhidl-gen-utils",
+ ],
}
cc_library_static {
diff --git a/init/fuzzer/init_parser_fuzzer.cpp b/init/fuzzer/init_parser_fuzzer.cpp
index e6a78a2..dc76465 100644
--- a/init/fuzzer/init_parser_fuzzer.cpp
+++ b/init/fuzzer/init_parser_fuzzer.cpp
@@ -125,7 +125,7 @@
std::string path = fdp_.ConsumeBool() ? fdp_.PickValueInArray(kValidPaths)
: fdp_.ConsumeRandomLengthString(kMaxBytes);
parser.ParseConfig(path);
- parser.ParseConfigFileInsecure(path);
+ parser.ParseConfigFileInsecure(path, false /* follow_symlinks */);
}
void InitParserFuzzer::Process() {
diff --git a/init/host_init_verifier.cpp b/init/host_init_verifier.cpp
index db127d3..f070776 100644
--- a/init/host_init_verifier.cpp
+++ b/init/host_init_verifier.cpp
@@ -326,7 +326,9 @@
}
}
} else {
- if (!parser.ParseConfigFileInsecure(*argv)) {
+ if (!parser.ParseConfigFileInsecure(*argv, true /* follow_symlinks */)) {
+ // Follow symlinks as inputs during build execution in Bazel's
+ // execution root are symlinks, unlike Soong or Make.
LOG(ERROR) << "Failed to open init rc script '" << *argv << "'";
return EXIT_FAILURE;
}
diff --git a/init/parser.cpp b/init/parser.cpp
index adb41ad..8c0bb2b 100644
--- a/init/parser.cpp
+++ b/init/parser.cpp
@@ -131,9 +131,9 @@
}
}
-bool Parser::ParseConfigFileInsecure(const std::string& path) {
+bool Parser::ParseConfigFileInsecure(const std::string& path, bool follow_symlinks = false) {
std::string config_contents;
- if (!android::base::ReadFileToString(path, &config_contents)) {
+ if (!android::base::ReadFileToString(path, &config_contents, follow_symlinks)) {
return false;
}
diff --git a/init/parser.h b/init/parser.h
index 980ae0c..8e5bca7 100644
--- a/init/parser.h
+++ b/init/parser.h
@@ -77,7 +77,7 @@
void AddSingleLineParser(const std::string& prefix, LineCallback callback);
// Host init verifier check file permissions.
- bool ParseConfigFileInsecure(const std::string& path);
+ bool ParseConfigFileInsecure(const std::string& path, bool follow_symlinks);
size_t parse_error_count() const { return parse_error_count_; }
diff --git a/init/test_kill_services/init_kill_services_test.cpp b/init/test_kill_services/init_kill_services_test.cpp
index 66a3328..5355703 100644
--- a/init/test_kill_services/init_kill_services_test.cpp
+++ b/init/test_kill_services/init_kill_services_test.cpp
@@ -29,8 +29,8 @@
const std::string initial_pid = GetProperty(pid_prop, "");
- EXPECT_EQ("running", GetProperty(status_prop, "")) << status_prop;
- EXPECT_NE("", initial_pid) << pid_prop;
+ ASSERT_EQ("running", GetProperty(status_prop, "")) << status_prop;
+ ASSERT_NE("", initial_pid) << pid_prop;
EXPECT_EQ(0, system(("kill -9 " + initial_pid).c_str()));
diff --git a/libprocessgroup/processgroup.cpp b/libprocessgroup/processgroup.cpp
index 38f19ff..f7af08b 100644
--- a/libprocessgroup/processgroup.cpp
+++ b/libprocessgroup/processgroup.cpp
@@ -446,6 +446,14 @@
static int KillProcessGroup(uid_t uid, int initialPid, int signal, int retries,
int* max_processes) {
+ if (uid < 0) {
+ LOG(ERROR) << __func__ << ": invalid UID " << uid;
+ return -1;
+ }
+ if (initialPid <= 0) {
+ LOG(ERROR) << __func__ << ": invalid PID " << initialPid;
+ return -1;
+ }
std::string hierarchy_root_path;
if (CgroupsAvailable()) {
CgroupGetControllerPath(CGROUPV2_CONTROLLER_NAME, &hierarchy_root_path);
diff --git a/trusty/stats/aidl/Android.bp b/trusty/stats/aidl/Android.bp
new file mode 100644
index 0000000..078cc99
--- /dev/null
+++ b/trusty/stats/aidl/Android.bp
@@ -0,0 +1,39 @@
+// Copyright (C) 2023 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.
+
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+aidl_interface {
+ name: "android.trusty.stats.nw.setter",
+ unstable: true,
+ vendor_available: true,
+ srcs: [
+ "android/trusty/stats/nw/setter/IStatsSetter.aidl",
+ ],
+ imports: ["android.frameworks.stats-V1"],
+ backend: {
+ cpp: {
+ enabled: true,
+ },
+ java: {
+ enabled: false,
+ platform_apis: false,
+ },
+ ndk: {
+ enabled: false,
+ },
+ },
+}
diff --git a/trusty/stats/aidl/android/trusty/stats/nw/setter/IStatsSetter.aidl b/trusty/stats/aidl/android/trusty/stats/nw/setter/IStatsSetter.aidl
new file mode 100644
index 0000000..f44f4a3
--- /dev/null
+++ b/trusty/stats/aidl/android/trusty/stats/nw/setter/IStatsSetter.aidl
@@ -0,0 +1,28 @@
+//
+// Copyright (C) 2023 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.
+//
+package android.trusty.stats.nw.setter;
+
+import android.frameworks.stats.IStats;
+
+interface IStatsSetter {
+ /**
+ * Set the IStats interface facet.
+ *
+ * @param istats The IStats facet provided by the caller for the remote
+ * service to report IStats' VendorAtom.
+ */
+ void setInterface(in IStats istats);
+}