Skip to content
Open
Show file tree
Hide file tree
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 Jun 7, 2021
d23f876
add the common only runtime library to installation output of cmake
julihoh Jun 8, 2021
3968841
make cmake call cargo instead of cargo calling cmake
julihoh Jun 17, 2021
1613c78
common backend is now the rust backend
julihoh Jun 18, 2021
b67b70a
delegate call stack tracing to rust runtime
julihoh Jun 18, 2021
f1c6b0e
move panic mode configuration to cmake script
julihoh Jul 1, 2021
e243f9a
re-implement rust backend to support GC and _sym_bits_helper
julihoh Jul 16, 2021
1346fca
pass gc information as array instead of of single values
julihoh Jul 16, 2021
8840fda
Merge branch 'eurecom-s3:master' into main
andreafioraldi Jul 19, 2021
2b62059
fix missing include
julihoh Jul 26, 2021
ec05367
switch to building the rust backend into a static archive
julihoh Jul 26, 2021
ba0aeac
fix rust runtime header
julihoh Jul 28, 2021
1a1bf95
use more convenient types for rust runtime
julihoh Jul 28, 2021
8b35ef8
cleanup
julihoh Jul 29, 2021
f44262f
fix RuntimeCommon.h includes
julihoh Jul 29, 2021
45cde02
fix c+p bug in rust runtime (inadverntently turgnin trunc in zext)
julihoh Aug 2, 2021
3133c0b
Move to clap3 (#2)
domenukk Jan 4, 2022
08c29c5
Adds handling for afl-showmap failures, to avoid crashing the entire …
WilliamParks Mar 26, 2022
8f87bba
Merge remote-tracking branch 'eurecom/master'
domenukk Mar 26, 2022
5cccc33
more less bugs
domenukk Mar 27, 2022
b103c54
Merge upstream (#3)
julihoh Nov 19, 2022
76d4e26
adapt rust runtime to api changes from upstream (#4)
julihoh Nov 19, 2022
2a3229d
Follow up #4 (#5)
julihoh Nov 19, 2022
a42e95e
Fix naming for afl++
domenukk Jan 4, 2023
379061f
merge
tokatoka Oct 20, 2023
bee13da
Update: qsym_backend
tokatoka Oct 20, 2023
6e1a055
Merge pull request #7 from AFLplusplus/eurecom-s3-master
tokatoka Oct 20, 2023
5cb76f1
add
tokatoka Oct 20, 2023
6909c3f
Merge pull request #8 from AFLplusplus/upd
tokatoka Oct 20, 2023
d3870f3
Merge branch 'eurecom-s3:master' into main
tokatoka Dec 21, 2023
fa54463
remove extern block
tokatoka Jan 4, 2024
7caf6aa
endif
tokatoka Jan 4, 2024
27734ff
FMT
tokatoka Jan 4, 2024
019a226
Merge pull request #10 from AFLplusplus/no_extern
tokatoka Jan 4, 2024
5db9e6b
include
tokatoka Jan 4, 2024
1e8f02b
boolean?
tokatoka Jan 4, 2024
950ab01
fmt
tokatoka Jan 4, 2024
2d16373
Merge pull request #11 from AFLplusplus/cpp_to_c
tokatoka Jan 4, 2024
4898f5b
revert
tokatoka Jan 4, 2024
6010402
Merge pull request #12 from AFLplusplus/revert
tokatoka Jan 4, 2024
f33f679
Merge branch 'eurecom-s3:master' into main
tokatoka Apr 12, 2024
1330e29
Update rust backend (#13)
tokatoka Apr 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ cmake_minimum_required(VERSION 3.5)
project(SymbolicCompiler)

option(QSYM_BACKEND "Use the Qsym backend instead of our own" OFF)
option(RUST_BACKEND "Build the support code required for a Rust backend as a static archive." OFF)
option(TARGET_32BIT "Make the compiler work correctly with -m32" OFF)

# We need to build the runtime as an external project because CMake otherwise
Expand All @@ -29,6 +30,7 @@ set(SYM_RUNTIME_BUILD_ARGS
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_SHARED_LINKER_FLAGS=${CMAKE_SHARED_LINKER_FLAGS}
-DRUST_BACKEND=${RUST_BACKEND}
-DQSYM_BACKEND=${QSYM_BACKEND}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DZ3_TRUST_SYSTEM_VERSION=${Z3_TRUST_SYSTEM_VERSION})
Expand Down
5 changes: 4 additions & 1 deletion runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 \
-Wmissing-format-attribute -Wformat-nonliteral")

option(QSYM_BACKEND "Use the Qsym backend instead of our own" OFF)
option(RUST_BACKEND "Build the support code required for a Rust backend as a static archive." OFF)
option(Z3_TRUST_SYSTEM_VERSION "Use the system-provided Z3 without a version check" OFF)

# Place the final product in the top-level output directory
Expand All @@ -35,7 +36,9 @@ set(SHARED_RUNTIME_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/Shadow.cpp
${CMAKE_CURRENT_SOURCE_DIR}/GarbageCollection.cpp)

if (${QSYM_BACKEND})
if (${RUST_BACKEND})
Copy link
Collaborator

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).

add_subdirectory(rust_backend)
elseif (${QSYM_BACKEND})
add_subdirectory(qsym_backend)
else()
add_subdirectory(simple_backend)
Expand Down
2 changes: 2 additions & 0 deletions runtime/RuntimeCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@
#define RUNTIMECOMMON_H

#ifdef __cplusplus
#include <cstddef> // for size_t
#include <cstdint>
extern "C" {
#else
#include <stddef.h> // for size_t
#include <stdint.h>
#endif

Expand Down
2 changes: 0 additions & 2 deletions runtime/Shadow.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

#include <Runtime.h>

#include <z3.h>

//
// This file is dedicated to the management of shadow memory.
//
Expand Down
25 changes: 25 additions & 0 deletions runtime/rust_backend/CMakeLists.txt
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)
24 changes: 24 additions & 0 deletions runtime/rust_backend/README.md
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.
Loading