Giter Club home page Giter Club logo

bap-load's Introduction

This repo demos a problem I'm having with saved projects and call graph node names. The labels on nodes appear to be wrong some of the time when loading a project. I'm using BAP 1.4.0 (the latest version in opam).

To observe this, I've created a simple plugin called "shownames". To install it, just run make. It's invoked with both a binary and a saved project from some other binary, as in:

$ bap --pass=shownames --shownames-prog1=foo0.bpj foo1

This dumps the symbol tables from foo1 and foo0, and it dumps the names of every node in the call graph of both programs. Although the symbol tables both look correct, the names for the nodes in the call graph of the loaded project are wrong. I've included the output for the above example at the bottom of this file. Note the strange names under the "Saved project node labels" heading.

The examples subdirectory includes a small C program compile with GCC at three different optimization levels for experimentation. It also includes saved BAP project files for each binary (which I created with a different plugin).

The problem occurs whenever shownames is run with a saved project file and a different binary. The weird names are always given for the project loaded from the project file, never the binary. If you use the project file and the binary it was loaded from, the problem goes away. That is, this invocation prints correct names:

$ bap --pass=shownames --shownames-prog1=foo1.bpj foo1

Weird output

Saved project symbols:
    __libc_csu_fini  [0x4006F0]
    __libc_csu_init  [0x400680]
    __libc_start_main  [0x400480]
    _init  [0x400438]
    _start  [0x4004C0]
    atoi  [0x400490]
    exit  [0x4004A0]
    fact  [0x4005B6]
    main  [0x4005FB]
    mymin  [0x4005DF]
    printf  [0x400470]
    sub_4004b0  [0x4004B0]
    sub_4005aa  [0x4005AA]

New project symbols:
    __libc_csu_fini  [0x4006E0]
    __libc_csu_init  [0x400670]
    __libc_start_main  [0x400490]
    __printf_chk  [0x4004B0]
    _init  [0x400460]
    _start  [0x4004E0]
    exit  [0x4004C0]
    fact  [0x4005D6]
    main  [0x4005F6]
    mymin  [0x4005EE]
    strtol  [0x4004A0]
    sub_4004d0  [0x4004D0]
    sub_4005ca  [0x4005CA]
    sub_4005dd  [0x4005DD]


Saved project node labels:
  @__libc_csu_init
  @__libc_start_main
  %000000ac
  %000000fa
  @_start
  @exit
  %0000013c
  %00000192
  %000001b0
  %000001b3
  %000001b6

New project node labels:
  @__libc_csu_init
  @__libc_start_main
  @__printf_chk
  @_init
  @_start
  @exit
  @fact
  @main
  @strtol
  @sub_4004d0
  @sub_4005dd

bap-load's People

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.