Repository navigation
fix: use shell to write keybox - #161
Closed
nairain233 wants to merge 1 commit into
Closed
nairain233 wants to merge 1 commit into
nairain233 wants to merge 1 commit into
Conversation
- avoid OMK restoring its template while native IO clears the keybox
Owner
|
因为 write 也可能在别的地方出现这种 race condition 所以最好还是从根源上修 |
Merged
Author
|
已测试 ,可以正常更换 keybox,感谢修复。 |
KOWX712
added a commit
that referenced
this pull request
Nov 10, 2026
- fix #161 - write: write tmp path before complete - move: remove redundant checking - copy: early return on self copy
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.
问题
在支持原生 IO 的 KernelSU 管理器中,通过 Addon 更换 keybox 时,界面提示设置成功,但 OMK 会将文件恢复为内置 AOSP 模板。
OMK 日志报错:
触发该问题的写入路径由 2026-10-30 的提交引入:
e7d95a0 — feat: migrate to new ksu io and pm api
该提交使支持原生 IO 的环境优先使用
KsuIo.write()。时序原因
KernelSU 的原生输出流基于 libsu。打开覆盖写入流时,底层会先单独清空目标文件,并关闭这次清空操作,然后再建立实际写入流。
这会产生以下竞争:
实机日志中,正式文件在
native.open.return时就已变为模板大小;后续写入、刷新、关闭均返回成功,但文件 inode 发生变化,最终哈希与预期不符。修改
在
setKeybox()中复用现有ShellFile.write()写入正式 keybox。验证
在 KernelSU+OMK 1.2.6 上,包含相同 Shell 写入改动的调试构建已验证:
fallback=false。