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 recognizes GCC 7.2.0 binaries as GCC 4.6.3 #39

Closed
firmianay opened this issue Dec 15, 2017 · 3 comments
Closed

RetDec recognizes GCC 7.2.0 binaries as GCC 4.6.3 #39

firmianay opened this issue Dec 15, 2017 · 3 comments

Comments

@firmianay
Copy link

firmianay commented Dec 15, 2017

hi, I want to know if retdec on github and on online server have the different version. On my Arch Linux pc, gcc version is 7.2.0. And then, I try to decompile a binary.

This is the result from REST API:

// Detected compiler/packer: gcc (7.2.0)

and the result from my local build:

// Detected compiler/packer: gcc (4.6.3)

its wrong.

btw, the project is amazing!

@mbandzi
Copy link
Contributor

mbandzi commented Dec 15, 2017

Hello,

I believe REST API uses some older stable version of RetDec so this is a possible regression as detections are currently under development. Could you please upload mentioned binary?

@mbandzi mbandzi self-assigned this Dec 15, 2017
@mbandzi mbandzi added the bug label Dec 15, 2017
@s3rvac s3rvac changed the title wrong compiler detected RetDec recognizes GCC 7.2.0 binaries as GCC 4.6.3 Dec 15, 2017
@s3rvac
Copy link
Member

s3rvac commented Dec 15, 2017

@mbandzi We looked into this today for a bit with @metthal. There seems to be a regression with compiler detection. Consider the following file (32b ELF compiled with GCC 7.2.0 on Arch Linux): hello-gcc-7.2.0.elf:

$ fileinfo -s hello-gcc-7.2.0.elf
[..]
Detected tool : GCC (4.6.3) RHEL (compiler), 27 from 49 significant nibbles (55.102%)
Detected tool : GCC (7.2.0) (compiler), .comment section heuristic

When decompiled, the JSON config hello-gcc-7.2.0.c.json contains

"tools" : [
   {
      "additional" : "RHEL",
      "heuristics" : false,
      "identicalSignificantNibbles" : 27,
      [..]
      "version" : "4.6.3"
   },
   {
      "heuristics" : true,
      [..]
      "version" : "7.2.0"
   }
],

When generating the // Detected compiler/packer: comment, our back-end (llvmir2hll) chooses the first item from this list, so the compilers should be ordered by their priority.

We believe that there is a problem with the ordering of the detected compilers by their priority. In this case, the heuristic should probably have a greater priority than a signature having only 27/49 significant nibbles.

@mbandzi
Copy link
Contributor

mbandzi commented Dec 19, 2017

fixed in master, thanks for the report

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