-
Notifications
You must be signed in to change notification settings - Fork 147
Backend Rust/Foreign Language Support #69
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
Open
julihoh
wants to merge
42
commits into
eurecom-s3:master
Choose a base branch
from
AFLplusplus:main
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 16 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
58ec03e
add new runtime that compiles to static library and contains only com…
julihoh d23f876
add the common only runtime library to installation output of cmake
julihoh 3968841
make cmake call cargo instead of cargo calling cmake
julihoh 1613c78
common backend is now the rust backend
julihoh b67b70a
delegate call stack tracing to rust runtime
julihoh f1c6b0e
move panic mode configuration to cmake script
julihoh e243f9a
re-implement rust backend to support GC and _sym_bits_helper
julihoh 1346fca
pass gc information as array instead of of single values
julihoh 8840fda
Merge branch 'eurecom-s3:master' into main
andreafioraldi 2b62059
fix missing include
julihoh ec05367
switch to building the rust backend into a static archive
julihoh ba0aeac
fix rust runtime header
julihoh 1a1bf95
use more convenient types for rust runtime
julihoh 8b35ef8
cleanup
julihoh f44262f
fix RuntimeCommon.h includes
julihoh 45cde02
fix c+p bug in rust runtime (inadverntently turgnin trunc in zext)
julihoh 3133c0b
Move to clap3 (#2)
domenukk 08c29c5
Adds handling for afl-showmap failures, to avoid crashing the entire …
WilliamParks 8f87bba
Merge remote-tracking branch 'eurecom/master'
domenukk 5cccc33
more less bugs
domenukk b103c54
Merge upstream (#3)
julihoh 76d4e26
adapt rust runtime to api changes from upstream (#4)
julihoh 2a3229d
Follow up #4 (#5)
julihoh a42e95e
Fix naming for afl++
domenukk 379061f
merge
tokatoka bee13da
Update: qsym_backend
tokatoka 6e1a055
Merge pull request #7 from AFLplusplus/eurecom-s3-master
tokatoka 5cb76f1
add
tokatoka 6909c3f
Merge pull request #8 from AFLplusplus/upd
tokatoka d3870f3
Merge branch 'eurecom-s3:master' into main
tokatoka fa54463
remove extern block
tokatoka 7caf6aa
endif
tokatoka 27734ff
FMT
tokatoka 019a226
Merge pull request #10 from AFLplusplus/no_extern
tokatoka 5db9e6b
include
tokatoka 1e8f02b
boolean?
tokatoka 950ab01
fmt
tokatoka 2d16373
Merge pull request #11 from AFLplusplus/cpp_to_c
tokatoka 4898f5b
revert
tokatoka 6010402
Merge pull request #12 from AFLplusplus/revert
tokatoka f33f679
Merge branch 'eurecom-s3:master' into main
tokatoka 1330e29
Update rust backend (#13)
tokatoka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # This file is part of SymCC. | ||
| # | ||
| # SymCC is free software: you can redistribute it and/or modify it under the | ||
| # terms of the GNU General Public License as published by the Free Software | ||
| # Foundation, either version 3 of the License, or (at your option) any later | ||
| # version. | ||
| # | ||
| # SymCC is distributed in the hope that it will be useful, but WITHOUT ANY | ||
| # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | ||
| # A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License along with | ||
| # SymCC. If not, see <https://www.gnu.org/licenses/>. | ||
|
|
||
| add_library(SymRuntime STATIC | ||
| ${SHARED_RUNTIME_SOURCES} | ||
| Runtime.cpp) | ||
|
|
||
| target_include_directories(SymRuntime PRIVATE | ||
| ${CMAKE_CURRENT_SOURCE_DIR} | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/..) | ||
|
|
||
| set_target_properties(SymRuntime PROPERTIES COMPILE_FLAGS "-Werror") | ||
|
|
||
| INSTALL(TARGETS SymRuntime) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # SymCC Rust Runtime | ||
|
|
||
| This runtime is a wrapper around a stripped down runtime which can be implemented in Rust (or any other language). | ||
| This wrapper implements Garbage Collection like the the Simple and QSym runtimes and implements the `_sym_bits_helper`. | ||
|
|
||
| The functions that are left to be implemented by the wrapped runtime are defined in `RustRuntime.h` and mirror those which are defined in `RuntimeCommon.h` except for having new name prefixes and missing those which are related to memory management and utilites. | ||
|
|
||
| ## GC implementation | ||
| The GC implementation works by keeping track of all expressions that the wrapped runtime generates and calling a new method (`_rsym_expression_unreachable(RSymExpr)`) for each expression that became unreachable in terms of the GC. | ||
| The details of this implementation are the same as those of the Simple backend (it's a straight copy). | ||
|
|
||
| ## Bits Helper | ||
| The bits helper is implemented by embedding the number of bits inside the expression pointer. | ||
| Specifically, the least significant byte contains the bit width of the expression. | ||
| Boolean expressions have a bit width of 0. | ||
| The actual expression pointer is shifted towards the MSB to make space for the bit width. | ||
| This reduces the amount of available bits in the expression pointer by 8. | ||
| The runtime panics if an expression pointer is returned that would not fit, but this is not expected on 64-bit systems. | ||
| (On 32-bit systems this may be a problem, but at this point, we don't care about 32-bit.) | ||
|
|
||
| On a high level, this means that there are two `SymExpr` types now: `SymExpr`, which is used by the wrapper, and `RSymExpr`, which is used by the wrapped runtime. | ||
| The wrapper takes care of translating between the two representations as necessary. | ||
|
|
||
| The wrapper also takes care of maintaining the correct bit widths by calculating the resulting width when a width-changing instruction is encountered. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: I think it would make sense to rename the backend in a way that prevents confusion with a possible future backend for analyzing Rust programs (as opposed to your approach of enabling a backend implemented in Rust).