Fix bugs in signal processing functions #24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Patrons在信号处理这块有点问题:
xhook和Patrons都针对SIGSEGV做了特殊处理,用来防止自己的core dump扩散到外面。外面的信号被xhook或者Patrons捕获到时会调用sigaction把old信号处理函数重新注册成新的信号处理函数(等同放弃了自己的信号保护机制),
按代码信号处理函数注册时机来说,如果Patrons代码块的信号处理函数捕获到xhook代码块的SIGSEGV,Patrons代码块判断不是自己内部的便放弃了自己的信号处理函数并把xhook的信号处理函数注册成新的信号处理函数,最终会触发了xhook的信号处理函数,程序不会崩溃,程序执行一段时间后,如果Patrons代码块发出了SIGSEGV信号,SIGSEGV信号会被xhook的信号处理函数处理,程序就崩溃了。并没有做到杜绝因为Patrons崩溃而造成APP崩溃。
参考Android处理方案,直接调用旧的信号处理函数即可。
https://cs.android.com/android/platform/superproject/+/master:external/gwp_asan/gwp_asan/optional/segv_handler_posix.cpp
回归机型:
Android 12
ONEPLUS LE2110
SAMSUNG SM-A217F
Android 11
XIAOMI M2102J2SC
OPPO CPH2067
GOOGLE Pixel 4 XL
Android 10
BLACKSHARK SHARK KLE-A0
HUAWEI ANA-NX9
SAMSUNG SM-A202F
Android 9
XIAOMI MI 8
VIVO V1809A
MOTOROLA moto g(6)
Android 8.1
XIAOMI POCOPHONE F1
HUAWEI COR-AL10
MEIZU M1816
Android 8.0
MOTOROLA moto e5 play
HUAWEI AUM-L33
HUAWEI BLA-L29