Skip to content
Snippets Groups Projects
  1. May 29, 2018
  2. Apr 22, 2018
    • Andrea Gussoni's avatar
      Introduce the Function Isolation Pass · cf42e497
      Andrea Gussoni authored
      This commit introduces the Function Isolation Pass. We use the
      information provided by the Function Boundaries Detection Pass to
      organize the code that `revamb` places inside the `root` function in
      different LLVM functions. To do this we obviously need to introduce some
      changes and tricks to handle the execution of the translated program.
      
      The main idea is to have two different realms (one where the isolated
      functions live, one in which we have basically the old root function).
      We start the execution from the realm of the *non isolated* functions,
      and we transfer, as soon as possible, the execution to the *isolated
      functions* realm. We then have a fallback mechanism to restore the
      execution in the right place in the *non isolated* functions realm, and
      so on.
      
      The largest change, besides the re-organization of the code in different
      functions, is the use of the exception handling mechanism provided by
      the LLVM framework in order to be able to manage the switch between the
      two realms.
      
      We also introduce the `support.h` header file, which contains a couple
      of definitions used by `support.c` and that need to be shared with some
      of the components involved in the translation process. We have defined
      some helper functions, directly in C, that we use both for handling the
      exception mechanism and for giving extra debug informations when an
      exception is raised.
      
      The `revamb-dump` utility now supports the `-i` option to specify the
      path were to save the new LLVM module.
      
      The `translate` utility now supports the `-i` option that produces a
      binary in which the function isolation has been applied.
      
      We also introduced some tests that apply the function isolation pass to
      the `Runtime/` tests already present. In this way we can verify that the
      translation and the following function isolation preserve the behavior
      of the program.
      
      When serializing the new LLVM module we regenerate the metadata used for
      debug purposes, and for doing this, since we not longer have only the
      `root` function, we have changed some details in the `DebugHelper` class
      in order to be able to emit the metadata for all the functions of our
      interest in a single shot.
      cf42e497
  3. Jan 28, 2018
  4. Jan 17, 2018
    • Andrea Gussoni's avatar
      Add checks for `no-pie` flag for cross-compilers · 0735acd2
      Andrea Gussoni authored
      The check to see if a compiler supports the `no-pie` flag was done only
      for the main C compiler, and not for the cross-compilers used for
      creating the executables for the different supported architectures.
      
      This commit introduces the aforementioned missing checks.
      
      In addition instead of hard-coding the flags to check in the CMakeLists
      file we have a list that we pass each time we instantiate a project for
      the cross-compilers, and we check for the availability of all the flags.
      
      In order to do this we need to apply a sort of serialization and
      deserialization to avoid the "unpack" of the list passed as argument to
      the external project (that is implemented as a `;` separated string).
      
      Also implemented a fix suggested in the merge request for a line that
      mistakenly added the `TEST_CFLAGS` variable to the `NO_PIE` variable.
      0735acd2
  5. Oct 28, 2017
  6. Aug 28, 2017
    • Pietro Fezzardi's avatar
      Add `-no-pie` to compiler flags · 55eb769a
      Pietro Fezzardi authored
      Add this flag to the flags used for Runtime tests and to the flags used
      in the translate script.
      
      Recent GCC versions (`gcc-7` and later) enable PIE by default, and
      `-fno-pie` apparently is not enough to disable it.
      55eb769a
  7. Aug 12, 2017
  8. Mar 31, 2017
    • Alessandro Di Federico's avatar
      Detect `try`/`catch` landing pads · d8f13c79
      Alessandro Di Federico authored
      Landing pads are basically the `catch` blocks in C++ `try`/`catch`
      statements. So far we were missing them since they are encoded in a
      particular way in a way similar to DWARF debugging information in the
      `.eh_frame` and, more specifically, in the `.gcc_except_table` sections
      of ELF programs.
      
      This commit parses these sections so that the basic blocks associated to
      landing pads are correctly identified. Personality functions are
      detected too. A test is also introduced to assess the effectiveness of
      our code.
      d8f13c79
  9. Mar 29, 2017
  10. Dec 08, 2016
    • Alessandro Di Federico's avatar
      c4221f1a
    • Alessandro Di Federico's avatar
      Introduce tests for the analyses · f6b61384
      Alessandro Di Federico authored
      So far we only had end-to-end functionality testing. This commit
      introduces a new part of the testsuite which allows to verify quickly if
      the results that a certain analysis should give are changed or not. This
      is vital to be able to make larger changes.
      
      So far the test suite is composed by the most difficult case we support
      (the uClibc ARM memset) and the typical lowering of switch statements
      for ARM, MIPS and x86-64.
      
      I'm so happy now.
      f6b61384
  11. Dec 03, 2016
    • Alessandro Di Federico's avatar
      Improve testsuite · a7f10979
      Alessandro Di Federico authored
      * Add a label for runtime and analysis tests
      * Add support for per-test custom compile flags
      a7f10979
    • Alessandro Di Federico's avatar
      Reorganize testsuite · f67f7aef
      Alessandro Di Federico authored
      So far the only tests we had were end to end tests to assess the
      functionality of simple programs and, in particular, certain helper
      functions. In the perspective of being able to test individual features,
      and in particular check that we have no regressions in our analyses, we
      isolated these end to end tests in the Runtime directory. We kept in the
      root test directory the mechanism to compile a binary for a certain
      architecture so that all the test types can use it.
      f67f7aef
    • Alessandro Di Federico's avatar
    • Alessandro Di Federico's avatar
      Isolate ELF code and remove architecture parameter · 83ea2caa
      Alessandro Di Federico authored
      This commit removes all the ELF-specific code from the `CodeGenerator`
      class by creating a new class, `BinaryFile` which contains all the
      information about the program that might be needed in an image format
      independent way. However, `BinaryFile` has some fields which are
      specific to ELF, we might want to address this when additional file
      formats are supported.
      
      A key benefit of isolating this code is that we can anticipate the
      parsing of the input file, so that we have its architecture available
      earlier than when `CodeGenerator` is instantiated, therefore we can drop
      the `--architecture` parameter.
      83ea2caa
  12. Sep 22, 2016
    • Alessandro Di Federico's avatar
      Improve installation · d4871549
      Alessandro Di Federico authored
      * Use "$ORIGIN/../lib/" as RPATH when linking the installed binary
      * Install also support material such as "support.c"
      * Import the `translate` script for easy end-to-end translation
      d4871549
    • Alessandro Di Federico's avatar
      Make revamb portable · 59c871af
      Alessandro Di Federico authored
      Add different search paths for QEMU components, in paritcular relative
      to the program's path.
      Also, install the revamb.
      59c871af
  13. Sep 20, 2016
  14. Sep 17, 2016
  15. Aug 20, 2016
  16. Apr 14, 2016
    • Alessandro Di Federico's avatar
      `support.c`: introduce `unknownPC` plus fixes · b74f09ca
      Alessandro Di Federico authored
      `unknownPC` is an extern function we expect to be linked to the output
      which is called when we have to crash due to an unexpected jump target.
      
      * Remove unused references to register variables, now only need the
        stack pointer
      * Fix bug in how the auxiliary values were pushed on the stack.
      * Push 0 HW_CAPs
      * Implement some glib's functions
      b74f09ca
  17. Jan 30, 2016
    • Alessandro Di Federico's avatar
      Let tests run from `_start` · c8274af3
      Alessandro Di Federico authored
      c8274af3
    • Alessandro Di Federico's avatar
      Prepare stack for the translated program · 32b75651
      Alessandro Di Federico authored
      * Create 3 constant global variables (`phdr_address`, `e_phentsize` and
        `e_phnum`) in the IR which will be used to populate the auxiliary
        vectors at run-time.
      * Update compile options for `support.c` to ignore useless warnings and
        enable debug information
      * Implement in `support.c` some functions required by QEMU run-time and
        other cleanups to make it compatible with programs translated from
        `_start`, not `root`
      * Implement in `support.c` the `prepare_stack` function, which
        initializes the base of the stack with environment variables,
        arguments and auxiliary vectors
      * Improve syscall support
      32b75651
    • Alessandro Di Federico's avatar
      71f91967
  18. Jan 12, 2016
  19. Jan 09, 2016
    • Alessandro Di Federico's avatar
      Simplify command line usage exploiting ELF info · d510fea8
      Alessandro Di Federico authored
      * s/`importGlobalData`/`parseELF`/
      * Save the entry point specified in the ELF header, which will be used
        if the user doesn't provide an address.
      * Let parse `parseELF` take care of informing libtinycode about what
        has to be mmap'd and where.
      * Remove some support scripts used during testing, now no longer
        necessary.
      * Various cleanups
      d510fea8
Loading