retdec | retargetable machine-code decompiler | Compiler library
kandi X-RAY | retdec Summary
kandi X-RAY | retdec Summary
RetDec is a retargetable machine-code decompiler based on LLVM.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of retdec
retdec Key Features
retdec Examples and Code Snippets
Community Discussions
Trending Discussions on retdec
QUESTION
I'm trying to call cmake and redirect the output to a pipe.
To reproduce:
git clone https://github.com/avast/retdec
(It seems to be every CMake-Project, gradle projects don't work, too)mkdir build&&cd build
- Add a file
test.hs
:
ANSWER
Answered 2021-Dec-28 at 14:11The buffer size of pipes isn't unlimited. You're creating a deadlock, where the child process is hanging because it's trying to write to a buffer that's full, and your parent process doesn't try to read anything from the buffer until the child process has completed. To fix the problem, you need to use another thread to read from the buffer while the child process is still running. The simplest way to do this is to use readProcess
or a similar function in place of createProcess
. If this doesn't give you enough flexibility to do what you want, then you'll need to create and manage the other thread yourself, which you can see how to do by looking at how readProcess
is implemented.
QUESTION
I'm studying the binary instrumentation techniques and I found many papers claim that binary instrumentation is necessary when the source code is not available.
While maybe we cannot get the original source code, a semantical equivalent one from the decompiler is possible (like RetDec), which, in my mind, is sufficient for many tasks previously done by binary instrumentation, e.g., software fault isolation. Sometimes we even don't have to decompile the binary to the source code -- LLVM IR is enough for many code instrumentation and analysis. And the performance might be even better since we still have the optimizations in the middle end afterwards.
My guess is that (1) the decompiler cannot recover the code well enough for most binary instrumentation task, or (2) the decompiler can only decode a small portion of binary, or (3) it takes long long time for decompiler to recover a big library but binary instrumentation only takes a short time.
Is one of my guesses correct? What is the fact here?
EDIT: Among many binary instrumentation tasks, my focus is mainly on the memory address isolation, which is usually done by masking the address or setting a guard zone in the assembly. Just curious why not adding some checking code in the LLVM IR level if we can decompile the binary to such representation.
...ANSWER
Answered 2020-May-21 at 02:56Basically, the problem is that decompilers are "incomplete" in that they can't handle all possible binaries. Then too, with both decompilers and binary instrumentation, there's the problem of determining what in the binary is code and what is data -- it's generally undecidable and you just want to instrument the code, not alter the data.
With binary instrumentation, you can more readily deal with this incrementally, only instrumenting what you know to be code, with "instrumentation" where execution might leave the known code to interrupt and instrument more (or when what was thought to be code is accessed as data, "undo" the instrumentation for the access).
As with everything, there are performance tradeoffs -- the most extreme instrumentation is using an emulator to execute the code while extracting information, but the cost of that is high. Partial instrumentation by inserting breakpoints or inserting code has much lower cost, but is less complete. Decompiling and recompiling may allow for lower runtime cost but higher up-front cost.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install retdec
Download and unpack a pre-built stable or bleeding-edge package and follow instructions in the Use section of its retdec/share/retdec/README.md file after unpacking.
Build RetDec by yourself from sources by following the Build and Installation section. After installation, follow instructions below.
This section describes a local build and installation of RetDec. Instructions for Docker are given in the next section.
Docker support is maintained by community. If something does not work for you or if you have suggestions for improvements, open an issue or PR.
Building in Docker does not require installation of the required libraries locally. This is a good option for trying out RetDec without setting up the whole build toolchain. To build the RetDec Docker image, run. This builds the image from the master branch of this repository.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page