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 14.5 crashed #82

Open
cfxiao opened this issue Feb 3, 2021 · 13 comments
Open

iOS 14.5 crashed #82

cfxiao opened this issue Feb 3, 2021 · 13 comments

Comments

@cfxiao
Copy link

cfxiao commented Feb 3, 2021

0 perform_rebinding_with_section(fishhook.c:137)
1 perform_rebinding_with_section(fishhook.c:131)
2 rebind_symbols_for_image(fishhook.c:208)
3 rebind_symbols(fishhook.c:252)

iOS 14.5 crashed when hook GCD.

@cfxiao
Copy link
Author

cfxiao commented Feb 3, 2021

image

@cfxiao
Copy link
Author

cfxiao commented Feb 3, 2021

Hook fsync also crashes.

@feikang
Copy link

feikang commented Feb 3, 2021

have the same problem. I can reproduce the crash with iPhone Xs and OS version 14.5(18E5140j) beta. but iPhone 7 can't reproduce it.

@leirenbaobao
Copy link

@cfxiao can you supply detail codes? which func been hooked?

@biosli
Copy link

biosli commented Feb 4, 2021

@leirenbaobao it seems that he hook the dispatch_sync.
And I try to hook malloc / realloc get same crash report.

I'm pretty sure the iOS 14.5 beta at newer phones such as iPhoneXs, has change the memory offset of core library.

@leirenbaobao
Copy link

@biosli I tested some funcs. some crashes. what puzzle me is that even offset changed normal dynamic binding still work without hook.maybe it's nothing to do with offset.

@leirenbaobao
Copy link

I suppose write to a read-only address. https://stackoverflow.com/questions/19741409/whats-the-difference-between-code-1-and-code-2-in-exc-bad-access

@maniackk
Copy link

maniackk commented Feb 28, 2021

I found some case that vm_protect return KERN_SUCCESS , but memory don't set VM_PROT_WRITE success. like mprotect method

oldProtection = get_protection(rebindings); is wrong, It save struct rebindings_entry *rebindings memory protection. We should save section protection.

I commit code that oldProtection = get_protection((void *)trunc_address);.

and I found a problem when program set same section protection in multithread(iOS 14.5).

https://github.com/facebook/fishhook/pull/84/files

@maniackk
Copy link

maniackk commented Mar 4, 2021

@leirenbaobao it seems that he hook the dispatch_sync.
And I try to hook malloc / realloc get same crash report.

I'm pretty sure the iOS 14.5 beta at newer phones such as iPhoneXs, has change the memory offset of core library.

#84 fix bug

@daybreak1024
Copy link

When will the crash be fixed?

I used #84 code and it worked.But it's not merged into the main branch,so can I use it?

@maniackk
Copy link

When will the crash be fixed?

I used #84 code and it worked.But it's not merged into the main branch,so can I use it?

you can use it !

crash reason:

  1. int mprotect(void *address, size_t size, int protect); function Require address alignment at all iOS version(Not only iOS 14.5). apple doc
  2. The memory mapped to the __DATA_CONST section is readable and writable before iOS 14.5; but in iOS 14.5 maybe readwrite,maybe readonly。

@d6638219
Copy link

d6638219 commented Jun 9, 2021

iOS15 crash

@kaspesla
Copy link

kaspesla commented Jun 9, 2021

Thanks for the fix!! In case anyone else is using fishhook on the Mac, you will need this fix for macOS 12.

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

8 participants