svf-lib 1.0.2506 → 1.0.2508
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SVF-linux-aarch64/include/AE/Core/AbstractState.h +2 -0
- package/SVF-linux-aarch64/include/AE/Svfexe/AbstractInterpretation.h +23 -5
- package/SVF-linux-aarch64/include/AE/Svfexe/PreAnalysis.h +7 -0
- package/SVF-linux-aarch64/include/Graphs/SVFG.h +8 -8
- package/SVF-linux-aarch64/include/Util/Options.h +1 -0
- package/SVF-linux-aarch64/lib/libSvfCore.so.3.3 +0 -0
- package/SVF-osx/bin/ae +0 -0
- package/SVF-osx/include/AE/Core/AbstractState.h +51 -106
- package/SVF-osx/include/AE/Svfexe/AbstractInterpretation.h +4 -4
- package/SVF-osx/lib/libSvfCore.3.3.dylib +0 -0
- package/package.json +1 -1
|
@@ -109,11 +109,11 @@ public:
|
|
|
109
109
|
detectors.push_back(std::move(detector));
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
/// Retrieve
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
112
|
+
/// Retrieve SVFVar given its ID; asserts if no such variable exists
|
|
113
|
+
inline const SVFVar* getSVFVar(NodeID varId) const
|
|
114
|
+
{
|
|
115
|
+
return svfir->getSVFVar(varId);
|
|
116
|
+
}
|
|
117
117
|
|
|
118
118
|
/// Retrieve abstract value for a top-level variable at a given ICFG node
|
|
119
119
|
const AbstractValue& getAbstractValue(const ICFGNode* node, const ValVar* var);
|
|
@@ -124,6 +124,24 @@ public:
|
|
|
124
124
|
/// Retrieve abstract value for any SVF variable at a given ICFG node
|
|
125
125
|
const AbstractValue& getAbstractValue(const ICFGNode* node, const SVFVar* var);
|
|
126
126
|
|
|
127
|
+
/// Set abstract value for a top-level variable at a given ICFG node
|
|
128
|
+
void updateAbstractValue(const ICFGNode* node, const ValVar* var, const AbstractValue& val);
|
|
129
|
+
|
|
130
|
+
/// Set abstract value for an address-taken variable at a given ICFG node
|
|
131
|
+
void updateAbstractValue(const ICFGNode* node, const ObjVar* var, const AbstractValue& val);
|
|
132
|
+
|
|
133
|
+
/// Set abstract value for any SVF variable at a given ICFG node
|
|
134
|
+
void updateAbstractValue(const ICFGNode* node, const SVFVar* var, const AbstractValue& val);
|
|
135
|
+
|
|
136
|
+
/// Propagate an ObjVar's abstract value from defSite to all its use-site ICFGNodes via SVFG
|
|
137
|
+
void propagateObjVarAbsVal(const ObjVar* var, const ICFGNode* defSite);
|
|
138
|
+
|
|
139
|
+
/// Retrieve the abstract state from the trace for a given ICFG node; asserts if no trace exists
|
|
140
|
+
AbstractState& getAbstractState(const ICFGNode* node);
|
|
141
|
+
|
|
142
|
+
/// Check if an abstract state exists in the trace for a given ICFG node
|
|
143
|
+
bool hasAbstractState(const ICFGNode* node);
|
|
144
|
+
|
|
127
145
|
/// Retrieve abstract state filtered to specific top-level variables
|
|
128
146
|
void getAbstractState(const ICFGNode* node, const Set<const ValVar*>& vars, AbstractState& result);
|
|
129
147
|
|
|
@@ -65,6 +65,12 @@ public:
|
|
|
65
65
|
{
|
|
66
66
|
return callGraphSCC;
|
|
67
67
|
}
|
|
68
|
+
SVFG* getSVFG() const
|
|
69
|
+
{
|
|
70
|
+
return svfg;
|
|
71
|
+
}
|
|
72
|
+
/// Given an ObjVar and its def-site ICFGNode, find all use-site ICFGNodes
|
|
73
|
+
const Set<const ICFGNode*> getUseSitesOfObjVar(const ObjVar* obj, const ICFGNode* node) const;
|
|
68
74
|
|
|
69
75
|
/// Build WTO for each function using call graph SCC
|
|
70
76
|
void initWTO();
|
|
@@ -78,6 +84,7 @@ public:
|
|
|
78
84
|
private:
|
|
79
85
|
SVFIR* svfir;
|
|
80
86
|
ICFG* icfg;
|
|
87
|
+
SVFG* svfg;
|
|
81
88
|
AndersenWaveDiff* pta;
|
|
82
89
|
CallGraph* callGraph;
|
|
83
90
|
CallGraphSCC* callGraphSCC;
|
|
@@ -181,19 +181,19 @@ public:
|
|
|
181
181
|
|
|
182
182
|
/// Given a ValVar and its SVFGNode, find the definition-site ICFGNode
|
|
183
183
|
/// by following incoming direct VFGEdges (asserts unique definition)
|
|
184
|
-
const ICFGNode* getDefSiteOfValVar(const ValVar* var
|
|
184
|
+
const ICFGNode* getDefSiteOfValVar(const ValVar* var) const;
|
|
185
185
|
|
|
186
|
-
/// Given an ObjVar and its
|
|
186
|
+
/// Given an ObjVar and its use-site ICFGNode, find the definition-site ICFGNode
|
|
187
187
|
/// by following incoming IndirectSVFGEdges whose pts contains the ObjVar (asserts unique definition)
|
|
188
|
-
const ICFGNode* getDefSiteOfObjVar(const ObjVar* obj, const
|
|
188
|
+
const ICFGNode* getDefSiteOfObjVar(const ObjVar* obj, const ICFGNode* node) const;
|
|
189
189
|
|
|
190
|
-
/// Given a ValVar
|
|
191
|
-
/// by following outgoing direct VFGEdges from its definition SVFGNode
|
|
192
|
-
const Set<const ICFGNode*> getUseSitesOfValVar(const ValVar* var
|
|
190
|
+
/// Given a ValVar, find all use-site ICFGNodes
|
|
191
|
+
/// by following outgoing direct VFGEdges from its unique definition SVFGNode
|
|
192
|
+
const Set<const ICFGNode*> getUseSitesOfValVar(const ValVar* var) const;
|
|
193
193
|
|
|
194
|
-
/// Given an ObjVar and its
|
|
194
|
+
/// Given an ObjVar and its def-site ICFGNode, find all use-site ICFGNodes
|
|
195
195
|
/// by following outgoing IndirectSVFGEdges whose pts contains the ObjVar
|
|
196
|
-
const Set<const ICFGNode*> getUseSitesOfObjVar(const ObjVar* obj, const
|
|
196
|
+
const Set<const ICFGNode*> getUseSitesOfObjVar(const ObjVar* obj, const ICFGNode* node) const;
|
|
197
197
|
|
|
198
198
|
/// Perform statistics
|
|
199
199
|
void performStat();
|
|
@@ -240,6 +240,7 @@ public:
|
|
|
240
240
|
static const Option<u32_t> LoopBound;
|
|
241
241
|
|
|
242
242
|
// Abstract Execution
|
|
243
|
+
static const Option<bool> SparseAE;
|
|
243
244
|
static const Option<u32_t> WidenDelay;
|
|
244
245
|
/// recursion handling mode, Default: TOP
|
|
245
246
|
static const OptionMap<u32_t> HandleRecur;
|
|
Binary file
|
package/SVF-osx/bin/ae
CHANGED
|
Binary file
|
|
@@ -49,9 +49,6 @@
|
|
|
49
49
|
#include "AE/Core/AbstractValue.h"
|
|
50
50
|
#include "AE/Core/IntervalValue.h"
|
|
51
51
|
#include "SVFIR/SVFVariables.h"
|
|
52
|
-
#include "Util/Z3Expr.h"
|
|
53
|
-
|
|
54
|
-
#include <iomanip>
|
|
55
52
|
|
|
56
53
|
namespace SVF
|
|
57
54
|
{
|
|
@@ -62,10 +59,6 @@ class AbstractState
|
|
|
62
59
|
public:
|
|
63
60
|
typedef Map<u32_t, AbstractValue> VarToAbsValMap;
|
|
64
61
|
typedef VarToAbsValMap AddrToAbsValMap;
|
|
65
|
-
Set<NodeID> _freedAddrs;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
public:
|
|
69
62
|
/// default constructor
|
|
70
63
|
AbstractState()
|
|
71
64
|
{
|
|
@@ -74,7 +67,7 @@ public:
|
|
|
74
67
|
AbstractState(VarToAbsValMap&_varToValMap, AddrToAbsValMap&_locToValMap) : _varToAbsVal(_varToValMap), _addrToAbsVal(_locToValMap) {}
|
|
75
68
|
|
|
76
69
|
/// copy constructor
|
|
77
|
-
AbstractState(const AbstractState&rhs) :
|
|
70
|
+
AbstractState(const AbstractState&rhs) : _varToAbsVal(rhs.getVarToVal()), _addrToAbsVal(rhs.getLocToVal()), _freedAddrs(rhs._freedAddrs)
|
|
78
71
|
{
|
|
79
72
|
|
|
80
73
|
}
|
|
@@ -112,41 +105,19 @@ public:
|
|
|
112
105
|
}
|
|
113
106
|
|
|
114
107
|
/// Return the internal index if addr is an address otherwise return the value of idx
|
|
115
|
-
inline u32_t getIDFromAddr(u32_t addr)
|
|
108
|
+
inline u32_t getIDFromAddr(u32_t addr) const
|
|
116
109
|
{
|
|
117
110
|
return _freedAddrs.count(addr) ? AddressValue::getInternalID(BlackHoleObjAddr) : AddressValue::getInternalID(addr);
|
|
118
111
|
}
|
|
119
112
|
|
|
120
|
-
AbstractState&operator=(const AbstractState&rhs)
|
|
121
|
-
{
|
|
122
|
-
if (rhs != *this)
|
|
123
|
-
{
|
|
124
|
-
_varToAbsVal = rhs._varToAbsVal;
|
|
125
|
-
_addrToAbsVal = rhs._addrToAbsVal;
|
|
126
|
-
_freedAddrs = rhs._freedAddrs;
|
|
127
|
-
}
|
|
128
|
-
return *this;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
113
|
/// move constructor
|
|
132
114
|
AbstractState(AbstractState&&rhs) : _varToAbsVal(std::move(rhs._varToAbsVal)),
|
|
133
|
-
_addrToAbsVal(std::move(rhs._addrToAbsVal))
|
|
115
|
+
_addrToAbsVal(std::move(rhs._addrToAbsVal)),
|
|
116
|
+
_freedAddrs(std::move(rhs._freedAddrs))
|
|
134
117
|
{
|
|
135
118
|
|
|
136
119
|
}
|
|
137
120
|
|
|
138
|
-
/// operator= move constructor
|
|
139
|
-
AbstractState&operator=(AbstractState&&rhs)
|
|
140
|
-
{
|
|
141
|
-
if (&rhs != this)
|
|
142
|
-
{
|
|
143
|
-
_varToAbsVal = std::move(rhs._varToAbsVal);
|
|
144
|
-
_addrToAbsVal = std::move(rhs._addrToAbsVal);
|
|
145
|
-
_freedAddrs = std::move(rhs._freedAddrs);
|
|
146
|
-
}
|
|
147
|
-
return *this;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
121
|
/// Set all value bottom
|
|
151
122
|
AbstractState bottom() const
|
|
152
123
|
{
|
|
@@ -176,9 +147,7 @@ public:
|
|
|
176
147
|
{
|
|
177
148
|
AbstractState inv;
|
|
178
149
|
for (u32_t id: sl)
|
|
179
|
-
{
|
|
180
150
|
inv._varToAbsVal[id] = _varToAbsVal[id];
|
|
181
|
-
}
|
|
182
151
|
return inv;
|
|
183
152
|
}
|
|
184
153
|
|
|
@@ -196,6 +165,7 @@ public:
|
|
|
196
165
|
protected:
|
|
197
166
|
VarToAbsValMap _varToAbsVal; ///< Map a variable (symbol) to its abstract value
|
|
198
167
|
AddrToAbsValMap _addrToAbsVal; ///< Map a memory address to its stored abstract value
|
|
168
|
+
Set<NodeID> _freedAddrs;
|
|
199
169
|
|
|
200
170
|
public:
|
|
201
171
|
|
|
@@ -203,24 +173,46 @@ public:
|
|
|
203
173
|
/// get abstract value of variable
|
|
204
174
|
inline virtual AbstractValue &operator[](u32_t varId)
|
|
205
175
|
{
|
|
176
|
+
assert(!isVirtualMemAddress(varId) && "varId is a virtual memory address, use load() instead");
|
|
206
177
|
return _varToAbsVal[varId];
|
|
207
178
|
}
|
|
208
179
|
|
|
209
180
|
/// get abstract value of variable
|
|
210
181
|
inline virtual const AbstractValue &operator[](u32_t varId) const
|
|
211
182
|
{
|
|
183
|
+
assert(!isVirtualMemAddress(varId) && "varId is a virtual memory address, use load() instead");
|
|
212
184
|
return _varToAbsVal.at(varId);
|
|
213
185
|
}
|
|
214
186
|
|
|
187
|
+
inline virtual AbstractValue &load(u32_t addr)
|
|
188
|
+
{
|
|
189
|
+
assert(isVirtualMemAddress(addr) && "not virtual address?");
|
|
190
|
+
u32_t objId = getIDFromAddr(addr);
|
|
191
|
+
return _addrToAbsVal[objId];
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
inline virtual const AbstractValue &load(u32_t addr) const
|
|
195
|
+
{
|
|
196
|
+
assert(isVirtualMemAddress(addr) && "not virtual address?");
|
|
197
|
+
u32_t objId = getIDFromAddr(addr);
|
|
198
|
+
return _addrToAbsVal.at(objId);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
inline void store(u32_t addr, const AbstractValue &val)
|
|
202
|
+
{
|
|
203
|
+
assert(isVirtualMemAddress(addr) && "not virtual address?");
|
|
204
|
+
u32_t objId = getIDFromAddr(addr);
|
|
205
|
+
if (isNullMem(addr)) return;
|
|
206
|
+
_addrToAbsVal[objId] = val;
|
|
207
|
+
}
|
|
208
|
+
|
|
215
209
|
/// whether the variable is in varToAddrs table
|
|
216
210
|
inline bool inVarToAddrsTable(u32_t id) const
|
|
217
211
|
{
|
|
218
212
|
if (_varToAbsVal.find(id)!= _varToAbsVal.end())
|
|
219
213
|
{
|
|
220
214
|
if (_varToAbsVal.at(id).isAddr())
|
|
221
|
-
{
|
|
222
215
|
return true;
|
|
223
|
-
}
|
|
224
216
|
}
|
|
225
217
|
return false;
|
|
226
218
|
}
|
|
@@ -231,9 +223,7 @@ public:
|
|
|
231
223
|
if (_varToAbsVal.find(id) != _varToAbsVal.end())
|
|
232
224
|
{
|
|
233
225
|
if (_varToAbsVal.at(id).isInterval())
|
|
234
|
-
{
|
|
235
226
|
return true;
|
|
236
|
-
}
|
|
237
227
|
}
|
|
238
228
|
return false;
|
|
239
229
|
}
|
|
@@ -265,19 +255,17 @@ public:
|
|
|
265
255
|
}
|
|
266
256
|
|
|
267
257
|
/// get var2val map
|
|
268
|
-
const VarToAbsValMap&getVarToVal() const
|
|
258
|
+
inline const VarToAbsValMap&getVarToVal() const
|
|
269
259
|
{
|
|
270
260
|
return _varToAbsVal;
|
|
271
261
|
}
|
|
272
262
|
|
|
273
263
|
/// get loc2val map
|
|
274
|
-
const AddrToAbsValMap&getLocToVal() const
|
|
264
|
+
inline const AddrToAbsValMap&getLocToVal() const
|
|
275
265
|
{
|
|
276
266
|
return _addrToAbsVal;
|
|
277
267
|
}
|
|
278
268
|
|
|
279
|
-
public:
|
|
280
|
-
|
|
281
269
|
/// domain widen with other, and return the widened domain
|
|
282
270
|
AbstractState widening(const AbstractState&other);
|
|
283
271
|
|
|
@@ -310,81 +298,39 @@ public:
|
|
|
310
298
|
*/
|
|
311
299
|
const SVFType* getPointeeElement(NodeID id);
|
|
312
300
|
|
|
313
|
-
|
|
314
|
-
u32_t hash() const;
|
|
315
|
-
|
|
316
|
-
public:
|
|
317
|
-
inline void store(u32_t addr, const AbstractValue &val)
|
|
318
|
-
{
|
|
319
|
-
assert(isVirtualMemAddress(addr) && "not virtual address?");
|
|
320
|
-
u32_t objId = getIDFromAddr(addr);
|
|
321
|
-
if (isNullMem(addr)) return;
|
|
322
|
-
_addrToAbsVal[objId] = val;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
inline virtual AbstractValue &load(u32_t addr)
|
|
326
|
-
{
|
|
327
|
-
assert(isVirtualMemAddress(addr) && "not virtual address?");
|
|
328
|
-
u32_t objId = getIDFromAddr(addr);
|
|
329
|
-
return _addrToAbsVal[objId];
|
|
330
|
-
|
|
331
|
-
}
|
|
332
|
-
|
|
333
301
|
void printAbstractState() const;
|
|
334
302
|
|
|
335
|
-
|
|
336
|
-
{
|
|
337
|
-
return "";
|
|
338
|
-
}
|
|
303
|
+
u32_t hash() const;
|
|
339
304
|
|
|
305
|
+
// lhs == rhs for varToValMap
|
|
306
|
+
bool eqVarToValMap(const VarToAbsValMap&lhs, const VarToAbsValMap&rhs) const;
|
|
307
|
+
// lhs >= rhs for varToValMap
|
|
308
|
+
bool geqVarToValMap(const VarToAbsValMap&lhs, const VarToAbsValMap&rhs) const;
|
|
309
|
+
// lhs == rhs for AbstractState
|
|
340
310
|
bool equals(const AbstractState&other) const;
|
|
341
311
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
{
|
|
345
|
-
if (lhs.size() != rhs.size()) return false;
|
|
346
|
-
for (const auto &item: lhs)
|
|
347
|
-
{
|
|
348
|
-
auto it = rhs.find(item.first);
|
|
349
|
-
if (it == rhs.end())
|
|
350
|
-
return false;
|
|
351
|
-
if (!item.second.equals(it->second))
|
|
352
|
-
return false;
|
|
353
|
-
else
|
|
354
|
-
{
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
return true;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
static bool lessThanVarToValMap(const VarToAbsValMap&lhs, const VarToAbsValMap&rhs)
|
|
312
|
+
/// Assignment operator
|
|
313
|
+
AbstractState&operator=(const AbstractState&rhs)
|
|
361
314
|
{
|
|
362
|
-
if (
|
|
363
|
-
for (const auto &item: lhs)
|
|
315
|
+
if (&rhs != this)
|
|
364
316
|
{
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
if (item.second.getInterval().contain(it->second.getInterval())) return false;
|
|
317
|
+
_varToAbsVal = rhs._varToAbsVal;
|
|
318
|
+
_addrToAbsVal = rhs._addrToAbsVal;
|
|
319
|
+
_freedAddrs = rhs._freedAddrs;
|
|
369
320
|
}
|
|
370
|
-
return
|
|
321
|
+
return *this;
|
|
371
322
|
}
|
|
372
323
|
|
|
373
|
-
|
|
374
|
-
|
|
324
|
+
/// operator= move constructor
|
|
325
|
+
AbstractState&operator=(AbstractState&&rhs)
|
|
375
326
|
{
|
|
376
|
-
if (rhs
|
|
377
|
-
for (const auto &item: rhs)
|
|
327
|
+
if (&rhs != this)
|
|
378
328
|
{
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
if (!it->second.getInterval().contain(
|
|
383
|
-
item.second.getInterval()))
|
|
384
|
-
return false;
|
|
385
|
-
|
|
329
|
+
_varToAbsVal = std::move(rhs._varToAbsVal);
|
|
330
|
+
_addrToAbsVal = std::move(rhs._addrToAbsVal);
|
|
331
|
+
_freedAddrs = std::move(rhs._freedAddrs);
|
|
386
332
|
}
|
|
387
|
-
return
|
|
333
|
+
return *this;
|
|
388
334
|
}
|
|
389
335
|
|
|
390
336
|
bool operator==(const AbstractState&rhs) const
|
|
@@ -403,7 +349,6 @@ public:
|
|
|
403
349
|
return !(*this >= rhs);
|
|
404
350
|
}
|
|
405
351
|
|
|
406
|
-
|
|
407
352
|
bool operator>=(const AbstractState&rhs) const
|
|
408
353
|
{
|
|
409
354
|
return geqVarToValMap(_varToAbsVal, rhs.getVarToVal()) && geqVarToValMap(_addrToAbsVal, rhs.getLocToVal());
|
|
@@ -113,16 +113,16 @@ public:
|
|
|
113
113
|
AbstractState& getAbstractState(const ICFGNode* node);
|
|
114
114
|
|
|
115
115
|
/// Check if an abstract state exists in the trace for a given ICFG node
|
|
116
|
-
bool
|
|
116
|
+
bool hasAbstractState(const ICFGNode* node);
|
|
117
117
|
|
|
118
118
|
/// Retrieve abstract value for a top-level variable at a given ICFG node
|
|
119
|
-
AbstractValue& getAbstractValue(const ICFGNode* node, const ValVar* var);
|
|
119
|
+
const AbstractValue& getAbstractValue(const ICFGNode* node, const ValVar* var);
|
|
120
120
|
|
|
121
121
|
/// Retrieve abstract value for an address-taken variable at a given ICFG node
|
|
122
|
-
AbstractValue& getAbstractValue(const ICFGNode* node, const ObjVar* var);
|
|
122
|
+
const AbstractValue& getAbstractValue(const ICFGNode* node, const ObjVar* var);
|
|
123
123
|
|
|
124
124
|
/// Retrieve abstract value for any SVF variable at a given ICFG node
|
|
125
|
-
AbstractValue& getAbstractValue(const ICFGNode* node, const SVFVar* var);
|
|
125
|
+
const AbstractValue& getAbstractValue(const ICFGNode* node, const SVFVar* var);
|
|
126
126
|
|
|
127
127
|
/// Retrieve abstract state filtered to specific top-level variables
|
|
128
128
|
void getAbstractState(const ICFGNode* node, const Set<const ValVar*>& vars, AbstractState& result);
|
|
Binary file
|