svf-tools 1.0.660 → 1.0.662
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.662",
|
|
4
4
|
"description": "* <b>[TypeClone](https://github.com/SVF-tools/SVF/wiki/TypeClone) published in our [ECOOP paper](https://yuleisui.github.io/publications/ecoop20.pdf) is now available in SVF </b> * <b>SVF now uses a single script for its build. Just type [`source ./build.sh`](https://github.com/SVF-tools/SVF/blob/master/build.sh) in your terminal, that's it!</b> * <b>SVF now supports LLVM-10.0.0! </b> * <b>We thank [bsauce](https://github.com/bsauce) for writing a user manual of SVF ([link1](https://www.jianshu.com/p/068a08ec749c) and [link2](https://www.jianshu.com/p/777c30d4240e)) in Chinese </b> * <b>SVF now supports LLVM-9.0.0 (Thank [Byoungyoung Lee](https://github.com/SVF-tools/SVF/issues/142) for his help!). </b> * <b>SVF now supports a set of [field-sensitive pointer analyses](https://yuleisui.github.io/publications/sas2019a.pdf). </b> * <b>[Use SVF as an external lib](https://github.com/SVF-tools/SVF/wiki/Using-SVF-as-a-lib-in-your-own-tool) for your own project (Contributed by [Hongxu Chen](https://github.com/HongxuChen)). </b> * <b>SVF now supports LLVM-7.0.0. </b> * <b>SVF now supports Docker. [Try SVF in Docker](https://github.com/SVF-tools/SVF/wiki/Try-SVF-in-Docker)! </b> * <b>SVF now supports [LLVM-6.0.0](https://github.com/svf-tools/SVF/pull/38) (Contributed by [Jack Anthony](https://github.com/jackanth)). </b> * <b>SVF now supports [LLVM-4.0.0](https://github.com/svf-tools/SVF/pull/23) (Contributed by Jared Carlson. Thank [Jared](https://github.com/jcarlson23) and [Will](https://github.com/dtzWill) for their in-depth [discussions](https://github.com/svf-tools/SVF/pull/18) about updating SVF!) </b> * <b>SVF now supports analysis for C++ programs.</b> <br />",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -4974,35 +4974,35 @@
|
|
|
4974
4974
|
"arguments": "(i8*, i8, i32, i32, i1)",
|
|
4975
4975
|
"type": "EFT_L_A0__A0R_A1",
|
|
4976
4976
|
"overwrite_app_function": 0,
|
|
4977
|
-
"memset_like": ["
|
|
4977
|
+
"memset_like": ["Arg0", "Arg1", "Arg2"]
|
|
4978
4978
|
},
|
|
4979
4979
|
"llvm.memset.p0i8.i32": {
|
|
4980
4980
|
"return": "void",
|
|
4981
4981
|
"arguments": "(i8*, i8, i32, i32, i1)",
|
|
4982
4982
|
"type": "EFT_L_A0__A0R_A1",
|
|
4983
4983
|
"overwrite_app_function": 0,
|
|
4984
|
-
"memset_like": ["
|
|
4984
|
+
"memset_like": ["Arg0", "Arg1", "Arg2"]
|
|
4985
4985
|
},
|
|
4986
4986
|
"llvm.memset.p0i8.i64": {
|
|
4987
4987
|
"return": "void",
|
|
4988
4988
|
"arguments": "(i8*, i8, i64, i32, i1)",
|
|
4989
4989
|
"type": "EFT_L_A0__A0R_A1",
|
|
4990
4990
|
"overwrite_app_function": 0,
|
|
4991
|
-
"memset_like": ["
|
|
4991
|
+
"memset_like": ["Arg0", "Arg1", "Arg2"]
|
|
4992
4992
|
},
|
|
4993
4993
|
"__memset_chk": {
|
|
4994
4994
|
"return": "void *",
|
|
4995
4995
|
"arguments": "(void *, int, size_t, size_t)",
|
|
4996
4996
|
"type": "EFT_L_A0__A0R_A1",
|
|
4997
4997
|
"overwrite_app_function": 0,
|
|
4998
|
-
"memset_like": ["
|
|
4998
|
+
"memset_like": ["Arg0", "Arg1", "Arg2"]
|
|
4999
4999
|
},
|
|
5000
5000
|
"llvm.memcpy": {
|
|
5001
5001
|
"return": "void",
|
|
5002
5002
|
"arguments": "(i8*, i8*, i32, i32, i1)",
|
|
5003
5003
|
"type": "EFT_L_A0__A0R_A1R",
|
|
5004
5004
|
"overwrite_app_function": 0,
|
|
5005
|
-
"memcpy_like": ["
|
|
5005
|
+
"memcpy_like": ["Arg0", "Arg1", "Arg2"],
|
|
5006
5006
|
"CopyStmt": {
|
|
5007
5007
|
"src": "Arg0",
|
|
5008
5008
|
"dst": "Ret"
|
|
@@ -5013,7 +5013,7 @@
|
|
|
5013
5013
|
"arguments": "(i8*, i8*, i32, i32, i1)",
|
|
5014
5014
|
"type": "EFT_L_A0__A0R_A1R",
|
|
5015
5015
|
"overwrite_app_function": 0,
|
|
5016
|
-
"memcpy_like": ["
|
|
5016
|
+
"memcpy_like": ["Arg0", "Arg1", "Arg2"],
|
|
5017
5017
|
"CopyStmt": {
|
|
5018
5018
|
"src": "Arg0",
|
|
5019
5019
|
"dst": "Ret"
|
|
@@ -5024,7 +5024,7 @@
|
|
|
5024
5024
|
"arguments": "(i8*, *i8, i64, i32, i1)",
|
|
5025
5025
|
"type": "EFT_L_A0__A0R_A1R",
|
|
5026
5026
|
"overwrite_app_function": 0,
|
|
5027
|
-
"memcpy_like": ["
|
|
5027
|
+
"memcpy_like": ["Arg0", "Arg1", "Arg2"],
|
|
5028
5028
|
"CopyStmt": {
|
|
5029
5029
|
"src": "Arg0",
|
|
5030
5030
|
"dst": "Ret"
|
|
@@ -5035,7 +5035,7 @@
|
|
|
5035
5035
|
"arguments": "(i8*, i8*, i32, i1)",
|
|
5036
5036
|
"type": "EFT_L_A0__A0R_A1R",
|
|
5037
5037
|
"overwrite_app_function": 0,
|
|
5038
|
-
"memcpy_like": ["
|
|
5038
|
+
"memcpy_like": ["Arg0", "Arg1", "Arg2"],
|
|
5039
5039
|
"CopyStmt": {
|
|
5040
5040
|
"src": "Arg0",
|
|
5041
5041
|
"dst": "Ret"
|
|
@@ -5046,7 +5046,7 @@
|
|
|
5046
5046
|
"arguments": "(i8*, i8*, i32, i1)",
|
|
5047
5047
|
"type": "EFT_L_A0__A0R_A1R",
|
|
5048
5048
|
"overwrite_app_function": 0,
|
|
5049
|
-
"memcpy_like": ["
|
|
5049
|
+
"memcpy_like": ["Arg0", "Arg1", "Arg2"],
|
|
5050
5050
|
"CopyStmt": {
|
|
5051
5051
|
"src": "Arg0",
|
|
5052
5052
|
"dst": "Ret"
|
|
@@ -5057,7 +5057,7 @@
|
|
|
5057
5057
|
"arguments": "(i8*, i8*, i64, i1)",
|
|
5058
5058
|
"type": "EFT_L_A0__A0R_A1R",
|
|
5059
5059
|
"overwrite_app_function": 0,
|
|
5060
|
-
"memcpy_like": ["
|
|
5060
|
+
"memcpy_like": ["Arg0", "Arg1", "Arg2"],
|
|
5061
5061
|
"CopyStmt": {
|
|
5062
5062
|
"src": "Arg0",
|
|
5063
5063
|
"dst": "Ret"
|
|
@@ -5068,7 +5068,7 @@
|
|
|
5068
5068
|
"arguments": "(void *restrict, const void *restrict, int, size_t)",
|
|
5069
5069
|
"type": "EFT_L_A0__A0R_A1R",
|
|
5070
5070
|
"overwrite_app_function": 0,
|
|
5071
|
-
"memcpy_like": ["
|
|
5071
|
+
"memcpy_like": ["Arg0", "Arg1", "Arg2"],
|
|
5072
5072
|
"CopyStmt": {
|
|
5073
5073
|
"src": "Arg0",
|
|
5074
5074
|
"dst": "Ret"
|
|
@@ -5079,7 +5079,7 @@
|
|
|
5079
5079
|
"arguments": "(void *, const void *, size_t)",
|
|
5080
5080
|
"type": "EFT_L_A0__A0R_A1R",
|
|
5081
5081
|
"overwrite_app_function": 0,
|
|
5082
|
-
"memcpy_like": ["
|
|
5082
|
+
"memcpy_like": ["Arg0", "Arg1", "Arg2"],
|
|
5083
5083
|
"CopyStmt": {
|
|
5084
5084
|
"src": "Arg0",
|
|
5085
5085
|
"dst": "Ret"
|
|
@@ -5090,7 +5090,7 @@
|
|
|
5090
5090
|
"arguments": "(void *, const void *, size_t)",
|
|
5091
5091
|
"type": "EFT_L_A0__A0R_A1R",
|
|
5092
5092
|
"overwrite_app_function": 0,
|
|
5093
|
-
"memcpy_like": ["
|
|
5093
|
+
"memcpy_like": ["Arg0", "Arg1", "Arg2"],
|
|
5094
5094
|
"CopyStmt": {
|
|
5095
5095
|
"src": "Arg0",
|
|
5096
5096
|
"dst": "Ret"
|
|
@@ -5108,14 +5108,14 @@
|
|
|
5108
5108
|
"arguments": "(const void *, void *, size_t)",
|
|
5109
5109
|
"type": "EFT_A1R_A0R",
|
|
5110
5110
|
"overwrite_app_function": 0,
|
|
5111
|
-
"memcpy_like": ["
|
|
5111
|
+
"memcpy_like": ["Arg1", "Arg0", "Arg2"]
|
|
5112
5112
|
},
|
|
5113
5113
|
"iconv": {
|
|
5114
5114
|
"return": "size_t",
|
|
5115
5115
|
"arguments": "(iconv_t, char **restrict, size_t *restrict, char **restrict, size_t *restrict)",
|
|
5116
5116
|
"type": "EFT_A3R_A1R_NS",
|
|
5117
5117
|
"overwrite_app_function": 0,
|
|
5118
|
-
"memcpy_like": ["
|
|
5118
|
+
"memcpy_like": ["Arg3", "Arg1"]
|
|
5119
5119
|
},
|
|
5120
5120
|
"strtod": {
|
|
5121
5121
|
"return": "double",
|
|
@@ -5192,7 +5192,7 @@
|
|
|
5192
5192
|
"arguments": "(char *, const char *, size_t)",
|
|
5193
5193
|
"type": "EFT_L_A0__A1_A0",
|
|
5194
5194
|
"overwrite_app_function": 0,
|
|
5195
|
-
"memcpy_like": ["
|
|
5195
|
+
"memcpy_like": ["Arg0", "Arg1", "Arg2"],
|
|
5196
5196
|
"CopyStmt": {
|
|
5197
5197
|
"src": "Arg0",
|
|
5198
5198
|
"dst": "Ret"
|
|
@@ -5203,7 +5203,7 @@
|
|
|
5203
5203
|
"arguments": "(char *, const char *, size_t)",
|
|
5204
5204
|
"type": "EFT_L_A0__A1_A0",
|
|
5205
5205
|
"overwrite_app_function": 0,
|
|
5206
|
-
"memcpy_like": ["
|
|
5206
|
+
"memcpy_like": ["Arg0", "Arg1", "Arg2"],
|
|
5207
5207
|
"CopyStmt": {
|
|
5208
5208
|
"src": "Arg0",
|
|
5209
5209
|
"dst": "Ret"
|
|
@@ -5214,7 +5214,7 @@
|
|
|
5214
5214
|
"arguments": "(char *restrict, const char *restrict)",
|
|
5215
5215
|
"type": "EFT_L_A0__A1_A0",
|
|
5216
5216
|
"overwrite_app_function": 0,
|
|
5217
|
-
"memcpy_like": ["
|
|
5217
|
+
"memcpy_like": ["Arg0", "Arg1"],
|
|
5218
5218
|
"CopyStmt": {
|
|
5219
5219
|
"src": "Arg0",
|
|
5220
5220
|
"dst": "Ret"
|
|
@@ -5225,7 +5225,7 @@
|
|
|
5225
5225
|
"arguments": "(char *, char *)",
|
|
5226
5226
|
"type": "EFT_L_A0__A1_A0",
|
|
5227
5227
|
"overwrite_app_function": 0,
|
|
5228
|
-
"memcpy_like": ["
|
|
5228
|
+
"memcpy_like": ["Arg0", "Arg1"],
|
|
5229
5229
|
"CopyStmt": {
|
|
5230
5230
|
"src": "Arg0",
|
|
5231
5231
|
"dst": "Ret"
|
|
@@ -5236,7 +5236,7 @@
|
|
|
5236
5236
|
"arguments": "(char *, const char *)",
|
|
5237
5237
|
"type": "EFT_L_A0__A1_A0",
|
|
5238
5238
|
"overwrite_app_function": 0,
|
|
5239
|
-
"memcpy_like": ["
|
|
5239
|
+
"memcpy_like": ["Arg0", "Arg1"],
|
|
5240
5240
|
"CopyStmt": {
|
|
5241
5241
|
"src": "Arg0",
|
|
5242
5242
|
"dst": "Ret"
|
|
@@ -5247,7 +5247,7 @@
|
|
|
5247
5247
|
"arguments": "(char *, const char *, size_t)",
|
|
5248
5248
|
"type": "EFT_L_A0__A1_A0",
|
|
5249
5249
|
"overwrite_app_function": 0,
|
|
5250
|
-
"memcpy_like": ["
|
|
5250
|
+
"memcpy_like": ["Arg0", "Arg1", "Arg2"],
|
|
5251
5251
|
"CopyStmt": {
|
|
5252
5252
|
"src": "Arg0",
|
|
5253
5253
|
"dst": "Ret"
|
|
@@ -5258,7 +5258,7 @@
|
|
|
5258
5258
|
"arguments": "(char *, const char *, size_t)",
|
|
5259
5259
|
"type": "EFT_L_A0__A1_A0",
|
|
5260
5260
|
"overwrite_app_function": 0,
|
|
5261
|
-
"memcpy_like": ["
|
|
5261
|
+
"memcpy_like": ["Arg0", "Arg1", "Arg2"],
|
|
5262
5262
|
"CopyStmt": {
|
|
5263
5263
|
"src": "Arg0",
|
|
5264
5264
|
"dst": "Ret"
|
|
@@ -5703,5 +5703,19 @@
|
|
|
5703
5703
|
"dst": "Ret",
|
|
5704
5704
|
"offset": "0"
|
|
5705
5705
|
}
|
|
5706
|
+
},
|
|
5707
|
+
"my_multi_free":{
|
|
5708
|
+
"return": "void",
|
|
5709
|
+
"arguments": "(int id, void** ptr)",
|
|
5710
|
+
"type": "EFT_FREE_MULTILEVEL",
|
|
5711
|
+
"overwrite_app_function": 1,
|
|
5712
|
+
"LoadStmt": {
|
|
5713
|
+
"src": "Arg1",
|
|
5714
|
+
"dst": "Dummy"
|
|
5715
|
+
},
|
|
5716
|
+
"StoreStmt": {
|
|
5717
|
+
"src": "NullPtr",
|
|
5718
|
+
"dst": "Dummy"
|
|
5719
|
+
}
|
|
5706
5720
|
}
|
|
5707
5721
|
}
|
package/svf/lib/SVFIR/SVFIR.cpp
CHANGED
|
@@ -690,11 +690,22 @@ bool SVFIR::isNonPointerObj(NodeID id) const
|
|
|
690
690
|
}
|
|
691
691
|
}
|
|
692
692
|
/*
|
|
693
|
-
* If this is a dummy node or node does not have incoming edges we assume it is not a pointer here
|
|
693
|
+
* If this is a dummy node or node does not have incoming edges and outcoming edges we assume it is not a pointer here.
|
|
694
|
+
* However, if it is a pointer and it is an argument of a function definition, we assume it is a pointer here.
|
|
694
695
|
*/
|
|
695
696
|
bool SVFIR::isValidPointer(NodeID nodeId) const
|
|
696
697
|
{
|
|
697
698
|
SVFVar* node = pag->getGNode(nodeId);
|
|
699
|
+
|
|
700
|
+
if (node->hasValue() && node->isPointer())
|
|
701
|
+
{
|
|
702
|
+
if(const SVFArgument* arg = SVFUtil::dyn_cast<SVFArgument>(node->getValue()))
|
|
703
|
+
{
|
|
704
|
+
if (!(arg->getParent()->isDeclaration()))
|
|
705
|
+
return true;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
|
|
698
709
|
if ((node->getInEdges().empty() && node->getOutEdges().empty()))
|
|
699
710
|
return false;
|
|
700
711
|
return node->isPointer();
|
package/svf/lib/Util/ExtAPI.cpp
CHANGED
|
@@ -244,8 +244,9 @@ u32_t ExtAPI::getArgPos(const std::string& s)
|
|
|
244
244
|
// return value = -1 is an inst node
|
|
245
245
|
// return value = -2 is a Dummy node
|
|
246
246
|
// return value = -3 is an object node
|
|
247
|
-
// return value = -4 is
|
|
248
|
-
// return value = -5 is an
|
|
247
|
+
// return value = -4 is a nullptr node
|
|
248
|
+
// return value = -5 is an offset
|
|
249
|
+
// return value = -6 is an illegal operand format
|
|
249
250
|
s32_t ExtAPI::getNodeIDType(const std::string& s)
|
|
250
251
|
{
|
|
251
252
|
u32_t argPos = -1;
|
|
@@ -271,6 +272,7 @@ s32_t ExtAPI::getNodeIDType(const std::string& s)
|
|
|
271
272
|
{"Ret", -1},
|
|
272
273
|
{"Dummy", -2},
|
|
273
274
|
{"Obj", -3},
|
|
275
|
+
{"NullPtr", -4},
|
|
274
276
|
{"Add", BinaryOPStmt::Add},
|
|
275
277
|
{"Sub", BinaryOPStmt::Sub},
|
|
276
278
|
{"Mul", BinaryOPStmt::Mul},
|
|
@@ -302,9 +304,9 @@ s32_t ExtAPI::getNodeIDType(const std::string& s)
|
|
|
302
304
|
while (i < s.size() && isdigit(s[i]))
|
|
303
305
|
i++;
|
|
304
306
|
if (i == s.size())
|
|
305
|
-
return -
|
|
307
|
+
return -5;
|
|
306
308
|
// illegal operand format
|
|
307
|
-
return -
|
|
309
|
+
return -6;
|
|
308
310
|
}
|
|
309
311
|
|
|
310
312
|
// Get external function name, e.g "memcpy"
|
|
@@ -1198,6 +1198,11 @@ void SVFIRBuilder::parseOperations(std::vector<ExtAPI::Operation> &operations,
|
|
|
1198
1198
|
{
|
|
1199
1199
|
if( cs->arg_size() <= (u32_t) nodeIDType)
|
|
1200
1200
|
assert(false && "Argument out of bounds!");
|
|
1201
|
+
else if (operation.getOperator() == "memcpy_like" || operation.getOperator() == "memset_like")
|
|
1202
|
+
{
|
|
1203
|
+
operands.push_back(nodeIDType);
|
|
1204
|
+
nodeIDMap[s] = nodeIDType;
|
|
1205
|
+
}
|
|
1201
1206
|
else
|
|
1202
1207
|
{
|
|
1203
1208
|
operands.push_back(getValueNode(cs->getArgOperand(nodeIDType)));
|
|
@@ -1223,6 +1228,11 @@ void SVFIRBuilder::parseOperations(std::vector<ExtAPI::Operation> &operations,
|
|
|
1223
1228
|
}
|
|
1224
1229
|
}
|
|
1225
1230
|
else if (nodeIDType == -4)
|
|
1231
|
+
{
|
|
1232
|
+
operands.push_back(pag->getNullPtr());
|
|
1233
|
+
nodeIDMap[s] = operands[operands.size() - 1];
|
|
1234
|
+
}
|
|
1235
|
+
else if (nodeIDType == -5)
|
|
1226
1236
|
{
|
|
1227
1237
|
for (char const &c : s)
|
|
1228
1238
|
{
|
|
@@ -1361,17 +1371,17 @@ void SVFIRBuilder::handleExtCall(CallBase* cs, const Function *callee)
|
|
|
1361
1371
|
// this is for memset(void *str, int c, size_t n)
|
|
1362
1372
|
// which copies the character c (an unsigned char) to the first n characters of the string pointed to, by the argument str
|
|
1363
1373
|
std::vector<LocationSet> dstFields;
|
|
1364
|
-
const Type* dtype = getBaseTypeAndFlattenedFields(cs->getArgOperand(0), dstFields, cs->getArgOperand(2));
|
|
1374
|
+
const Type* dtype = getBaseTypeAndFlattenedFields(cs->getArgOperand(op.getOperands()[0]), dstFields, cs->getArgOperand(op.getOperands()[2]));
|
|
1365
1375
|
u32_t sz = dstFields.size();
|
|
1366
1376
|
//For each field (i), add store edge *(arg0 + i) = arg1
|
|
1367
1377
|
for (u32_t index = 0; index < sz; index++)
|
|
1368
1378
|
{
|
|
1369
1379
|
const SVFType* dElementType = pag->getSymbolInfo()->getFlatternedElemType(LLVMModuleSet::getLLVMModuleSet()->getSVFType(dtype), dstFields[index].accumulateConstantFieldIdx());
|
|
1370
|
-
NodeID dField = getGepValVar(cs->getArgOperand(0), dstFields[index], dElementType);
|
|
1371
|
-
addStoreEdge(getValueNode(cs->getArgOperand(1)),dField);
|
|
1380
|
+
NodeID dField = getGepValVar(cs->getArgOperand(op.getOperands()[0]), dstFields[index], dElementType);
|
|
1381
|
+
addStoreEdge(getValueNode(cs->getArgOperand(op.getOperands()[1])),dField);
|
|
1372
1382
|
}
|
|
1373
1383
|
if(SVFUtil::isa<PointerType>(cs->getType()))
|
|
1374
|
-
addCopyEdge(getValueNode(cs->getArgOperand(0)), getValueNode(cs));
|
|
1384
|
+
addCopyEdge(getValueNode(cs->getArgOperand(op.getOperands()[0])), getValueNode(cs));
|
|
1375
1385
|
}
|
|
1376
1386
|
else if (op.getOperator() == "memcpy_like")
|
|
1377
1387
|
{
|