Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f7b957b
Start adding CFGBase and new LLVMBasedCFG/ICFG
fabianbs96 Aug 2, 2022
ab53a3b
Add LLVMBasedICFG (TODO: implement)
fabianbs96 Aug 2, 2022
16f5c93
Implement LLVMBasedICFG
fabianbs96 Aug 3, 2022
6e1f3dd
Make phasar compile again
fabianbs96 Aug 4, 2022
c3f0515
Fix LLVMBasedICFGExportTest
fabianbs96 Aug 8, 2022
30a0ec1
Fix resolver tests
fabianbs96 Aug 8, 2022
a9cb0c8
Remove duplication with Forward and Backward CFG
fabianbs96 Aug 8, 2022
58a9d32
Get rid of the old (I)CFG interfaces
fabianbs96 Aug 8, 2022
29c5302
Getting rid of boost in LLVMBasedICFG
fabianbs96 Aug 8, 2022
c1c2d1a
pre-commit
fabianbs96 Aug 8, 2022
95efbe5
cleanup
fabianbs96 Aug 8, 2022
3d67141
Cleanup callgraph + memory_resources
fabianbs96 Aug 10, 2022
082b0c4
Incorporate ByConstRef into CFG/ICFG -- it got committed accidently, …
fabianbs96 Aug 12, 2022
432f421
Merge branch 'f-RedesignICFG' of github.com:secure-software-engineeri…
fabianbs96 Aug 12, 2022
b595b6f
Change type of callers/callees sets to llvm:ArrayRef to increase flex…
fabianbs96 Aug 12, 2022
186a1f5
Add some comments + cleanup + using log categories (at least partially)
fabianbs96 Aug 18, 2022
cfcb28a
minor
fabianbs96 Aug 18, 2022
15222ff
Merge branch 'development' into f-RedesignICFG
fabianbs96 Oct 18, 2022
27ee359
Merge branch 'development' into f-RedesignICFG
fabianbs96 Oct 28, 2022
ca1901d
minor
fabianbs96 Oct 30, 2022
c9dedb3
Merge branch 'development' into f-RedesignICFG
fabianbs96 Nov 8, 2022
499a19d
Small fix due to merging
fabianbs96 Nov 8, 2022
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: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Checks: '-*,
-readability-function-cognitive-complexity,
-readability-convert-member-functions-to-static,
-readability-isolate-declaration,
-readability-identifier-length,
cppcoreguidelines-*,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
Expand All @@ -28,7 +29,6 @@ Checks: '-*,
-bugprone-easily-swappable-parameters,
modernize-*,
-modernize-use-trailing-return-type,
-modernize-pass-by-value,
performance-*,
clang-analyzer-*,
'
Expand Down
87 changes: 43 additions & 44 deletions config/DOTGraphConfig.json
Original file line number Diff line number Diff line change
@@ -1,49 +1,48 @@
{
"CFNode": {
"style": "filled",
"shape": "record"
},
"CFIntraEdge": {
},
"CFInterEdge": {
"weight": "1"
},
"FactNode": {
"style": "rounded"
},
"FactIDEdge": {
"style": "dotted",
"arrowhead": "normal",
"fontsize": "11",
"arrowsize": "0.7"
},
"FactCrossEdge": {
"CFNode": {
"style": "filled",
"shape": "record"
},
"CFIntraEdge": {},
"CFInterEdge": {
"weight": "1"
},
"FactNode": {
"style": "rounded"
},
"FactIDEdge": {
"style": "dotted",
"arrowhead": "normal",
"fontsize": "11",
"arrowsize": "0.7"
},
"FactInterEdge": {
"arrowhead": "normal",
"fontsize": "11",
"arrowsize": "0.7"
},
"FactCrossEdge": {
"style": "dotted",
"arrowhead": "normal",
"fontsize": "11",
"arrowsize": "0.7"
},
"FactInterEdge": {
"weight": "0.1",
"style": "dashed",
"arrowhead": "normal",
"fontsize": "11",
"arrowsize": "0.7"
},
"LambdaNode": {
"style": "rounded"
},
"LambdaIDEdge": {
"style": "dotted",
"arrowhead": "normal",
"fontsize": "11",
"arrowsize": "0.7"
},
"LambdaInterEdge": {
"style": "dashed",
"arrowhead": "normal",
"fontsize": "11",
"arrowsize": "0.7"
},
"LambdaNode": {
"style": "rounded"
},
"LambdaIDEdge": {
"style": "dotted",
"arrowhead": "normal",
"fontsize": "11",
"arrowsize": "0.7"
},
"LambdaInterEdge": {
"weight": "0.1",
"style": "dashed",
"arrowhead": "normal",
"fontsize": "11",
"arrowsize": "0.7"
}
"style": "dashed",
"arrowhead": "normal",
"fontsize": "11",
"arrowsize": "0.7"
}
}
44 changes: 26 additions & 18 deletions config/phasar-source-sink-function.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
{
"Source Functions": {
"source()": {
"Args": [],
"Return": true
},
"read": {
"Args": [0, 1, 3],
"Return": false
}
},
"Sink Functions": {
"sink(int)": {
"Args": [0]
},
"write": {
"Args": [1]
}
}
"Source Functions": {
"source()": {
"Args": [],
"Return": true
},
"read": {
"Args": [
0,
1,
3
],
"Return": false
}
},
"Sink Functions": {
"sink(int)": {
"Args": [
0
]
},
"write": {
"Args": [
1
]
}
}
}
8 changes: 4 additions & 4 deletions include/phasar/Controller/AnalysisController.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ enum class AnalysisControllerEmitterOptions : uint32_t {
EmitTHAsText = (1 << 5),
EmitTHAsDot = (1 << 6),
EmitTHAsJson = (1 << 7),
EmitCGAsText = (1 << 8),
// EmitCGAsText = (1 << 8),
EmitCGAsDot = (1 << 9),
EmitCGAsJson = (1 << 10),
// EmitCGAsJson = (1 << 10),
EmitPTAAsText = (1 << 11),
EmitPTAAsDot = (1 << 12),
EmitPTAAsJson = (1 << 13),
Expand All @@ -60,7 +60,7 @@ class AnalysisController {
LLVMBasedICFG ICF;
std::vector<DataFlowAnalysisType> DataFlowAnalyses;
std::vector<std::string> AnalysisConfigs;
std::set<std::string> EntryPoints;
std::vector<std::string> EntryPoints;
[[maybe_unused]] AnalysisStrategy Strategy;
AnalysisControllerEmitterOptions EmitterOptions =
AnalysisControllerEmitterOptions::None;
Expand Down Expand Up @@ -193,7 +193,7 @@ class AnalysisController {
std::vector<std::string> AnalysisConfigs,
PointerAnalysisType PTATy, CallGraphAnalysisType CGTy,
Soundness SoundnessLevel, bool AutoGlobalSupport,
const std::set<std::string> &EntryPoints,
std::vector<std::string> EntryPoints,
AnalysisStrategy Strategy,
AnalysisControllerEmitterOptions EmitterOptions,
IFDSIDESolverConfig SolverConfig,
Expand Down
6 changes: 5 additions & 1 deletion include/phasar/DB/ProjectIRDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ class ProjectIRDB {
std::map<std::string, std::unique_ptr<llvm::Module>> Modules;
// Maps an id to its corresponding instruction
std::map<std::size_t, llvm::Instruction *> IDInstructionMapping;
size_t NumberCallsites;
size_t NumGlobals = 0;
size_t NumberCallsites = 0;
nlohmann::json StatsJson;

void buildIDModuleMapping(llvm::Module *M);
Expand Down Expand Up @@ -97,6 +98,7 @@ class ProjectIRDB {
~ProjectIRDB();

void insertModule(llvm::Module *M);
void insertFunction(llvm::Function *F);

// add WPA support by providing a fat completely linked module
void linkForWPA();
Expand Down Expand Up @@ -180,6 +182,8 @@ class ProjectIRDB {

[[nodiscard]] std::size_t getNumGlobals() const;

[[nodiscard]] std::size_t getNumFunctions() const;

[[nodiscard]] llvm::Instruction *getInstruction(std::size_t Id) const;

[[nodiscard]] static std::size_t getInstructionID(const llvm::Instruction *I);
Expand Down
29 changes: 16 additions & 13 deletions include/phasar/PhasarLLVM/AnalysisStrategy/WholeProgramAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "phasar/DB/ProjectIRDB.h"
#include "phasar/PhasarLLVM/AnalysisStrategy/AnalysisSetup.h"
#include "phasar/PhasarLLVM/ControlFlow/Resolver/CallGraphAnalysisType.h"
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/IFDSIDESolverConfig.h"
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Solver/IDESolver.h"

Expand Down Expand Up @@ -54,7 +55,7 @@ class WholeProgramAnalysis {

public:
WholeProgramAnalysis(IFDSIDESolverConfig SolverConfig, ProjectIRDB &IRDB,
std::set<std::string> EntryPoints = {},
llvm::ArrayRef<std::string> EntryPoints = {},
PointerAnalysisTy *PointerInfo = nullptr,
CallGraphAnalysisTy *CallGraph = nullptr,
TypeHierarchyTy *TypeHierarchy = nullptr)
Expand All @@ -67,11 +68,12 @@ class WholeProgramAnalysis {
: std::unique_ptr<PointerAnalysisTy>(PointerInfo)),
CallGraph(CallGraph == nullptr
? std::make_unique<CallGraphAnalysisTy>(
IRDB, CallGraphAnalysisType::OTF, EntryPoints,
&IRDB, CallGraphAnalysisType::OTF, EntryPoints,
this->TypeHierarchy.get(), this->PointerInfo.get())
: std::unique_ptr<CallGraphAnalysisTy>(CallGraph)),
EntryPoints(EntryPoints),
ProblemDesc(&IRDB, TypeHierarchy, CallGraph, PointerInfo, EntryPoints),
EntryPoints(EntryPoints.begin(), EntryPoints.end()),
ProblemDesc(&IRDB, TypeHierarchy, CallGraph, PointerInfo,
this->EntryPoints),
DataFlowSolver(ProblemDesc) {
if constexpr (has_setIFDSIDESolverConfig_v<ProblemDescription>) {
ProblemDesc.setIFDSIDESolverConfig(SolverConfig);
Expand All @@ -83,7 +85,7 @@ class WholeProgramAnalysis {
typename T::ConfigurationTy, HasNoConfigurationType>>>
WholeProgramAnalysis(IFDSIDESolverConfig SolverConfig, ProjectIRDB &IRDB,
ConfigurationTy *Config,
std::set<std::string> EntryPoints = {},
llvm::ArrayRef<std::string> EntryPoints = {},
PointerAnalysisTy *PointerInfo = nullptr,
CallGraphAnalysisTy *CallGraph = nullptr,
TypeHierarchyTy *TypeHierarchy = nullptr)
Expand All @@ -96,12 +98,12 @@ class WholeProgramAnalysis {
: std::unique_ptr<PointerAnalysisTy>(PointerInfo)),
CallGraph(CallGraph == nullptr
? std::make_unique<CallGraphAnalysisTy>(
IRDB, CallGraphAnalysisType::OTF, EntryPoints,
&IRDB, CallGraphAnalysisType::OTF, EntryPoints,
this->TypeHierarchy.get(), this->PointerInfo.get())
: std::unique_ptr<CallGraphAnalysisTy>(CallGraph)),
EntryPoints(EntryPoints), Config(Config),
EntryPoints(EntryPoints.begin(), EntryPoints.end()), Config(Config),
ProblemDesc(&IRDB, TypeHierarchy, CallGraph, PointerInfo, *Config,
EntryPoints),
this->EntryPoints),
DataFlowSolver(ProblemDesc) {
if constexpr (has_setIFDSIDESolverConfig_v<ProblemDescription>) {
ProblemDesc.setIFDSIDESolverConfig(SolverConfig);
Expand All @@ -113,7 +115,7 @@ class WholeProgramAnalysis {
typename T::ConfigurationTy, HasNoConfigurationType>>>
WholeProgramAnalysis(IFDSIDESolverConfig SolverConfig, ProjectIRDB &IRDB,
std::string ConfigPath,
std::set<std::string> EntryPoints = {},
llvm::ArrayRef<std::string> EntryPoints = {},
PointerAnalysisTy *PointerInfo = nullptr,
CallGraphAnalysisTy *CallGraph = nullptr,
TypeHierarchyTy *TypeHierarchy = nullptr)
Expand All @@ -126,13 +128,14 @@ class WholeProgramAnalysis {
: std::unique_ptr<PointerAnalysisTy>(PointerInfo)),
CallGraph(CallGraph == nullptr
? std::make_unique<CallGraphAnalysisTy>(
IRDB, CallGraphAnalysisType::OTF, EntryPoints,
&IRDB, CallGraphAnalysisType::OTF, EntryPoints,
this->TypeHierarchy.get(), this->PointerInfo.get())
: std::unique_ptr<CallGraphAnalysisTy>(CallGraph)),
EntryPoints(EntryPoints), Config(new ConfigurationTy(ConfigPath)),
OwnsConfig(true), ConfigPath(ConfigPath),
EntryPoints(EntryPoints.begin(), EntryPoints.end()),
Config(new ConfigurationTy(ConfigPath)), OwnsConfig(true),
ConfigPath(ConfigPath),
ProblemDesc(&IRDB, TypeHierarchy, CallGraph, PointerInfo, *Config,
EntryPoints),
this->EntryPoints),
DataFlowSolver(ProblemDesc) {
if constexpr (has_setIFDSIDESolverConfig_v<ProblemDescription>) {
ProblemDesc.setIFDSIDESolverConfig(SolverConfig);
Expand Down
61 changes: 0 additions & 61 deletions include/phasar/PhasarLLVM/ControlFlow/BiDiICFG.h

This file was deleted.

Loading