Skip to content

无法hook只有赋值代码的set、get方法 #443

@weimingjue

Description

@weimingjue

反馈BUG之前,先issue里面搜看看有没有别人已经反馈过,重复的不予处理!!

问题描述

android代码:MainActivity里面

private String mSt;
public void setString(String ss) {
    mSt = ss;
}
protected void initData() {
    setString("哈哈");
    Log.i(TAG, mSt);
}

hook代码:在handleLoadPackage中
XposedHelpers.findAndHookMethod("com.wang.hongbao.MainActivity", lpparam.classLoader,
"setString", String.class, new XC_MethodHook() {
@OverRide
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
LogUtil.logXposedI("hokkset方法:" + Arrays.toString(param.args));
}
});
结果:必崩溃,日志如下
10-24 12:06:19.221 5147-5147/com.wang.hongbao A/libc: Fatal signal 7 (SIGBUS), code 1, fault addr 0xebd05cdf in tid 5147 (om.wang.hongbao)
10-24 12:06:19.345 5226-5226/? A/DEBUG: pid: 5147, tid: 5147, name: om.wang.hongbao >>> com.wang.hongbao <<<
signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr 0xebd05cdf
r0 e3f54000 r1 12da75e0 r2 12fb3928 r3 ebd05400
r4 e3f54000 r5 00000000 r6 00000002 r7 ffe38fb8
r8 ffe38fb8 r9 ebd05400 sl 00000000 fp ffe38f3c
ip ddf61168 sp ffe38f30 lr eb8899c3 pc e3f53042 cpsr 200d0030
10-24 12:06:19.409 5226-5226/? A/DEBUG: #00 pc 00000042 anonymous:e3f53000
#1 pc 000aa9c1 /system/lib/libart.so (art_quick_invoke_stub_internal+64)
#2 pc 001ba81b /system/lib/libart.so (offset 0x26e000)
#3 pc 000b2201 /system/lib/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+144)
#4 pc 000c79a1 /system/lib/libart.so (offset 0x26e000)
#5 pc 000c91e3 /system/lib/libart.so (offset 0x26e000)
#6 pc 000623d9 /system/lib/libart.so (offset 0x26e000)
#7 pc 005afbc9 /system/framework/arm/boot.oat (offset 0x51c000) (java.lang.reflect.Method.invoke+116)
#8 pc 000aa9c1 /system/lib/libart.so (art_quick_invoke_stub_internal+64)
#9 pc 001ba81b /system/lib/libart.so (offset 0x26e000)
#10 pc 000b2201 /system/lib/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+144)
#11 pc 00208cf1 /system/lib/libart.so (_ZN3art11interpreter34ArtInterpreterToCompiledCodeBridgeEPNS_6ThreadEPNS_9ArtMethodEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+200)
#12 pc 00202e51 /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+432)
#13 pc 001b4c35 /system/lib/libart.so (offset 0x26e000)
#14 pc 000a1594 /system/lib/libart.so (ExecuteMterpImpl+29972)
#15 pc 001e6037 /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+282)
#16 pc 001eaaef /system/lib/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+114)
#17 pc 00202e39 /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+408)
#18 pc 001b3137 /system/lib/libart.so (offset 0x26e000)
#19 pc 0009d914 /system/lib/libart.so (ExecuteMterpImpl+14484)
#20 pc 001e6037 /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+282)
#21 pc 001eaaef /system/lib/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+114)
#22 pc 00202e39 /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+408)
#23 pc 001b4c35 /system/lib/libart.so (offset 0x26e000)
#24 pc 000a1594 /system/lib/libart.so (ExecuteMterpImpl+29972)
#25 pc 001e6037 /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+282)
#26 pc 001eaaef /system/lib/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+114)
#27 pc 00202e39 /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+408)
#28 pc 001b340f /system/lib/libart.so (offset 0x26e000)
#29 pc 0009d994 /system/lib/libart.so (ExecuteMterpImpl+14612)
#30 pc 001e6037 /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+282)
#31 pc 001eaaef /system/lib/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+114)
#32 pc 00202e39 /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+408)
#33 pc 001b340f /system/lib/libart.so (offset 0x26e000)
#34 pc 0009d994 /system/lib/libart.so (ExecuteMterpImpl+14612)
#35 pc 001e6037 /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+282)
#36 pc 001eaaef /system/lib/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+114)
#37 pc 00202e39 /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+408)
#38 pc 001b340f /system/lib/libart.so (offset 0x26e000)
#39 pc 0009d994 /system/lib/libart.so (ExecuteMterpImpl+14612)
#40 pc 001e6037 /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+282)
#41 pc 001eaa55 /system/lib/libart.so (_ZN3art11interpreter30EnterInterpreterFromEntryPointEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameE+92)
#42 pc 001a87dd /system/lib/libart.so (offset 0x26e000)
#43 pc 000af413 /system/lib/libart.so (art_quick_to_interpreter_bridge+34)
#44 pc 000004b1 /data/data/io.va.exposed/virtual/opt/data@app@com.wang.hongbao-1@base.apk@classes.dex (offset 0x12cb000)

复现步骤

 调用就崩溃

环境

机型:360n6pro手机
系统版本:7.1.1
ROM版本:
Xposed 插件以及插件版本:
VirtualXposed版本:0.12.7

补充

hook超父类Object的构造也会崩溃,不知道为什么
(别的需要描述的内容)

写完之后,请自己再读一遍自己写的,如果你自己都读不懂,就不用说修复了

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions