frida / frida-gum

Cross-platform instrumentation and introspection library written in C
https://frida.re
Other
727 stars 240 forks source link

Fix Darwin symbolicator cache invalidator logic #768

Closed mrmacete closed 8 months ago

mrmacete commented 8 months ago

There are 2 problems with the existing logic:

  1. Since Xcode 15.1, when Xcode launches an app it places a software breakpoint (brk / int3) instruction at the beginning of the notification_address returned by all_image_infos. That's a function which the cache invalidator hooks with Interceptor in order to trigger when any libraries are loaded or unloaded at runtime. The problem with this approach is that in this way Interceptor relocates the breakpoint instruction, so when it gets executed Xcode can't match it with the address it expected, resulting into an uncaught exception crashing the app.
  2. In cases where Interceptor can't work on system code (like the Gadget with required code-signing) the symbolicator cache is never invalidated

To overcome these problems what this change proposes is:

In order to do so, though, other 2 changes are present in this MR:

https://github.com/frida/frida-core/pull/498 depends on this

oleavr commented 8 months ago

w00t! 🤘 Thanks! 🙌