tobefuturer / restore-symbol

A reverse engineering tool to restore stripped symbol table for iOS app.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

导入符号后无法识别arch

uaex opened this issue · comments

我的可执行文件只有arm64一个arch,不是FAT。烧机器的时候Xcode报cpu无法识别的错误,我用MachOView看了一下,arch是(???)。

commented

能发下原始文件看下吗

我是用Xcode run的脚本,类似以下:

dylib=$1

lipo -thin arm64 $dylib -o $dylib

restore-symbol $dylib -o $dylib"-with-symbols"

cp $dylib"-with-symbols" $dylib

rm $dylib"-with-symbols"

但我在尝试提取示例时发现无法复现,只是在运行工程时出现了
image
异常的地方在 00109B50 CPU SubType
正常情况应是 00000000 CPU SubType

上传又抽风了,暂时无法提供

commented

有点诡异。。。看其他数据没啥问题,就这一个字段出问题了,你试试看不要每次都rm掉那个-with-symbol文件,把他copy到某个路径下,如果出问题了 相当于一个现场

我找到错误的原因了,是因为没有签名,出错的代码如下:

struct linkedit_data_command *command = (struct linkedit_data_command *)((char *)outData.mutableBytes + codesignature.commandOffset);
uint32_t tmp_offset =  command -> dataoff + increase_size_all_without_padding;
uint32_t final_offset = vm_addr_round(tmp_offset, 16);
        
string_table_padding = final_offset - tmp_offset;
command -> dataoff = final_offset;

当codesignature.commandOffset == 0时,command -> dataoff刚好是文件的第三个32bit,也就是那个出错标识符的位置
已经pull request,另外可能其他地方也存在command不存在导致的写入异常