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

Decompilation fails with "Could not acquire a cryptographic context" #676

Closed
trsh opened this issue Nov 6, 2019 · 10 comments
Closed

Decompilation fails with "Could not acquire a cryptographic context" #676

trsh opened this issue Nov 6, 2019 · 10 comments

Comments

@trsh
Copy link

trsh commented Nov 6, 2019

Running phase: Input binary to LLVM IR decoding ( 2.36s )
LLVM ERROR: Could not acquire a cryptographic context: Not enough memory resources are available to process this command. (0x8)
Error: Decompilation to LLVM IR failed

Sorry, another issue here

@s3rvac
Copy link
Member

s3rvac commented Nov 6, 2019

Have you taken a look at #73, #387, and #565? There are already three issues dealing with the problem you have reported.

@s3rvac s3rvac changed the title Could not acquire a cryptographic context Decompilation fails with "Could not acquire a cryptographic context" Nov 6, 2019
@trsh
Copy link
Author

trsh commented Nov 6, 2019

Im on win 64b with 8gb ram. Im using 64b version of this tool with --no-memory-limit and it still fails :(

Running phase: Initialization ( 0.01s )
Running phase: LLVM ( 0.01s )
Running phase: Providers initialization ( 0.01s )
Running phase: Input binary to LLVM IR decoding ( 2.38s )
Error: Decompilation to LLVM IR failed

@s3rvac
Copy link
Member

s3rvac commented Nov 6, 2019

Does the same error happen when decompiling different input files, or just for some of them? Would it be possible to share the input file with us so we can try to reproduce the issue?

@trsh
Copy link
Author

trsh commented Nov 6, 2019

Sharing the exe would violate legit stuff :(

@trsh
Copy link
Author

trsh commented Nov 6, 2019

I tried it with GIMP executable

Running phase: Initialization ( 0.00s )
Running phase: LLVM ( 0.01s )
Running phase: Providers initialization ( 0.01s )
Running phase: Input binary to LLVM IR decoding ( 0.95s )
Running phase: LLVM ( 21.62s )
Running phase: x87 fpu register analysis ( 22.71s )
Running phase: Main function identification optimization ( 22.96s )
Running phase: Libgcc idioms optimization ( 22.97s )
Running phase: LLVM instruction optimization ( 22.97s )
Running phase: Conditional branch optimization ( 23.40s )
Error: Decompilation to LLVM IR failed

process went further but also died

@SuperKael
Copy link

SuperKael commented Nov 6, 2019

I have what seems to be the same problem. After adding --no-memory-limit, it ran for over 2500(!) seconds, and multiple times during the process peaked its memory usage at a whopping 9.5 GB! The file being decompiled is under 18 MB... it used more than 500 times the memory of the size of the file itself! Something is obviously very wrong here. To be clear, it still finally failed, which coincided with many of my applications simultaneously crashing, probably due to my 32 GB pagefile finally getting full...

Running phase: Initialization ( 0.04s )
Running phase: LLVM ( 0.11s )
Running phase: Providers initialization ( 0.14s )
Running phase: Input binary to LLVM IR decoding ( 6.72s )
Running phase: LLVM ( 495.28s )
Running phase: x87 fpu register analysis ( 505.31s )
Running phase: Main function identification optimization ( 507.75s )
Running phase: Libgcc idioms optimization ( 507.93s )
Running phase: LLVM instruction optimization ( 507.93s )
Running phase: Conditional branch optimization ( 511.07s )
Running phase: Syscalls optimization ( 619.31s )
Running phase: Stack optimization ( 619.33s )
Running phase: Constants optimization ( 763.51s )
Running phase: Function parameters and returns optimization ( 2018.13s )
Running phase: Register localization optimization ( 2351.13s )
Running phase: LLVM instruction optimization ( 2578.77s )
Running phase: Simple types recovery optimization ( 2588.90s )
Error: Decompilation to LLVM IR failed

@silverbacknet
Copy link

That sounds fairly normal. Memory usage goes up exponentially with increasing executable size, not linearly. Just a few megabytes does need many gigabytes to reconstruct the complete program logic, as you've seen, though you can bypass individual stages that fail in exchange for worse output. If you can pick out the parts that matter, you can get much faster results that won't up and die like this.

@trsh
Copy link
Author

trsh commented Nov 6, 2019

How long can the process take? I'm in "Input binary to LLVM IR decoding" for 3 hrs. Task manager shows changing huge ram usage.

@s3rvac
Copy link
Member

s3rvac commented Nov 7, 2019

High memory and processing-time requirements are one of the issues that we constantly face and which need to be improved. As a rule of thumb, if a decompilation runs more than e.g. 30 minutes, the results probably won't be useful. In such cases, it is suggested to perform selective decompilation (decompile only the given functions via --select-functions or address ranges via --select-ranges) or use our IDA plugin with IDA 7.0 (beware that the plugin does not work with the freeware version though), which also performs selective decompilation.

As for the Could not acquire a cryptographic context errors, in general, I believe they are caused by insufficient memory in the system.

@s3rvac
Copy link
Member

s3rvac commented Dec 22, 2019

I am closing the issue as I do not believe there is anything else to be added here. If you wish to re-open, please share with us one of the executable files that you are unable to decompile so we can investigate. However, please bare with mind the above-mentioned comment of mine.

@s3rvac s3rvac closed this as completed Dec 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants