Closed gloxec closed 3 years ago
Hi, on my machine with BigSur 11.4 I don't see a crash like that. Could you fetch the latest TinyInst/Jackalope, rebuild and try the test Jackalope command from the Readme:
./fuzzer -in in -out out -t 1000 -delivery shmem -instrument_module test -target_module test -target_method __Z4fuzzPc -nargs 1 -iterations 10000 -persist -loop -cmp_coverage -- ./test -m @@
(you'll need to create the in
directory with at least one file).
Does this still result in the same crash?
Yes, TinyInst is the latest version from the repository, and ./fuzzer
was able to run normally before.
But now neither the old version of the fuzzer
compiled when running on MacOS Catalina (the old Jackalope and TinyInst without Arm64 debugger) nor the recompiled new version of Jackalope and TinyInst can not run.
It stands to reason that even if there is a problem with the code, the fuzzer
program originally compiled in MacOS Catalina should still run normally after upgrading BigSur, but the real situation is that the above-mentioned error is reported.
At the same time, the same error was reported in the program I wrote locally. Combined with the lldb prompt, I guess whether BigSur updated the dyld and caused the code to fail to run normally?
TinyInst code used by the local program:
instrumentation->Run(argc, argv, 1000)
Can you confirm that even the test binary crashes (command above)?
Could you run with -trace_debug_events and post the output?
Yes, running the above command, both programs ./fuzzer
& test
will crash.
./fuzzer -in in -out out -t 1000 -delivery shmem -instrument_module test -target_module test -target_method __Z4fuzzPc -nargs 1 -iterations 10000 -persist -loop -cmp_coverage -trace_debug_events -- ./test -m @@
Fuzzer version 0.01
1 input files read
Running input sample in/seed-0
Debugger: Mach exception (5) @ address 0x113215000
Debugger: Process created or attached
Debugger: Loaded module /usr/lib/dyld at 0x113214000
Debugger: Loaded module test at 0x10ce2c000
Debugger: Loaded module libc++.1.dylib at 0x7fff204be000
Debugger: Loaded module libSystem.B.dylib at 0x7fff2a731000
Debugger: Loaded module libc++abi.dylib at 0x7fff20514000
Debugger: Loaded module libcache.dylib at 0x7fff2a72b000
Debugger: Loaded module libcommonCrypto.dylib at 0x7fff2a6e7000
Debugger: Loaded module libcompiler_rt.dylib at 0x7fff2a711000
Debugger: Loaded module libcopyfile.dylib at 0x7fff2a706000
Debugger: Loaded module libcorecrypto.dylib at 0x7fff202e8000
Debugger: Loaded module libdispatch.dylib at 0x7fff203b3000
Debugger: Loaded module libdyld.dylib at 0x7fff20566000
Debugger: Loaded module libkeymgr.dylib at 0x7fff2a722000
Debugger: Loaded module liblaunch.dylib at 0x7fff2db38000
Debugger: Loaded module libmacho.dylib at 0x7fff2a6c5000
Debugger: Loaded module libquarantine.dylib at 0x7fff29ebd000
Debugger: Loaded module libremovefile.dylib at 0x7fff2a71f000
Debugger: Loaded module libsystem_asl.dylib at 0x7fff24dc2000
Debugger: Loaded module libsystem_blocks.dylib at 0x7fff20298000
Debugger: Loaded module libsystem_c.dylib at 0x7fff20435000
Debugger: Loaded module libsystem_collections.dylib at 0x7fff2a719000
Debugger: Loaded module libsystem_configuration.dylib at 0x7fff291c3000
Debugger: Loaded module libsystem_containermanager.dylib at 0x7fff284ab000
Debugger: Loaded module libsystem_coreservices.dylib at 0x7fff2a468000
Debugger: Loaded module libsystem_darwin.dylib at 0x7fff229a1000
Debugger: Loaded module libsystem_dnssd.dylib at 0x7fff2a723000
Debugger: Loaded module libsystem_featureflags.dylib at 0x7fff20432000
Debugger: Loaded module libsystem_info.dylib at 0x7fff205ac000
Debugger: Loaded module libsystem_m.dylib at 0x7fff2a67c000
Debugger: Loaded module libsystem_malloc.dylib at 0x7fff20386000
Debugger: Loaded module libsystem_networkextension.dylib at 0x7fff24d55000
Debugger: Loaded module libsystem_notify.dylib at 0x7fff22dc0000
Debugger: Loaded module libsystem_product_info_filter.dylib at 0x7fff2ffc7000
Debugger: Loaded module libsystem_sandbox.dylib at 0x7fff291c7000
Debugger: Loaded module libsystem_secinit.dylib at 0x7fff2a71c000
Debugger: Loaded module libsystem_kernel.dylib at 0x7fff2052a000
Debugger: Loaded module libsystem_platform.dylib at 0x7fff205a2000
Debugger: Loaded module libsystem_pthread.dylib at 0x7fff2055a000
Debugger: Loaded module libsystem_symptoms.dylib at 0x7fff2649d000
Debugger: Loaded module libsystem_trace.dylib at 0x7fff202d0000
Debugger: Loaded module libunwind.dylib at 0x7fff2a6f3000
Debugger: Loaded module libxpc.dylib at 0x7fff2029a000
Debugger: Loaded module libobjc.A.dylib at 0x7fff203f8000
Debugger: Loaded module liboah.dylib at 0x7fff2a6fe000
[1] 6966 abort ./fuzzer -in in -out out -t 1000 -delivery shmem -instrument_module test tes
Hmm, that's really strange. According to your original post, TinyInst crashes in Debugger::OnDyldImageNotifier
, but that function appears to be working normally (at least in most of the cases), otherwise we wouldn't see all those "Loaded module" notifications.
Since I can't reproduce, could you add the following line at the start of Debugger::OnDyldImageNotifier
:
printf("OnDyldImageNotifier %zd %lu %p\n", mode, infoCount, machHeaders);
re-run and post the output?
OnDyldImageNotifier 0 43 0x7ffee4575970
./fuzzer -in in -out out -t 1000 -delivery shmem -instrument_module test -target_module test -target_method __Z4fuzzPc -nargs 1 -iterations 10000 -persist -loop -cmp_coverage -trace_debug_events -- ./test -m @@
Fuzzer version 0.01
1 input files read
Running input sample in/seed-0
Debugger: Mach exception (5) @ address 0x11366d000
Debugger: Process created or attached
Debugger: Loaded module /usr/lib/dyld at 0x11366c000
OnDyldImageNotifier 0 43 0x7ffee4575970
Debugger: Loaded module test at 0x10b688000
Debugger: Loaded module libc++.1.dylib at 0x7fff204be000
Debugger: Loaded module libSystem.B.dylib at 0x7fff2a731000
Debugger: Loaded module libc++abi.dylib at 0x7fff20514000
Debugger: Loaded module libcache.dylib at 0x7fff2a72b000
Debugger: Loaded module libcommonCrypto.dylib at 0x7fff2a6e7000
Debugger: Loaded module libcompiler_rt.dylib at 0x7fff2a711000
Debugger: Loaded module libcopyfile.dylib at 0x7fff2a706000
Debugger: Loaded module libcorecrypto.dylib at 0x7fff202e8000
Debugger: Loaded module libdispatch.dylib at 0x7fff203b3000
Debugger: Loaded module libdyld.dylib at 0x7fff20566000
Debugger: Loaded module libkeymgr.dylib at 0x7fff2a722000
Debugger: Loaded module liblaunch.dylib at 0x7fff2db38000
Debugger: Loaded module libmacho.dylib at 0x7fff2a6c5000
Debugger: Loaded module libquarantine.dylib at 0x7fff29ebd000
Debugger: Loaded module libremovefile.dylib at 0x7fff2a71f000
Debugger: Loaded module libsystem_asl.dylib at 0x7fff24dc2000
Debugger: Loaded module libsystem_blocks.dylib at 0x7fff20298000
Debugger: Loaded module libsystem_c.dylib at 0x7fff20435000
Debugger: Loaded module libsystem_collections.dylib at 0x7fff2a719000
Debugger: Loaded module libsystem_configuration.dylib at 0x7fff291c3000
Debugger: Loaded module libsystem_containermanager.dylib at 0x7fff284ab000
Debugger: Loaded module libsystem_coreservices.dylib at 0x7fff2a468000
Debugger: Loaded module libsystem_darwin.dylib at 0x7fff229a1000
Debugger: Loaded module libsystem_dnssd.dylib at 0x7fff2a723000
Debugger: Loaded module libsystem_featureflags.dylib at 0x7fff20432000
Debugger: Loaded module libsystem_info.dylib at 0x7fff205ac000
Debugger: Loaded module libsystem_m.dylib at 0x7fff2a67c000
Debugger: Loaded module libsystem_malloc.dylib at 0x7fff20386000
Debugger: Loaded module libsystem_networkextension.dylib at 0x7fff24d55000
Debugger: Loaded module libsystem_notify.dylib at 0x7fff22dc0000
Debugger: Loaded module libsystem_product_info_filter.dylib at 0x7fff2ffc7000
Debugger: Loaded module libsystem_sandbox.dylib at 0x7fff291c7000
Debugger: Loaded module libsystem_secinit.dylib at 0x7fff2a71c000
Debugger: Loaded module libsystem_kernel.dylib at 0x7fff2052a000
Debugger: Loaded module libsystem_platform.dylib at 0x7fff205a2000
Debugger: Loaded module libsystem_pthread.dylib at 0x7fff2055a000
Debugger: Loaded module libsystem_symptoms.dylib at 0x7fff2649d000
Debugger: Loaded module libsystem_trace.dylib at 0x7fff202d0000
Debugger: Loaded module libunwind.dylib at 0x7fff2a6f3000
Debugger: Loaded module libxpc.dylib at 0x7fff2029a000
Debugger: Loaded module libobjc.A.dylib at 0x7fff203f8000
Debugger: Loaded module liboah.dylib at 0x7fff2a6fe000
[1] 7814 abort ./fuzzer -in in -out out -t 1000 -delivery shmem -instrument_module test tes
Yep, that's the same output that I'm getting, the arguments seem to be correct, the function appears to be working correctly all the way to the end (it processes all 43 modules), so no idea why it would crash.
Could you maybe create a Debug build of Jackalope/TinyInst and run it from Xcode? Perhaps it will be able to tell us something new?
The result is very strange. Whether I run the fuzzer directly, or set its scheme to be rooted and run with those parameters, or set a breakpoint at main, I will enter the dyld error.
Thread 1: EXC_BAD_ACCESS (code=2, address=0x7fff239c0879
So it doesn't even reach main then? If so, this behavior is likely unrelated to the OnDyldImageNotifier issue (or, if they are related, it seems unrelated to the TinyInst code).
What version of Xcode are you running?
Did you manage to resolve the issues? My suspicion is that updating Xcode and rebuilding the project will resolve them.
Yes!
What version of Xcode are you running?
Xcode 11.3.1
After updating Xcode(12.5), TinyInst started to work normally whether it was compiled with Xcode or command-line. Could the above problems be caused by BigSur's minor adjustments to MachO?
Therefore, the fuzzer compiled by Catalina cannot be used normally after upgrading to BigSur, and the fuzzer cannot be used after recompiling the fuzzer by Xcode in Catalina. Only after upgrading to BigSur's Xcode, the fuzzer compiled by clang can run normally.
Awesome! Yes, looks like the declarations/size of some dyld-related structures changed between Catalina and Big Sur, so it requires a rebuild with up-to-date headers.
Whether I use
Jackalope
or callinstrumentation->Run(argc, argv, 1000)
by myself, the same abort signal error will be generatedAt the same time, it was found that the started process produced a crash report: