gaasedelen / lighthouse

A Coverage Explorer for Reverse Engineers
MIT License
2.23k stars 308 forks source link

Coverage pin tool doesn't work on macOS Big Sur #91

Closed xwlin-roy closed 8 months ago

xwlin-roy commented 3 years ago

Hi,

I'm using the pin plugin to collect coverage in macOS big sur. In the big sur, apple aggregates all the system binaries into dyld_shared_cache. And I use the pin plugin to collect /bin/ls, it reported error:

$ ~/xxx/lighthouse/coverage/pin/pin-3.17-98314-g0c048d619-clang-mac/pin -t obj-intel64/CodeCoverage.dylib -- /bin/ls                  CodeCoverage tool by Agustin Gianni (agustingianni@gmail.com)
Logging code coverage information to: trace.log
Loaded image: 0x10a487000:0x10a496fff -> ls
Loaded image: 0x116ffb000:0x117112fff -> dyld
A: Source/pin/pin_m/image_macho.cpp: GetLoadOffset: 99: Failed to open /usr/lib/libutil.dylib: No such file or directory
################################################################################
## STACK TRACE
################################################################################
ZN10LEVEL_BASE12MESSAGE_TYPE15MessageNoReturnERKSsb11PIN_ERRTYPEiz+0x00000006c at /xxx/lighthouse/coverage/pin/obj-intel64/CodeCoverage.dylib+0x00001055c

ZN15LEVEL_PINCLIENTL13GetLoadOffsetEPKcy+0x00000023e at /xxx/lighthouse/coverage/pin/obj-intel64/CodeCoverage.dylib+0x0000f40ee

ZN15LEVEL_PINCLIENTL20ParseAddedImagesInfoEjPK15dyld_image_infoPSt3mapIyNS_13ImageLoadArgsESt4lessIyESaISt4pairIKyS4_EEE+0x0000005c6 at /xxx/lighthouse/coverage/pin/obj-intel64/CodeCoverage.dylib+0x0000f7a86

ZN15LEVEL_PINCLIENTL21ScanLibrariesUnlockedEjjPK15dyld_image_info+0x00000027a at /xxx/lighthouse/coverage/pin/obj-intel64/CodeCoverage.dylib+0x0000f560a

ZN15LEVEL_PINCLIENTL13OnLoaderBreakEjjPK15dyld_image_info+0x0000000dc at /xxx/lighthouse/coverage/pin/obj-intel64/CodeCoverage.dylib+0x0000f41cc

Pin: pin-3.17-98314-0c048d619
Copyright 2002-2020 Intel Corporation.

Pin child/app terminated abnormally due to signal 6.

I'm not sure it's Intel Pin's issue or the plugin's issue. The Intel Pin version is: 3.17, and the lighthouse version is the latest.

DrWhax commented 3 years ago

It might be worth trying to build from the develop branch, have you tried?

DrWhax commented 3 years ago

Other thing is, seems those dylib's moved into big sur's shared cache: https://developer.apple.com/forums/thread/655588

Might have to wait till Intel pushes an update to Pin to work with that..

xwlin-roy commented 3 years ago

Other thing is, seems those dylib's moved into big sur's shared cache: https://developer.apple.com/forums/thread/655588

Might have to wait till Intel pushes an update to Pin to work with that..

yeap, I have said in my issue that it should be the dyld_shared_cache issue.

In the big sur, apple aggregates all the system binaries into dyld_shared_cache.

gaasedelen commented 3 years ago

Just looping back. It looks like Big Sur is still unsupported by Intel Pin, so there's still nothing really actionable on this side.

https://groups.io/g/pinheads/topic/big_sur/82069168?p=,,,20,0,0,0::recentpostdate%2Fsticky,,,20,2,0,82069168

I'll leave this issue open for now, just so people are aware.

gaasedelen commented 8 months ago

Closing, since Pin 3.20 (kit 98437) was released summer 2021 adding support for Big Sur.