Skip to content
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

Port to llvm9? #8

Closed
JunfengJia opened this issue Nov 5, 2019 · 5 comments
Closed

Port to llvm9? #8

JunfengJia opened this issue Nov 5, 2019 · 5 comments

Comments

@JunfengJia
Copy link

No description provided.

@amimo
Copy link
Owner

amimo commented Nov 5, 2019

@JunfengJia try the llvm-9.0.0 branch.

@JunfengJia
Copy link
Author

looks good.

@JunfengJia
Copy link
Author

Crashed with simple hello world:

/home/jack/src/packer/goron/build/bin/clang main.c -mllvm -irobf-cff

clang-9: /home/jack/src/packer/goron/llvm/include/llvm/PassAnalysisSupport.h:221: AnalysisType& llvm::Pass::getAnalysis() const [with AnalysisType = llvm::LazyValueInfoWrapperPass]: Assertion `Resolver && "Pass has not been inserted into a PassManager object!"' failed.
Stack dump:
0. Program arguments: /home/jack/src/packer/goron/build/bin/clang-9 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name main.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -resource-dir /home/jack/src/packer/goron/build/lib/clang/9.0.0 -internal-isystem /usr/local/include -internal-isystem /home/jack/src/packer/goron/build/lib/clang/9.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /home/jack/test/obf -ferror-limit 19 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -mllvm -irobf-cff -faddrsig -o /tmp/main-e41ac0.o -x c main.c

  1. parser at end of file
  2. Per-module optimization passes
  3. Running pass 'Obfuscation Pass Manager' on module 'main.c'.
    #0 0x000055b53fb67a5a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/jack/src/packer/goron/build/bin/clang-9+0x2ca1a5a)
    GTSDK 包含个推sdk编译时报错 #1 0x000055b53fb65704 llvm::sys::RunSignalHandlers() (/home/jack/src/packer/goron/build/bin/clang-9+0x2c9f704)
    能否考虑加上一些随机的因素,每次生成的跳转都不一样 #2 0x000055b53fb65842 SignalHandler(int) (/home/jack/src/packer/goron/build/bin/clang-9+0x2c9f842)
    string encrypt pass是否有计划 #3 0x00007f26545a2890 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
    add simple c string encryption pass #4 0x00007f2653253e97 raise /build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
    不能编译Bitcode的bc文件 #5 0x00007f2653255801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
    update readme #6 0x00007f265324539a __assert_fail_base /build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
    ObjC字符串加密支持 #7 0x00007f2653245412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
    Port to llvm9? #8 0x000055b53fc34dd4 (anonymous namespace)::LowerSwitch::runOnFunction(llvm::Function&) (/home/jack/src/packer/goron/build/bin/clang-9+0x2d6edd4)
    Function annotation not supported? #9 0x000055b540965930 (anonymous namespace)::Flattening::flatten(llvm::Function*) (.isra.83) (/home/jack/src/packer/goron/build/bin/clang-9+0x3a9f930)
    fix cff pass crash on llvm-9 #10 0x000055b540966e74 (anonymous namespace)::Flattening::runOnFunction(llvm::Function&) (/home/jack/src/packer/goron/build/bin/clang-9+0x3aa0e74)
    结构体或字符数组中的字符串访问是否可以统一 #11 0x000055b540956b4c llvm::ObfuscationPassManager::runOnModule(llvm::Module&) (/home/jack/src/packer/goron/build/bin/clang-9+0x3a90b4c)
    how to protect target running at aarch64(arm64)? #12 0x000055b53f57a631 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/jack/src/packer/goron/build/bin/clang-9+0x26b4631)
    arm64e #13 0x000055b53fd7f8af clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_deletellvm::raw_pwrite_stream >) (/home/jack/src/packer/goron/build/bin/clang-9+0x2eb98af)
    混淆是在ir做的,理论上所有后端都支持. #14 0x000055b5407e23fd clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/jack/src/packer/goron/build/bin/clang-9+0x391c3fd)
    如何编译windows能用的goron? #15 0x000055b5410f85f9 clang::ParseAST(clang::Sema&, bool, bool) (/home/jack/src/packer/goron/build/bin/clang-9+0x42325f9)
    不兼容32位设备? #16 0x000055b5407dfa68 clang::CodeGenAction::ExecuteAction() (/home/jack/src/packer/goron/build/bin/clang-9+0x3919a68)
    Support for LLVM 10.0 #17 0x000055b54024a0c9 clang::FrontendAction::Execute() (/home/jack/src/packer/goron/build/bin/clang-9+0x33840c9)
    有没有支持xcode的工具链啊 #18 0x000055b54020e261 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/jack/src/packer/goron/build/bin/clang-9+0x3348261)
    一个函数属性问题 #19 0x000055b5402f517f clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/jack/src/packer/goron/build/bin/clang-9+0x342f17f)
    LLVM源 #20 0x000055b53de876ff cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/jack/src/packer/goron/build/bin/clang-9+0xfc16ff)
    CMake Error on macOS Catalina #21 0x000055b53ddfb979 main (/home/jack/src/packer/goron/build/bin/clang-9+0xf35979)
    混淆特性选项 #22 0x00007f2653236b97 __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
    如何控制while循环的层数 #23 0x000055b53de82cca _start (/home/jack/src/packer/goron/build/bin/clang-9+0xfbccca)
    clang-9: error: unable to execute command: Aborted (core dumped)
    clang-9: error: clang frontend command failed due to signal (use -v to see invocation)
    clang version 9.0.0 (https://github.com/amimo/goron.git 2391b63)
    Target: x86_64-unknown-linux-gnu
    Thread model: posix
    InstalledDir: /home/jack/src/packer/goron/build/bin
    clang-9: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
    clang-9: note: diagnostic msg:

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-9: note: diagnostic msg: /tmp/main-e59e26.c
clang-9: note: diagnostic msg: /tmp/main-e59e26.sh
clang-9: note: diagnostic msg:

@JunfengJia JunfengJia reopened this Nov 5, 2019
@amimo
Copy link
Owner

amimo commented Nov 6, 2019

fix in llvm-9.0.0-fix-cff-crash

@JunfengJia
Copy link
Author

It works now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants