fix: 修复 upx 内核切换后首次启动重复下载内核的问题#1295
Open
abcfy2 wants to merge 1 commit into
Open
Conversation
core_check 的 upx 分支在第52行将内核文件移动到 $BINDIR/CrashCore.upx, 但符号链接 $TMPDIR/CrashCore 却指向了不存在的 $TMPDIR/CrashCore.upx, 导致链接悬空(目标文件实际位于 $BINDIR)。 在 BusyBox 路由器上(BINDIR=/jffs/ShellCrash ≠ TMPDIR=/tmp/ShellCrash), check_core 的自愈入口 core_find 会被绕过而无法修复该悬空链接: BusyBox find 不支持 -size(故 find_para 为空),且 `find <悬空链接>` 会把链接本身列为结果,使 `[ -z "$(...)" ]` 判定为假、core_find 被跳过; 随后 `[ ! -f $TMPDIR/CrashCore ]` 跟随悬空链接误判内核缺失,触发重复下载。 将符号链接改为指向 $BINDIR/CrashCore.upx,与文件实际位置一致。 该写法对 BINDIR==TMPDIR 的小闪存模式同样正确。 仅在 BusyBox 路由器上、切换 upx 内核后未重启即启动时可复现; GNU find 环境因 -size 过滤掉悬空链接会正常触发 core_find 自愈,故此前未被发现。
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.
切换到 upx 内核后第一次启动,会提示"未找到核心"然后重新下载一遍刚下好的内核。
原因:core_check 的 upx 分支把内核文件 mv 到了 $BINDIR/CrashCore.upx,但 $TMPDIR/CrashCore 这个符号链接指向的却是 $TMPDIR/CrashCore.upx(不存在),是个断链。BusyBox 路由器上 check_core 本来能靠 core_find 自愈重建链接,但 BusyBox 的 find 不支持 -size,还会把断链本身当成结果列出来,于是 core_find 被跳过、断链没修上,被判成内核缺失,触发重新下载。
把链接指向 $BINDIR/CrashCore.upx 即可。只有 upx 受影响,tar.gz / gz 都是直接放真实文件,没这个问题。