Repository navigation
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.
问题描述
在 Jailbreak 模式下,Zygisk next和元模块挂载操作受到 seccomp 策略限制,导致挂载流程无法正常完成。
修复方案
针对 Jailbreak 模式下软重启后模块挂载失败的问题,从 seccomp 状态处理和任务凭据更新两个方面进行修复。
kp_commit_su()提权成功后,增加当前任务的 seccomp 禁用处理。通过sighand->siglock保护状态修改,根据内核版本分别使用clear_syscall_work(SECCOMP)或clear_thread_flag(TIF_SECCOMP)清除对应标志,并将current->seccomp.mode设置为SECCOMP_MODE_DISABLED。保留原有 filter 引用,交由任务退出时的正常流程释放,避免直接释放 filter 带来的内核版本兼容性问题。kp_task_su()中直接修改目标任务cred和real_cred指针的方式,改为通过task_work_add()将凭据更新操作提交至目标任务自身的执行上下文,由工作回调完成提权及 SELinux 上下文设置,避免跨任务直接修改凭据引发的兼容性问题。kp_resolve_symbol_variant()动态解析task_work_add,并使用TWA_SIGNAL请求及时执行任务工作;同时补充任务退出检查、凭据更新失败处理及资源释放逻辑,降低不同 GKI 内核实现差异带来的影响。设计考虑
Related PR: bmax121/APatch#1686