Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS Crashed: #0 in dyld3::MachOFile::isMachO(Diagnostics&, unsigned long long) const () #1176

Closed
347008893 opened this issue Jun 29, 2023 · 5 comments
Assignees

Comments

@347008893
Copy link

【版本信息】

4.2.98

【平台信息】

iOS 原生/ Xcode 14.3.1/ iOS Simulator iPhone 14 Pro-16.4

【复现路径】

空工程使用 SPM 引用 libpag,run 的时候崩溃

【log】

Thread 1#0 0x00000001003108dc in dyld3::MachOFile::isMachO(Diagnostics&, unsigned long long) const ()
#1 0x00000001003107bc in dyld3::FatFile::isValidSlice(Diagnostics&, unsigned long long, unsigned int, unsigned int, unsigned int, unsigned long long, unsigned long long) const ()
#2 0x0000000100310ab8 in dyld3::FatFile::forEachSlice(Diagnostics&, unsigned long long, bool, void (unsigned int, unsigned int, void const*, unsigned long long, bool&) block_pointer) const ()
#3 0x0000000100310ebc in dyld3::FatFile::isFatFileWithSlice(Diagnostics&, unsigned long long, dyld3::GradedArchs const&, bool, unsigned long long&, unsigned long long&, bool&) const ()
#4 0x00000001003138a0 in dyld3::MachOFile::compatibleSlice(Diagnostics&, void const*, unsigned long, char const*, dyld3::Platform, bool, dyld3::GradedArchs const&) ()
#5 0x00000001002f6e78 in invocation function for block in dyld4::JustInTimeLoader::makeJustInTimeLoaderDisk(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, bool, unsigned int, mach_o::Layout const*) ()
#6 0x00000001002faed4 in dyld4::SyscallDelegate::withReadOnlyMappedFile(Diagnostics&, char const*, bool, void (void const*, unsigned long, bool, dyld4::FileID const&, char const*) block_pointer) const ()
#7 0x00000001002f6dec in dyld4::JustInTimeLoader::makeJustInTimeLoaderDisk(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, bool, unsigned int, mach_o::Layout const*) ()
#8 0x00000001002f0174 in invocation function for block in dyld4::Loader::getLoader(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&) ()
#9 0x00000001002ef430 in dyld4::Loader::forEachResolvedAtPathVar(dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, dyld4::ProcessConfig::PathOverrides::Type, bool&, void (char const*, dyld4::ProcessConfig::PathOverrides::Type, bool&) block_pointer) ()
#10 0x00000001002e5d8c in invocation function for block in dyld4::ProcessConfig::PathOverrides::forEachPathVariant(char const*, dyld3::Platform, bool, bool, bool&, void (char const*, dyld4::ProcessConfig::PathOverrides::Type, bool&) block_pointer) const ()
#11 0x00000001002e4c6c in dyld4::ProcessConfig::PathOverrides::forEachInColonList(char const*, char const*, bool&, void (char const*, bool&) block_pointer) ()
#12 0x00000001002e5730 in dyld4::ProcessConfig::PathOverrides::forEachPathVariant(char const*, dyld3::Platform, bool, bool, bool&, void (char const*, dyld4::ProcessConfig::PathOverrides::Type, bool&) block_pointer) const ()
#13 0x00000001002ef0a0 in dyld4::Loader::forEachPath(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, void (char const*, dyld4::ProcessConfig::PathOverrides::Type, bool&) block_pointer) ()
#14 0x00000001002ef698 in dyld4::Loader::getLoader(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&) ()
#15 0x00000001002f5538 in invocation function for block in dyld4::JustInTimeLoader::loadDependents(Diagnostics&, dyld4::RuntimeState&, dyld4::Loader::LoadOptions const&) ()
#16 0x0000000100312288 in invocation function for block in dyld3::MachOFile::forEachDependentDylib(void (char const*, bool, bool, bool, unsigned int, unsigned int, bool&) block_pointer) const ()
#17 0x0000000100311938 in dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const ()
#18 0x00000001003120dc in dyld3::MachOFile::forEachDependentDylib(void (char const*, bool, bool, bool, unsigned int, unsigned int, bool&) block_pointer) const ()
#19 0x00000001002f52c8 in dyld4::JustInTimeLoader::loadDependents(Diagnostics&, dyld4::RuntimeState&, dyld4::Loader::LoadOptions const&) ()
#20 0x00000001002e1a78 in dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) ()
#21 0x00000001002e12e4 in _dyld_sim_prepare ()
#22 0x00000001005278bc in dyld4::prepareSim(dyld4::RuntimeState&, char const*) ()
#23 0x000000010052613c in dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) ()
#24 0x0000000100525dc4 in start ()

@kevingpqi123
Copy link
Collaborator

我这边测试了下,测试是 OK 的,堆栈信息都是系统的,建议提供复现工程

@347008893
Copy link
Author

TestPag.zip

@347008893
Copy link
Author

已经提交了复现工程

@kevingpqi123
Copy link
Collaborator

该问题已修复,可以升级至 4.2.100

@kevingpqi123
Copy link
Collaborator

kevingpqi123 commented Nov 16, 2023

出现该问题的原因是编译好的 XCFramework 为了进一步减少包体,执行了 strip 操作,造成签名出现异常,修复方案为对 strip 之后的 XCFramework 重签名

(lldb) bt

  • thread#1, stop reason = EXC_BAD_ACCESS (code=50, address=0x10fe41000)
    • frame#0: 0x000000010ea8e00a dyld_simdyld3::MachOFile::isMachO(Diagnostics&, unsigned long long) const + 24 frame#1: 0x000000010ea72cc1 dyld_simdyld4::Loader::mapSegments(Diagnostics&, dyld4::RuntimeState&, char const*, unsigned long long, dyld4::Loader::CodeSignatureInFile const&, bool, dyld3::Arraydyld4::Loader::Region const&, bool, bool, dyld4::Loader::FileValidationInfo const&) + 1341
      frame#2: 0x000000010ea7a05c dyld_siminvocation function for block in dyld4::JustInTimeLoader::makeJustInTimeLoaderDisk(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, bool, unsigned int, mach_o::Layout const*) + 84 frame#3: 0x000000010ea79987 dyld_simdyld4::JustInTimeLoader::withRegions(dyld3::MachOFile const*, void (dyld3::Arraydyld4::Loader::Region const&) block_pointer) + 229
      frame#4: 0x000000010ea79f55 dyld_siminvocation function for block in dyld4::JustInTimeLoader::makeJustInTimeLoaderDisk(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, bool, unsigned int, mach_o::Layout const*) + 513 frame#5: 0x000000010ea7af29 dyld_simdyld4::SyscallDelegate::withReadOnlyMappedFile(Diagnostics&, char const*, bool, void (void const*, unsigned long, bool, dyld4::FileID const&, char const*) block_pointer) const + 143
      frame#6: 0x000000010ea79d2a dyld_simdyld4::JustInTimeLoader::makeJustInTimeLoaderDisk(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, bool, unsigned int, mach_o::Layout const*) + 194 frame#7: 0x000000010ea72024 dyld_siminvocation function for block in dyld4::Loader::getLoader(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&) + 2716
      frame#8: 0x000000010ea70e33 dyld_simdyld4::Loader::forEachResolvedAtPathVar(dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, dyld4::ProcessConfig::PathOverrides::Type, bool&, void (char const*, dyld4::ProcessConfig::PathOverrides::Type, bool&) block_pointer) + 605 frame#9: 0x000000010ea68bef dyld_siminvocation function for block in dyld4::ProcessConfig::PathOverrides::forEachPathVariant(char const*, dyld3::Platform, bool, bool, bool&, void (char const*, dyld4::ProcessConfig::PathOverrides::Type, bool&) block_pointer) const + 146

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

No branches or pull requests

2 participants