From 8c3c6e6b2c565f5a56b99113c94979dfbd6604a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=83=82=E6=B3=A5=E6=89=B6=E4=B8=8A=E5=A2=99?= <2114486405@qq.com> Date: Wed, 26 Feb 2025 19:29:45 +0800 Subject: [PATCH] Fix the SIGSEGV caused by premature initialization of ClassLinker (#137) ClassLinker should be initialized after Class because FixupStaticTrampolines references Class::GetClassDef, causing a SIGSEGV. --- lsplant/src/main/jni/lsplant.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lsplant/src/main/jni/lsplant.cc b/lsplant/src/main/jni/lsplant.cc index 9968127..3851511 100644 --- a/lsplant/src/main/jni/lsplant.cc +++ b/lsplant/src/main/jni/lsplant.cc @@ -268,14 +268,14 @@ bool InitNative(JNIEnv *env, const HookHandler &handler) { LOGE("Failed to init thread"); return false; } - if (!ClassLinker::Init(handler)) { - LOGE("Failed to init class linker"); - return false; - } if (!Class::Init(handler)) { LOGE("Failed to init mirror class"); return false; } + if (!ClassLinker::Init(handler)) { + LOGE("Failed to init class linker"); + return false; + } if (!ScopedSuspendAll::Init(handler)) { LOGE("Failed to init scoped suspend all"); return false;