GithubHelp home page GithubHelp logo

galoisinc / reopt Goto Github PK

View Code? Open in Web Editor NEW
297.0 25.0 26.0 17.67 MB

A tool for analyzing x86-64 binaries.

License: BSD 3-Clause "New" or "Revised" License

Shell 0.89% Haskell 36.04% Makefile 0.38% LLVM 48.21% C 2.15% Assembly 7.62% Python 0.57% C++ 0.01% Dockerfile 0.19% HTML 0.01% TypeScript 3.90% CSS 0.03%

reopt's Introduction

reopt

Reopt is a general purpose decompilation and recompilation tool for repurposing application logic. It does this by analyzing machine code to recover a more flexible program representation -- specifically the LLVM assembly language. Once in this format, one can then apply optimization tools to optimize the LLVM, recompile the application into optimized or security hardened object code, and use Reopt to merge the recompiled code back into the original executable.

Reopt supports Linux x86_64 programs. We are working towards a full 1.0 release, but the current pre-release version supports the end-to-end recompilation toolchain.

Getting Reopt

Although Reopt can build on other POSIX systems such as OSX, we recommend building Reopt to run on Linux. Reopt currently only supports Elf binaries which are the default binary format for Linux. It does not support OSX Macho binaries, and so it is easier to find applications to try Reopt on when running Linux.

Gitpod

For most people, the easiest way to try out Reopt is to try it out on Gitpod. This requires an account on Gitpod, but gives you access to a VSCode IDE connected to a Linux container with Reopt pre-installed.

Github Releases

If you have Linux installed, you can download one of our recent releases from the Releases page. We build releases as static binaries on Centos 7, so they should work on a variety of distributions.

Docker

If you have Docker installed, you can install and run the Reopt pre-release Docker image by running:

docker pull galoisbinaryanalysis/reopt
docker run --rm -it galoisbinaryanalysis/reopt

Building from source

Building Reopt requires that one has installed the GHC Haskell compiler and supporting tooling. We currently build on GHC 8.10.4. An easy way to get GHC is to install ghcup, and run ghcup install ghc-8.10.4. We also maintain a Docker image that has GHC and other dependencies preinstalled for building Reopt.

Once GHC is installed, the following steps may be useful for building Reopt:

git clone https://github.com/GaloisInc/reopt.git

cd reopt
# Fix submodule URLs (can skip if you have a Github account)
sed -i 's/[email protected]:/https:\/\/github.com\//' .gitmodules
git submodule update --init
# Build Reopt
cabal install exe:reopt
# Build Reopt Explore
cabal install exe:reopt-explore

Reopt and Reopt Explore will be installed at $HOME/.cabal/bin/reopt $HOME/.cabal/bin/reopt-explore.

Reopt's verification condition generator (reopt-vcg) is included in the aforementioned Github release and Docker image, however the source is currently maintained in a separate repository with it's own build instructions and requirements.

Using Reopt

Once reopt is installed on a Linux system and included in your path, you can try running it on system utilities such as ls. To do an end-to-end recompilation, you can run reopt with the command.

$ reopt -o ls.exe $(which ls)

This execution will use the version of ls in your system path and produce an executable ls.exe in the current directory. When running reopt will print out messages as it discovers functions within the application and attempts to convert each discovered function into LLVM.

Inspecting intermediate state

During recompilation, Reopt has to do a complex series of analysis steps to lift the machine code into LLVM. Each of these analysis steps is incomplete and may fail either due to Reopt not recognizing features in the binary or an error in our prerelease version of Reopt. As such, do not be alarmed when Reopt fails to translate functions.

If you'd like to inspect Reopt's intermediate state, there are several command line flags to export intermediate results. We describe the main flags for exporting intermediate state below. Additional options can be viewed by running reopt --help.

  • Disassembly. reopt --disassemble <binary> provides a raw disassembler output view of the code in the binary. This is similiar to objdump's disassembly output.

  • Control flow graph construction. reopt --cfg <binary> displays the low level control flow graphs that Reopt has constructed for each discovered function within the binary. This is a low-level IR that maintains machine code's explicit stack and register references, but lifts the machine code instructions into a more architectural neutral register transfer language.

  • Function Recovery reopt --export-fns <path> <binary> writes the functions that Reopt has generated after performing stack and function argument analysis. This is a higher-level IR in which explicit references to the stack have been replaced with allocations, and functions take arguments.

  • LLVM Generation reopt --export-llvm <path> <binary> generates LLVM from the binary. This is essentially a version of function recovery rendered in LLVM's format. Providing the --annotations <ann_file> flag during LLVM generation will cause reopt to additionally emit JSON in <ann_file> describing verification conditions which (if valid) demonstrate functional equivalence between the generated LLVM and machine code. Running reopt-vcg <ann_file> will simulate the executation of the LLVM and machine code, block-by-block, leveraging an SMT solver (cvc4) to verify as many of the conditions as possible.

  • Object Files reopt --export-object <path> <binary> generates an object file from the LLVM generated in the previous state. This is essentially the same as generating the LLVM, and then running the LLVM compiler toolchain with the selected options.

Function arguments

One common reason Reopt fails is because it cannot figure out the arguments that a function can take. We have four mechanisms for obtaining function arguments: (1) User provided hints; (2) a small builtin database; (3) debug information; and (4) a demand analysis that looks at what registers are used to infer arguments. These mechanisms are listed in priority order, although we note that the builtin database is currently the only mechanism for supporting functions that take a variable number of arguments like printf.

If you'd like to provide hints to Reopt, the recommended way is write a C header file with the arguments, such as:

// decls.h


typedef long ssize_t;
typedef unsigned long size_t;

ssize_t read(int fd, void* buf, size_t count);
ssize_t write(int fd, const void* buf, size_t count);

You can then use this file to tell Reopt about the expected types for read and write via the --header flag, e.g.,

reopt -o ls.exe --header decls.h $(which ls)

Using OCCAM for additional optimizations

reopt can leverage the OCCAM whole-program partial evaluator for LLVM bitcode to further optimize binaries (assuming a user has already installed and made available both OCCAM and its accompanying interface slash).

This feature can be enabled by passing the --occam-config=FILE option to reopt, where FILE is the reopt/OCCAM manifest. The manifest should essentially a valid OCCAM manifest file (i.e., a file with JSON entries) with the following (optional) additional field:

  • slash_options: a list of command line option flags for OCCAM's slash tool,

and excluding the following fields (reopt will populate these appropriately):

  • binary
  • name

The main field should specify the desired name of the bitcode file that will be generated for OCCAM to process, and the OCCAM optimized result will share the name with an added .occam suffix.

N.B., when passing flags to customize OCCAM/slash behavior, be aware that reopt passes the -c and -emit-llvm flags via the ldflags manifest entry so OCCAM skips recompiling and acts only as an LLVM to LLVM translator.

Using Reopt Explore

With reopt-explore installed we can gather statistics regarding reopt's ability to recover functions in an individual or collection of binaries.

To examine a single binary, simply call reopt-explore with the a path to the binary:

$ reopt-explore llvm $(which ls)
...
/usr/bin/ls
  Initialization:
    Code segment: 112,004 bytes
    Initial entry points: 234
    Warnings: 0
  Discovery:
    Bytes discovered: 59,502 (53%)
    Succeeded: 216 (92%)
    Failed: 18 (8%)
      Unhandled instruction: 1 (0%)
      Unidentified control flow: 17 (7%)
  Argument Analysis:
    Succeeded: 123 (57%)
    Failed: 93 (43%)
    Header Warnings: 0
    DWARF Warnings: 0
    Code Warnings: 112
  Invariant Inference:
    Succeeded: 92 (75%)
    Failed: 31 (25%)
      Indirect call target: 1 (1%)
      Unresolved call target arguments: 30 (24%)
  Recovery:
    Succeeded: 81 (88%)
    Failed: 11 (12%)
      Unsupported function value: 8 (9%)
      Unimplemented LLVM backend feature: 3 (3%)
  LLVM generation status: Succeeded.

To recursively search a directory for binaries and examine each, call reopt-explore with the path to the directory to search:

$ reopt-explore llvm /usr/bin
...
reopt analyzed 394 binaries:
Generated LLVM bitcode for 394 out of 394 binaries.
Initialization:
  Code segment: 42,933,178 bytes
  Initial entry points: 79776
  Warnings: 0
Discovery:
  Bytes discovered: 23,025,164 (54%)
  Succeeded: 64,494 (81%)
  Failed: 15,500 (19%)
    Unhandled instruction: 425 (1%)
    Unidentified control flow: 15,075 (19%)
Argument Analysis:
  Succeeded: 40,429 (63%)
  Failed: 24,065 (37%)
  Header Warnings: 0
  DWARF Warnings: 0
  Code Warnings: 38,681
Invariant Inference:
  Succeeded: 30,221 (75%)
  Failed: 10,208 (25%)
    Symbolic call stack height: 1 (0%)
    Unresolved stack read: 13 (0%)
    Indirect call target: 526 (1%)
    Call target not function entry point: 41 (0%)
    Unresolved call target arguments: 9,614 (24%)
    Could not resolve varargs args: 13 (0%)
Recovery:
  Succeeded: 21,952 (73%)
  Failed: 8,269 (27%)
    Unsupported function value: 2,425 (8%)
    Unimplemented feature: 6 (0%)
    Unimplemented LLVM backend feature: 4,762 (16%)
    Stack offset escape: 83 (0%)
    Stack read overlapping offset: 1 (0%)
    Unresolved return value: 8 (0%)
    Missing variable value: 984 (3%)

Improving recovery with debug information

reopt and reopt-explore will try to determine if any debug information is available for dynamic dependencies by querying gdb (if it is installed).

Users can also manually specify dependency and debug directories to search in manually for both reopt and reopt-explore via the following flags:

--lib-dir=PATH              Additional location to search for dynamic
                            dependencies.
--debug-dir=PATH            Additional location to search for dynamic
                            dependencies' debug info.

Contributing

The project has been contributed to by many authors over many years without much coordination on code style and library usage. For our currently-maintained sub-projects, we favor the following, without enforcing them aggressively (i.e. you may still find instances where those are not used):

  • We use the fourmolu code formatter, informed by the fourmolu.yaml present in the root directory.

  • We are trying to move to optparse-applicative for CLI argument parsing (though there remain some instances of cmdargs for executables we are not actively maintaining).

  • We use prettyprinter for pretty-printing.

  • We tend to use labeled generic lenses for accessing complex data types in read/write. We still have a mixed use of named- and symbol-based lens operators.

  • We do not yet have a very nice logging story. Currently, the code outputs to stdout/stderr as it deems necessary, but we ought to use a more principled logging discipline.

reopt's People

Contributors

benjaminselfridge avatar dagit avatar dependabot[bot] avatar ericson2314 avatar joehendrix avatar mhuesch avatar ntc2 avatar ptival avatar ryanglscott avatar simonjwinwood avatar smagill avatar thebendavis avatar travitch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reopt's Issues

Reopt Testing

We should do more automated regression testing on Reopt.

Bug: not respecting function return type

e.g. in x86_64.ubuntu20.dnsmasq.clang.O0.nopie.nostrip/x86_64.ubuntu20.dnsmasq.clang.O0.nopie.nostrip.elf:

The function is defined as:

define i64 @cache_get_name({ <52 x i8>, i32, { }* }* %arg0) {

Yet, in the final block we infer a pointer type for the return value:

block_0_403d83:
  ; r22
  %t29 = phi { }* [ %t11, %block_0_403d3d ], [ %t25, %block_0_403d61 ], [ %t28, %block_0_403d72 ]
  ret { }* %t29

These are incompatible.

Remove fnSize

The datatype Function in Reopt.CFG.FnRep includes a fnSize parameter which makes the assumption that functions occupy a contiguous region of memory. This field should be eliminated, and the use of it in Relinking should be replaced with a function that correctly figures out how many bytes can be rewritten without affecting other code locations.

Fix bss support

From reading the kernel loader code, it appears that an Elf file can only contain a single BSS section, and it must be at the end of the segment with the highest virtual file address offset. If any other segments contains contain bss regions, they will be silently dropped by the kernel.

Fix exec_fst

The implementation of exec_fst in Reopt.Semantics.Semantics does not have a mechanism for dealing with floating point exceptions. In particular, it ignore stack underflow and always assigns the rounding direction.

Error while building reopt

Build errors:

Failed to build reopt-0.1.0.
Build log (
/home/lifter/.cabal/logs/ghc-8.6.3/reopt-0.1.0-4c93af2623a0806b496051257d405d45c4692164fbb8e447b413bab21182ef14.log
):
Configuring library for reopt-0.1.0..
Preprocessing library for reopt-0.1.0..
Building library for reopt-0.1.0..
[ 1 of 18] Compiling Reopt.Analysis.Domains.DiffEquations ( src/Reopt/Analysis/Domains/DiffEquations.hs, dist/build/Reopt/Analysis/Domains/DiffEquations.o )
[ 2 of 18] Compiling Reopt.CFG.FnRep  ( src/Reopt/CFG/FnRep.hs, dist/build/Reopt/CFG/FnRep.o )
[ 3 of 18] Compiling Reopt.CFG.FnRep.X86 ( src/Reopt/CFG/FnRep/X86.hs, dist/build/Reopt/CFG/FnRep/X86.o )
[ 4 of 18] Compiling Reopt.CFG.FunctionCheck ( src/Reopt/CFG/FunctionCheck.hs, dist/build/Reopt/CFG/FunctionCheck.o )
[ 5 of 18] Compiling Reopt.CFG.LLVM   ( src/Reopt/CFG/LLVM.hs, dist/build/Reopt/CFG/LLVM.o )

src/Reopt/CFG/LLVM.hs:493:29: error:
    Ambiguous occurrence โ€˜withArchConstraintsโ€™
    It could refer to either โ€˜Data.Macaw.X86.withArchConstraintsโ€™,
                             imported from โ€˜Data.Macaw.X86โ€™ at src/Reopt/CFG/LLVM.hs:91:1-31
                             (and originally defined in โ€˜Data.Macaw.Architecture.Infoโ€™)
                          or โ€˜Reopt.CFG.LLVM.withArchConstraintsโ€™,
                             defined at src/Reopt/CFG/LLVM.hs:393:5
    |
493 | valueToLLVM ctx avmap val = withArchConstraints ctx $ do
    |                             ^^^^^^^^^^^^^^^^^^^

src/Reopt/CFG/LLVM.hs:684:5: error:
    Not in scope: data constructor โ€˜MkTupleโ€™
    |
684 |     MkTuple fieldTypes fields -> do
    |     ^^^^^^^

src/Reopt/CFG/LLVM.hs:802:17: error:
    Ambiguous occurrence โ€˜archEndiannessโ€™
    It could refer to either โ€˜Data.Macaw.X86.archEndiannessโ€™,
                             imported from โ€˜Data.Macaw.X86โ€™ at src/Reopt/CFG/LLVM.hs:91:1-31
                             (and originally defined in โ€˜Data.Macaw.Architecture.Infoโ€™)
                          or โ€˜Reopt.CFG.LLVM.archEndiannessโ€™,
                             defined at src/Reopt/CFG/LLVM.hs:355:5
    |
802 |   req <- asks $ archEndianness . archFns
    |                 ^^^^^^^^^^^^^^

src/Reopt/CFG/LLVM.hs:878:3: error:
    Ambiguous occurrence โ€˜withArchConstraintsโ€™
    It could refer to either โ€˜Data.Macaw.X86.withArchConstraintsโ€™,
                             imported from โ€˜Data.Macaw.X86โ€™ at src/Reopt/CFG/LLVM.hs:91:1-31
                             (and originally defined in โ€˜Data.Macaw.Architecture.Infoโ€™)
                          or โ€˜Reopt.CFG.LLVM.withArchConstraintsโ€™,
                             defined at src/Reopt/CFG/LLVM.hs:393:5
    |
878 |   withArchConstraints ctx m
    |   ^^^^^^^^^^^^^^^^^^^

src/Reopt/CFG/LLVM.hs:1253:30: error:
    Ambiguous occurrence โ€˜withArchConstraintsโ€™
    It could refer to either โ€˜Data.Macaw.X86.withArchConstraintsโ€™,
                             imported from โ€˜Data.Macaw.X86โ€™ at src/Reopt/CFG/LLVM.hs:91:1-31
                             (and originally defined in โ€˜Data.Macaw.Architecture.Infoโ€™)
                          or โ€˜Reopt.CFG.LLVM.withArchConstraintsโ€™,
                             defined at src/Reopt/CFG/LLVM.hs:393:5
     |
1253 |                            , withArchConstraints = \x -> x
     |                              ^^^^^^^^^^^^^^^^^^^
cabal: Failed to build reopt-0.1.0 (which is required by exe:reopt from
reopt-0.1.0 and exe:reopt-relink from reopt-0.1.0). See the build log above
for details.

GHC version:

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.8.3
$ cabal --version
cabal-install version 3.2.0.0
compiled using version 3.2.0.0 of the Cabal library

Support for MXCSR

We need to add support for the SSE MXCSR register. This will enable support for conversion operations such as cvtss2si.

Build with GHC 7.10

reopt currently does not build with GHC 7.10. For compatibiity with other projects this would be useful.

undefined reference to `reopt_*'

reopt --export-llvm ls.ll /bin/ls
llvm-as-8 -o ls.bc ls.ll
clang -o ls ls.bc
warning: overriding the module target triple with x86_64-pc-linux-gnu [-Woverride-module]            
1 warning generated.                                                                                 
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/crt1.o: in function `_start': 
(.text+0x24): undefined reference to `main'                                                          
/usr/bin/ld: /tmp/ls-4f5341.o: in function `reopt_1_0xf310':                                         
ls.ll:(.text+0x1488): undefined reference to `reopt_1_0xebd0'                                        
/usr/bin/ld: /tmp/ls-4f5341.o: in function `reopt_1_0x13390':                                        
ls.ll:(.text+0x1c40): undefined reference to `reopt_1_0x17340'                                       
/usr/bin/ld: /tmp/ls-4f5341.o: in function `reopt_1_0x14af0':                                        
ls.ll:(.text+0x1ec1): undefined reference to `reopt_1_0x14a00'                                       
/usr/bin/ld: /tmp/ls-4f5341.o: in function `reopt_1_0x14ba0':                                        
ls.ll:(.text+0x1ed2): undefined reference to `reopt_1_0x146c0'                                       
/usr/bin/ld: /tmp/ls-4f5341.o: in function `reopt_1_0x14bc0':                                        
ls.ll:(.text+0x1ee2): undefined reference to `reopt_1_0x146c0'                                       

`git submodule update --init` gives "fatal: Could not read from remote repository."

Hi!

Reopt looks like a really interesting project, and I'd love to get the chance to start using it and develop a further understanding of it's inner architecture and design.

I recently tried to build reopt on one of my new laptops, and then noticed an issue that is not obvious for already configured development laptops.

The way that the submodules (of dependencies) are currently setup in reopt requires you to use a Git SSH key, otherwise, you run into an error when running git submodule update --init.

In particular, for all the submodules (e.g. llvm-pretty-bc-parser, macaw, etc), running git submodule update --init gives the error "fatal: Could not read from remote repository. Please make sure you have correct access rights"

This is because all submodules are accessed using [email protected]:GaloisInc/foo.git instead of e.g. https://github.com/GaloisInc/foo.git.

While a very small issue, it does make it more difficult to get started with the project as a new user. Thus, I wanted to let you know, as this issue is not likely to turn up in the development environment of existing developers.

Cheers,
Robin

Support lifting printf format strings to LLVM constants

Currently, the first argument to printf is a 64-bit bitvector. It would be ideal if this was mapped to a string literal as in LLVM.

For reference, we include one example program below and it's corresponding LLVM output:

#include<stdio.h>

void foo() {
  printf("Hello World\n");
}

This compiles to:

 @.str = private unnamed_addr constant [13 x i8] c"Hello World\0A\00", align 1

; Function Attrs: noinline nounwind optnone uwtable
define dso_local void @foo() #0 {
  %1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
  ret void
}

Fix support/print_startup_info/reopt_print_startup_info.sh

The script support/print_startup_info/reopt_print_startup_info.sh fails during relinking with the output

User error
Expected data segment after code segment.

The error message should be cleaned up, and the example fixed. This is likely related to #25.

pre- vs post-reopt ABI

I get an Expected the new object to use the same OS ABI as original when running reopt on ELF64 binaries on MacOS.

Specifically, according to readelf, the input binary appears to have OS/ABI UNIX - GNU while the output object file has UNIX - System V.

Per an internal discussion at Galois, this check is likely unnecessary.

Support transformations on intermediate LLVM code (.ll)

Is there a possibility to make custom changes to the generated .ll code and continue with the producing final binary? Specifically, I'm interested in applying AFL instrumentation. I tried to compile/link produced .ll with clang and got linker errors.
I looked at the source code and it seems like the original binary is used to merge .ll into the final binary (.ll alone cannot be used to produce the final binary). Could you please clarify how does this work or maybe point me to some documentation?

Bug: types need to be quoted in CSV

We now generate types that contain commas, e.g. { i64, i64 }.

In the absence of quoting, these confuse the CSV output into thinking there are more columns.

git submodule out of date - macaw-base and flexdis - top level commit missing?

git submodules grabs macaw-base-0.0.1, but the cabal file requires macaw-base-0.0.2
I checked out master for all the submodules, more of the code builds, but
LoadOptions in Data.Macaw.Memory.LoadCommon has changed field names, it's no longer loadStyle, but now loadStyleOverride.

I suspect there's a commit missing from the top level repo.

Bug: negative offsets make it into LLVM types

Example in cat block block_0_402730:

  ; r0 := (0x60c288 : bv 64)
  ; r1 := (read r0 (bv 64))
  %t0 = load { <18446744073709551615 x i8>, i8 }*, { <18446744073709551615 x i8>, i8 }** 6341256

Error Building - Prebuilt docker images?

I am experiencing some build issues. I tried building the master branch and the jhx/new-relinker branch and am build in the Haskell:8.8.3 container. The version of cabal is 3.2.0.0 and ghc is 8.8.3. Would it be possible to make prebuilt docker images with reopt already compiled?

The use case I am researching is making llvm passes for after the binary has been lifted for adding buffer overflow checks and mitigations.

Build profile: -w ghc-8.8.3 -O1
In order, the following will be built (use -v for more details):
 - reopt-0.1.0 (lib) (requires build)
 - reopt-0.1.0 (exe:reopt) (requires build)
 - reopt-0.1.0 (exe:reopt-relink) (requires build)
Starting     reopt-0.1.0 (lib)
Building     reopt-0.1.0 (lib)

Failed to build reopt-0.1.0.
Build log (
/root/.cabal/logs/ghc-8.8.3/reopt-0.1.0-3e4a2d216537bdd33630dad51c3af2b33bfedea007fbc380e75e16e76ad84dee.log
):
Configuring library for reopt-0.1.0..
Preprocessing library for reopt-0.1.0..
Building library for reopt-0.1.0..
[ 1 of 18] Compiling Reopt.Analysis.Domains.DiffEquations ( src/Reopt/Analysis/Domains/DiffEquations.hs, dist/build/Reopt/Analysis/Domains/DiffEquations.o )
[ 2 of 18] Compiling Reopt.AnnotatedTypes ( src/Reopt/AnnotatedTypes.hs, dist/build/Reopt/AnnotatedTypes.o )
[ 3 of 18] Compiling Reopt.CFG.FnRep  ( src/Reopt/CFG/FnRep.hs, dist/build/Reopt/CFG/FnRep.o )

src/Reopt/CFG/FnRep.hs:263:25: error:
    * Couldn't match expected type `Doc'
                  with actual type `prettyprinter-1.7.0:Prettyprinter.Internal.Doc
                                      ann1'
      NB: `prettyprinter-1.7.0:Prettyprinter.Internal.Doc'
            is defined in `Prettyprinter.Internal'
                in package `prettyprinter-1.7.0'
          `Doc'
            is defined in `Text.PrettyPrint.ANSI.Leijen.Internal'
                in package `ansi-wl-pprint-0.6.9'
    * In the expression: sexpr "read" [pretty a, pretty tp]
      In a case alternative:
          FnReadMem a tp -> sexpr "read" [pretty a, pretty tp]
      In the expression:
        case rhs of
          FnSetUndefined w -> text "undef ::" <+> brackets (text (show w))
          FnReadMem a tp -> sexpr "read" [pretty a, pretty tp]
          FnCondReadMem _ c a d
            -> sexpr "cond_read" [pretty c, pretty a, ....]
          FnEvalApp a -> ppApp pretty a
          FnEvalArchFn f -> runIdentity (ppArchFn (pure . pretty) f)
    |
263 |       FnReadMem a tp -> sexpr "read" [ pretty a, pretty tp]
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Reopt/CFG/FnRep.hs:263:40: error:
    * Couldn't match expected type `prettyprinter-1.7.0:Prettyprinter.Internal.Doc
                                      ann1'
                  with actual type `Doc'
      NB: `Doc'
            is defined in `Text.PrettyPrint.ANSI.Leijen.Internal'
                in package `ansi-wl-pprint-0.6.9'
          `prettyprinter-1.7.0:Prettyprinter.Internal.Doc'
            is defined in `Prettyprinter.Internal'
                in package `prettyprinter-1.7.0'
    * In the expression: pretty a
      In the second argument of `sexpr', namely `[pretty a, pretty tp]'
      In the expression: sexpr "read" [pretty a, pretty tp]
    |
263 |       FnReadMem a tp -> sexpr "read" [ pretty a, pretty tp]
    |                                        ^^^^^^^^

src/Reopt/CFG/FnRep.hs:263:50: error:
    * Couldn't match expected type `prettyprinter-1.7.0:Prettyprinter.Internal.Doc
                                      ann1'
                  with actual type `Doc'
      NB: `Doc'
            is defined in `Text.PrettyPrint.ANSI.Leijen.Internal'
                in package `ansi-wl-pprint-0.6.9'
          `prettyprinter-1.7.0:Prettyprinter.Internal.Doc'
            is defined in `Prettyprinter.Internal'
                in package `prettyprinter-1.7.0'
    * In the expression: pretty tp
      In the second argument of `sexpr', namely `[pretty a, pretty tp]'
      In the expression: sexpr "read" [pretty a, pretty tp]
    |
263 |       FnReadMem a tp -> sexpr "read" [ pretty a, pretty tp]
    |                                                  ^^^^^^^^^

Consider adding a `HasConstraintProvenance` class

After implementing ConstraintProvenance in #248, @Ptival noted #248 (comment) that this results in lots of additional constraint arguments being passed around:

I think what might be nicer in the long run, to avoid all this explicit passing of provenance, would be to add a typeclass constraint HasConstraintProvenance ctx, s.t. more or less HasConstraintProvenance has one method Getter ctx ConstraintProvenance.

That way the bottom functions get to just grab the ambient provenance.

This issue tracks implementing this idea. I responded in #248 (comment) that we would need to think a bit about the design of such a type class:

That is an intriguing idea. I'm not sure if it would be applicable in all places that we pass around constraints, however. For instance, I'm not sure what constraint we'd use for SolverM, which doesn't have anything like CGenM's ctx type parameter.

Unused `what4` dependency

reopt depends on what4 as a submodule, but as far as I can tell, it does not actually use what4 for anything. If that is indeed the case, then we should consider removing the what4 submodule, as it will influence cabal's build plan logic.

Support lld generated executables

lld generates static executables with three segments, a read-only segment containing the elf headers and read-only data, a read-only and executable segment containing the code, and a read-write segment containing the modifiable data.

reopt currently does not support this layout in relinking, and it should be fixed.

Limitation: `void` in type signature confuses reopt

I had the following header:

uid_t getuid(void);

and reopt would fail to understand arguments for calls to getuid. Switching to:

uid_t getuid();

fixed it.

I assume it's because our header parser considers the initial signature as if it takes one argument.

Potential bug in `React.useEffect` call

Fairly sure the following:

React.useEffect(() => {
const handler = (e: MessageEvent) => {
return makeMessageListener({
setProjectName,
setSymbols,
})(e.data)
}
window.addEventListener('message', handler)
return () => {
window.removeEventListener('message', handler)
}
})

should have a [] as second argument to not repeat the effect on state change.

Should also check in the other component that listens to messages.

Support .rodata common expression elimination

When relinking, sections like .rodata.cst16 are copied from the source to the binary unchanged. We should parse symbol and relocation information to determine which parts are needed, and generate a single .rodata with only the required information.

The 'IsValue Expr' implementation of 'bvSlt' is wrong.

In 'Reopt.Semantics.Implementation' we have

  bvUlt x y
    | Just xv <- asBVLit x, Just yv <- asBVLit y = S.boolValue (xv < yv)
    | x == y = S.false
    | otherwise = app $ BVUnsignedLt x y

  bvSlt x y
    | Just xv <- asBVLit x, Just yv <- asBVLit y = S.boolValue (xv < yv)
    | x == y = S.false
    | otherwise = app $ BVUnsignedLt x y

The last line should use 'BVSignedLt', not 'BVUnsignedLt', and the logic in the first case probably needs to take sign bits into account.

Test relinker

We need to validate that the layout the relinker thinks it is generating the file for matches what is actually loaded by the kernel.

This includes the following information:

  • The segment base addresses, sizes, and permissions.
  • The auxiliary vector entries (see the x86_64 ABI documentation).
  • The initial program counter.

When we support dynamic binaries, we will have to extend this with additional features.

RepMovs and RepStos data constructors not in scope

Platform info:

pag@ubuntu:~/reopt$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.4.3
pag@ubuntu:~/reopt$ cabal --version
cabal-install version 1.24.0.2
compiled using version 1.24.2.0 of the Cabal library 
pag@ubuntu:~/reopt$ uname -a
Linux ubuntu 4.15.0-29-generic #31-Ubuntu SMP Tue Jul 17 15:39:52 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
pag@ubuntu:~/reopt$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"

Error:

[ 7 of 18] Compiling Reopt.CFG.LLVM.X86 ( src/Reopt/CFG/LLVM/X86.hs, /home/pag/reopt/dist-newstyle/build/reopt-0.1.0/build/Reopt/CFG/LLVM/X86.o )

src/Reopt/CFG/LLVM/X86.hs:224:5: error:
    Not in scope: data constructor โ€˜RepMovsโ€™
    |
224 |     RepMovs bytesPerCopy destExpr srcExpr cntExpr dirExpr -> do
    |     ^^^^^^^

src/Reopt/CFG/LLVM/X86.hs:245:5: error:
    Not in scope: data constructor โ€˜RepStosโ€™
    |
245 |     RepStos bytesPerCopy destExpr srcExpr cntExpr dirExpr -> do
    |     ^^^^^^^

reopt_test

I'm currently running into build failures with posix-waitpid on OSX. Is there any objection to making reopt_test optional? Specifically, changing "executable reopt_test" to "test-suite reopt_test"?

Error while building reopt

Build errors:

In order, the following will be built (use -v for more details):
parameterized-utils-1.0.8
macaw-base-0.3.4
macaw-x86-0.0.1
reopt-0.1.0
Preprocessing library parameterized-utils-1.0.8...
[12 of 27] Compiling Data.Parameterized.NatRepr ( src/Data/Parameterized/NatRepr.hs, /home/sdasgup3/Github/reopt/dist-newstyle/build/parameterized-utils-1.0.8/build/Data/Parameterized/NatRepr.o )

src/Data/Parameterized/NatRepr.hs:138:1: error:
    Failed to load interface for โ€˜GHC.TypeNatsโ€™
    Perhaps you meant
      GHC.TypeLits (from base-4.9.1.0)
      GHC.Types (from ghc-prim-0.5.0.0)
    Use -v to see a list of the files searched for.

Tools versions are:

$ ghc --version 
The Glorious Glasgow Haskell Compilation System, version 8.0.2

$ cabal --version 
cabal-install version 1.24.0.1
compiled using version 1.24.1.0 of the Cabal library

Bug: not reconciling pointer types with external function types nicely

Example in x86_64.ubuntu20.anope.clang.O0.nopie.nostrip.elf:

error: '@reopt__ZN9__gnu_cxx14__alloc_traitsISaINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEES6_E9constructIS6_EEvRS7_PS6_RKT__0_0x407630'
defined with type 'void (i64, i64, i64)*' but expected 'void ({}*, i64, i64)*'

The error seems to arise of the conflict between the declared type of this symbol:

declare void
@reopt__ZN9__gnu_cxx14__alloc_traitsISaINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEES6_E9constructIS6_EEvRS7_PS6_RKT__0_0x407630
(i64, i64, i64)

While we have inferred a pointer type for the value that will end up in first argument position.

Example from README doesn't run in Docker container

$ docker run -it galoisbinaryanalysis/reopt
root@56d894b61629:~# reopt -o ls.exe $(which ls)
Could not determine gdb's debug-file-directory:
  debug directory reported by gdb does not exist: /usr/lib/debug
Initialization
  Complete.
Searching for dynamic dependency libselinux.so.1's debug info...
No debug info for libselinux.so.1 found.
Searching for dynamic dependency libc.so.6's debug info...
No debug info for libc.so.6 found.
Header Processing
  Complete.
Discovering 0x4da0
  Complete.
Discovering 0x4da5
  Complete.
Discovering 0x4daa
  Complete.
Discovering 0x4daf
  Complete.
Discovering 0x4db4
  Complete.
Discovering 0x4db9
  Complete.
Discovering 0x4dbe
  Complete.
Discovering 0x4dc3
  Complete.
Discovering 0x4dc8
  Complete.
Discovering 0x4dcd
  Complete.
Discovering 0x4dd2
  Complete.
Discovering 0x4dd7
  Complete.
Discovering 0x4ddc
  Complete.
Discovering 0x4de1
  Complete.
Discovering 0x4de6
  Complete.
Discovering 0x4deb
  Complete.
Discovering 0x4df0
  Block 0x507a: segment1+0x5081: Could not decode instruction 3effe0
  Block 0x5cdd: Unclassified control flow transfer.
  Incomplete.

Discovering 0x67d0
  Complete.
Discovering 0x68c0
  Complete.
Discovering 0x68d0
  Complete.
Discovering 0x68f0
  Complete.
Discovering 0x6910
  Block 0x6976: segment1+0x6981: Could not decode instruction 3e41ffe0
  Incomplete.

Discovering 0x6b30
  Complete.
Discovering 0x6b40
  Complete.
Discovering 0x6bb0
  Complete.
Discovering 0x6c30
  Complete.
Discovering 0x6e80
  Complete.
Discovering 0x6ef0
  Complete.
Discovering 0x6f00
  Complete.
Discovering 0x6f20
  Complete.
Discovering 0x6f70
  Complete.
Discovering 0x7020
  Complete.
Discovering 0x70a0
  Block 0x7278: Unclassified control flow transfer.
  Block 0x7322: Unclassified control flow transfer.
  Incomplete.

Discovering 0x7180
  Block 0x7322: Unclassified control flow transfer.
  Incomplete.

Discovering 0x7310
  Complete.
Discovering 0x7340
  Complete.
Discovering 0x7350
  Complete.
Discovering 0x7360
  Complete.
Discovering 0x7380
  Complete.
Discovering 0x7390
  Complete.
Discovering 0x7520
  Complete.
Discovering 0x75f0
  Complete.
Discovering 0x76c0
  Complete.
Discovering 0x7780
  Complete.
Discovering 0x77d0
  Complete.
Discovering 0x77f0
  Complete.
Discovering 0x7860
  Complete.
Discovering 0x78a0
  Complete.
Discovering 0x7900
  Complete.
Discovering 0x7960
  Complete.
Discovering 0x79d0
  Complete.
Discovering 0x7a40
  Complete.
Discovering 0x7b30
  Complete.
Discovering 0x7b80
  Complete.
Discovering 0x7c00
  Complete.
Discovering 0x7c70
  Complete.
Discovering 0x7cd0
  Complete.
Discovering 0x7dc0
  Complete.
Discovering 0x7f90
  Complete.
Discovering 0x7ff0
  Complete.
Discovering 0x8060
  Complete.
Discovering 0x8090
  Complete.
Discovering 0x8170
  Complete.
Discovering 0x81e0
  Complete.
Discovering 0x8650
  Complete.
Discovering 0x8a60
  Complete.
Discovering 0x8eb0
  Complete.
Discovering 0x9050
  Block 0x9530: Unclassified control flow transfer.
  Incomplete.

Discovering 0x9ab0
  Complete.
Discovering 0x9b50
  Complete.
Discovering 0x9d00
  Block 0xa119: Unclassified control flow transfer.
  Block 0xa180: Unclassified control flow transfer.
  Incomplete.

Discovering 0x9fe0
  Complete.
Discovering 0xa1a0
  Block 0xa1ad: segment1+0xa1cf: Could not decode instruction 3effe0
  Incomplete.

Discovering 0xa530
  Complete.
Discovering 0xa5b0
  Complete.
Discovering 0xa5f0
  Complete.
Discovering 0xa670
  Complete.
Discovering 0xa6f0
  Complete.
Discovering 0xa770
  Complete.
Discovering 0xa7b0
  Complete.
Discovering 0xa7f0
  Complete.
Discovering 0xa880
  Complete.
Discovering 0xa900
  Complete.
Discovering 0xa9d0
  Block 0xac06: Unclassified control flow transfer.
  Block 0xba08: Unclassified control flow transfer.
  Incomplete.

Discovering 0xb8c0
  Complete.
Discovering 0xbfc0
  Complete.
Discovering 0xc010
  Complete.
Discovering 0xc060
  Complete.
Discovering 0xc0b0
  Complete.
Discovering 0xc0f0
  Complete.
Discovering 0xc140
  Complete.
Discovering 0xc180
  Complete.
Discovering 0xc210
  Complete.
Discovering 0xc290
  Complete.
Discovering 0xc320
  Complete.
Discovering 0xc3b0
  Complete.
Discovering 0xc450
  Complete.
Discovering 0xc4d0
  Complete.
Discovering 0xc510
  Complete.
Discovering 0xc560
  Complete.
Discovering 0xc5b0
  Complete.
Discovering 0xc600
  Complete.
Discovering 0xc640
  Complete.
Discovering 0xc690
  Complete.
Discovering 0xc720
  Complete.
Discovering 0xc7b0
  Complete.
Discovering 0xc850
  Complete.
Discovering 0xc8c0
  Complete.
Discovering 0xc930
  Complete.
Discovering 0xc9f0
  Complete.
Discovering 0xcab0
  Complete.
Discovering 0xcb30
  Complete.
Discovering 0xcbb0
  Complete.
Discovering 0xcca0
  Complete.
Discovering 0xd3e0
  Complete.
Discovering 0xd4d0
  Complete.
Discovering 0xd4e0
  Complete.
Discovering 0xd5f0
  Complete.
Discovering 0xd680
  Complete.
Discovering 0xd7b0
  Complete.
Discovering 0xd830
  Complete.
Discovering 0xd890
  Complete.
Discovering 0xd900
  Complete.
Discovering 0xdfc0
  Complete.
Discovering 0xdfd0
  Complete.
Discovering 0xdfe0
  Complete.
Discovering 0xe090
  Complete.
Discovering 0xe0d0
  Complete.
Discovering 0xe140
  Complete.
Discovering 0xe1a0
  Complete.
Discovering 0xe1d0
  Complete.
Discovering 0xe290
  Block 0xe370: Unclassified control flow transfer.
  Incomplete.

Discovering 0xe320
  Complete.
Discovering 0xe380
  Complete.
Discovering 0xe500
  Complete.
Discovering 0xe510
  Complete.
Discovering 0xe530
  Complete.
Discovering 0xe630
  Complete.
Discovering 0xe6e0
  Complete.
Discovering 0xeae0
  Complete.
Discovering 0xeb50
  Complete.
Discovering 0xeba0
  Complete.
Discovering 0xebc0
  Complete.
Discovering 0xebd0
  Block 0xebde: Unclassified control flow transfer.
  Incomplete.

Discovering 0xec00
  Complete.
Discovering 0xed00
  Block 0xed0f: Unsupported instruction at segment1+0xed14: II {iiLockPrefix = NoLockPrefix, iiAddrSize = Size64, iiOp = "comiss", iiArgs = [(XMMReg xmm0,RG_XMM_reg Nothing),(Mem128 (IP_Offset_64 ss (Disp32 0xd259)),RM_XMM Nothing)], iiPrefixes = Prefixes {_prLockPrefix = NoLockPrefix, _prSP = SegmentPrefix {unwrapSegmentPrefix = 0}, _prREX = 0b00000000, _prVEX = Nothing, _prASO = False, _prOSO = False}, iiRequiredPrefix = Nothing, iiOpcode = [15,47], iiRequiredMod = Nothing, iiRequiredReg = Nothing, iiRequiredRM = Nothing}
  Incomplete.

Discovering 0xed80
  Block 0xed9a: Unsupported instruction at segment1+0xeda1: II {iiLockPrefix = NoLockPrefix, iiAddrSize = Size64, iiOp = "comiss", iiArgs = [(XMMReg xmm0,RG_XMM_reg Nothing),(Mem128 (IP_Offset_64 ss (Disp32 0xd1e0)),RM_XMM Nothing)], iiPrefixes = Prefixes {_prLockPrefix = NoLockPrefix, _prSP = SegmentPrefix {unwrapSegmentPrefix = 0}, _prREX = 0b00000000, _prVEX = Nothing, _prASO = False, _prOSO = False}, iiRequiredPrefix = Nothing, iiOpcode = [15,47], iiRequiredMod = Nothing, iiRequiredReg = Nothing, iiRequiredRM = Nothing}
  Incomplete.

Discovering 0xeeb0
  Complete.
Discovering 0xf000
  Complete.
Discovering 0xf010
  Complete.
Discovering 0xf020
  Complete.
Discovering 0xf030
  Complete.
Discovering 0xf090
  Complete.
Discovering 0xf100
  Complete.
Discovering 0xf260
  Complete.
Discovering 0xf2c0
  Block 0xf2db: Unclassified control flow transfer.
  Block 0xf307: Unclassified control flow transfer.
  Incomplete.

Discovering 0xf310
  Complete.
Discovering 0xf380
  Complete.
Discovering 0xf3d0
  Complete.
Discovering 0xf450
  Complete.
Discovering 0xf490
  Complete.
Discovering 0xf4c0
  Complete.
Discovering 0xf5d0
  Complete.
Discovering 0xf680
  Complete.
Discovering 0xf770
  Block 0xf856: Unclassified control flow transfer.
  Incomplete.

Discovering 0xf900
  Block 0xf900: Unclassified control flow transfer.
  Incomplete.

Discovering 0xfba0
  Complete.
Discovering 0xfc00
  Block 0xfc9d: Unsupported instruction at segment1+0xfca1: II {iiLockPrefix = NoLockPrefix, iiAddrSize = Size64, iiOp = "comiss", iiArgs = [(XMMReg xmm1,RG_XMM_reg Nothing),(XMMReg xmm0,RM_XMM Nothing)], iiPrefixes = Prefixes {_prLockPrefix = NoLockPrefix, _prSP = SegmentPrefix {unwrapSegmentPrefix = 0}, _prREX = 0b00000000, _prVEX = Nothing, _prASO = False, _prOSO = False}, iiRequiredPrefix = Nothing, iiOpcode = [15,47], iiRequiredMod = Nothing, iiRequiredReg = Nothing, iiRequiredRM = Nothing}
  Incomplete.

Discovering 0xfe00
  Complete.
Discovering 0xfe30
  Complete.
Discovering 0xfe50
  Complete.
Discovering 0xfe80
  Complete.
Discovering 0xfec0
  Complete.
Discovering 0xfee0
  Block 0xfee0: Unsupported instruction at segment1+0xfeea: II {iiLockPrefix = NoLockPrefix, iiAddrSize = Size64, iiOp = "fcomi", iiArgs = [(X87Register 0,RG_ST 0),(X87Register 1,RG_ST 1)], iiPrefixes = Prefixes {_prLockPrefix = NoLockPrefix, _prSP = SegmentPrefix {unwrapSegmentPrefix = 0}, _prREX = 0b00000000, _prVEX = Nothing, _prASO = False, _prOSO = False}, iiRequiredPrefix = Nothing, iiOpcode = [219], iiRequiredMod = Just OnlyReg, iiRequiredReg = Just (Fin8 {unFin8 = 6}), iiRequiredRM = Just (Fin8 {unFin8 = 1})}
  Incomplete.

Discovering 0xffa0
  Block 0x10095: Unsupported instruction at segment1+0x1009a: II {iiLockPrefix = NoLockPrefix, iiAddrSize = Size64, iiOp = "fild", iiArgs = [(Mem64 (Addr_64 ss (Just rsp) Nothing (Disp8 32)),M_X QSize)], iiPrefixes = Prefixes {_prLockPrefix = NoLockPrefix, _prSP = SegmentPrefix {unwrapSegmentPrefix = 0}, _prREX = 0b00000000, _prVEX = Nothing, _prASO = False, _prOSO = False}, iiRequiredPrefix = Nothing, iiOpcode = [223], iiRequiredMod = Just OnlyMem, iiRequiredReg = Just (Fin8 {unFin8 = 5}), iiRequiredRM = Nothing}
  Incomplete.

Discovering 0x109e0
  Complete.
Discovering 0x10bc0
  Complete.
Discovering 0x10c60
  Complete.
Discovering 0x10d70
  Complete.
Discovering 0x10e10
  Complete.
Discovering 0x10f20
  Complete.
Discovering 0x10fc0
  Complete.
Discovering 0x11020
  Complete.
Discovering 0x11400
  Complete.
Discovering 0x114b0
  Complete.
Discovering 0x116d0
  Complete.
Discovering 0x11700
  Complete.
Discovering 0x11940
  Complete.
Discovering 0x11950
  Complete.
Discovering 0x119a0
  Complete.
Discovering 0x119f0
  Block 0x11b9b: segment1+0x11bac: Could not decode instruction 3effe0
  Incomplete.

Discovering 0x13280
  Complete.
Discovering 0x132d0
  Complete.
Discovering 0x13390
  Complete.
Discovering 0x13470
  Block 0x134dd: Unclassified control flow transfer.
  Incomplete.

Discovering 0x146c0
  Block 0x146df: Unclassified control flow transfer.
  Incomplete.

Discovering 0x14860
  Complete.
Discovering 0x148a0
  Complete.
Discovering 0x148c0
  Complete.
Discovering 0x148e0
  Complete.
Discovering 0x14920
  Complete.
Discovering 0x14940
  Block 0x14940: Unclassified control flow transfer.
  Incomplete.

Discovering 0x14980
  Complete.
Discovering 0x14a00
  Complete.
Discovering 0x14af0
  Complete.
Discovering 0x14b00
  Complete.
Discovering 0x14ba0
  Complete.
Discovering 0x14bc0
  Complete.
Discovering 0x14bd0
  Complete.
Discovering 0x14bf0
  Complete.
Discovering 0x14c10
  Block 0x14c10: Unclassified control flow transfer.
  Incomplete.

Discovering 0x14cb0
  Block 0x14cb0: Unclassified control flow transfer.
  Incomplete.

Discovering 0x14d40
  Complete.
Discovering 0x14d50
  Complete.
Discovering 0x14d70
  Complete.
Discovering 0x14e10
  Complete.
Discovering 0x14e30
  Complete.
Discovering 0x14e50
  Complete.
Discovering 0x14e60
  Block 0x14e60: Unclassified control flow transfer.
  Incomplete.

Discovering 0x14f00
  Block 0x14f00: Unclassified control flow transfer.
  Incomplete.

Discovering 0x14fa0
  Complete.
Discovering 0x14fb0
  Complete.
Discovering 0x14fd0
  Complete.
Discovering 0x14ff0
  Complete.
Discovering 0x15000
  Complete.
Discovering 0x15020
  Complete.
Discovering 0x15040
  Complete.
Discovering 0x15060
  Complete.
Discovering 0x15190
  Complete.
Discovering 0x15230
  Complete.
Discovering 0x15250
  Block 0x152ea: segment1+0x152f8: Could not decode instruction 3effe0
  Incomplete.

Discovering 0x156a0
  Complete.
Discovering 0x156c0
  Complete.
Discovering 0x15750
  Complete.
Discovering 0x15830
  Complete.
Discovering 0x158c0
  Block 0x158fd: Unclassified control flow transfer.
  Block 0x15905: Unclassified control flow transfer.
  Incomplete.

Discovering 0x158e0
  Block 0x15905: Unclassified control flow transfer.
  Incomplete.

Discovering 0x15910
  Complete.
Discovering 0x15920
  Block 0x1597d: Unclassified control flow transfer.
  Block 0x159c1: Unclassified control flow transfer.
  Incomplete.

Discovering 0x15960
  Block 0x159c1: Unclassified control flow transfer.
  Incomplete.

Discovering 0x15990
  Block 0x159c1: Unclassified control flow transfer.
  Incomplete.

Discovering 0x15a20
  Block 0x15a8e: Unclassified control flow transfer.
  Incomplete.

Discovering 0x15a80
  Complete.
Discovering 0x15aa0
  Block 0x15af9: Unclassified control flow transfer.
  Incomplete.

Discovering 0x15ae0
  Complete.
Discovering 0x15b10
  Complete.
Discovering 0x15b30
  Complete.
Discovering 0x15b70
  Complete.
Discovering 0x15c70
  Complete.
Discovering 0x15ca0
  Complete.
Discovering 0x15cd0
  Complete.
Discovering 0x15db0
  Block 0x15ee8: segment1+0x15ef9: Could not decode instruction 3effe0
  Block 0x15f12: segment1+0x15f23: Could not decode instruction 3effe0
  Incomplete.

Discovering 0x16270
  Block 0x162f8: Unclassified control flow transfer.
  Block 0x16332: Unclassified control flow transfer.
  Incomplete.

Discovering 0x16340
  Block 0x16478: segment1+0x16489: Could not decode instruction 3effe0
  Block 0x164a2: segment1+0x164b3: Could not decode instruction 3effe0
  Incomplete.

Discovering 0x16800
  Complete.
Discovering 0x16870
  Complete.
Discovering 0x16890
  Complete.
Discovering 0x168b0
  Complete.
Discovering 0x168d0
  Complete.
Discovering 0x16960
  Complete.
Discovering 0x169b0
  Complete.
Discovering 0x169d0
  Complete.
Discovering 0x169f0
  Block 0x16a73: Unclassified control flow transfer.
  Incomplete.

Discovering _obstack_begin(0x16a80)
  Complete.
Discovering _obstack_begin_1(0x16aa0)
  Complete.
Discovering _obstack_newchunk(0x16ac0)
  Block 0x16bd3: Unclassified control flow transfer.
  Block 0x16be0: Unclassified control flow transfer.
  Block 0x16be6: Unclassified control flow transfer.
  Incomplete.

Discovering _obstack_allocated_p(0x16bb0)
  Complete.
Discovering _obstack_free(0x16bf0)
  Block 0x16c35: Unclassified control flow transfer.
  Incomplete.

Discovering _obstack_memory_used(0x16c60)
  Complete.
Discovering 0x16c90
  Complete.
Discovering 0x16cc0
  Complete.
Discovering 0x16cf0
  Complete.
Discovering 0x16d50
  Complete.
Discovering 0x16df0
  Complete.
Discovering 0x16f50
  Complete.
Discovering 0x17010
  Complete.
Discovering 0x17030
  Complete.
Discovering 0x170e0
  Complete.
Discovering 0x17230
  Complete.
Discovering 0x17270
  Complete.
Discovering 0x172e0
  Complete.
Discovering 0x17300
  Complete.
Discovering 0x17340
  Complete.
Discovering 0x17380
  Complete.
Discovering 0x17410
  Complete.
Discovering 0x17460
  Complete.
Discovering 0x174e0
  Candidate function 0x4000  (called at 174e0).
  Complete.
Discovering 0x4000
  Complete.
Discovering 0x17550
  Complete.
Discovering 0x17560
  Complete.
Argument inference
  reopt_1_0x4000(0x4000): Could not determine signature at callsite 0x4014:
    Indirect call target.
  reopt_1_0x4da0(0x4da0): Could not determine signature at callsite 0x4da0:
    Unknown arguments to abort.
  reopt_1_0x4da5(0x4da5): Could not determine signature at callsite 0x4da5:
    Unknown arguments to abort.
  reopt_1_0x4daa(0x4daa): Could not determine signature at callsite 0x4daa:
    Unknown arguments to abort.
  reopt_1_0x4daf(0x4daf): Could not determine signature at callsite 0x4daf:
    Unknown arguments to abort.
  reopt_1_0x4db4(0x4db4): Could not determine signature at callsite 0x4db4:
    Unknown arguments to abort.
  reopt_1_0x4db9(0x4db9): Could not determine signature at callsite 0x4db9:
    Unknown arguments to abort.
  reopt_1_0x4dbe(0x4dbe): Could not determine signature at callsite 0x4dbe:
    Unknown arguments to abort.
  reopt_1_0x4dc3(0x4dc3): Could not determine signature at callsite 0x4dc3:
    Unknown arguments to abort.
  reopt_1_0x4dc8(0x4dc8): Could not determine signature at callsite 0x4dc8:
    Unknown arguments to abort.
  reopt_1_0x4dcd(0x4dcd): Could not determine signature at callsite 0x4dcd:
    Unknown arguments to abort.
  reopt_1_0x4dd2(0x4dd2): Could not determine signature at callsite 0x4dd2:
    Unknown arguments to abort.
  reopt_1_0x4dd7(0x4dd7): Could not determine signature at callsite 0x4dd7:
    Unknown arguments to abort.
  reopt_1_0x4ddc(0x4ddc): Could not determine signature at callsite 0x4ddc:
    Unknown arguments to abort.
  reopt_1_0x4de1(0x4de1): Could not determine signature at callsite 0x4de1:
    Unknown arguments to abort.
  reopt_1_0x4de6(0x4de6): Could not determine signature at callsite 0x4de6:
    Unknown arguments to abort.
  reopt_1_0x4deb(0x4deb): Could not determine signature at callsite 0x4deb:
    Unknown arguments to abort.
  reopt_1_0x4df0(0x4df0): Could not determine signature at callsite 0x4e2c:
    Unknown arguments to setlocale.
  reopt_1_0x67d0(0x67d0): Could not determine signature at callsite 0x67f8:
    Indirect call target.
  reopt_1_0x6b30(0x6b30): Could not determine signature at callsite 0x6b34:
    Unknown arguments to free.
  reopt_1_0x6c30(0x6c30): Could not determine signature at callsite 0x6cef:
    Unknown arguments to nl_langinfo.
  reopt_1_0x6ef0(0x6ef0): Could not determine signature at callsite 0x6efa:
    Unknown arguments to strcmp.
  reopt_1_0x6f00(0x6f00): Could not determine signature at callsite 0x6f0d:
    Unknown arguments to strcmp.
  reopt_1_0x6f20(0x6f20): Could not determine signature at callsite 0x6f27:
    Unknown arguments to free.
  reopt_1_0x7020(0x7020): Could not determine signature at callsite 0x7086:
    Unknown arguments to strlen.
  reopt_1_0x70a0(0x70a0): Could not determine signature at callsite 0x70ae:
    Unknown arguments to strlen.
  reopt_1_0x7180(0x7180): Could not determine signature at callsite 0x71df:
    Unknown arguments to _setjmp.
  reopt_1_0x7310(0x7310): Could not determine signature at callsite 0x7335:
    Unknown arguments to strcoll.
  reopt_1_0x7390(0x7390): Could not determine signature at callsite 0x7443:
    Unknown arguments to free.
  reopt_1_0x7520(0x7520): Could not determine signature at callsite 0x75bd:
    Unknown arguments to __overflow.
  reopt_1_0x75f0(0x75f0): Could not determine signature at callsite 0x765a:
    Unknown arguments to fputs_unlocked.
  reopt_1_0x76c0(0x76c0): Could not determine signature at callsite 0x76ef:
    Unknown arguments to fputs_unlocked.
  reopt_1_0x77f0(0x77f0): Could not determine signature at callsite 0x781b:
    Unknown arguments to error.
  reopt_1_0x7860(0x7860): Could not determine signature at callsite 0x7876:
    Unknown arguments to strcmp.
  reopt_1_0x7900(0x7900): Could not determine signature at callsite 0x794a:
    Unknown arguments to strcmp.
  reopt_1_0x79d0(0x79d0): Could not determine signature at callsite 0x7a22:
    Unknown arguments to strcmp.
  reopt_1_0x7b30(0x7b30): Could not determine signature at callsite 0x7b73:
    Unknown arguments to __overflow.
  reopt_1_0x7b80(0x7b80): Could not determine signature at callsite 0x7be0:
    Unknown arguments to strcmp.
  reopt_1_0x7cd0(0x7cd0): Could not determine signature at callsite 0x7d3f:
    Unknown arguments to strrchr.
  reopt_1_0x7dc0(0x7dc0): Could not determine signature at callsite 0x7e18:
    Unknown arguments to sigismember.
  reopt_1_0x7ff0(0x7ff0): Could not determine signature at callsite 0x801e:
    Unknown arguments to fwrite_unlocked.
  reopt_1_0x8090(0x8090): Could not determine signature at callsite 0x80bf:
    Unknown arguments to fflush_unlocked.
  reopt_1_0x81e0(0x81e0): Could not determine signature at callsite 0x8284:
    Unknown arguments to strlen.
  reopt_1_0x8650(0x8650): Could not determine signature at callsite 0x879a:
    Unknown arguments to free.
  reopt_1_0x8a60(0x8a60): Could not determine signature at callsite 0x8ce3:
    Unknown arguments to strlen.
  reopt_1_0x9050(0x9050): Could not determine signature at callsite 0x91b8:
    Unknown arguments to __sprintf_chk.
  reopt_1_0x9ab0(0x9ab0): Could not determine signature at callsite 0x9b19:
    Unknown arguments to free.
  reopt_1_0x9b50(0x9b50): Could not determine signature at callsite 0x9c77:
    Unknown arguments to strlen.
  reopt_1_0x9d00(0x9d00): Could not determine signature at callsite 0xa154:
    Unknown arguments to __overflow.
  reopt_1_0x9fe0(0x9fe0): Could not determine signature at callsite 0xa154:
    Unknown arguments to __overflow.
  reopt_1_0xa530(0xa530): Could not determine signature at callsite 0xa58e:
    Unknown arguments to strcmp.
  reopt_1_0xa670(0xa670): Could not determine signature at callsite 0xa6c6:
    Unknown arguments to strcmp.
  reopt_1_0xa7b0(0xa7b0): Could not determine signature at callsite 0xa7c9:
    Unknown arguments to strcmp.
  reopt_1_0xa7f0(0xa7f0): Could not determine signature at callsite 0xa85c:
    Unknown arguments to strcmp.
  reopt_1_0xa880(0xa880): Could not determine signature at callsite 0xa8e0:
    Unknown arguments to strcmp.
  reopt_1_0xa900(0xa900): Could not determine signature at callsite 0xa93d:
    Unknown arguments to __sprintf_chk.
  reopt_1_0xa9d0(0xa9d0): Could not determine signature at callsite 0xab2d:
    Unknown arguments to __lxstat.
  reopt_1_0xb8c0(0xb8c0): Could not determine signature at callsite 0xb903:
    Unknown arguments to opendir.
  reopt_1_0xc4d0(0xc4d0): Could not determine signature at callsite 0xc4ef:
    Unknown arguments to strcmp.
  reopt_1_0xc510(0xc510): Could not determine signature at callsite 0xc532:
    Unknown arguments to strcmp.
  reopt_1_0xc560(0xc560): Could not determine signature at callsite 0xc58b:
    Unknown arguments to strcmp.
  reopt_1_0xc5b0(0xc5b0): Could not determine signature at callsite 0xc5d2:
    Unknown arguments to strcmp.
  reopt_1_0xc600(0xc600): Could not determine signature at callsite 0xc61f:
    Unknown arguments to strcmp.
  reopt_1_0xc640(0xc640): Could not determine signature at callsite 0xc66e:
    Unknown arguments to strcmp.
  reopt_1_0xc690(0xc690): Could not determine signature at callsite 0xc6f8:
    Unknown arguments to strcmp.
  reopt_1_0xc720(0xc720): Could not determine signature at callsite 0xc788:
    Unknown arguments to strcmp.
  reopt_1_0xc7b0(0xc7b0): Could not determine signature at callsite 0xc824:
    Unknown arguments to strcmp.
  reopt_1_0xc850(0xc850): Could not determine signature at callsite 0xc866:
    Unknown arguments to strrchr.
  reopt_1_0xc8c0(0xc8c0): Could not determine signature at callsite 0xc8d7:
    Unknown arguments to strrchr.
  reopt_1_0xc930(0xc930): Could not determine signature at callsite 0xc98c:
    Unknown arguments to strrchr.
  reopt_1_0xc9f0(0xc9f0): Could not determine signature at callsite 0xca4c:
    Unknown arguments to strrchr.
  reopt_1_0xcab0(0xcab0): Could not determine signature at callsite 0xcac7:
    Unknown arguments to strrchr.
  reopt_1_0xcb30(0xcb30): Could not determine signature at callsite 0xcb47:
    Unknown arguments to strrchr.
  reopt_1_0xcbb0(0xcbb0): Could not determine signature at callsite 0xcc1f:
    Unknown arguments to strrchr.
  reopt_1_0xcca0(0xcca0): Could not determine signature at callsite 0xccdc:
    Unknown arguments to dcgettext.
  reopt_1_0xd3e0(0xd3e0): Could not determine signature at callsite 0xd423:
    Unknown arguments to malloc.
  reopt_1_0xd4e0(0xd4e0): Could not determine signature at callsite 0xd508:
    Unknown arguments to strlen.
  reopt_1_0xd5f0(0xd5f0): Could not determine signature at callsite 0xd618:
    Unknown arguments to dcgettext.
  reopt_1_0xd680(0xd680): Could not determine signature at callsite 0xd6bf:
    Unknown arguments to dcgettext.
  reopt_1_0xd7b0(0xd7b0): Could not determine signature at callsite 0xd81c:
    Indirect call target.
  reopt_1_0xd900(0xd900): Could not determine signature at callsite 0xd96f:
    Unknown arguments to strlen.
  reopt_1_0xdfe0(0xdfe0): Could not determine signature at callsite 0xe037:
    Unknown arguments to dcgettext.
  reopt_1_0xe0d0(0xe0d0): Could not determine signature at callsite 0xe0f3:
    Unknown arguments to malloc.
  reopt_1_0xe1a0(0xe1a0): Could not determine signature at callsite 0xe1a8:
    Unknown arguments to strlen.
  reopt_1_0xe1d0(0xe1d0): Could not determine signature at callsite 0xe207:
    Unknown arguments to getxattr.
  reopt_1_0xe510(0xe510): Could not determine signature at callsite 0xe56b:
    Unknown arguments to strlen.
  reopt_1_0xe530(0xe530): Could not determine signature at callsite 0xe56b:
    Unknown arguments to strlen.
  reopt_1_0xe6e0(0xe6e0): Could not determine signature at callsite 0xe706:
    Unknown arguments to strcmp.
  reopt_1_0xeae0(0xeae0): Could not determine signature at callsite 0xeb01:
    Unknown arguments to clock_gettime.
  reopt_1_0xeb50(0xeb50): Could not determine signature at callsite 0xeb5a:
    Unknown arguments to setlocale.
  reopt_1_0xebd0(0xebd0): Could not determine signature at callsite 0xebdb:
    Indirect call target.
  reopt_1_0xec00(0xec00): Could not determine signature at callsite 0xec33:
    Indirect call target.
  reopt_1_0xeeb0(0xeeb0): Could not determine signature at callsite 0xefdf:
    Unknown arguments to malloc.
  reopt_1_0xf100(0xf100): Could not determine signature at callsite 0xf181:
    Unknown arguments to __fprintf_chk.
  reopt_1_0xf260(0xf260): Could not determine signature at callsite 0xf28b:
    Indirect call target.
  reopt_1_0xf3d0(0xf3d0): Could not determine signature at callsite 0xf43b:
    Indirect call target.
  reopt_1_0xf4c0(0xf4c0): Could not determine signature at callsite 0xf502:
    Unknown arguments to malloc.
  reopt_1_0xf5d0(0xf5d0): Could not determine signature at callsite 0xf623:
    Indirect call target.
  reopt_1_0xf680(0xf680): Could not determine signature at callsite 0xf6d3:
    Indirect call target.
  reopt_1_0xf770(0xf770): Could not determine signature at callsite 0xf7c8:
    Unknown arguments to calloc.
  reopt_1_0xfe80(0xfe80): Could not determine signature at callsite 0xfeac:
    Unknown arguments to strcmp.
  reopt_1_0xfec0(0xfec0): Could not determine signature at callsite 0xfecb:
    Unknown arguments to free.
  reopt_1_0xffa0(0xffa0): Could not determine signature at callsite 0xfffb:
    Unknown arguments to localeconv.
  reopt_1_0x109e0(0x109e0): Could not determine signature at callsite 0x10b04:
    Unknown arguments to getenv.
  reopt_1_0x10bc0(0x10bc0): Could not determine signature at callsite 0x10c09:
    Unknown arguments to getpwuid.
  reopt_1_0x10c60(0x10c60): Could not determine signature at callsite 0x10c96:
    Unknown arguments to strcmp.
  reopt_1_0x10d70(0x10d70): Could not determine signature at callsite 0x10db9:
    Unknown arguments to getgrgid.
  reopt_1_0x10e10(0x10e10): Could not determine signature at callsite 0x10e46:
    Unknown arguments to strcmp.
  reopt_1_0x11020(0x11020): Could not determine signature at callsite 0x1104a:
    Unknown arguments to strlen.
  reopt_1_0x11400(0x11400): Could not determine signature at callsite 0x1143d:
    Unknown arguments to realloc.
  reopt_1_0x114b0(0x114b0): Could not determine signature at callsite 0x114dd:
    Unknown arguments to __ctype_get_mb_cur_max.
  reopt_1_0x116d0(0x116d0): Could not determine signature at callsite 0x116e1:
    Unknown arguments to strlen.
  reopt_1_0x11700(0x11700): Could not determine signature at callsite 0x11745:
    Indirect call target.
  reopt_1_0x11950(0x11950): Could not determine signature at callsite 0x11963:
    Unknown arguments to __ctype_tolower_loc.
  reopt_1_0x119a0(0x119a0): Could not determine signature at callsite 0x119b3:
    Unknown arguments to __ctype_toupper_loc.
  reopt_1_0x119f0(0x119f0): Could not determine signature at callsite 0x11c57:
    Unknown arguments to memset.
  reopt_1_0x132d0(0x132d0): Could not determine signature at callsite 0x132e6:
    Unknown arguments to strrchr.
  reopt_1_0x13470(0x13470): Could not determine signature at callsite 0x134d8:
    Unknown arguments to __ctype_get_mb_cur_max.
  reopt_1_0x14b00(0x14b00): Could not determine signature at callsite 0x14b37:
    Unknown arguments to free.
  reopt_1_0x15060(0x15060): Could not determine signature at callsite 0x150a9:
    Unknown arguments to __fxstatat.
  reopt_1_0x15250(0x15250): Could not determine signature at callsite 0x1528b:
    Unknown arguments to __fprintf_chk.
  reopt_1_0x15830(0x15830): Could not determine signature at callsite 0x15843:
    Unknown arguments to dcgettext.
  reopt_1_0x158c0(0x158c0): Could not determine signature at callsite 0x158c8:
    Unknown arguments to malloc.
  reopt_1_0x15920(0x15920): Could not determine signature at callsite 0x15935:
    Unknown arguments to realloc.
  reopt_1_0x15a80(0x15a80): Could not determine signature at callsite 0x15a98:
    Unknown arguments to memset.
  reopt_1_0x15aa0(0x15aa0): Could not determine signature at callsite 0x15abe:
    Unknown arguments to calloc.
  reopt_1_0x15ae0(0x15ae0): Could not determine signature at callsite 0x15b09:
    Unknown arguments to memcpy.
  reopt_1_0x15b10(0x15b10): Could not determine signature at callsite 0x15b18:
    Unknown arguments to strlen.
  reopt_1_0x15b30(0x15b30): Could not determine signature at callsite 0x15b48:
    Unknown arguments to dcgettext.
  reopt_1_0x15b70(0x15b70): Could not determine signature at callsite 0x15c11:
    Unknown arguments to error.
  reopt_1_0x15ca0(0x15ca0): Could not determine signature at callsite 0x15caa:
    Unknown arguments to getcwd.
  reopt_1_0x15cd0(0x15cd0): Could not determine signature at callsite 0x15d38:
    Unknown arguments to gethostname.
  reopt_1_0x15db0(0x15db0): Could not determine signature at callsite 0x15e0a:
    Unknown arguments to __ctype_b_loc.
  reopt_1_0x16270(0x16270): Could not determine signature at callsite 0x162d2:
    Unknown arguments to dcgettext.
  reopt_1_0x16340(0x16340): Could not determine signature at callsite 0x1639a:
    Unknown arguments to __ctype_b_loc.
  reopt_1_0x16800(0x16800): Could not determine signature at callsite 0x16834:
    Unknown arguments to freecon.
  reopt_1_0x16870(0x16870): Could not determine signature at callsite 0x16878:
    Unknown arguments to getfilecon.
  reopt_1_0x16890(0x16890): Could not determine signature at callsite 0x16898:
    Unknown arguments to lgetfilecon.
  reopt_1_0x168b0(0x168b0): Could not determine signature at callsite 0x168b8:
    Unknown arguments to fgetfilecon.
  reopt_1_0x168d0(0x168d0): Could not determine signature at callsite 0x16906:
    Unknown arguments to mbrtowc.
  reopt_1_0x16960(0x16960): Could not determine signature at callsite 0x16978:
    Unknown arguments to dcgettext.
  reopt_1_0x169b0(0x169b0): Could not determine signature at callsite 0x169be:
    Indirect call target.
  reopt_1_0x169d0(0x169d0): Could not determine signature at callsite 0x169de:
    Indirect call target.
  reopt_1_0x169f0(0x169f0): Could not determine signature at callsite 0x16a6d:
    Indirect call target.
  _obstack_newchunk(0x16ac0): Could not determine signature at callsite 0x16b55:
    Unknown arguments to memcpy.
  reopt_1_0x16c90(0x16c90): Could not determine signature at callsite 0x16ca4:
    Unknown arguments to setenv.
  reopt_1_0x16cc0(0x16cc0): Could not determine signature at callsite 0x16cd6:
    Unknown arguments to free.
  reopt_1_0x16cf0(0x16cf0): Could not determine signature at callsite 0x16d40:
    Unknown arguments to tzset.
  reopt_1_0x16d50(0x16d50): Could not determine signature at callsite 0x16d60:
    Unknown arguments to strlen.
  reopt_1_0x16df0(0x16df0): Could not determine signature at callsite 0x16e36:
    Unknown arguments to strcmp.
  reopt_1_0x16f50(0x16f50): Could not determine signature at callsite 0x16f5e:
    Unknown arguments to getenv.
  reopt_1_0x17030(0x17030): Could not determine signature at callsite 0x17060:
    Unknown arguments to localtime_r.
  reopt_1_0x170e0(0x170e0): Could not determine signature at callsite 0x17120:
    Unknown arguments to mktime.
  reopt_1_0x17270(0x17270): Could not determine signature at callsite 0x1727b:
    Unknown arguments to __fpending.
  reopt_1_0x172e0(0x172e0): Could not determine signature at callsite 0x1732e:
    Indirect call target.
  reopt_1_0x17340(0x17340): Could not determine signature at callsite 0x1734d:
    Unknown arguments to nl_langinfo.
  reopt_1_0x17380(0x17380): Could not determine signature at callsite 0x1738b:
    Unknown arguments to fileno.
  reopt_1_0x17410(0x17410): Could not determine signature at callsite 0x1741d:
    Unknown arguments to __freading.
  reopt_1_0x17460(0x17460): Could not determine signature at callsite 0x1747e:
    Unknown arguments to fseeko.
  reopt_1_0x174e0(0x174e0): Could not determine signature at callsite 0x17529:
    Indirect call target.
  reopt_1_0x17560(0x17560): Could not determine signature at callsite 0x1756d:
    Unknown arguments to __cxa_atexit.
  Complete.
Analyzing 0x68c0
  Complete.
Recovering 0x68c0
  Complete.
Analyzing 0x68d0
  Complete.
Recovering 0x68d0
  Complete.
Analyzing 0x68f0
  Complete.
Recovering 0x68f0
  Failed (0x68f0:3, Unsupported function value): Recover r8 failed: Cannot lift relative addr segment1+0x24218
Analyzing 0x6b40
  Complete.
Recovering 0x6b40
  Failed (0x6b40:24, Unsupported function value): Recover r45 failed: Cannot lift relative addr segment1+0x23060
Analyzing 0x6bb0
  Complete.
Recovering 0x6bb0
  Failed (0x6bb0:20, Unimplemented LLVM backend feature): LLVM backend does not yet support: fs.base
Analyzing 0x6e80
  Complete.
Recovering 0x6e80
  Failed (0x6ec4:1, Unsupported function value): Recover r205 failed: Cannot lift relative addr segment1+0x24380
Analyzing 0x6f70
  Block: 0x6f80: Unknown arguments to reopt_1_0x6f20.
Analyzing 0x7340
  Block: 0x7340: Unknown arguments to reopt_1_0x7310.
Analyzing 0x7350
  Block: 0x7350: Unknown arguments to reopt_1_0x7310.
Analyzing 0x7360
  Block: 0x7360: Unknown arguments to reopt_1_0xe6e0.
Analyzing 0x7380
  Block: 0x7380: Unknown arguments to reopt_1_0xe6e0.
Analyzing 0x7780
  Block: 0x77a2: Unknown arguments to reopt_1_0x76c0.
Analyzing 0x77d0
  Complete.
Recovering 0x77d0
  Failed (0x77d0:3, Unsupported function value): Recover r8 failed: Cannot lift relative addr segment1+0x24218
Analyzing 0x78a0
  Block: 0x78e4: Unknown arguments to reopt_1_0x7310.
Analyzing 0x7960
  Block: 0x79ac: Unknown arguments to reopt_1_0x7310.
Analyzing 0x7a40
  Complete.
Recovering 0x7a40
  Failed (0x7a53:4, Unsupported function value): Recover r57 failed: Cannot lift relative addr segment1+0x24314
Analyzing 0x7c00
  Block: 0x7c4c: Unknown arguments to reopt_1_0xe6e0.
Analyzing 0x7c70
  Block: 0x7cb4: Unknown arguments to reopt_1_0xe6e0.
Analyzing 0x7f90
  Block: 0x7f9a: Unknown arguments to reopt_1_0x7ff0.
Analyzing 0x8060
  Block: 0x8060: Unknown arguments to reopt_1_0x7ff0.
Analyzing 0x8170
  Block: 0x81a0: Unknown arguments to reopt_1_0x7ff0.
Analyzing 0x8eb0
  Block: 0x8f97: Unknown arguments to reopt_1_0x8a60.
Analyzing 0xa5b0
  Block: 0xa5c0: Unknown arguments to reopt_1_0x7310.
Analyzing 0xa5f0
  Block: 0xa640: Unknown arguments to reopt_1_0x7310.
Analyzing 0xa6f0
  Block: 0xa748: Unknown arguments to reopt_1_0x7310.
Analyzing 0xa770
  Block: 0xa783: Unknown arguments to reopt_1_0x7310.
Analyzing 0xbfc0
  Block: 0xbfe8: Unknown arguments to reopt_1_0x7310.
Analyzing 0xc010
  Block: 0xc02c: Unknown arguments to reopt_1_0x7310.
Analyzing 0xc060
  Block: 0xc085: Unknown arguments to reopt_1_0x7310.
Analyzing 0xc0b0
  Block: 0xc0c9: Unknown arguments to reopt_1_0x7310.
Analyzing 0xc0f0
  Block: 0xc10c: Unknown arguments to reopt_1_0x7310.
Analyzing 0xc140
  Block: 0xc159: Unknown arguments to reopt_1_0x7310.
Analyzing 0xc180
  Block: 0xc1e2: Unknown arguments to reopt_1_0x7310.
Analyzing 0xc210
  Block: 0xc26a: Unknown arguments to reopt_1_0x7310.
Analyzing 0xc290
  Block: 0xc2f6: Unknown arguments to reopt_1_0x7310.
Analyzing 0xc320
  Block: 0xc382: Unknown arguments to reopt_1_0x7310.
Analyzing 0xc3b0
  Block: 0xc41e: Unknown arguments to reopt_1_0x7310.
Analyzing 0xc450
  Block: 0xc4aa: Unknown arguments to reopt_1_0x7310.
Analyzing 0xd4d0
  Block: 0xd4d0: Unknown arguments to reopt_1_0xcca0.
Analyzing 0xd830
  Complete.
Recovering 0xd830
  Complete.
Analyzing 0xd890
  Complete.
Recovering 0xd890
  Complete.
Analyzing 0xdfc0
  Complete.
Recovering 0xdfc0
  Failed (0xdfc0:3, Unsupported function value): Recover write address failed: Cannot lift relative addr segment1+0x243d8
Analyzing 0xdfd0
  Complete.
Recovering 0xdfd0
  Failed (0xdfd0:4, Unsupported function value): Recover write address failed: Cannot lift relative addr segment1+0x243d0
Analyzing 0xe090
  Complete.
Recovering 0xe090
  Complete.
Analyzing 0xe140
  Complete.
Recovering 0xe140
  Complete.
Analyzing 0xe1a0
  Block: 0xe1a0: Unknown arguments to strlen.
Analyzing 0xe320
  Block: 0xe33d: Unknown arguments to reopt_1_0xf260.
Analyzing 0xe380
  Complete.
Recovering 0xe380
  Complete.
Analyzing 0xe500
  Complete.
Recovering 0xe500
  Complete.
Analyzing 0xe630
  Complete.
Recovering 0xe630
  Complete.
Analyzing 0xeba0
  Complete.
Recovering 0xeba0
  Complete.
Analyzing 0xebc0
  Complete.
Recovering 0xebc0
  Complete.
Analyzing 0xec00
  Block: 0xec30: Indirect call target.
Analyzing 0xf000
  Complete.
Recovering 0xf000
  Complete.
Analyzing 0xf010
  Complete.
Recovering 0xf010
  Complete.
Analyzing 0xf020
  Complete.
Recovering 0xf020
  Complete.
Analyzing 0xf030
  Complete.
Recovering 0xf030
  Complete.
Analyzing 0xf090
  Complete.
Recovering 0xf090
  Complete.
Analyzing 0xf310
  Complete.
Recovering 0xf310
  Complete.
Analyzing 0xf380
  Complete.
Recovering 0xf380
  Complete.
Analyzing 0xf450
  Complete.
Recovering 0xf450
  Complete.
Analyzing 0xf490
  Complete.
Recovering 0xf490
  Complete.
Analyzing 0xfba0
  Complete.
Recovering 0xfba0
  Failed (0xfba0:18, Unimplemented LLVM backend feature): LLVM backend does not yet support: fs.base
Analyzing 0xfe00
  Complete.
Recovering 0xfe00
  Complete.
Analyzing 0xfe30
  Complete.
Recovering 0xfe30
  Complete.
Analyzing 0xfe50
  Complete.
Recovering 0xfe50
  Complete.
Analyzing 0x10f20
  Complete.
Recovering 0x10f20
  Complete.
Analyzing 0x10fc0
  Complete.
Recovering 0x10fc0
  Complete.
Analyzing 0x11940
  Block: 0x11940: Unknown arguments to reopt_1_0x11700.
Analyzing 0x13280
  Block: 0x13280: Unknown arguments to reopt_1_0x119f0.
Analyzing 0x13390
  Complete.
Recovering 0x13390
  Complete.
Analyzing 0x14860
  Block: 0x14870: Unknown arguments to reopt_1_0x15ae0.
Analyzing 0x148a0
  Complete.
Recovering 0x148a0
  Failed (0x148a0:12, Unsupported function value): Recover r15 failed: Cannot lift relative addr segment1+0x24520
Analyzing 0x148c0
  Complete.
Recovering 0x148c0
  Failed (0x148c0:12, Unsupported function value): Recover r14 failed: Cannot lift relative addr segment1+0x24520
Analyzing 0x148e0
  Complete.
Recovering 0x148e0
  Failed (0x148e0:16, Unsupported function value): Recover r115 failed: Cannot lift relative addr segment1+0x24520
Analyzing 0x14920
  Complete.
Recovering 0x14920
  Failed (0x14920:16, Unsupported function value): Recover r19 failed: Cannot lift relative addr segment1+0x24524
Analyzing 0x14980
  Complete.
Recovering 0x14980
  Failed (0x14980:55, Unsupported function value): Recover r43 failed: Cannot lift relative addr segment1+0x24520
Analyzing 0x14a00
  Complete.
Recovering 0x14a00
  Failed (0x14a00:55, Unsupported function value): Recover r42 failed: Cannot lift relative addr segment1+0x24520
Analyzing 0x14af0
  Complete.
Recovering 0x14af0
  Complete.
Analyzing 0x14ba0
  Complete.
Recovering 0x14ba0
  Complete.
Analyzing 0x14bc0
  Complete.
Recovering 0x14bc0
  Complete.
Analyzing 0x14bd0
  Complete.
Recovering 0x14bd0
  Complete.
Analyzing 0x14bf0
  Complete.
Recovering 0x14bf0
  Complete.
Analyzing 0x14d40
  Complete.
Recovering 0x14d40
  Complete.
Analyzing 0x14d50
  Complete.
Recovering 0x14d50
  Complete.
Analyzing 0x14d70
  Complete.
Recovering 0x14d70
  Failed (0x14d70:14, Unsupported function value): Recover r130 failed: Cannot lift relative addr segment1+0x24520
Analyzing 0x14e10
  Complete.
Recovering 0x14e10
  Complete.
Analyzing 0x14e30
  Complete.
Recovering 0x14e30
  Failed (0x14e30:8, Unsupported function value): Recover rdi failed: Uninitialized value rdi
Analyzing 0x14e50
  Complete.
Recovering 0x14e50
  Failed (0x14e50:6, Unsupported function value): Recover rdi failed: Uninitialized value rdi
Analyzing 0x14fa0
  Complete.
Recovering 0x14fa0
  Complete.
Analyzing 0x14fb0
  Complete.
Recovering 0x14fb0
  Complete.
Analyzing 0x14fd0
  Complete.
Recovering 0x14fd0
  Complete.
Analyzing 0x14ff0
  Complete.
Recovering 0x14ff0
  Complete.
Analyzing 0x15000
  Complete.
Recovering 0x15000
  Complete.
Analyzing 0x15020
  Complete.
Recovering 0x15020
  Complete.
Analyzing 0x15040
  Complete.
Recovering 0x15040
  Complete.
Analyzing 0x15190
  Block: 0x15202: Unknown arguments to reopt_1_0x15060.
Analyzing 0x15230
  Complete.
Recovering 0x15230
  Complete.
Analyzing 0x156a0
  Block: 0x156bb: Unknown arguments to reopt_1_0x15250.
Analyzing 0x156c0
  Block: 0x15730: Unknown arguments to reopt_1_0x15250.
Analyzing 0x15750
  Block: 0x15800: Unknown arguments to reopt_1_0x15250.
Analyzing 0x15910
  Complete.
Recovering 0x15910
  Complete.
Analyzing 0x15b10
  Block: 0x15b10: Unknown arguments to strlen.
Analyzing 0x15b30
  Block: 0x15b30: Unknown arguments to dcgettext.
Analyzing 0x15c70
  Block: 0x15c70: Unknown arguments to reopt_1_0x15b70.
Analyzing _obstack_begin(0x16a80)
  Block: 0x16a80: Unknown arguments to reopt_1_0x169f0.
Analyzing _obstack_begin_1(0x16aa0)
  Block: 0x16aa0: Unknown arguments to reopt_1_0x169f0.
Analyzing _obstack_allocated_p(0x16bb0)
  Complete.
Recovering _obstack_allocated_p(0x16bb0)
  Complete.
Analyzing _obstack_memory_used(0x16c60)
  Complete.
Recovering _obstack_memory_used(0x16c60)
  Complete.
Analyzing 0x17010
  Block: 0x1701a: Unknown arguments to reopt_1_0x16cc0.
Analyzing 0x17230
  Complete.
Recovering 0x17230
  Complete.
Analyzing 0x17300
  Complete.
Recovering 0x17300
  Complete.
Analyzing 0x17340
  Block: 0x17340: Unknown arguments to nl_langinfo.
Analyzing 0x17550
  Complete.
Recovering 0x17550
  Complete.
Removing cycle (shift 1 252 <: shift 0 252)
Removing cycle (shift 0 213 <: shift 1 213)
Removing cycle (shift 0 197 <: shift 1 197)
Removing cycle (shift 0 185 <: shift 1 185)
Removing cycle (shift 1 144 <: shift 0 144)
Removing cycle (shift 0 295 <: shift 0 136)
Removing cycle (shift 16 130 <: shift 0 130)
Removing cycle (shift 0 294 <: shift 0 131)
Removing cycle (shift 0 295 <: shift 0 290)
Removing cycle (shift 16 124 <: shift 0 124)
Removing cycle (shift 0 316 <: shift 0 114)
Removing cycle (shift 16 113 <: shift 0 108)
Removing cycle (shift 0 323 <: shift 0 316)
Removing cycle (shift 16 324 <: shift 16 113)
Removing cycle (shift 0 323 <: shift 0 114)
Removing cycle (shift 16 102 <: shift 0 98)
Removing cycle (shift 16 333 <: shift 16 102)
Removing cycle (shift 0 341 <: shift 0 80)
Removing cycle (shift 0 342 <: shift 0 79)
Removing cycle (shift 0 341 <: shift 0 80)
Removing cycle (shift 0 342 <: shift 0 79)
Removing cycle (shift 0 345 <: shift 0 83)
Removing cycle (shift 0 346 <: shift 0 82)
Removing cycle (shift 0 353 <: shift 0 80)
Removing cycle (shift 0 354 <: shift 0 79)
Removing cycle (shift 0 370 <: shift 0 48)
Removing cycle (shift 0 371 <: shift 0 46)
Removing cycle (shift 0 371 <: shift 0 46)
Removing cycle (shift 1 44 <: shift 0 44)
Removing cycle (shift 16 12 <: shift 8 12)
Removing cycle (shift 0 296 <: shift 0 131)
Removing cycle (shift 0 376 <: shift 0 378)
Removing cycle (shift 0 373 <: shift 0 378)
Removing cycle (shift 0 373 <: shift 0 376)
Removing cycle (shift 0 387 <: shift 0 130)
Removing cycle (shift 0 393 <: shift 0 391)
opt: <stdin>:378:33: error: invalid forward reference to function 'reopt_1_0xe140' with wrong type: expected 'i64 ({ i8, i8 }*)*' but was '{}* ({ i8, i8 }*)*'
  %t5 = call { }* ({ i8, i8 }*) @reopt_1_0xe140({ i8, i8 }* %arg0)
                                ^

root@56d894b61629:~#

`opt` fails on `musl-gcc -static` binary

If you take this simple C program:

int main(void) {
  return 0;
}

And produce a statically linked binary using musl-gcc (obtained from here):

$ musl-gcc -static test.c -o test.exe

Then if I run reopt on it like so:

$ cabal run exe:reopt -- --header scratch/shed.h test.exe -o test.exe.exe

It eventually fails with:

opt: <stdin>:45:30: error: '@__libc_start_main' defined with type 'void (i64, i64, i64)*' but expected 'void (i64, i64, {}*)*'
  call void (i64, i64, { }*) @__libc_start_main(i64 4198713, i64 %t1, { }* %t3)

addMemWrite precision

The definition of addMemWrite in Data.Macaw.AbsDomain.AbsState will clear the stack at offsets where it knows that a user has written to the stack. However, it does not clear the stack information at arbitrary writes.

We should determine how much stack information is really needed in code discovery, and see if we can remove the stack information or significantly simplify it rather than track information imprecisely.

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.