Comments (17)
The list of generally available LLVM passes is here https://www.llvm.org/docs/Passes.html
I can't really answer for if Remill can do something about this -- that's best asked in Remill's repository
from rellic.
Upgrading to LLVM16 might fix the printing issue, so I think we should wait until that is done before proceeding with a longterm fix
from rellic.
I'm going to need more details to help. Can you share the module that's causing issues?
I'm guessing that in this case Rellic tried to create a 128 bit wide integer, but AFAIK C doesn't provide such a type
from rellic.
i tried a function :
FF0301D1E00F00F9E10B00F9E20700F9E00F40F9E01F00F9E00B40F9E01B00F9E00740F91F1C00F109070054E11F40F9E01B40F9200000AA000840921F0000F141060054E01F40F9E01700F9E01B40F9E01300F910000014E01740F9010040F9E01340F9000040F93F0000EBC1010054E01740F900200091E01700F9E01340F900200091E01300F9E00740F9002000D1E00700F9E00740F91F1C00F1E8FDFF54020000141F2003D5E01740F9E01F00F9E01340F9E01B00F914000014E01F40F901004039E01B40F9000040393F00006B00010054E01F40F900004039E103002AE01B40F9000040392000004B0D000014E01F40F900040091E01F00F9E01B40F900040091E01B00F9E00740F9010400D1E10700F91F0000F121FDFF5400008052FF030191C0035FD6
from rellic.
Is that a hex encoded LLVM module? Could you translate it into textual format and share it?
llvm-dis -o output.ll input.bc
from rellic.
this aarch64 hex bytes
remill-lift-14 -arch aarch64 --ir_out ./func1.ir --bytes FF0301D1E00F00F9E10B00F9E20700F9E00F40F9E01F00F9E00B40F9E01B00F9E00740F91F1C00F109070054E11F40F9E01B40F9200000AA000840921F0000F141060054E01F40F9E01700F9E01B40F9E01300F910000014E01740F9010040F9E01340F9000040F93F0000EBC1010054E01740F900200091E01700F9E01340F900200091E01300F9E00740F9002000D1E00700F9E00740F91F1C00F1E8FDFF54020000141F2003D5E01740F9E01F00F9E01340F9E01B00F914000014E01F40F901004039E01B40F9000040393F00006B00010054E01F40F900004039E103002AE01B40F9000040392000004B0D000014E01F40F900040091E01F00F9E01B40F900040091E01B00F9E00740F9010400D1E10700F91F0000F121FDFF5400008052FF030191C0035FD6
from rellic.
user@user-virtual-machine:~/magnifier$ remill-lift-14 -arch aarch64 --ir_out ./func1.ir --bytes FF0301D1E00F00F9E10B00F9E20700F9E00F40F9E01F00F9E00B40F9E01B00F9E00740F91F1C00F109070054E11F40F9E01B40F9200000AA000840921F0000F141060054E01F40F9E01700F9E01B40F9E01300F910000014E01740F9010040F9E01340F9000040F93F0000EBC1010054E01740F900200091E01700F9E01340F900200091E01300F9E00740F9002000D1E00700F9E00740F91F1C00F1E8FDFF54020000141F2003D5E01740F9E01F00F9E01340F9E01B00F914000014E01F40F901004039E01B40F9000040393F00006B00010054E01F40F900004039E103002AE01B40F9000040392000004B0D000014E01F40F900040091E01F00F9E01B40F900040091E01B00F9E00740F9010400D1E10700F91F0000F121FDFF5400008052FF030191C0035FD6
user@user-virtual-machine:~/magnifier$ remill-lift-14 -arch aarch64 --bc_out ./func1.bc --bytes FF0301D1E00F00F9E10B00F9E20700F9E00F40F9E01F00F9E00B40F9E01B00F9E00740F91F1C00F109070054E11F40F9E01B40F9200000AA000840921F0000F141060054E01F40F9E01700F9E01B40F9E01300F910000014E01740F9010040F9E01340F9000040F93F0000EBC1010054E01740F900200091E01700F9E01340F900200091E01300F9E00740F9002000D1E00700F9E00740F91F1C00F1E8FDFF54020000141F2003D5E01740F9E01F00F9E01340F9E01B00F914000014E01F40F901004039E01B40F9000040393F00006B00010054E01F40F900004039E103002AE01B40F9000040392000004B0D000014E01F40F900040091E01F00F9E01B40F900040091E01B00F9E00740F9010400D1E10700F91F0000F121FDFF5400008052FF030191C0035FD6
user@user-virtual-machine:~/magnifier$ rellic-decomp --input func1.bc --output func.c
F20230510 19:42:37.049466 17869 ASTBuilder.cpp:158] Check failed: val.getBitWidth() == ctx.getIntWidth(type) (128 vs. 64)
*** Check failure stack trace: ***
@ 0x5dd39c google::LogMessageFatal::~LogMessageFatal()
@ 0x5c3501 rellic::ASTBuilder::CreateIntLit()
@ 0x5c3557 rellic::ASTBuilder::CreateAdjustedIntLit()
@ 0x4c60f0 rellic::ASTBuilder::CreateAdjustedIntLit()
@ 0x4be532 rellic::ExprGen::CreateLiteralExpr()
@ 0x4bec55 rellic::ExprGen::CreateOperandExpr()
@ 0x4c1beb rellic::ExprGen::visitBinaryOperator()
@ 0x4c378d rellic::StmtGen::visitInstruction()
@ 0x4c3d1b rellic::IRToASTVisitor::VisitBasicBlock()
@ 0x4afe60 rellic::GenerateAST::CreateRegionStmts()
@ 0x4b0f07 rellic::GenerateAST::StructureCyclicRegion()
@ 0x4b33d7 rellic::GenerateAST::StructureRegion()
@ 0x4b4cbc std::_Function_handler<>::_M_invoke()
@ 0x4b4ca8 std::_Function_handler<>::_M_invoke()
@ 0x4b4ca8 std::_Function_handler<>::_M_invoke()
@ 0x4b383a rellic::GenerateAST::run()
@ 0x4bbf4d llvm::detail::PassModel<>::run()
@ 0x2ef5c91 llvm::PassManager<>::run()
@ 0x4b4832 rellic::GenerateAST::run()
@ 0x436014 rellic::Decompile()
@ 0x42b243 main
@ 0x7ffbd8429d90 (unknown)
@ 0x7ffbd8429e40 __libc_start_main
@ 0x42a77e _start
@ (nil) (unknown)
Aborted (core dumped)
from rellic.
Could you provide the result of remill-lift-14
, i.e. func1.ir
? Thanks!
from rellic.
sure here
func1.txt
from rellic.
Pretty much as I suspected. While I can fix Rellic to produce a wide enough type, it's not standard C and Clang doesn't know how to print it, so it'll need a bit more work.
In the meantime, as a workaround, I can suggest finding or writing an LLVM pass that would turn 128bit-wide values and operations into two 64bits ops. Not sure if something like this already exists, but it's pretty likely.
from rellic.
where i can find one if you can point to somewhere?
from rellic.
is there a way to do it through remill?
from rellic.
Do you know if it's representable as 64 bits? One possibility could be a 64-bit literal, upcasted to a 128-bit type.
from rellic.
Just tried it, some of the values have more significant bits than available in a long long
from rellic.
Next question: are those significant bits all 1
:-P Worst case, you could decompose into two 64-bit literals, then upcast, and merge into the final literal via a shift and bitwise or.
from rellic.
That seems to work, I have a branch with that fix in it: #323
from rellic.
Related Issues (20)
- Using substitution maps for provenance tracking loses info HOT 2
- Could `NestedCondProp` also propagate `while` conditions?
- Move invalid store handling to an LLVM pass
- memcpy intrinsic tests failing on ARM64 with LLVM-13 HOT 3
- Remove 'compat' code
- Invalid operand in IRToASTVisitor.cpp:264 HOT 2
- Globals should be sorted using a topological ordering HOT 1
- Ideas for refinement pass improvements / new refinement passes HOT 1
- Probable bug in `LoopRefine` HOT 4
- Inline asm is treated as extern functions and discarded
- Investigate reworking CBR and RBR to match Dream
- Anvill to Rellic does not compile HOT 1
- Improve README
- Canonicalization pass
- Use new user-extension points to inject debug info
- Scheduled CI runs are failing
- Rellic produces semantically non-equivalent code HOT 1
- Assertion `NewParamInfo.size() == getNumParams() && "Parameter count mismatch!"` failed. HOT 3
- "Exception terminator 'invoke' is not supported yet" HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rellic.