Commit Graph

33 Commits

Author SHA1 Message Date
Eric Kilmer aa49fcc4fb Support LLVM 11 (#729)
* Add guards based on LLVM version for 11 compatibility

* Use remill LLVM 11 compat headers

* CI support for LLVM 11
2021-02-13 11:22:32 -05:00
Peter Goodman b0f7790f43 Sparc support (#709)
* Adds sparc support; formats files

* Update the readme and walkthrough

* Minor tweaks to readme/walkthrough

* Update ci.yml
2020-11-05 12:59:20 -05:00
Artem Dinaburg f5aa430e3a Detailed Version Information (#684)
Emit version information with git commit hash, commit date, message, and author.
2020-08-11 02:03:37 -04:00
Peter Goodman c002b8505c Formats the code with clang-format and my additional stylistic mojojojo (#682) 2020-08-05 16:14:01 -04:00
Peter Goodman 2d55d02cc3 API improvements. Must be used with the api_improvements branches of Remill and Anvill (#666)
* API improvements. Must be used with the api_improvements branch of both Remill and McSema

fixes for x86 and running the lifted code with klee

* Update dockerfile to clone anvill

* update remill commit id

* Add python3 to dockerfile

* update python3

* disable abi script

* Updated cmake to find anvill

* Update main.cpp

* update find_package for anvill

* WIP:updated prebuild cfg

* update prebuild cfg files

* enable abi build for testsuite

* Fix memory leak

* install missing package for testcases

* frontend: Reflect cfg file changes in dyninst frontend.

* frontend: Update local files copyrights to reflect overall change to agplv3.

* fix failing testcases

* update test cfgs

* Fix test failure with local state pointer

* set the flag to use local state_ptr in default mode

Co-authored-by: kumarak <iit.akshay@gmail.com>
Co-authored-by: Lukas Korencik <xkorenc1@fi.muni.cz>
2020-07-23 02:14:56 -04:00
Aiethel 797dbf152b lift: Fix bug with ABILoader options attribute lifetime. (#629) 2020-02-21 19:16:28 -05:00
Aiethel 8ecfe165ef Various improvements (#628)
* bc: Inline calls to semantic functions and wrappers manually.

* bc: Inline calls to semantics and wrappers only if some flags are set.

* Refactor code that is responsible for abi libs loading.

* Wrap global pointers in RAII.

* Update .remill_commit_id

Co-authored-by: Peter Goodman <peter.goodman@gmail.com>
2020-02-10 13:20:05 -05:00
Peter Goodman 46362c1f69 Function annotations (#619)
* Annotate lifted functions

* Annotate and Tie entrypoints

* Annotate external functions

* Annote _attach_call

* Update comments

* Simplify code that generated VerifyRegState

Co-authored-by: Aiethel <korencikl@gmail.com>
2020-01-08 17:35:35 -05:00
Aiethel 0e11aa0a7d Refactor abi libs loading (#596)
* lift: Filter function from abi_libs based on other flags

* lift: C++11 compatibility

* lift: Change severity of logs when IR prototype of ext function is not used.
2019-10-27 23:29:48 +01:00
Peter Goodman 782bd1dcfa Update for new remill APIs (#595)
* Update for new remill APIs

* Update remill commit id

* Cleanups

* resolved one issue
2019-10-27 17:48:43 -04:00
Peter Goodman 03c6acae4b Tries to address Issue #432, by searching for the location of the ABI… (#433)
* Tries to address Issue #432, by searching for the location of the ABI library.

* Update .remill_commit_id
2018-07-06 11:56:01 -04:00
Dushyanth Chowdary ef14c57492 Show usage message for mcsema-lift (#417)
* Added usage for mcsemma_lift

* remove tabs

* change exit status after usage message

* print using gflags program usage
2018-06-05 23:10:53 -04:00
kumarak fffbb0e30b Missing llvm.global_ctors from the lifted bitcode (#405)
* Check for the global ctors/dtors during ABI library unload

* Add std::terminate to std-def list

* Fix integration test
2018-04-19 22:50:02 -04:00
kumarak a3483e4bf1 C++ exception handling support (#391)
* Initial changes to parse the eh_frame and exception table

* linearly scan the function to find missing blocks

* Update protobuf format for lp; need to tag instructions or basic blocks to associate it with the lp

* tag instructions with lp; removed debug logs

* updated comments and protobuf; use utility functions for pointer size;

* travis build failure; make lp_ea optional field

* Collect the exception handling bb chunks; Create a passthrough for the lifted landingpad;

* Generate the passthrough IR and attach the landing pad with function invoke

* Generate the eh_frame/exception table and add personality function with one raising the exception.

* catch/cleanup wrapper for the exception handling; Disable CFG simplification pass temporarily for invoke inst;

* invoke wrapper to fix stack and base pointers

* recover type indices of the exception type

* fix exception table offset

* Add the function definition for setting the rsp/rpb correctly after eh return;

* Changes for abi_library support in exception handling

* Remove unwind attribute from ext_* functions to generate eh table

* Support the lifting of multiple exception types thrown;

* Fix the multiple declaration of personality function in lifted bitcode;

* Add --recover_exception flag to lift the exception table

* Update the list of external functions with c++ ABI's; Fix basic block split issue for exception chunks;

* Weak linkage for external function causing the garbage value for out_of_range destructor. Temporarily disabled;

* cleanup redundant changes and resolve conflicts

* Update --std-defs list with the c++ exception ABIs

* Fix merge fail

* exception test binaries for integration test; Move to clang++ for recompiling the bitcode.

* Fix the exception handling support for llvm 3.5

* Disable the optimization passes for the function having landingpad;

* Temporary changes to add ABI libraries for exception tests.

* Remove the noreturn attribute to fix the problem with -03 optimization

* review comment changes

* Change wrapper function name across invoke;

* review changes

* Updated comments text

* Remove duplicate clauses from the list; Add arguments for personalityfn and fix review comments.

* Update the flag name to --exception_personalityfn;

* Update the flag name to --exception_personality_func;

* Follow the variable naming convention;

* Update comments

* travis build fix for unused variable

* Create the map of type indices from original binary. Runtime routine to fix the RDX with correct type index;

* Add _Unwind_Resume to --abi_libraries functions list;

* Update comments & code restructure

* Exception handling changes and utility functions for 32 bit;

* DWORD for 32-bit system
2018-04-12 14:05:45 -04:00
artemdinaburg 29d9952b43 Suport multiple ABI libraries on command line (#388)
* Convert --abi_library to --abi_libraries

* Change path delimeter to ','
2018-03-29 14:04:56 -04:00
kumarak 1cc571b11f Support for --abi_library flag to call the external functions with explicit arguments. (#387)
* Add initial support for --abi_library flags

* support for abi_library

* Remove the weak linkage for __mcsema_debug_get_reg_state.

* Fix num of agruments for __cxa_allocate_exception

* Remove --library flag and cleanup

* Don't reload/overwrite mcsema::gModule after loading in the protobuf.

* Use PrepareModuleDataLayout to avoid checks for __remill_basic_block function.

* Bump the remill commit id to support --abi_library flag

* Fix travis build failure

* Initialize the test log filename;

* trim newline char from the eof
2018-03-22 11:09:13 -04:00
Peter Goodman 8a9856ada3 Klee maze example (#369)
* In progress. Working on an example of using KLEE on a Maze, but with the maze program being compiled to x86, amd64, and aarch64.

* Making lots of progress on getting lifting and runnning an aarch64 maze program on amd64, but using --explicit_args. The key thing I'm working through right now is a jump offset table, but where the offset is a block pc, rather than a table base. Also adding various bits of code here and there to making runnning with klee more directly doable, and working on a debugging facility to track down when the emulated program counter gets out of sync with the original program.

* Fixed a subtle @PAGE and @PAGEOFF-related reference bug on AArch64. Partially disabled the special jump offset table handling I had in table.py, as it doesn't (yet) handle the shifted table values. However, I still have the code there, so that it can recognize that a basic block address is used as a possible offset, so that I can remove the block address as a reference, which permits a new heuristic on the C++ side to work. On the C++ side, when there's a jump instruction that isn't associated with a cross-reference flow, I try to auto-augment it with addition switch cases, targeting blocks with no predecessors (as present in the CFG). This seems to work reasonably well.

* Improved the scripts and updated the READMEs.

* Minor rephrase

* Minor rephrase
2018-01-13 23:47:55 -05:00
Peter Goodman a9fd609eea Fixes an issue where we assume that every symbol in the module passed to --library is external, whereas that's false. (#368) 2018-01-10 12:24:20 -05:00
Mike Myers f17d36956d Bring back the mcsema-lift option for --list-supported (#365)
* Bring back the mcsema-lift option for --list-supported

* Discard changes to whitespace from last commit.
2018-01-05 18:08:20 -05:00
Peter Goodman e237b56055 Adding missing docstring stuff, and comments in the code about the options available. (#362) 2017-12-27 18:47:32 -05:00
Peter Goodman 57b864008c Thunk resolution (#315)
* Fixes some issues related to not identifying thunks anymore. @kumarak please review and do your own internal testing.

* Adds --library command-line option, which can be used to link in declarations from another bitcode file.

* Minor fix for llvm 3.6 compatibility.

* Possible fix to issue where a native var address is left uninitialized.

* fixed issue in resolving data references for apache

* Update get_cfg.py

Remove some debug statements.
2017-11-08 14:34:57 -05:00
Peter Goodman bf62bb3807 Updated the reg tracer PIN tool so that its output more closely matches the output from lifted bitcode. This required special handling of REP-prefixed instructions and thunks. This commit should fix issue #285. Added some checks to avoid treating certain kinds of data embedded in code sections as code. This came up with some windows DLLs. Played around with the reference-adding and string-adding heuristics. The most recent SQLite3 bug was due to a reference being added where it shouldn't have been. SQLite3's .databases command still does not do the right thing, though. 2017-09-15 00:54:31 -04:00
Peter Goodman 8b465717e4 Made the pc annotation configurable, and auto-set when --legacy_mode is enabled 2017-08-23 12:49:01 -04:00
Peter Goodman df1678412b Adds support for --legacy_mode, where drivers are added for the entrypoint and the callbacks 2017-08-18 15:09:25 -04:00
Peter Goodman 18abc11714 Added new --legacy_mode operation that tries to produce bitcode that is more similar to old bitcode. Also updates get_cfg.py to disassemble in such a way that mcsema2 will be able to support global variable recovery as though they were distinct segments 2017-08-16 23:06:53 -04:00
Peter Goodman e4d87c7154 Updates to some API changes in remill. 2017-08-04 15:27:13 -04:00
Peter Goodman c1bd1668f4 Minor fixes here and there. May not yet build! 2017-05-25 11:00:02 -04:00
Peter Goodman b20883da7a Adjusted line lengths 2017-05-01 22:57:15 -04:00
Alessandro Gario 8b57bc7bf4 mcsema-lift: Added a -dumpcfg option to print the CFG contents to screen. (#252)
* mcsema-lift: Added a -dumpcfg option to print the CFG contents to screen.

* Style changes (see details).

 o Renamed --cfgdump to --cfg_dump
 o Moved the PrintVersion/DumpCFG functions in the anonymous
   namespace at the top of the file.
 o Only show lifted names when the native name is not available.
 o Deserialize the CFG file only once.
2017-05-01 22:22:36 -04:00
Peter Goodman 5e508962f8 Fixes for lifting. Simple lifted binaries can now be recompiled when using the alessandro/refactor/llvmmultiversion-cmake branch of remill as a base. 2017-04-29 22:06:24 -04:00
Peter Goodman fd20ddf914 Changes to make things compile again. 2017-04-22 16:56:58 -04:00
Peter Goodman c6595839b3 Minor fixes 2017-04-18 17:37:50 -04:00
Peter Goodman 93b4aa56b4 WIP. Modified license to apache 2.0 to follow remill, also most code is new anyway. 2017-04-15 16:27:35 -04:00