[PATCH] D30550: ImportArguments analysis printer

Thomas Garnier via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 2 13:32:37 PST 2017


thgarnie created this revision.
Herald added a subscriber: mgorny.

Add a module pass that displays constants and simple constraints applied to integer arguments for imported functions. It can help to infer how an API is used.

For example, if the mmap and mprotect libc functions never use the PROT_EXEC flag; it can be assumed the module does not generate dynamic code.

It outputs a YAML format:

  caller:      check_set_after
  import:      externalfunction
  arguments:
    1:
      - type:            eq
        value:           3
  ...

This first commit outputs the collected information. Following changes will help drive the analysis to specific function and mark binaries matching specific constraints. I also plan to extend the constraints to strings.


https://reviews.llvm.org/D30550

Files:
  include/llvm/Analysis/ImportArguments.h
  lib/Analysis/CMakeLists.txt
  lib/Analysis/ImportArguments.cpp
  lib/Passes/PassBuilder.cpp
  lib/Passes/PassRegistry.def
  test/Analysis/ImportArguments/O0.ll
  test/Analysis/ImportArguments/O1.ll
  test/Analysis/ImportArguments/O2.ll
  test/Analysis/ImportArguments/O3.ll
  test/Analysis/ImportArguments/checks.txt
  test/Analysis/ImportArguments/lit.local.cfg
  test/Analysis/ImportArguments/source.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30550.90382.patch
Type: text/x-patch
Size: 44076 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170302/4c9a997e/attachment.bin>


More information about the llvm-commits mailing list