aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-08 04:40:01 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-08 04:40:01 +0000
commit3820c7d5e1a29b5e5f6f7c078b072c5fe5daf924 (patch)
tree26c4570f6cc8f5ee36233bd88a2b1236e65a8f20
parentd72b789704dd110b735ea5816116ac02a929176d (diff)
parentc362e05a76d7238f684234fe4ad6768c0c461b8d (diff)
downloadadb-android14-mainline-healthfitness-release.tar.gz
Snap for 10460766 from c362e05a76d7238f684234fe4ad6768c0c461b8d to mainline-healthfitness-releaseaml_hef_341613000aml_hef_341512030aml_hef_341415040aml_hef_341311010aml_hef_341114030android14-mainline-healthfitness-release
Change-Id: Ibc9d6d2311d8bc90400084544155f6bb3574e690
-rw-r--r--daemon/jdwp_service.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/daemon/jdwp_service.cpp b/daemon/jdwp_service.cpp
index d03573fb..2501688c 100644
--- a/daemon/jdwp_service.cpp
+++ b/daemon/jdwp_service.cpp
@@ -459,12 +459,16 @@ static int jdwp_tracker_enqueue(asocket* s, apacket::payload_type) {
}
static asocket* create_process_tracker_service_socket(TrackerKind kind) {
- auto t = std::make_unique<JdwpTracker>(kind, true);
+ std::unique_ptr<JdwpTracker> t = std::make_unique<JdwpTracker>(kind, true);
if (!t) {
LOG(FATAL) << "failed to allocate JdwpTracker";
}
- memset(t.get(), 0, sizeof(asocket));
+ /* Object layout (with an inheritance hierarchy) varies across arch (e.g
+ * armv7a/Android TV vs aarch64), so no assumptions can be made about
+ * accessing fields based on offsets (e.g memset(t.get(), 0, sizeof(asocket))
+ * might clobber an unintended memory location).
+ */
install_local_socket(t.get());
D("LS(%d): created new jdwp tracker service", t->id);