svf-lib 1.0.2477 → 1.0.2479
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/bin/ae +0 -0
- package/SVF-linux-aarch64/include/AE/Core/AbstractState.h +3 -3
- package/SVF-linux-aarch64/include/AE/Core/AddressValue.h +2 -2
- package/SVF-linux-aarch64/include/AE/Svfexe/AbsExtAPI.h +12 -32
- package/SVF-linux-aarch64/include/AE/Svfexe/AbstractInterpretation.h +13 -3
- package/SVF-linux-aarch64/lib/libSvfCore.so.3.3 +0 -0
- package/SVF-linux-x86_64/bin/ae +0 -0
- package/SVF-linux-x86_64/include/AE/Core/AbstractState.h +3 -3
- package/SVF-linux-x86_64/include/AE/Core/AddressValue.h +2 -2
- package/SVF-linux-x86_64/include/AE/Svfexe/AbsExtAPI.h +12 -32
- package/SVF-linux-x86_64/include/AE/Svfexe/AbstractInterpretation.h +13 -3
- package/SVF-linux-x86_64/lib/libSvfCore.so.3.3 +0 -0
- package/package.json +1 -1
package/SVF-linux-aarch64/bin/ae
CHANGED
|
Binary file
|
|
@@ -114,7 +114,7 @@ public:
|
|
|
114
114
|
/// Return the internal index if addr is an address otherwise return the value of idx
|
|
115
115
|
inline u32_t getIDFromAddr(u32_t addr)
|
|
116
116
|
{
|
|
117
|
-
return _freedAddrs.count(addr) ? AddressValue::getInternalID(
|
|
117
|
+
return _freedAddrs.count(addr) ? AddressValue::getInternalID(BlackHoleObjAddr) : AddressValue::getInternalID(addr);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
AbstractState&operator=(const AbstractState&rhs)
|
|
@@ -187,9 +187,9 @@ public:
|
|
|
187
187
|
return addr == NullMemAddr;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
static inline bool
|
|
190
|
+
static inline bool isBlackHoleObjAddr(u32_t addr)
|
|
191
191
|
{
|
|
192
|
-
return addr ==
|
|
192
|
+
return addr == BlackHoleObjAddr;
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
|
|
33
33
|
#define AddressMask 0x7f000000
|
|
34
34
|
#define FlippedAddressMask (AddressMask^0xffffffff)
|
|
35
|
-
// the address of
|
|
36
|
-
#define
|
|
35
|
+
// the address of BlackHole object, getVirtualMemAddress(2);
|
|
36
|
+
#define BlackHoleObjAddr 0x7f000000 + 2
|
|
37
37
|
// the address of NullMem, getVirtualMemAddress(0);
|
|
38
38
|
#define NullMemAddr 0x7f000000
|
|
39
39
|
|
|
@@ -74,43 +74,23 @@ public:
|
|
|
74
74
|
*/
|
|
75
75
|
void handleExtAPI(const CallICFGNode *call);
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
* @brief Handles the strcpy API call.
|
|
79
|
-
* @param call Pointer to the call ICFG node.
|
|
80
|
-
*/
|
|
81
|
-
void handleStrcpy(const CallICFGNode *call);
|
|
77
|
+
// --- Shared primitives used by string/memory handlers ---
|
|
82
78
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
79
|
+
/// Get the byte size of each element for a pointer/array variable.
|
|
80
|
+
u32_t getElementSize(AbstractState& as, const SVFVar* var);
|
|
81
|
+
|
|
82
|
+
/// Check if an interval length is usable (not bottom, not unbounded).
|
|
83
|
+
static bool isValidLength(const IntervalValue& len);
|
|
84
|
+
|
|
85
|
+
/// Calculate the length of a null-terminated string in abstract state.
|
|
89
86
|
IntervalValue getStrlen(AbstractState& as, const SVF::SVFVar *strValue);
|
|
90
87
|
|
|
91
|
-
|
|
92
|
-
* @brief Handles the strcat API call.
|
|
93
|
-
* @param call Pointer to the call ICFG node.
|
|
94
|
-
*/
|
|
95
|
-
void handleStrcat(const SVF::CallICFGNode *call);
|
|
88
|
+
// --- String/memory operation handlers ---
|
|
96
89
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
* @param dst Pointer to the destination SVF variable.
|
|
101
|
-
* @param src Pointer to the source SVF variable.
|
|
102
|
-
* @param len The interval value representing the length to copy.
|
|
103
|
-
* @param start_idx The starting index for copying.
|
|
104
|
-
*/
|
|
90
|
+
void handleStrcpy(const CallICFGNode *call);
|
|
91
|
+
void handleStrcat(const CallICFGNode *call);
|
|
92
|
+
void handleStrncat(const CallICFGNode *call);
|
|
105
93
|
void handleMemcpy(AbstractState& as, const SVF::SVFVar *dst, const SVF::SVFVar *src, IntervalValue len, u32_t start_idx);
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* @brief Handles the memset API call.
|
|
109
|
-
* @param as Reference to the abstract state.
|
|
110
|
-
* @param dst Pointer to the destination SVF variable.
|
|
111
|
-
* @param elem The interval value representing the element to set.
|
|
112
|
-
* @param len The interval value representing the length to set.
|
|
113
|
-
*/
|
|
114
94
|
void handleMemset(AbstractState& as, const SVFVar* dst, IntervalValue elem, IntervalValue len);
|
|
115
95
|
|
|
116
96
|
/**
|
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
#include "Util/SVFBugReport.h"
|
|
37
37
|
#include "Util/SVFStat.h"
|
|
38
38
|
#include "Graphs/SCC.h"
|
|
39
|
+
#include "Graphs/CallGraph.h"
|
|
40
|
+
#include <deque>
|
|
39
41
|
|
|
40
42
|
namespace SVF
|
|
41
43
|
{
|
|
@@ -144,6 +146,13 @@ public:
|
|
|
144
146
|
/// Program entry
|
|
145
147
|
void analyse();
|
|
146
148
|
|
|
149
|
+
/// Analyze all entry points (functions without callers)
|
|
150
|
+
void analyzeFromAllProgEntries();
|
|
151
|
+
|
|
152
|
+
/// Get all entry point functions (functions without callers)
|
|
153
|
+
std::deque<const FunObjVar*> collectProgEntryFuns();
|
|
154
|
+
|
|
155
|
+
|
|
147
156
|
static AbstractInterpretation& getAEInstance()
|
|
148
157
|
{
|
|
149
158
|
static AbstractInterpretation instance;
|
|
@@ -218,14 +227,14 @@ private:
|
|
|
218
227
|
*
|
|
219
228
|
* @param cycle WTOCycle which has weak topo order of basic blocks and nested cycles
|
|
220
229
|
*/
|
|
221
|
-
virtual void handleLoopOrRecursion(const ICFGCycleWTO* cycle);
|
|
230
|
+
virtual void handleLoopOrRecursion(const ICFGCycleWTO* cycle, const CallICFGNode* caller = nullptr);
|
|
222
231
|
|
|
223
232
|
/**
|
|
224
233
|
* Handle a function using worklist algorithm
|
|
225
234
|
*
|
|
226
235
|
* @param funEntry The entry node of the function to handle
|
|
227
236
|
*/
|
|
228
|
-
void handleFunction(const ICFGNode* funEntry);
|
|
237
|
+
void handleFunction(const ICFGNode* funEntry, const CallICFGNode* caller = nullptr);
|
|
229
238
|
|
|
230
239
|
/**
|
|
231
240
|
* Handle an ICFG node by merging states and processing statements
|
|
@@ -322,9 +331,9 @@ private:
|
|
|
322
331
|
AEAPI* api{nullptr};
|
|
323
332
|
|
|
324
333
|
ICFG* icfg;
|
|
334
|
+
CallGraph* callGraph;
|
|
325
335
|
AEStat* stat;
|
|
326
336
|
|
|
327
|
-
std::vector<const CallICFGNode*> callSiteStack;
|
|
328
337
|
Map<const FunObjVar*, const ICFGWTO*> funcToWTO;
|
|
329
338
|
Set<std::pair<const CallICFGNode*, NodeID>> nonRecursiveCallSites;
|
|
330
339
|
Set<const FunObjVar*> recursiveFuns;
|
|
@@ -358,6 +367,7 @@ private:
|
|
|
358
367
|
Map<std::string, std::function<void(const CallICFGNode*)>> func_map;
|
|
359
368
|
|
|
360
369
|
Map<const ICFGNode*, AbstractState> abstractTrace; // abstract states immediately after nodes
|
|
370
|
+
Set<const ICFGNode*> allAnalyzedNodes; // All nodes ever analyzed (across all entry points)
|
|
361
371
|
std::string moduleName;
|
|
362
372
|
|
|
363
373
|
std::vector<std::unique_ptr<AEDetector>> detectors;
|
|
Binary file
|
package/SVF-linux-x86_64/bin/ae
CHANGED
|
Binary file
|
|
@@ -114,7 +114,7 @@ public:
|
|
|
114
114
|
/// Return the internal index if addr is an address otherwise return the value of idx
|
|
115
115
|
inline u32_t getIDFromAddr(u32_t addr)
|
|
116
116
|
{
|
|
117
|
-
return _freedAddrs.count(addr) ? AddressValue::getInternalID(
|
|
117
|
+
return _freedAddrs.count(addr) ? AddressValue::getInternalID(BlackHoleObjAddr) : AddressValue::getInternalID(addr);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
AbstractState&operator=(const AbstractState&rhs)
|
|
@@ -187,9 +187,9 @@ public:
|
|
|
187
187
|
return addr == NullMemAddr;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
static inline bool
|
|
190
|
+
static inline bool isBlackHoleObjAddr(u32_t addr)
|
|
191
191
|
{
|
|
192
|
-
return addr ==
|
|
192
|
+
return addr == BlackHoleObjAddr;
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
|
|
33
33
|
#define AddressMask 0x7f000000
|
|
34
34
|
#define FlippedAddressMask (AddressMask^0xffffffff)
|
|
35
|
-
// the address of
|
|
36
|
-
#define
|
|
35
|
+
// the address of BlackHole object, getVirtualMemAddress(2);
|
|
36
|
+
#define BlackHoleObjAddr 0x7f000000 + 2
|
|
37
37
|
// the address of NullMem, getVirtualMemAddress(0);
|
|
38
38
|
#define NullMemAddr 0x7f000000
|
|
39
39
|
|
|
@@ -74,43 +74,23 @@ public:
|
|
|
74
74
|
*/
|
|
75
75
|
void handleExtAPI(const CallICFGNode *call);
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
* @brief Handles the strcpy API call.
|
|
79
|
-
* @param call Pointer to the call ICFG node.
|
|
80
|
-
*/
|
|
81
|
-
void handleStrcpy(const CallICFGNode *call);
|
|
77
|
+
// --- Shared primitives used by string/memory handlers ---
|
|
82
78
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
79
|
+
/// Get the byte size of each element for a pointer/array variable.
|
|
80
|
+
u32_t getElementSize(AbstractState& as, const SVFVar* var);
|
|
81
|
+
|
|
82
|
+
/// Check if an interval length is usable (not bottom, not unbounded).
|
|
83
|
+
static bool isValidLength(const IntervalValue& len);
|
|
84
|
+
|
|
85
|
+
/// Calculate the length of a null-terminated string in abstract state.
|
|
89
86
|
IntervalValue getStrlen(AbstractState& as, const SVF::SVFVar *strValue);
|
|
90
87
|
|
|
91
|
-
|
|
92
|
-
* @brief Handles the strcat API call.
|
|
93
|
-
* @param call Pointer to the call ICFG node.
|
|
94
|
-
*/
|
|
95
|
-
void handleStrcat(const SVF::CallICFGNode *call);
|
|
88
|
+
// --- String/memory operation handlers ---
|
|
96
89
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
* @param dst Pointer to the destination SVF variable.
|
|
101
|
-
* @param src Pointer to the source SVF variable.
|
|
102
|
-
* @param len The interval value representing the length to copy.
|
|
103
|
-
* @param start_idx The starting index for copying.
|
|
104
|
-
*/
|
|
90
|
+
void handleStrcpy(const CallICFGNode *call);
|
|
91
|
+
void handleStrcat(const CallICFGNode *call);
|
|
92
|
+
void handleStrncat(const CallICFGNode *call);
|
|
105
93
|
void handleMemcpy(AbstractState& as, const SVF::SVFVar *dst, const SVF::SVFVar *src, IntervalValue len, u32_t start_idx);
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* @brief Handles the memset API call.
|
|
109
|
-
* @param as Reference to the abstract state.
|
|
110
|
-
* @param dst Pointer to the destination SVF variable.
|
|
111
|
-
* @param elem The interval value representing the element to set.
|
|
112
|
-
* @param len The interval value representing the length to set.
|
|
113
|
-
*/
|
|
114
94
|
void handleMemset(AbstractState& as, const SVFVar* dst, IntervalValue elem, IntervalValue len);
|
|
115
95
|
|
|
116
96
|
/**
|
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
#include "Util/SVFBugReport.h"
|
|
37
37
|
#include "Util/SVFStat.h"
|
|
38
38
|
#include "Graphs/SCC.h"
|
|
39
|
+
#include "Graphs/CallGraph.h"
|
|
40
|
+
#include <deque>
|
|
39
41
|
|
|
40
42
|
namespace SVF
|
|
41
43
|
{
|
|
@@ -144,6 +146,13 @@ public:
|
|
|
144
146
|
/// Program entry
|
|
145
147
|
void analyse();
|
|
146
148
|
|
|
149
|
+
/// Analyze all entry points (functions without callers)
|
|
150
|
+
void analyzeFromAllProgEntries();
|
|
151
|
+
|
|
152
|
+
/// Get all entry point functions (functions without callers)
|
|
153
|
+
std::deque<const FunObjVar*> collectProgEntryFuns();
|
|
154
|
+
|
|
155
|
+
|
|
147
156
|
static AbstractInterpretation& getAEInstance()
|
|
148
157
|
{
|
|
149
158
|
static AbstractInterpretation instance;
|
|
@@ -218,14 +227,14 @@ private:
|
|
|
218
227
|
*
|
|
219
228
|
* @param cycle WTOCycle which has weak topo order of basic blocks and nested cycles
|
|
220
229
|
*/
|
|
221
|
-
virtual void handleLoopOrRecursion(const ICFGCycleWTO* cycle);
|
|
230
|
+
virtual void handleLoopOrRecursion(const ICFGCycleWTO* cycle, const CallICFGNode* caller = nullptr);
|
|
222
231
|
|
|
223
232
|
/**
|
|
224
233
|
* Handle a function using worklist algorithm
|
|
225
234
|
*
|
|
226
235
|
* @param funEntry The entry node of the function to handle
|
|
227
236
|
*/
|
|
228
|
-
void handleFunction(const ICFGNode* funEntry);
|
|
237
|
+
void handleFunction(const ICFGNode* funEntry, const CallICFGNode* caller = nullptr);
|
|
229
238
|
|
|
230
239
|
/**
|
|
231
240
|
* Handle an ICFG node by merging states and processing statements
|
|
@@ -322,9 +331,9 @@ private:
|
|
|
322
331
|
AEAPI* api{nullptr};
|
|
323
332
|
|
|
324
333
|
ICFG* icfg;
|
|
334
|
+
CallGraph* callGraph;
|
|
325
335
|
AEStat* stat;
|
|
326
336
|
|
|
327
|
-
std::vector<const CallICFGNode*> callSiteStack;
|
|
328
337
|
Map<const FunObjVar*, const ICFGWTO*> funcToWTO;
|
|
329
338
|
Set<std::pair<const CallICFGNode*, NodeID>> nonRecursiveCallSites;
|
|
330
339
|
Set<const FunObjVar*> recursiveFuns;
|
|
@@ -358,6 +367,7 @@ private:
|
|
|
358
367
|
Map<std::string, std::function<void(const CallICFGNode*)>> func_map;
|
|
359
368
|
|
|
360
369
|
Map<const ICFGNode*, AbstractState> abstractTrace; // abstract states immediately after nodes
|
|
370
|
+
Set<const ICFGNode*> allAnalyzedNodes; // All nodes ever analyzed (across all entry points)
|
|
361
371
|
std::string moduleName;
|
|
362
372
|
|
|
363
373
|
std::vector<std::unique_ptr<AEDetector>> detectors;
|
|
Binary file
|