Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of the JacoDB interpreter #18

Merged
merged 26 commits into from
Jun 29, 2023
Merged

Implementation of the JacoDB interpreter #18

merged 26 commits into from
Jun 29, 2023

Conversation

sergeypospelov
Copy link
Member

@sergeypospelov sergeypospelov commented May 22, 2023

This PR adds an initial support of the JVM byte-code analysis. In addition, simple search strategies DfsPathSelector, BfsPathSelector and combinators were implemented, as well as TargetsCoveredStoppingStrategy. Also, some minor refactorings in usvm-core were made.

The PR includes some tests, comments and lots of TODOs in the code. The supported features and known issues are listed in #25.

Details

The overall architecture is very similar to the sample-language analyzer.

The JVM interpreter is based on JacoDB 3-address code, which is very similar to well-known Soot Jimple representation.

JcMachine

JcMachine is an entry point of analysis, and it takes a JcClasspath as a dependency. Some varying features, like search strategy, are hard-coded for simplicity now.

JcApplicationGraph

JcApplicationGraph is a wrapper for JacoDB application graph, which simply delegates calls to it.

JcState

JcState extends UState with a JcMethodResult field, which represents a current result of a method execution, other components are the same.

JcInterpreter

JcIntepreter is very similar to SampleInterpreter, except that it isn't responsible for handling calls. It also provides an initial support for handling exceptions, but without catch blocks now.

JcExprResolver

JcExprResolver performs an actual symbolic execution, handling all JcExpressions. The primitive types are handled based on their size, meaning that, e.g. char is represented by bit-vectors of 16 bits. There is a known issue in JacoDB about incorrect types for operations with integrals like char or short, so some tests are disabled now.

Changes in usvm-core

  • Regions for an input arrays are now constructed from a UHeapRef and USizeExpr, instead of just a USizeExpr
  • UReadOnlyMemoryInterface implemented by UMemoryBase and UModelBase
  • Refactored URegistersStack a little bit
  • UArrayLengthLValue
  • Some minor fixes

TODO:

  • Description
  • Tests
  • Evaluation
  • Comments

@sergeypospelov sergeypospelov changed the title Implementation of JacoDB interpreter Draft: Implementation of JacoDB interpreter May 23, 2023
@sergeypospelov sergeypospelov marked this pull request as draft June 9, 2023 14:54
@sergeypospelov sergeypospelov force-pushed the sergey/jvm branch 4 times, most recently from 02ae0b8 to 36d969f Compare June 15, 2023 15:22
@sergeypospelov sergeypospelov marked this pull request as ready for review June 20, 2023 19:24
@sergeypospelov sergeypospelov changed the title Draft: Implementation of JacoDB interpreter Implementation of the JacoDB interpreter Jun 20, 2023
@sergeypospelov sergeypospelov requested review from CaelmBleidd and removed request for dvvrd June 21, 2023 09:38
@CaelmBleidd CaelmBleidd merged commit afdc9e2 into main Jun 29, 2023
korifey pushed a commit that referenced this pull request Jul 12, 2023
Co-authored-by: Alexey Menshutin <alex.menshutin99@gmail.com>
korifey pushed a commit that referenced this pull request Jul 12, 2023
Co-authored-by: Alexey Menshutin <alex.menshutin99@gmail.com>
korifey added a commit that referenced this pull request Jul 13, 2023
* First version of logging for usvm

* Implementation of the JacoDB interpreter (#18)

Co-authored-by: Alexey Menshutin <alex.menshutin99@gmail.com>

* New path selectors infrastructure (#29)

* Add general framework for weighted searchers

* Add tests for AA-tree and discrete PDF

* Little typo fix in tests

* Add shortest distance to targets weighter

* Add random tree path selector

* Add fork depth path selector

* Fix interleaved path selector

* Add comments and some new java tests, infrastructure fixes

* PR comments fixes, add solver type and timeout options

* First version of logging for usvm

* synchronize with master

---------

Co-authored-by: Sergey Pospelov <sergeypospelov59@gmail.com>
Co-authored-by: Alexey Menshutin <alex.menshutin99@gmail.com>
Co-authored-by: Maksim Parshin <mxprshn@gmail.com>
@sergeypospelov sergeypospelov deleted the sergey/jvm branch July 17, 2023 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants