Skip to content

fix(jailbreak): fix module initialization failures after soft reboot - #347

Open
iliaoke wants to merge 2 commits into
bmax121:mainfrom
iliaoke:fix/jailbreak-seccomp-module-mount
Open

iliaoke wants to merge 2 commits into
bmax121:mainfrom
iliaoke:fix/jailbreak-seccomp-module-mount

Conversation

@iliaoke

@iliaoke iliaoke commented Nov 13, 2026 •

Copy link
Copy Markdown

问题描述

在 Jailbreak 模式下,Zygisk next和元模块挂载操作受到 seccomp 策略限制,导致挂载流程无法正常完成。

修复方案

针对 Jailbreak 模式下软重启后模块挂载失败的问题,从 seccomp 状态处理和任务凭据更新两个方面进行修复。

  • 调整 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 上下文设置,避免跨任务直接修改凭据引发的兼容性问题。
  • 完善 GKI 兼容性:通过 kp_resolve_symbol_variant() 动态解析 task_work_add,并使用 TWA_SIGNAL 请求及时执行任务工作;同时补充任务退出检查、凭据更新失败处理及资源释放逻辑,降低不同 GKI 内核实现差异带来的影响。

设计考虑

  • 不改变现有模块管理机制。
  • 不引入不必要的额外依赖。
  • 保持对现有 APatch / KernelPatch 功能及执行流程的兼容性。

Related PR: bmax121/APatch#1686

Copilot AI balanced review requested due to automatic review settings November 13, 2026 17:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants