-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
obfuscator-llvm 3.5 crashes when building a specific m file #14
Comments
Hi, I can't reproduce your problem... I assume, seeing your backtrace, that you are trying to compile a program for IOS? I tried to compile a IOS application within Xcode with Obfuscator and It worked fine. Can you give me more information please? Cheers |
I wrote a demo to find out the procedure to reproduce the problem. The demo contains a m file with a bunch of functions like this: char* getCurrentDeviceNameBridge() The compiler is set to "Obfuscator 3.5", which was installed by following the offical OLLVM install instruction. Also i add some flags to the "Other C Flags" section in build setting: "-mllvm, "-sub", "-mllvm", "-bcf", "-mllvm", "-fla", "-miphoneos-version-min=6.0" The demo's building process crashed sometimes, with the same kind of backtrace i provided yesterday. But everything works fine when i switch the compiler back to Obfuscator 3.4. |
I can provide the files follows or the Demo Project if necessary: clang-3.5: note: diagnostic msg: /var/folders/18/xxx/T/CrashedCode-871862.m |
By removing code function by function, i've found the function caused the crash: @interface DummyLocker : NSObject
@end
@implementation DummyLocker
@end
int functionA(signed long long v) {
@synchronized([DummyLocker class]){
//do someting
return 1;
}
return 0;
}
signed long long functionB(signed long long v){
//do something
return v;
}
signed long long functionC(signed long long v){
@synchronized([DummyLocker class]){
return functionB(v);
}
} If i remove the codes above or replace @synchronied with NSLock, the crash doesn't reproduce anymore. Hope this helps :) |
Thx for details... Unfortunately I won't be able to check that until next friday. |
Other than modifying my code, both adding "attribute((__annotate(("nobcf"))))" flag and removing "-bcf" can make the crash disappear. Hope this helps :) |
Working on it... I'll probably have a fix by monday! |
Sorry, I didn't had the time to work properly on it... A fix will come soon! |
Just pushed some changes... Can you try to update your local repo and tell me if it works? I created a new IOS project in Xcode, pasted you code in the main.m file and added a simple loop with a NSLog inside where you put the "// Do something" comments. I tried the code, with all flags and once with only bcf (both time with -mllvm -bogus-cf=100, means every basic block is obfuscated) and everything went fine (compil+exec). Thx for your feedback |
os: OS X 10.10.1 (14B17)
Xcode:5.1.1
bfuscator-llvm version: commit 3bc5428, branch llvm_3.5
BackTrace:
0 clang-3.5 0x0000000104809bd8 llvm::sys::PrintStackTrace(sFILE) + 40
1 clang-3.5 0x000000010480a0b4 SignalHandler(int) + 452
2 libsystem_platform.dylib 0x00007fff8d861f1a sigtramp + 26
3 libsystem_platform.dylib 0x00007faa0854a2a0 sigtramp + 2060354464
4 clang-3.5 0x0000000104556c2f llvm::FPPassManager::doInitialization(llvm::Module&) + 63
5 clang-3.5 0x0000000104556fa0 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 736
6 clang-3.5 0x0000000104be743e clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module, clang::BackendAction, llvm::raw_ostream) + 6318
7 clang-3.5 0x0000000104cfdbfb clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 523
8 clang-3.5 0x0000000104fd86f4 clang::ParseAST(clang::Sema&, bool, bool) + 468
9 clang-3.5 0x0000000104cfc677 clang::CodeGenAction::ExecuteAction() + 87
10 clang-3.5 0x00000001049e773e clang::FrontendAction::Execute() + 62
11 clang-3.5 0x00000001049bb5c3 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 867
12 clang-3.5 0x0000000104a1d0f2 clang::ExecuteCompilerInvocation(clang::CompilerInstance) + 4354
13 clang-3.5 0x0000000103c91abc cc1_main(char const**, char const**, char const_, void_) + 1036
14 clang-3.5 0x0000000103c8e7b8 main + 1128
15 libdyld.dylib 0x00007fff927ac5c9 start + 1
Stack dump:
0. Program arguments: /Users/SomeUser/llvm_obfuscator/build/bin/clang-3.5 -cc1 -triple thumbv7s-apple-ios4.3.0 -emit-obj -disable-free -disable-llvm-verifier -main-file-name SomeFile.m -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -target-cpu swift -target-feature +soft-float-abi -target-abi apcs-gnu -mfloat-abi soft -dwarf-column-info -coverage-file /Users/SomeUser/Documents/SomeSDK/target/ios/sdk/Build/Intermediates/SomeSDK.build/Release-iphoneos/SomeSDK.build/Objects-normal/armv7s/SomeFile.o -resource-dir /Users/SomeUser/llvm_obfuscator/build/bin/../lib/clang/3.5.0 -isysroot /Applications/Xcode-5.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -iquote /Users/SomeUser/Documents/SomeSDK/target/ios/sdk/Build/Intermediates/SomeSDK.build/Release-iphoneos/SomeSDK.build/SomeSDK-generated-files.hmap -iquote /Users/SomeUser/Documents/SomeSDK/target/ios/sdk/Build/Intermediates/SomeSDK.build/Release-iphoneos/SomeSDK.build/SomeSDK-project-headers.hmap -include-pch /Users/SomeUser/Documents/SomeSDK/target/ios/sdk/Build/Intermediates/PrecompiledHeaders/SomeSDK-Prefix-cjjuroblszylmgbipghgksrtnqty/SomeSDK-Prefix.pch.pch -I /Users/SomeUser/Documents/SomeSDK/target/ios/sdk/Build/Intermediates/SomeSDK.build/Release-iphoneos/SomeSDK.build/SomeSDK-own-target-headers.hmap -I /Users/SomeUser/Documents/SomeSDK/target/ios/sdk/Build/Intermediates/SomeSDK.build/Release-iphoneos/SomeSDK.build/SomeSDK-all-target-headers.hmap -I /Users/SomeUser/Documents/SomeSDK/target/ios/sdk/Build/Products/Release-iphoneos/include -I /Applications/Xcode-5.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I /Users/SomeUser/Documents/SomeSDK/target/ios/sdk/Build/Intermediates/SomeSDK.build/Release-iphoneos/SomeSDK.build/DerivedSources/armv7s -I /Users/SomeUser/Documents/SomeSDK/target/ios/sdk/Build/Intermediates/SomeSDK.build/Release-iphoneos/SomeSDK.build/DerivedSources -F/Users/SomeUser/Documents/SomeSDK/target/ios/sdk/Build/Products/Release-iphoneos -Os -Wno-trigraphs -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-implicit-atomic-properties -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wno-bool-conversion -Wenum-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -Wprotocol -Wdeprecated-declarations -Wno-sign-conversion -std=gnu99 -fdebug-compilation-dir /Users/SomeUser/Documents/SomeSDK/source/SDK/iOS/SomeSDK -ferror-limit 19 -fmacro-backtrace-limit 0 -fmessage-length 0 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=ios-4.3.0 -fencode-extended-block-signature -fobjc-exceptions -fexceptions -fsjlj-exceptions -fpascal-strings -fdiagnostics-show-option -fdiagnostics-show-note-include-stack -vectorize-loops -vectorize-slp -mllvm -sub -mllvm -bcf -mllvm -fla -o /Users/SomeUser/Documents/SomeSDK/target/ios/sdk/Build/Intermediates/SomeSDK.build/Release-iphoneos/SomeSDK.build/Objects-normal/armv7s/SomeFile.o -x objective-c /Users/SomeUser/Documents/SomeSDK/source/Adapter/iOS/CMethodBridge/SomeFile.m
clang-3.5: error: unable to execute command: Segmentation fault: 11
clang-3.5: error: clang frontend command failed due to signal (use -v to see invocation)
Obfuscator- clang version 3.5.0 (tags/RELEASE_350/final) (based on LLVM 3.5.0svn)
Target: arm-apple-darwin14.0.0
Thread model: posix
Description: obfucator-llvm crashes every time when building SomeFile.m. C and OC code are mixed it SomFile.m.
The text was updated successfully, but these errors were encountered: