【问题标题】:Is there a way to directly run iOS binaries on M1 MacBooks?有没有办法在 M1 MacBook 上直接运行 iOS 二进制文件?
【发布时间】:2021-05-19 00:16:03
【问题描述】:

既然 M1 MacBook 可以直接运行 iOS 应用程序,我想知道是否有办法直接运行 iOS 二进制文件,而不是只能运行 App Store 中的那些?

我正在用 C 开发没有 Xcode 的 iOS 应用程序,我目前的工作流程是:

  • 使用xcrun -sdk iphonesimulator clang 构建
  • 打包到 iOS .app 捆绑包中
  • 使用xcrun simctl 命令复制并在模拟器上运行

它工作得很好,但如果我能以某种方式直接运行构建的二进制文件,那就太好了,如果我直接运行它只是说

% file app
app: Mach-O universal binary with 2 architectures: [arm_v7:Mach-O executable arm_v7] [arm64:Mach-O 64-bit executable arm64]
app (for architecture armv7):   Mach-O executable arm_v7
app (for architecture arm64):   Mach-O 64-bit executable arm64

% ./app
zsh: killed     ./app

我真的不知道这是怎么回事

来自 App Store 的可运行 iOS .app 似乎具有这种结构:

iOSapp.app
├── WrappedBundle -> Wrapper/iOSapp.app
└── Wrapper
    ├── BundleMetadata.plist
    ├── iTunesMetadata.plist
    └── iOSapp.app

但我不知道这些是否有助于它可以运行,并且在这些上找不到文档

【问题讨论】:

    标签: ios macos macos-big-sur apple-m1 apple-silicon


    【解决方案1】:

    是的,Google P0 刚刚找到了一种方法:

    因此,在 macOS 上启动 iOS 二进制文件所需的完整步骤是:

    Use the posix_spawnattr_set_platform_np API to set the target platform to PLATFORM_IOS
    
    Execute the new process via posix_spawn(2) and start it suspended
    
    Patch dyld to allow library interposing
    
    In the interposed library, claim to possess the com.apple.security.cs.debugger entitlement by replacing xpc_copy_entitlements_for_self
    
    Continue the process by sending it SIGCONT
    

    完整链接是https://googleprojectzero.blogspot.com/2021/05/fuzzing-ios-code-on-macos-at-native.html

    【讨论】:

      猜你喜欢
      • 2022-08-06
      • 2021-04-24
      • 2021-10-02
      • 2022-01-15
      • 2021-08-04
      • 2013-08-30
      • 2022-12-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多