palera1n / jbinit

iOS, iPadOS, tvOS, HomePod Software and bridgeOS booter ramsdisk
Other
68 stars 16 forks source link

fix: kerninfo size parsing #12

Closed oleavr closed 1 year ago

oleavr commented 1 year ago

To support newer versions of the structure.

asdfugil commented 1 year ago

Checking the kerninfo size is a flaw carried over from checkra1n that’s fundamentally broken - just because that size number is the same doesn’t mean the struct is the same.

Allowing larger structs will make it even more likely to fail silently because now instead of one number all numbers larger than the expected size will pass.

paleinfo, unlike kerninfo, has proper checks with a magic and version number, so extending that instead is perferred.

also, I don’t believe that jailbreaking a new iOS 17 beta would have any reason to require extending kerninfo/paleinfo

oleavr commented 1 year ago

@asdfugil Thanks for reviewing! Ah yes, it all makes sense now. So until the jbinit code is refactored to migrate fully to paleinfo from kerninfo, I take it the correct fix is to bring this repo's kerninfo into sync with that of https://github.com/palera1n/PongoOS?

asdfugil commented 1 year ago

this repo’s kerninfo is already in sync with https://github.com/palera1n/PongoOS (iOS15 branch), as that’s unmodified from checkra1n.

there are in fact ongoing work to migrate everything to paleinfo due to the problems mentioned above.

oleavr commented 1 year ago

this repo’s kerninfo is already in sync with https://github.com/palera1n/PongoOS (iOS15 branch), as that’s unmodified from checkra1n.

Oh yes, sorry, my bad. I was using https://github.com/plooshi/PongoOS (iOS 15 branch), which adds one commit on top of palera1n's, fixing support for the latest kernels (and some other changes), where the boot process would otherwise fail with:

panic: Missing patch: apfs_patch_mount

I didn't notice that it also patches kerninfo to add back the two fields. They aren't actually initialized though, so it looks like it might have been a rebase gone wrong.

asdfugil commented 1 year ago

the kerninfo changes in that fork is for use with older versions of the checkra1n ramdisk, which is irrelevant here.