Skip to content

Commit

Permalink
fix : Probabilistic double free when multi-thread callback signal han…
Browse files Browse the repository at this point in the history
…dler.
  • Loading branch information
zhi1ong committed Jul 28, 2021
1 parent ab7fb40 commit 16510f5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
通过一系列技术手段实现运行期间动态调整`Region Space`预分配的地址空间,释放出最多`900MB`(根据实际情况调整参数)虚拟内存给到 libc:malloc,增加了接近30%的地址上限,大幅度给应用续命。(细节待补充)

## 三、使用方式
编译`patrons`模块,主工程依赖该模块产物,在合适的时机进行初始化:
编译`patrons`模块 or 使用以下中心仓库的坐标,主工程依赖该模块产物,在合适的时机进行初始化:

```groovy
repositories {
mavenCentral()
}
dependencies {
implementation 'com.alibaba:patrons:1.0.6.2'
implementation 'com.alibaba:patrons:1.0.6.3'
}
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ ext {
ndkVersion = "20.1.5948944"
cmakeVersion = "3.10.2"
abiFilters = "armeabi-v7a"
versionName = "1.0.6.2"
versionName = "1.0.6.3"
}
2 changes: 1 addition & 1 deletion patrons/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ POM_NAME=Patrons SDK
POM_ARTIFACT_ID=patrons
POM_PACKAGING=aar
POM_DESCRIPTION=Patrons SDK for android.
VERSION_NAME=1.0.6.2
VERSION_NAME=1.0.6.3
5 changes: 3 additions & 2 deletions patrons/src/main/cpp/patrons_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,15 @@ void InitEnv() {
*/
static void CustomSignalHandler(int sig) {
if (i_want_handle_signal_flag) {
LOGE("found exception signal %d", sig);
__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "found exception signal %d", sig);

// reset flag.
i_want_handle_signal_flag = 0;

siglongjmp(time_machine, 1);
} else {
LOGE("found exception signal %d, but not my business.", sig);
// use raw log method, LOGE not thread safe.
__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "found exception signal %d, but not my business.", sig);
sigaction(sig, &sig_act_old[sig], NULL);
}
}
Expand Down

0 comments on commit 16510f5

Please sign in to comment.