Skip to content

+[GREYDispatchQueueTracker load] fails when attempting rebind_symbols #1641

@Mattmlm

Description

@Mattmlm

When running EarlGrey 2 setup with whitebox via bazel on Xcode 13 Beta 5, I run into this issue on the host app (not the test runner app).

The callstack fails inside of fishhook.c, in this method perform_rebinding_with_section on this line:
indirect_symbol_bindings[i] = cur->rebindings[j].replacement;

The error is:
Thread 1: EXC_BAD_ACCESS (code=2, address=0x7fff80b9fce8)

With this output:

(lldb) p indirect_symbol_bindings
(void **) $7 = 0x00007fff80b9e588
(lldb) p cur
(rebindings_entry *) $8 = 0x0000600001259540
(lldb) p cur->rebindings
(rebinding *) $9 = 0x000060000205c1b0
(lldb) p cur->rebindings[j]
(rebinding) $10 = {
  name = 0x000000010ee72df2 "dispatch_after"
  replacement = 0x000000010e5741d0
  replaced = 0x0000000000000000
}
(lldb) p cur->rebindings[j].replacement
(void *) $11 = 0x000000010e5741d0

The full stack trace is here:

2021-09-10 13:12:03.848430-0700 HostAppEG2[94089:1522543] Crash handler setup started.
2021-09-10 13:12:03.848605-0700 HostAppEG2[94089:1522543] Crash handler setup completed.
2021-09-10 13:12:03.866055-0700 HostAppEG2[94089:1522543] Writing analzed variants.
2021-09-10 13:12:03.872509-0700 HostAppEG2[94089:1522543] Writing analzed variants.

(lldb) po [NSThread callStackSymbols]
<_NSCallStackArray 0x600000f262b0>(
0   ???                                 0x000000011aa32867 0x0 + 4741867623,
1   HostAppEG2             0x000000010e154c50 main + 0,
2   HostAppEG2             0x0000000110b22f9e rebind_symbols_for_image + 590,
3   HostAppEG2             0x0000000110b23152 _rebind_symbols_for_image + 50,
4   dyld                                0x000000011a68be19 ___ZN5dyld44APIs33_dyld_register_func_for_add_imageEPFvPK11mach_headerlE_block_invoke + 175,
5   dyld                                0x000000011a6780b5 _ZN5dyld412RuntimeState19withLoadersReadLockEU13block_pointerFvvE + 41,
6   dyld                                0x000000011a68bd1a _ZN5dyld44APIs33_dyld_register_func_for_add_imageEPFvPK11mach_headerlE + 116,
7   HostAppEG2             0x0000000110b2309d rebind_symbols + 93,
8   HostAppEG2             0x0000000110afd0e4 +[GREYDispatchQueueTracker load] + 1476,
9   libobjc.A.dylib                     0x00007fff2018cf26 load_images + 1419,
10  dyld                                0x000000011a67c9da _ZN5dyld412RuntimeState14notifyObjCInitEPKNS_6LoaderE + 170,
11  dyld                                0x000000011a6818cd _ZNK5dyld46Loader23runInitializersBottomUpERNS_12RuntimeStateERN5dyld35ArrayIPKS0_EE + 167,
12  dyld                                0x000000011a681976 _ZNK5dyld46Loader38runInitializersBottomUpPlusUpwardLinksERNS_12RuntimeStateE + 102,
13  dyld                                0x000000011a69023a _ZN5dyld44APIs25runAllInitializersForMainEv + 222,
14  dyld                                0x000000011a674920 _ZN5dyld4L7prepareERNS_4APIsEPKN5dyld313MachOAnalyzerE + 2306,
15  dyld                                0x000000011a674d3f _dyld_sim_prepare + 379,
16  ???                                 0x000000012078fc27 0x0 + 4839767079,
17  ???                                 0x000000012078d15e 0x0 + 4839756126,
18  ???                                 0x0000000120787224 0x0 + 4839731748,
19  ???                                 0x0000000120787025 0x0 + 4839731237
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions