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

retdec-llvmir2hll crashes in the SimpleCopyPropagationOptimizer phase #144

Open
decidedlygray opened this issue Feb 1, 2018 · 4 comments

Comments

@decidedlygray
Copy link

Hello,

I'm trying to decompile a rather larger (3.5MB) ELF x86 binary and I am seeing a crash during the optimizations phase of decompilation. I'm hoping you might have some pointers on how to prevent this crash, or a way to work around it (maybe ignore/skip optimizations somehow).

Issue Description

What command am I running?

A pretty vanilla command:

./retdec-decompiler.sh -o /home/user/mybinary.ext /home/user/mybinary

The binary is stripped but not packed.

What am I seeing?

The process makes it through this decompile step:

##### Decompiling /home/user/mybinary into /home/user/mybinary.ext.backend.bc....

Then fails during:

##### Decompiling /home/user/mybinary.ext.backend.bc into /home/user/mybinary.ext

What error message am I seeing?

After making it through several phases of the second Decompiling step, it fails with the following information:

 -> converting function_82f85c0() ( 138.19s )
 -> converting _fini() ( 138.19s )
 -> converting function_82f8600() ( 138.19s )
Running phase: removing functions prefixed with [__decompiler_undefined_function_] ( 138.35s )
Running phase: removing functions from standard libraries ( 149.06s )
 -> removing tolower() ( 149.06s )
Running phase: removing code that is not reachable in a CFG ( 149.06s )
Warning: [NonRecursiveCFGBuilder] there is no node for an edge to `v3_82e3b47 = *(IntToPtrCastExpr<ptr>((v0_82e3b47 + 4)))` -> skipping this edge
Warning: [NonRecursiveCFGBuilder] there is no node for an edge to `v3_82e4507 = *(IntToPtrCastExpr<ptr>((v0_82e4507 + 4)))` -> skipping this edge
Running phase: signed/unsigned types fixing ( 153.00s )
Running phase: converting LLVM intrinsic functions to standard functions ( 166.99s )
Running phase: obtaining debug information ( 169.24s )
Running phase: alias analysis [simple] ( 169.41s )
Running phase: optimizations [normal] ( 171.17s )
 -> running RemoveUselessCastsOptimizer ( 171.17s )
 -> running UnusedGlobalVarOptimizer ( 172.46s )
 -> running DeadLocalAssignOptimizer ( 174.33s )
 -> running SimpleCopyPropagationOptimizer ( 224.00s )
Warning: [NonRecursiveCFGBuilder] there is no node for an edge to `v3_82e3b47 = *(IntToPtrCastExpr<ptr>((v0_82e3b47 + 4)))` -> skipping this edge
Warning: [NonRecursiveCFGBuilder] there is no node for an edge to `v3_82e4507 = *(IntToPtrCastExpr<ptr>((v0_82e4507 + 4)))` -> skipping this edge
./retdec-decompiler.sh: line 940: 25960 Killed                  "$LLVMIR2HLL" "${LLVMIR2HLL_PARAMS[@]}"
Error: Decompilation of file '/home/user/mybinary.ext.backend.bc' failed

So something is going wrong around here... https://github.com/avast-tl/retdec/blob/master/scripts/retdec-decompiler.sh#L945

What is interesting is the "Killed" message. Is something getting forcefully killed because it is taking too long maybe?

My System Information

retdec Version

I successfully cloned and built the project yesterday 1/31/2018

OS Info

x86_64 Ubuntu 16.04.3 (xenial)

@silverbacknet
Copy link

silverbacknet commented Feb 2, 2018

This strongly points to #16 & #13, did you track memory usage while it was running?

@decidedlygray
Copy link
Author

Aha! Yes it does. This is likely a duplicate. I thought I had searched deep enough through the issues, but I didn’t see those.

My crash is occurring at he same point #13 mentions. I will try the flags mentioned in the comments of that issue to disable optimizations while tracking memory usage and see what happens.

@s3rvac
Copy link
Member

s3rvac commented Feb 2, 2018

Thank you for the report. Would you be able to share with us the input binary file? Otherwise, I am afraid there is not much we can do about it, other than pointing you towards #13.

@s3rvac s3rvac changed the title retdec-llvmir2hll Crash on optimizations phase retdec-llvmir2hll crashes in the SimpleCopyPropagationOptimizer phase Feb 2, 2018
@decidedlygray
Copy link
Author

Absolutely. It's a publicly available binary so there are no issues there - https://mega.nz/#!p3BCFCCL!J9R9nL-jzKY-HJvSO477WrWBfnl6BXQ_hC2D-WIw88A

Thanks for following up

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

3 participants