Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
8e146d8
Typo
N00byKing Apr 3, 2025
d80a594
Add .vscode to gitignore
N00byKing Apr 3, 2025
42f8710
Test param error impl
N00byKing Apr 3, 2025
79d1b1f
Fix some issues with parameter check pass
N00byKing Apr 9, 2025
6832592
Refine param analysis and add example contracts
N00byKing Apr 10, 2025
4345ac2
Remove weird check
N00byKing May 15, 2025
0c297c9
Alloc track
N00byKing May 16, 2025
9c82e41
Abstract access patterns for alloc
N00byKing May 16, 2025
affa6ba
Fix FP for sendrecv MPI_IN_PLACE
N00byKing May 16, 2025
d0c5f90
Fix mpi win alloc param
N00byKing May 16, 2025
f3dc7c6
Remove debug output
N00byKing May 16, 2025
6c1ad82
Fix VerifierAlloc for newer llvm
N00byKing Sep 18, 2025
c79f21c
Cleanup param verification
N00byKing Sep 18, 2025
b64b1cc
Fix compilation when disabling unity build, and disable unity build i…
N00byKing Mar 9, 2026
c63faef
Merge Formula and OperationType
N00byKing Mar 9, 2026
4bbd731
Fix dynamic analysis instr
N00byKing Mar 9, 2026
d8c9a67
Fix missing newline in test
N00byKing Mar 9, 2026
873f209
Add contracts
N00byKing Mar 9, 2026
fff94c9
Add dynamic param checks
N00byKing Mar 9, 2026
ee46c59
Add more contracts
N00byKing Mar 9, 2026
9001505
Fix broken contract
N00byKing Mar 10, 2026
8970617
Set wrap target in terminal as well
N00byKing Mar 11, 2026
ef21522
Add support for named constants in Fortran param checks
N00byKing Mar 11, 2026
ada9be5
Consistently use implicit none in fortran tests
N00byKing Mar 11, 2026
00a6691
Add test for param
N00byKing Mar 11, 2026
5067069
Better integration with IDE
N00byKing Mar 11, 2026
c45ab9c
Fix error maybe probably
N00byKing Mar 11, 2026
83cf2de
Add missing break
N00byKing Mar 11, 2026
346c395
Fix UB
N00byKing Mar 11, 2026
a6fe3a5
Add more contracts
N00byKing Mar 11, 2026
959894c
Remove commented code
N00byKing Mar 11, 2026
e0bd03d
Move some output to debug only
N00byKing Mar 12, 2026
2392b61
Adjust trivialalloc
N00byKing Mar 12, 2026
f13d6b6
Semi-functioning alloc
N00byKing Mar 12, 2026
b4b711d
Fix FP in allocanalysis for C
N00byKing Mar 12, 2026
610f218
Fix IDE test path parsing
N00byKing Mar 12, 2026
cb9d74e
Allow specifying memory free ops for alloctracking
N00byKing Mar 13, 2026
c40a27b
Add tests for MPI_Win_allocate
N00byKing Mar 13, 2026
1c77f23
Support use-after-free error detection
N00byKing Mar 13, 2026
21be307
Add fallback for static DEREF op
N00byKing Mar 17, 2026
5006cf0
Allow rwop as operation (useful for dyn analysis later)
N00byKing Mar 17, 2026
c7ce8d5
Concretize removal of mapping paramacc better for fortran
N00byKing Mar 17, 2026
6569000
Stricter string check
N00byKing Mar 18, 2026
2bd079d
Integrate actual call into dyn callback
N00byKing Mar 18, 2026
03690c7
Fix broken contracts
N00byKing Mar 18, 2026
78330f2
Dont send uninit data in test
N00byKing Mar 18, 2026
893824a
Add secondary error reporting
N00byKing Mar 18, 2026
8c7ec98
Add allocation size specifiers
N00byKing Mar 19, 2026
c15660f
Remove obsolete warning
N00byKing Mar 20, 2026
774ecf6
Offload basictypes to analysis
N00byKing Mar 20, 2026
7b969bf
Fix compilation
N00byKing Mar 20, 2026
91d585d
Add MD to BasicTypes
N00byKing Mar 23, 2026
8f0f840
Some oopsies
N00byKing Mar 23, 2026
92dee50
Better static err reports for alloc
N00byKing Mar 23, 2026
fa81c91
Add dynamic allocation analysis
N00byKing Mar 23, 2026
4228b14
Add corr alloc tests for offset access to buffer
N00byKing Mar 23, 2026
e451d1a
Cleanup
N00byKing Mar 25, 2026
55827e7
Improve param error detection
N00byKing Mar 25, 2026
7cc0c3c
Remove dwarf dependency
N00byKing Mar 25, 2026
6b46ff7
Fix dynamic det of int param error comparisons
N00byKing Mar 26, 2026
abc982a
Fix short circuit EXEQ not working statically
N00byKing Mar 26, 2026
3bafba6
Fix dynamic param again
N00byKing Mar 26, 2026
278c6c7
Add RankNull from bugbench
N00byKing Mar 26, 2026
9aa1840
For static paramanalysis prefer constint comparisons
N00byKing Mar 26, 2026
778db37
Semi-hack: Add heuristic to detect constint for fortran dyn analysis
N00byKing Mar 26, 2026
2e2d080
Allow MPI_COMM_WORLD explicitly for param checks
N00byKing Mar 27, 2026
1bb9dd7
Improve Fortran param heuristic
N00byKing Mar 27, 2026
565d659
Improve error message
N00byKing Mar 27, 2026
c953a2e
Another attempt at improving fort heuristics
N00byKing Mar 27, 2026
c85ac5c
Filter unneded fort instr
N00byKing Mar 27, 2026
e219ae8
Fix FP for SendRecv
N00byKing Mar 27, 2026
6d9e85c
Stricter buffer nullcheck
N00byKing Mar 27, 2026
c6e8d77
Fix a flaky test failure
N00byKing Mar 30, 2026
dd8958d
Fix output
N00byKing Mar 31, 2026
afcd048
Fix pointer equality comparison
N00byKing Apr 1, 2026
86b1fa9
Fix FP
N00byKing Apr 1, 2026
ba99968
Fix FN, oops
N00byKing Apr 2, 2026
b520381
Add missing alloc size for MPI_Win_allocate
N00byKing Apr 7, 2026
b442802
Improve contract lang syntax
N00byKing Apr 7, 2026
76eb348
Workaround for older python vers
N00byKing Apr 7, 2026
ddb62ca
Hardcode intrinsics path to lib
N00byKing Apr 8, 2026
a705deb
Add "missing" include
N00byKing Apr 8, 2026
3078313
Fix instrumentation return value
N00byKing Apr 9, 2026
10c3a6c
Improved error reporting
N00byKing Apr 9, 2026
3c10edc
Fix instrumentation of ret for floats as well
N00byKing Apr 9, 2026
533c1d3
Reorder opt passes
N00byKing Apr 9, 2026
415fd73
Fix broken contract
N00byKing Apr 9, 2026
3c62b6e
Remove manual llc step
N00byKing Apr 9, 2026
31157f2
Try LTO for DynLib only
N00byKing Apr 9, 2026
e801d4c
Remove lto again
N00byKing Apr 10, 2026
7dbff6e
Cache ffi cifs
N00byKing Apr 10, 2026
1fcc585
Fix ret size calc
N00byKing Apr 10, 2026
b860dd6
Actually fix ret type
N00byKing Apr 10, 2026
29d32e9
Test reinvert instr
N00byKing Apr 10, 2026
9f3dd16
Move heuristic from param to passutils
N00byKing Apr 10, 2026
a4ce342
Use own, lighter-weight mem analysis for getLastStore
N00byKing Apr 13, 2026
1fdc1e0
Restore filtering of unused intrinsics
N00byKing Apr 13, 2026
716a32d
Add debugger flag
N00byKing Apr 13, 2026
86d3d5d
Propagate error code from child in exec
N00byKing Apr 13, 2026
af19f9f
Fix comment
N00byKing Apr 13, 2026
e2f47da
Cleanup
N00byKing Apr 13, 2026
337807d
Fix debug str
N00byKing Apr 13, 2026
6b5fc2e
Stabilize
N00byKing Apr 13, 2026
0535a9c
Move deletion of fortran contr carries after opt passes
N00byKing Apr 13, 2026
03c0340
Port improvement from triplefunc
N00byKing Apr 13, 2026
f298114
Tiny opt
N00byKing Apr 13, 2026
9a923a5
Improve comments
N00byKing Apr 13, 2026
0629305
Remove std::bitset
N00byKing Apr 13, 2026
9c69781
Fix return value (really) (for real this time)
N00byKing Apr 13, 2026
ec74f7f
Fix compilation on some code
N00byKing Apr 13, 2026
f88cf3f
Rem whitespace
N00byKing Apr 14, 2026
09aa7e3
Revert "Tiny opt"
N00byKing Apr 14, 2026
9dc8b84
Fix bit manips in hooks.cpp
N00byKing Apr 14, 2026
dc034b5
Fix __THROW annot location
N00byKing Apr 14, 2026
a7c43bd
Use extern C for (c/m)alloc, free, and intrinsics
N00byKing Apr 14, 2026
f87ce5e
Make ContractValuePair static
N00byKing Apr 14, 2026
3beb541
Add contract for operator new[]
N00byKing Apr 14, 2026
746866a
Cleanup autocomplete script
N00byKing Apr 14, 2026
6cd15ab
Fix compilation when throwing functions are instrumented
N00byKing Apr 14, 2026
e7cdc6f
Split into pre/post cb instead of funcparam in dyn analysis
N00byKing Apr 14, 2026
77cbae3
Moar opt flags
N00byKing Apr 14, 2026
48c338a
Fix param parsing for C++ code
N00byKing Apr 15, 2026
f31c48f
Collapse all CoVer_AllocStack calls per function
N00byKing Apr 15, 2026
d42dbf3
Fix significant perf regression
N00byKing Apr 16, 2026
75af6a7
Remove unordered_map from allocanalysis
N00byKing Apr 16, 2026
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
15 changes: 15 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
]
}
},
"cmake.ctest.failurePatterns": [
{
"regexp": "(.+):(\\d+):(\\d+): error: CHECK: (.+)",
"file": 1,
"line": 2,
"column": 3,
"message": 4,
},
],
"terminal.integrated.defaultProfile.linux": "CoVer Wrapper Bash",
"cmake.configureArgs": [
"-DMPI_HOME=/home/archuser/Desktop/ompi/install",
Expand All @@ -18,4 +27,10 @@
"COVER_WRAP_TARGET_mpicc": "~/Desktop/ompi/install/bin/mpicc",
"COVER_WRAP_TARGET_mpicxx": "~/Desktop/ompi/install/bin/mpicxx",
},
"terminal.integrated.env.linux": {
"COVER_WRAP_TARGET_mpifort": "~/Desktop/ompi/install/bin/mpifort",
"COVER_WRAP_TARGET_mpicc": "~/Desktop/ompi/install/bin/mpicc",
"COVER_WRAP_TARGET_mpicxx": "~/Desktop/ompi/install/bin/mpicxx",
},
"cmake.ctest.testSuiteDelimiter": "-|::",
}
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,16 @@ target_compile_options (ContractLanguage PUBLIC -fexceptions)

add_llvm_pass_plugin(CoVerPlugin
Passes/Registrar.cpp
Passes/BasicTypes.cpp
Passes/ContractManager.cpp
Passes/ContractVerifierPreCall.cpp
Passes/ContractVerifierPostCall.cpp
Passes/ContractVerifierRelease.cpp
Passes/Instrument.cpp
Passes/ContractVerifierParam.cpp
Passes/ContractVerifierAlloc.cpp
Passes/ContractPostProcess.cpp
Passes/Intrinsics.cpp
Passes/Instrument.cpp
Utils/ContractPassUtility.cpp
Include/ContractPassUtility.hpp
)
Expand Down Expand Up @@ -136,6 +140,12 @@ install(
WORLD_READ
)

##
## CoVer Intrinsics definitions
##

add_subdirectory(Intrinsics)

##
## Dynamic project
##
Expand Down Expand Up @@ -196,6 +206,7 @@ endif(MPI_C_FOUND AND Python_FOUND)

set(CONTR_PLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/lib/CoVerPlugin.so")
set(COVER_DYNAMIC_ANALYSER_PATH ${CMAKE_INSTALL_PREFIX}/lib/libCoVerDynamicAnalyzer.a)
set(COVER_INTRINSICS_LIB_PATH ${CMAKE_INSTALL_PREFIX}/lib/libCoVerIntrinsics.a)
set(DSA_PLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/lib/DSA.so")
set(CONTR_INCLUDE_PATH "${CMAKE_INSTALL_PREFIX}/include")

Expand Down
61 changes: 61 additions & 0 deletions Dynamic/Analyses/AllocAnalysis.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#include "AllocAnalysis.h"
#include "BaseAnalysis.h"
#include "DynamicAnalysis.h"
#include "../DynamicUtils.h"

#include <cstddef>
#include <cstdint>
#include <utility>
#include <vector>

int vecContains(std::vector<MemOpFunc_t> vec, void* f) {
for (int i = 0; i < vec.size(); i++) {
if (vec[i].func == f) return i;
}
return -1;
}

Fulfillment AllocAnalysis::functionPreCBImpl(void* const& func, CallsiteInfo const& callsite) {
if (func == func_supplier) {
uintptr_t ptr = (uintptr_t)callsite.params[idx].value;
for (std::pair<uintptr_t, size_t> alloc_ptr : allocated) {
if ((uintptr_t)alloc_ptr.first == ptr) return Fulfillment::UNKNOWN;
if (ptr >= alloc_ptr.first && ptr < alloc_ptr.first + alloc_ptr.second) return Fulfillment::UNKNOWN;
}
references.push_back(callsite.location);
return Fulfillment::VIOLATED;
}
return Fulfillment::UNKNOWN;
}

Fulfillment AllocAnalysis::functionPostCBImpl(void* const& func, CallsiteInfo const& callsite) {
if (int idx = vecContains(mem_allocators, func); idx != -1) {
MemOpFunc_t const& memop = mem_allocators[idx];
uintptr_t alloc = (uintptr_t)(memop.rwOp->idx == 99 ? callsite.retval : callsite.params[memop.rwOp->idx].value);
if (memop.rwOp->accType == ParamAccess::DEREF) alloc = (uintptr_t)*(void**)alloc;
MathExpr_t const* cur = memop.size;
size_t res = cur->isArgValue ? (size_t)callsite.params[cur->value].value : cur->value;
while (cur->other != nullptr) {
switch (cur->type) {
case UNARY_VALUE:
break;
case MULT:
res *= cur->other->isArgValue ? (size_t)callsite.params[cur->other->value].value : cur->other->value;
break;
}
cur = cur->other;
}
allocated.push_back({alloc, res});
}
else if (int idx = vecContains(mem_deallocators, func); idx != -1) {
MemOpFunc_t const& memop = mem_deallocators[idx];
uintptr_t const& target = (uintptr_t)(memop.rwOp->idx == 99 ? callsite.retval : callsite.params[memop.rwOp->idx].value);
for (int i = 0; i < allocated.size(); i++) {
if (target == allocated[i].first) {
allocated.erase(allocated.begin() + i);
break;
}
}
}
return Fulfillment::UNKNOWN;
}
34 changes: 34 additions & 0 deletions Dynamic/Analyses/AllocAnalysis.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#pragma once

#include "BaseAnalysis.h"
#include "DynamicAnalysis.h"
#include <cstddef>
#include <cstdint>

struct AllocAnalysis : BaseAnalysis<AllocAnalysis> {
public:
AllocAnalysis(void const* _func_supplier, AllocOp_t* allocop) : idx(allocop->idx), acc(allocop->accType), func_supplier(_func_supplier) {
for (int i = 0; i < allocop->num_allocators; i++) {
mem_allocators.push_back(allocop->allocators[i]);
}
for (int i = 0; i < allocop->num_deallocators; i++) {
mem_deallocators.push_back(allocop->deallocators[i]);
}
}

ANALYSIS_PREAMBLE Fulfillment functionPreCBImpl(void* const& func, CallsiteInfo const& callsite);
ANALYSIS_PREAMBLE Fulfillment functionPostCBImpl(void* const& func, CallsiteInfo const& callsite);
ANALYSIS_PREAMBLE Fulfillment memoryCBImpl(CodePtr const& location, void const* const& memory, bool const& isWrite) const { return Fulfillment::UNKNOWN; }
ANALYSIS_PREAMBLE Fulfillment exitCBImpl(CodePtr const& location) const { return Fulfillment::FULFILLED; }; // Evidently none of the callsites were erroneous

constexpr CallBacks requiredCallbacksImpl() const { return {true, true, false, false}; }

private:
// Configuration
void const* func_supplier;
int const idx;
ParamAccess const acc;
std::vector<std::pair<uintptr_t, size_t>> allocated;
std::vector<MemOpFunc_t> mem_allocators;
std::vector<MemOpFunc_t> mem_deallocators;
};
6 changes: 4 additions & 2 deletions Dynamic/Analyses/BaseAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
enum struct Fulfillment { FULFILLED, UNKNOWN, VIOLATED, INACTIVE };

struct CallBacks {
bool FUNCTION;
bool FUNCTION_PRE;
bool FUNCTION_POST;
bool MEMORY_R;
bool MEMORY_W;
};
Expand All @@ -19,7 +20,8 @@ class BaseAnalysis {
public:
// Event handlers. Return non-unknown if analysis is resolved and no longer needs to be analysed.
// onFunctionCall does not forward return address, as it is included in callsiteinfo
inline Fulfillment onFunctionCall(CodePtr const& location, void* const& func, CallsiteInfo const& callsite) { return static_cast<T*>(this)->functionCBImpl(func, callsite); };
inline Fulfillment onFunctionCallPre(CodePtr const& location, void* const& func, CallsiteInfo const& callsite) { return static_cast<T*>(this)->functionPreCBImpl(func, callsite); };
inline Fulfillment onFunctionCallPost(CodePtr const& location, void* const& func, CallsiteInfo const& callsite) { return static_cast<T*>(this)->functionPostCBImpl(func, callsite); };
inline Fulfillment onMemoryAccess(CodePtr const& location, void const* const& memory, bool const& isWrite) { return static_cast<T*>(this)->memoryCBImpl(std::forward<CodePtr const>(location), memory, isWrite); };
inline Fulfillment onProgramExit(CodePtr const& location) { return static_cast<T*>(this)->exitCBImpl(std::forward<void const* const>(location)); };

Expand Down
59 changes: 59 additions & 0 deletions Dynamic/Analyses/ParamAnalysis.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#include "ParamAnalysis.h"
#include "BaseAnalysis.h"
#include "DynamicAnalysis.h"
#include "../DynamicUtils.h"

#include <cstdint>
#include <vector>

static constexpr int64_t sign_extend(uintptr_t const ptr, int const size) {
switch (size) {
case 8: return (int64_t)(int8_t)ptr; break;
case 16: return (int64_t)(int16_t)ptr; break;
case 32: return (int64_t)(int32_t)ptr; break;
}
return ptr;
}

Fulfillment ParamAnalysis::functionPreCBImpl(void* const& func, CallsiteInfo const& callsite) {
if (func != func_supplier) return Fulfillment::UNKNOWN;

void const* act_callp = callsite.params[idx].value;
if (callval_need_deref) {
act_callp = (const void*)(*(void**)act_callp);
}
int64_t const int_callp = sign_extend((uintptr_t)act_callp, callsite.params[idx].size);
for (const ParamReq_t* req : param_requirements) {
void const* act_req = req->isArg ? callsite.params[(int64_t)req->value].value: req->value;
if (req->reqval_need_deref) {
act_req = (const void*)*(void**)act_req;
}
int64_t const int_req = sign_extend((uintptr_t)act_req, callsite.params[idx].size);
switch (req->comparator) {
case Comparator::EXEQ:
// EXEQ is the exception (pun), it overrides other forbidden values.
if (act_callp == act_req || int_callp == int_req) return Fulfillment::FULFILLED;
continue;
case Comparator::EQ:
if (act_callp == act_req && int_callp == int_req) continue;
references.push_back(callsite.location); return Fulfillment::VIOLATED;
case Comparator::NEQ:
if (act_callp != act_req && int_callp != int_req) continue;
references.push_back(callsite.location); return Fulfillment::VIOLATED;
// Smaller/Larger comparisons dont make sense for pointers. Assume ints from here
case Comparator::GTEQ:
if (int_callp >= int_req) continue;
references.push_back(callsite.location); return Fulfillment::VIOLATED;
case Comparator::GT:
if (int_callp > int_req) continue;
references.push_back(callsite.location); return Fulfillment::VIOLATED;
case Comparator::LTEQ:
if (int_callp <= int_req) continue;
references.push_back(callsite.location); return Fulfillment::VIOLATED;
case Comparator::LT:
if (int_callp < int_req) continue;
references.push_back(callsite.location); return Fulfillment::VIOLATED;
}
}
return Fulfillment::UNKNOWN;
}
28 changes: 28 additions & 0 deletions Dynamic/Analyses/ParamAnalysis.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#pragma once

#include "BaseAnalysis.h"
#include "DynamicAnalysis.h"
#include <vector>

struct ParamAnalysis : BaseAnalysis<ParamAnalysis> {
public:
ParamAnalysis(void const* _func_supplier, ParamOp_t* paramop) : idx(paramop->idx), func_supplier(_func_supplier), callval_need_deref(paramop->callval_need_deref) {
for (int i = 0; i < paramop->num_reqs; i++) {
param_requirements.push_back(&paramop->requirements[i]);
}
}

ANALYSIS_PREAMBLE Fulfillment functionPreCBImpl(void* const& func, CallsiteInfo const& callsite);
ANALYSIS_PREAMBLE Fulfillment functionPostCBImpl(void* const& func, CallsiteInfo const& callsite) { return Fulfillment::UNKNOWN; };
ANALYSIS_PREAMBLE Fulfillment memoryCBImpl(CodePtr const& location, void const* const& memory, bool const& isWrite) const { return Fulfillment::UNKNOWN; }
ANALYSIS_PREAMBLE Fulfillment exitCBImpl(CodePtr const& location) const { return Fulfillment::FULFILLED; }; // Evidently none of the callsites were erroneous

constexpr CallBacks requiredCallbacksImpl() const { return {true, false, false, false}; }

private:
// Configuration
void const* func_supplier;
int const idx;
bool const callval_need_deref;
std::vector<ParamReq_t const*> param_requirements;
};
2 changes: 1 addition & 1 deletion Dynamic/Analyses/PostCallAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ PostCallAnalysis::PostCallAnalysis(void const* _func_supplier, CallTagOp_t* call
target_funcs = DynamicUtils::getFunctionsForTag(callop->target_tag);
}

Fulfillment PostCallAnalysis::functionCBImpl(void* const& func, CallsiteInfo const& callsite) {
Fulfillment PostCallAnalysis::functionPreCBImpl(void* const& func, CallsiteInfo const& callsite) {
for (void const* const& target_func : target_funcs) {
if (target_func == func) {
// Target function found, maybe analysis success
Expand Down
9 changes: 5 additions & 4 deletions Dynamic/Analyses/PostCallAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ struct PostCallAnalysis : public BaseAnalysis<PostCallAnalysis> {
PostCallAnalysis(void const* func_supplier, CallOp_t* callop);
PostCallAnalysis(void const* func_supplier, CallTagOp_t* callop);

inline __attribute__((always_inline)) Fulfillment functionCBImpl(void* const& func, CallsiteInfo const& callsite);
inline __attribute__((always_inline)) Fulfillment memoryCBImpl(CodePtr const& location, void const* const& memory, bool const& isWrite) const { return Fulfillment::UNKNOWN; }
inline __attribute__((always_inline)) Fulfillment exitCBImpl(CodePtr const& location);
ANALYSIS_PREAMBLE Fulfillment functionPreCBImpl(void* const& func, CallsiteInfo const& callsite);
ANALYSIS_PREAMBLE Fulfillment functionPostCBImpl(void* const& func, CallsiteInfo const& callsite) { return Fulfillment::UNKNOWN; };
ANALYSIS_PREAMBLE Fulfillment memoryCBImpl(CodePtr const& location, void const* const& memory, bool const& isWrite) const { return Fulfillment::UNKNOWN; }
ANALYSIS_PREAMBLE Fulfillment exitCBImpl(CodePtr const& location);

constexpr CallBacks requiredCallbacksImpl() const { return {true, false, false}; }
constexpr CallBacks requiredCallbacksImpl() const { return {true, false, false, false}; }

private:
void SharedInit(void const* _func_supplier, const char* target_str, CallParam_t *params, int64_t num_params);
Expand Down
2 changes: 1 addition & 1 deletion Dynamic/Analyses/PreCallAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ PreCallAnalysis::PreCallAnalysis(void const* _func_supplier, CallTagOp_t* callop
target_funcs = DynamicUtils::getFunctionsForTag(callop->target_tag);
}

Fulfillment PreCallAnalysis::functionCBImpl(void* const& func, CallsiteInfo const& callsite) {
Fulfillment PreCallAnalysis::functionPreCBImpl(void* const& func, CallsiteInfo const& callsite) {
for (void const* const& target_func : target_funcs) {
if (target_func == func) {
// Possible match for precall
Expand Down
9 changes: 5 additions & 4 deletions Dynamic/Analyses/PreCallAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ struct PreCallAnalysis : BaseAnalysis<PreCallAnalysis> {
PreCallAnalysis(void const* func_supplier, CallOp_t* callop);
PreCallAnalysis(void const* func_supplier, CallTagOp_t* callop);

inline __attribute__((always_inline)) Fulfillment functionCBImpl(void* const& func, CallsiteInfo const& callsite);
inline __attribute__((always_inline)) Fulfillment memoryCBImpl(CodePtr const& location, void const* const& memory, bool const& isWrite) const { return Fulfillment::UNKNOWN; }
inline __attribute__((always_inline)) Fulfillment exitCBImpl(CodePtr const& location) const { return Fulfillment::INACTIVE; };
ANALYSIS_PREAMBLE Fulfillment functionPreCBImpl(void* const& func, CallsiteInfo const& callsite);
ANALYSIS_PREAMBLE Fulfillment functionPostCBImpl(void* const& func, CallsiteInfo const& callsite) { return Fulfillment::UNKNOWN; };
ANALYSIS_PREAMBLE Fulfillment memoryCBImpl(CodePtr const& location, void const* const& memory, bool const& isWrite) const { return Fulfillment::UNKNOWN; }
ANALYSIS_PREAMBLE Fulfillment exitCBImpl(CodePtr const& location) const { return Fulfillment::INACTIVE; };

constexpr CallBacks requiredCallbacksImpl() const { return {true, false, false}; }
constexpr CallBacks requiredCallbacksImpl() const { return {true, false, false, false}; }

private:
void SharedInit(void const* _func_supplier, const char* target_str, CallParam_t *params, int64_t num_params);
Expand Down
4 changes: 2 additions & 2 deletions Dynamic/Analyses/ReleaseAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ ReleaseAnalysis::ReleaseAnalysis(void const* _func_supplier, ReleaseOp_t* rOP) {
CallBacks ReleaseAnalysis::requiredCallbacksImpl() const {
if (!forbIsRW) return {true, false, false};
RWOp_t* rwOp = (RWOp_t*)forbiddenOp;
return {true, !rwOp->isWrite, rwOp->isWrite};
return {true, false, !rwOp->isWrite, rwOp->isWrite};
}

Fulfillment ReleaseAnalysis::functionCBImpl(void* const& func, CallsiteInfo const& callsite) {
Fulfillment ReleaseAnalysis::functionPreCBImpl(void* const& func, CallsiteInfo const& callsite) {
if (!forbiddenCallsites.empty()) {
// First, check if release
for (void const* const& rel_func : rel_funcs) {
Expand Down
7 changes: 4 additions & 3 deletions Dynamic/Analyses/ReleaseAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
struct ReleaseAnalysis : BaseAnalysis<ReleaseAnalysis> {
public:
ReleaseAnalysis(void const* func_supplier, ReleaseOp_t* rOP);
inline __attribute__((always_inline)) Fulfillment functionCBImpl(void* const& func, CallsiteInfo const& callsite);
inline __attribute__((always_inline)) Fulfillment memoryCBImpl(CodePtr const& location, void const* const& memory, bool const& isWrite);
inline __attribute__((always_inline)) Fulfillment exitCBImpl(CodePtr const& location) const { return Fulfillment::FULFILLED; };
ANALYSIS_PREAMBLE Fulfillment functionPreCBImpl(void* const& func, CallsiteInfo const& callsite);
ANALYSIS_PREAMBLE Fulfillment functionPostCBImpl(void* const& func, CallsiteInfo const& callsite) { return Fulfillment::UNKNOWN; };
ANALYSIS_PREAMBLE Fulfillment memoryCBImpl(CodePtr const& location, void const* const& memory, bool const& isWrite);
ANALYSIS_PREAMBLE Fulfillment exitCBImpl(CodePtr const& location) const { return Fulfillment::FULFILLED; };

CallBacks requiredCallbacksImpl() const;

Expand Down
16 changes: 14 additions & 2 deletions Dynamic/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
add_library(CoVerDynamicAnalyzer STATIC
Analyses/ParamAnalysis.cpp
Analyses/AllocAnalysis.cpp
Analyses/PostCallAnalysis.cpp
Analyses/PreCallAnalysis.cpp
Analyses/ReleaseAnalysis.cpp
Expand All @@ -7,14 +9,24 @@ add_library(CoVerDynamicAnalyzer STATIC
)

set_property(TARGET CoVerDynamicAnalyzer PROPERTY CXX_STANDARD 20)
set_property(TARGET CoVerDynamicAnalyzer PROPERTY UNITY_BUILD ON)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set_property(TARGET CoVerDynamicAnalyzer PROPERTY UNITY_BUILD OFF)
else()
set_property(TARGET CoVerDynamicAnalyzer PROPERTY UNITY_BUILD ON)
endif()
target_include_directories(CoVerDynamicAnalyzer PUBLIC ../Include/)

find_package(PkgConfig REQUIRED)
pkg_check_modules(FFI REQUIRED libffi)
target_include_directories(CoVerDynamicAnalyzer PRIVATE "${FFI_INCLUDE_DIRS}")

set_property(TARGET CoVerDynamicAnalyzer PROPERTY CXX_VISIBILITY_PRESET hidden)
set_property(TARGET CoVerDynamicAnalyzer PROPERTY C_VISIBILITY_PRESET hidden)
set_property(TARGET CoVerDynamicAnalyzer PROPERTY VISIBILITY_INLINES_HIDDEN ON)

target_compile_options(CoVerDynamicAnalyzer PUBLIC -fno-rtti -fno-exceptions -fomit-frame-pointer -fno-stack-protector)
target_compile_options(CoVerDynamicAnalyzer PUBLIC -fno-rtti -fno-exceptions -fomit-frame-pointer -fno-stack-protector -fno-math-errno -fno-trapping-math)
target_link_libraries(CoVerDynamicAnalyzer libffi)
target_include_directories(CoVerDynamicAnalyzer PRIVATE "${FFI_LIBRARIES}")

if (CMAKE_ADDR2LINE)
target_compile_definitions(CoVerDynamicAnalyzer PUBLIC CMAKE_ADDR2LINE="${CMAKE_ADDR2LINE}")
Expand Down
Loading