ipsw icon indicating copy to clipboard operation
ipsw copied to clipboard

ipsw dyld extract --all fails with optimization failure

Open R6-Mute opened this issue 9 months ago • 4 comments

What happened?

Trying to extract dylibs from ipsw with the command ipsw dyld extract -a --objc --slide --stubs ./21E237__iPhone16,1/dyld_shared_cache_arm64e on iOS 17.4.1 iPhone16,1 returns an error: failed to extract dylib /System/Library/PrivateFrameworks/CoreALD.framework/CoreALD: failed to optimize load commands: failed to remap offset in LC_ENCRYPTION_INFO_64: failed to remap offset 0x4000

Seems that running just with -a--all gives the same result, but would be nice to not fail the whole process just say which one failed and continue with the extraction.

My setup: MBP M3 Sonoma 14.4.1

How can we reproduce this?

run ipsw dyld extract -a --objc --slide --stubs ./21E237__iPhone16,1/dyld_shared_cache_arm64e on the extracted dyld from iPhone16,1_17.4.1_21E237_Restore.ipsw

ipsw version

Version: 3.1.480, BuildCommit: 2fffe45e5437a6f0ac4527edc4336fb80d853bbb

Search

  • [X] I did search for other open and closed issues before opening this

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

Additional context

No response

R6-Mute avatar May 06 '24 10:05 R6-Mute

simple echo 123 > OUTPUT_FOLDER_PATH/System/Library/PrivateFrameworks/CoreALD.framework/CoreALD "tricked" the script to go over the problematic dylib and finish extracting the rest : )

R6-Mute avatar May 06 '24 12:05 R6-Mute

Hi. I'm running into this issue as well. Here are some more details:

Device: Macbook Pro M1 Max Sonoma 14.5 Firmware Extracting: https://updates.cdn-apple.com/2024SpringFCS/fullrestores/052-39331/01B884E9-B6BA-493B-B9C2-A877A9F29360/iPhone11,8_17.5_21F79_Restore.ipsw IPSW Version: ipsw version Version: 3.1.500, BuildCommit: 6bebd309b594a61bcb02934b6ab38d90c1e61d69 Command Used: ipsw dyld extract extracted_files/21F79__iPhone11,8/dyld_shared_cache_arm64e --all

Result:

ipsw dyld extract extracted_files/21F79__iPhone11,8/dyld_shared_cache_arm64e --all --force
   • Extracting all dylibs from extracted_files/21F79__iPhone11,8/dyld_shared_cache_arm64e
        11s [====================================================================>---------| 3034/3412 ]
       
          ⨯ failed to extract dylib /System/Library/PrivateFrameworks/CoreALD.framework/CoreALD: failed to optimize load commands: failed to remap offset in LC_ENCRYPTION_INFO_64: failed to remap offset 0x4000

I've tried restarting my Mac, using --force, updating to the latest version of IPSW, but neither seem to address the issue. I also tried the comment mentioned above, but the CoreALD.framework/CoreALD path does not exist, as it hasn't been created yet.

Note: Doesn't happen with https://updates.cdn-apple.com/2023FallFCS/fullrestores/042-49415/A6D69931-A729-44D2-AC2A-EB3ED7E20EBB/iPhone11,8_17.0_21A329_Restore.ipsw. Seems to be happening on all of the newer iOS versions that just came out

Any suggestions or workarounds?

nemzutkovic avatar Jun 18 '24 20:06 nemzutkovic

ipsw dyld extract ".\private\preboot\Cryptexes\OS\System\Library\Caches\com.apple.dyld\dyld_shared_cache_arm64e" --all -o out 57s [=====================================================================>--------| 3040/3408 ] Usage: ipsw dyld extract [flags]

Aliases: extract, e

Flags: -a, --all Split ALL dylibs -c, --cache string Path to .a2s addr to sym cache file (speeds up analysis) --force Overwrite existing extracted dylib(s) -h, --help help for extract --objc Add ObjC metadata to extracted dylib(s) symtab -o, --output string Directory to extract the dylib(s) --slide Apply slide info to extracted dylib(s) --stubs Add stub islands to extracted dylib(s) symtab

Global Flags: --color colorize output --config string config file (default is $HOME/.config/ipsw/config.yaml) --no-color disable colorize output -V, --verbose verbose output

⨯ failed to extract dylib /System/Library/PrivateFrameworks/CoreALD.framework/CoreALD: failed to optimize load commands: failed to remap offset in LC_ENCRYPTION_INFO_64: failed to remap offset 0x4000

lilili87222 avatar Sep 04 '24 06:09 lilili87222

Sorry for the slow response, the ipsw dsc extract cmd is hidden and should not be used, due to it's brokenness, I'll add a warning message as well, but it no longer shows up in --help etc

I'm planning on spending the time to fix this and add proper KEXT-traction as well when I can.

However, people should not be using it now.

blacktop avatar Sep 04 '24 06:09 blacktop