Commit Graph

24 Commits

Author SHA1 Message Date
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
Peter Goodman 31f267bd5f Cmake refactor (#693)
* Update to latest remill APIs and way of using CMake.

* Minor fixes

* Bug fixes for AArch64

* Tweaks

* Adds some nifty functionality useful for debugging some aarch64 bugs

* Fixes a subtle bug

* Bug fixes

* Make the test suite use explicit args

* Bug fix in xrefs

* Disable tests for now
2020-09-22 23:22:56 -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 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 fd3bce8809 Issue 395 abi libs complex numbers (#436)
* -abi-libraries can work with function returning complex types

* -abi-libraries can now work with most functions taking complex numbers

* Code style improvements

* LLVM 3.5 compatibility

* long double complex numbers are now correctly passed to external function

* Code style changes, fix of float complex return for 64bit

* Older version of llvm allow pointer to be casted to type it is pointing to

* Add option to return integers in two registers if calling convention supports it.

* Byval attribute fix, small code style changes

* Floats are now correctly unpacked from xmm

* Add test for basic calls into complex.h

* Complex number test is now C-program

* Adding new prebuilt CFGs for unit tests

* WIP: Rework. Vector type is now one of the "simple" types. Easier code structure to support vector types in external libs

* Skeleton for vector passing

* WIP: Unpolished version of remake of constrant tables. Add constraint table also for return variables

* Code style changes, some small reworks.

* Incompatible return type now ends with error message instead of crash

* Code style

* Tables with information about registers used by different calling conventions are created only once.

* Changed severity of log, default for reg vectors are now xmm

* Win64 now uses only 4 registers to transfer arguments

* Code style improvements

* CallingConventionInfo now initialize ConstraintTable/s for specific gArch

* Remove kNoArgs since ConstraintTable can now use std::vector::size()

* Fixed iteration of ext_func arguments

* 32bit can now return i64 via two registers

* Code style
2018-08-30 16:12:31 -04:00
Peter Goodman 28265c4a8f Fixes to report not having a name for a variable segment, but not crashing on the condition. 2017-10-10 12:01:46 -04:00
Peter Goodman d0ae6e941c Minor fix to the reg state printer. Moved the TLS base pointer code into Arch/ABI, as it's more arch/os-specific. 2017-08-26 12:56:38 -04:00
Peter Goodman 7498b2d1ae Initial support for TLS. Some stuff is still not working, also it
is not thoroughly tested.
2017-08-24 22:52:36 -04:00
Peter Goodman 497d4dbe04 Pretty substantial changes. I removed --partition_segments. Now all idautils.Entries that are in the data sections are treated as segment split points. This is all to handle Apache, which exports its symbols to its shared libs (apr and apr-util). 2017-08-23 00:10:49 -04:00
Peter Goodman 89c42a3e42 Support for jump offset tables in the bitcode. Different handling of ELF GOT pointers. It might still be a bit wonky for stdin/stdout.. not sure. 2017-08-22 13:05:20 -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 bc84b2f56c Improvements to handling lifting of statically linked ELFs that also have thunks in them. Bug fixes. 2017-08-14 23:29:54 -04:00
Peter Goodman 834adb7991 More progress on calling convention stuff. Moved some existing code around. Added implementations for the runtime argument getting stuff. Added functions for setting the return value. Not well tested. (#267) 2017-07-10 11:57:10 -04:00
Peter Goodman 939f408d69 Lifting and recompiling a simple hello world program is working. This uses a new runtime that does more direct register conversion between lifted and native. Updated the .gdbinit debugging script to work using the remill State structure. 2017-05-01 22:51:41 -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
Peter Goodman 23ef38c7c0 Things are moving steadily forward. Redid all cfg proto stuff, and am bringing the get_cfg.py script back up to producing all relevant info. 2017-04-05 23:20:41 -04:00
Peter Goodman 30e3c86e48 Improved jump table handling and started implementing jump table (via switch inst) support on the C++ side of things. Removed some optimization passes; it seems as though the instruction combining pass of llvm injected lots of undefs into the code, which resulted in all the things optimizing themselves away. 2017-03-31 23:37:16 -04:00
Peter Goodman dcaaa8683b Makign great progress on various forms of reference resolution. 2017-03-29 00:10:22 -04:00
Peter Goodman 0441f95426 Updated copyright messages. Added namespace mcsema 2017-03-24 19:33:54 -04:00
Peter Goodman f17266f985 Making progress towards initial lifting 2017-03-23 23:23:49 -04:00
Peter Goodman 661174afba Reorg x86 files (#155)
* Initial move of some of the files

* Rename the semantics files.

* Moves more stuff, adds some files, removes others, fixes include paths.

* Addresses comments
2017-03-08 11:10:07 -05:00
Peter Goodman bcda6a120a Llvm38 (#112)
* - Upgrade to official llvm 3.8
- remove boost
- unify all cmake files into a single cmake file
- use official protobuf
- start factoring out x86-specific stuff to eventually make an arm port easier
- simplify the CLI; now use mcsema-lift, with -arch, -os, -cfg, -entrypoint, and -o. No more having to specify the target triple.
- moves source code slightly closer to our style guide

Note:
- lifted bitcode is not quite right in some cases, so this isn't a stable branch!
- TODO: re-add test cases to discover source of stability problems.

* Some minor fixes, one to make sure xmm regs in the state struct are properly aligned

* Added missing std defs for option parsing. This makes /bin/ls work properly :-)

* Remove old cmake files

* Minor changes to get_cfg.py and raiseX86.cpp in relation to those changes. Those changes don't fix anything, the purpose was to make symbol names for things match between python and cpp. E.g. get_cfg would name things like dta_0xf00, sub_0xf00, ext_... And it seems that it was dta_ instead of data_ for a reallly flaky and dumb reason but oh well. I also fixed a subtle bug related to saving and restoring of callee saved registers on elf 64. I have not made related changes to elf 32 or pe 32/64, though those may be necessary.

* Minor fix

* Adding mcsema-disass, which is a nice wrapper around get_cfg.py.

* Working on readme and cleaning out (currently) unused stuff from the repo

* Renaming mc-sema dir to mcsema

* new travis file

* Updates to bootstrap and build process

* Minor bootstrap fixes

* Well, don't have windows working yet but this is kind of progress I think

* Travis should work now

* Updating protobuf-cmake files so we can generate a VS2015 solution

* Removing and adding some choco packages from README

* Bootstrap now builds protobuf and generates protobuf files
LLVM should now be built on Windows

* Adding Win32 specific compiler options

* Renamed ConstantInt to CreateConstantInt to satisfy MSVC

* Build Release LLVM to not have linking conflicts of MD vs MDd

* Added some missing instructions

* Adding changes to generate runtimes

* Windows bootstrap works.
2017-02-23 13:23:31 -05:00