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

Unsupported value type with mcsema bitcode #220

Open
Heath123 opened this issue Feb 6, 2022 · 4 comments
Open

Unsupported value type with mcsema bitcode #220

Heath123 opened this issue Feb 6, 2022 · 4 comments

Comments

@Heath123
Copy link

Heath123 commented Feb 6, 2022

Trying to decompile the code for xz from the walkthrough:

F0206 08:52:46.518694 132263 IRToASTVisitor.cpp:379] Unsupported value type: @data_1ff0d023 = internal alias i8, getelementptr inbounds (<{ %seg_1ff00000_LOAD_2af8_type, [1288 x i8], %seg_1ff03000__init_1b_type, [923 x i8], %seg_1ff0d000__rodata_32f0_type, [5184 x i8], %seg_1ff13190__init_array_10_type }>, <{ %seg_1ff00000_LOAD_2af8_type, [1288 x i8], %seg_1ff03000__init_1b_type, [923 x i8], %seg_1ff0d000__rodata_32f0_type, [5184 x i8], %seg_1ff13190__init_array_10_type }>* @__mcsema_all_segments, i32 0, i32 4, i32 0, i32 35)
*** Check failure stack trace: ***
    @     0x5635a51727fc  google::LogMessageFatal::~LogMessageFatal()
    @     0x5635a4fffbf9  rellic::IRToASTVisitor::GetOrCreateDecl()
    @     0x5635a4ffefbb  rellic::IRToASTVisitor::GetOperandExpr()
    @     0x5635a5002393  rellic::IRToASTVisitor::CreateLiteralExpr()
    @     0x5635a4ffec00  rellic::IRToASTVisitor::GetOrCreateStmt()
    @     0x5635a4ffef75  rellic::IRToASTVisitor::GetOperandExpr()
    @     0x5635a5002393  rellic::IRToASTVisitor::CreateLiteralExpr()
    @     0x5635a4ffec00  rellic::IRToASTVisitor::GetOrCreateStmt()
    @     0x5635a4ffef75  rellic::IRToASTVisitor::GetOperandExpr()
    @     0x5635a4fff940  rellic::IRToASTVisitor::VisitGlobalVar()
    @     0x5635a4ff9f92  rellic::GenerateAST::runOnModule()
    @     0x5635a6b81cf9  llvm::legacy::PassManagerImpl::run()
    @     0x5635a4f3a6c2  main
    @     0x7ff593771b25  __libc_start_main
    @     0x5635a4f54bea  _start
    @              (nil)  (unknown)
fish: Job 1, '/home/heath/rellic-test/usr/loc…' terminated by signal SIGABRT (Abort)

Happens at
https://github.com/lifting-bits/rellic/blob/master/lib/AST/IRToASTVisitor.cpp#L379

@Heath123
Copy link
Author

Heath123 commented Feb 6, 2022

Executable + bitcode:
files.zip

@pgoodman
Copy link
Collaborator

pgoodman commented Feb 7, 2022

Hrmm, this is a result of GlobalAliases. @frabert to handle these we'd probably need to lift the aliasee instead of the alias itself. We could probably lift to local variables accordingly initialized to retain the alias name. Then they wouldn't turn into global variables.

@Heath123
Copy link
Author

Heath123 commented Feb 7, 2022

Is Rellic designed to generate readable C code from mcsema output? At first I thought t would but mcsema bitcode doesn't seem to work like normal bitcode as it uses the State thing

@pgoodman
Copy link
Collaborator

pgoodman commented Feb 7, 2022

@Heath123 Rellic is designed more for anvill-produced bitcode or Clang-produced bitcode. McSerma-produced bitcode makes heavy use of global aliases for human readability of the bitcode, but those aliases can be disabled with --disable_aliases.

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