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

fix issue #1306: compute vf guard for strong update in another branch #1309

Merged
merged 7 commits into from
Dec 30, 2023

Conversation

jumormt
Copy link
Contributor

@jumormt jumormt commented Dec 30, 2023

fix issue #1306: we compute the vf guard of invalid branches stemming from removed strong-update value-flow, and conjunct the negation of that.

Copy link

codecov bot commented Dec 30, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (fe88f84) 64.55% compared to head (f585f78) 64.61%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1309      +/-   ##
==========================================
+ Coverage   64.55%   64.61%   +0.05%     
==========================================
  Files         223      225       +2     
  Lines       23848    23892      +44     
==========================================
+ Hits        15396    15438      +42     
- Misses       8452     8454       +2     
Files Coverage Δ
svf/include/CFL/CFLVF.h 100.00% <ø> (ø)
svf/include/Graphs/SVFG.h 75.00% <ø> (ø)
svf/include/SABER/ProgSlice.h 100.00% <ø> (ø)
svf/include/SABER/SaberCondAllocator.h 83.78% <ø> (ø)
svf/include/SABER/SaberSVFGBuilder.h 100.00% <100.00%> (ø)
svf/lib/SABER/ProgSlice.cpp 97.46% <100.00%> (+0.69%) ⬆️
svf/lib/SABER/SaberSVFGBuilder.cpp 93.33% <100.00%> (+0.19%) ⬆️
svf/lib/SABER/SrcSnkDDA.cpp 82.47% <ø> (ø)
svf/include/CFL/CFLSVFGBuilder.h 50.00% <50.00%> (ø)
svf/lib/CFL/CFLSVFGBuilder.cpp 95.00% <95.00%> (ø)

@@ -276,6 +276,8 @@ void SaberSVFGBuilder::rmIncomingEdgeForSUStore(BVDataPTAImpl* pta)
}
for (SVFGEdge* edge: toRemove)
{
if (isa<StoreSVFGNode>(edge->getSrcNode()))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this condition? Not all edges in toRemove?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the condition should be removed. But this case won't pass because of an IntraMSSAPhinode to strong update. I'm afraid there will be more false positives.

@@ -97,6 +97,7 @@ void SrcSnkDDA::analyze(SVFModule* module)
if(Options::DumpSlice())
annotateSlice(_curSlice);

memSSA.getRemovedSUVFEdges();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why call this method here?

@@ -97,6 +101,8 @@ class SaberSVFGBuilder : public SVFGBuilder
PointsTo globs;
/// Store all global SVFG nodes
SVFGNodeSet globSVFGNodes;
/// Removed strong update edge
Map<const SVFGNode*, SVFGNodeSet> removedSUVFEdges;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to move this map to SaberCondAllocator

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure. removedSUVFEdges is derived from saber svfg builder. The Sabercondallocator is not yet initialized at the moment.

@@ -62,6 +62,10 @@ class SaberSVFGBuilder : public SVFGBuilder
svfg->addActualParmVFGNode(pagNode, cs);
}

const Map<const SVFGNode*, SVFGNodeSet>& getRemovedSUVFEdges() const {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to move this method under SaberCondAllocator

@@ -309,6 +312,7 @@ class ProgSlice
const SVFGNode* _curSVFGNode; ///< current svfg node during guard computation
Condition finalCond; ///< final condition
const SVFG* svfg; ///< SVFG
const Map<const SVFGNode*, SVFGNodeSet>& removedSUVFEdges;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to move this map to SaberCondAllocator

@@ -59,9 +59,9 @@ class ProgSlice
typedef FIFOWorkList<const SVFBasicBlock*> CFWorkList; ///< worklist for control-flow guard computation

/// Constructor
ProgSlice(const SVFGNode* src, SaberCondAllocator* pa, const SVFG* graph):
ProgSlice(const SVFGNode* src, SaberCondAllocator* pa, const SVFG* graph, const Map<const SVFGNode*, SVFGNodeSet>& edges):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep the constructor unchanged and move the map to SaberCondAllocator

@@ -33,6 +33,8 @@
#include "MSSA/SVFGBuilder.h"
#include "SVFIR/SVFValue.h"
#include "Util/WorkList.h"
#include "SABER/SaberCondAllocator.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put this include to cpp and use forward declaration instead.

@yuleisui
Copy link
Collaborator

CFL cases failed, looks to be assertion failures.

@jumormt
Copy link
Contributor Author

jumormt commented Dec 30, 2023

CFL cases failed, looks to be assertion failures.

Yes, CFL uses sabersvfgbuilder.

@jumormt
Copy link
Contributor Author

jumormt commented Dec 30, 2023

CFL cases failed, looks to be assertion failures.

Yes, CFL uses sabersvfgbuilder.

https://github.com/SVF-tools/SVF/blob/master/svf/include/CFL/CFLVF.h#L62

@yuleisui
Copy link
Collaborator

CFL cases failed, looks to be assertion failures.

Yes, CFL uses sabersvfgbuilder.

https://github.com/SVF-tools/SVF/blob/master/svf/include/CFL/CFLVF.h#L62

I see, we will then need to set the condition allocator.

@yuleisui yuleisui merged commit 3dee455 into SVF-tools:master Dec 30, 2023
5 checks passed
@jumormt jumormt deleted the saber branch January 1, 2024 23:58
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.

None yet

2 participants