aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-06-09 03:18:44 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-06-09 03:18:44 +0000
commit3db6029c73c0ae885c85a353ba867f904158c957 (patch)
tree26c4570f6cc8f5ee36233bd88a2b1236e65a8f20
parent35c760b8ad6b9539349f8bb33f227b89153b0596 (diff)
parent218aa200958c42c5c11e33e9b708fbf7c6431166 (diff)
downloadadb-android-14.0.0_r24.tar.gz
Change-Id: I10f36a18990a55fb5b56c1f00436c78efa3f3113
-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);