Fix SIGILL crash on Android 16 (HyperOS 3.0)#22
Open
Ahaochan wants to merge 1 commit intoshadowsocks:elastic-curranfrom
Open
Fix SIGILL crash on Android 16 (HyperOS 3.0)#22Ahaochan wants to merge 1 commit intoshadowsocks:elastic-curranfrom
Ahaochan wants to merge 1 commit intoshadowsocks:elastic-curranfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix SIGILL crash on Android 16 (HyperOS 3.0)
Summary / 概述
English: This PR fixes a critical crash (
SIGILL) of thesimple-obfsplugin on newer Android versions (specifically tested on Android 16, HyperOS 3.0). The issue was caused by an incorrect build configuration where the executable was being built as a shared library, leading to illegal instruction errors when the system attempted to execute it.中文: 本 PR 修复了
simple-obfs插件在较新 Android 版本(在 Android 16, 澎湃OS 3.0 上实测)下出现的严重崩溃(SIGILL)问题。问题根源在于原有的编译配置将可执行文件作为共享库(Shared Library)构建,导致系统尝试执行时触发“非法指令”错误。Environment / 环境信息
Problem & Analysis / 问题与分析
English: When enabling the simple-obfs plugin, Shadowsocks failed to connect. Logcat revealed the following error:
ERROR plugin exited with status: signal: 4 (SIGILL)The analysis suggests that on modern Android/Kernel environments, forcing a
SHAREDlibrary to act as an executable via-pieflags can lead to memory execution violations or entry point mismatches, resulting in theSIGILLsignal.中文: 开启插件后,Shadowsocks 无法联网。Logcat 日志显示:
ERROR plugin exited with status: signal: 4 (SIGILL)经过分析发现,在现代 Android/内核环境下,通过
-pie标志强制让SHARED库作为可执行文件运行,会导致内存执行权限校验失败或入口点匹配错误,从而触发SIGILL(非法指令)信号。Changes / 改动内容
English: 1. Changed
add_library(obfs-local SHARED ...)toadd_executable(obfs-local ...).2. Explicitly set target properties to maintain the
libobfs-local.sonaming convention to ensure the APK packaging and Shadowsocks' plugin loading logic remain compatible.3. This ensures the binary has a proper ELF execution header while still being recognized as a native library by the Android package manager for proper extraction.
中文: 1. 将
add_library(obfs-local SHARED ...)修改为add_executable(obfs-local ...)。2. 显式设置目标属性,保持
libobfs-local.so的命名约定,以确保 APK 打包逻辑和 Shadowsocks 的插件加载逻辑保持兼容。3. 这样做确保了二进制文件拥有正确的 ELF 执行头,同时仍能被 Android 包管理器识别为原生库并正确解压。
Note to Reviewers / 给维护者的说明
English: I am not a developer with an Android-native background. Although this change has been verified to work perfectly on my Redmi K80 Ultra (Android 16), please review the implications for older Android versions carefully. If this aligns with the project's compatibility goals, please consider merging.
中文: 我并非专业的安卓背景开发者。虽然该改动已在我的 Redmi K80 Ultra (Android 16) 上通过测试并能正常上网,但还请各位维护者仔细评估此改动对旧版本 Android 的影响。如果符合项目的兼容性目标,请考虑合并。