svf-tools 1.0.1089 → 1.0.1090
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 +1 -1
- package/svf/include/AE/Svfexe/AEDetector.h +2 -0
- package/svf/lib/AE/Svfexe/AEDetector.cpp +23 -6
- package/SVF-doxygen/doxygen.config +0 -2548
- package/SVF-doxygen/wiki/PAG.png +0 -0
- package/SVF-doxygen/wiki/andersen.png +0 -0
- package/SVF-doxygen/wiki/callgraph.png +0 -0
- package/SVF-doxygen/wiki/consG.png +0 -0
- package/SVF-doxygen/wiki/cpu2000-flto +0 -432
- package/SVF-doxygen/wiki/cpu2006-flto +0 -417
- package/SVF-doxygen/wiki/cpu2017-wllvm.cfg +0 -999
- package/SVF-doxygen/wiki/database.png +0 -0
- package/SVF-doxygen/wiki/framework.png +0 -0
- package/SVF-doxygen/wiki/help.png +0 -0
- package/SVF-doxygen/wiki/icfg.png +0 -0
- package/SVF-doxygen/wiki/mssa-cha.png +0 -0
- package/SVF-doxygen/wiki/pagedge.png +0 -0
- package/SVF-doxygen/wiki/pagnode.png +0 -0
- package/SVF-doxygen/wiki/pt.png +0 -0
- package/SVF-doxygen/wiki/setupcmake.png +0 -0
- package/SVF-doxygen/wiki/setupconfiguration.png +0 -0
- package/SVF-doxygen/wiki/setupdashboard.png +0 -0
- package/SVF-doxygen/wiki/setupdebug.png +0 -0
- package/SVF-doxygen/wiki/setupenv.png +0 -0
- package/SVF-doxygen/wiki/startup.png +0 -0
- package/SVF-doxygen/wiki/svf-stat.pdf +0 -0
- package/SVF-doxygen/wiki/svfg-framework.png +0 -0
- package/SVF-doxygen/wiki/svfg.png +0 -0
- package/SVF-doxygen/wiki/svfg_opt.png +0 -0
- package/SVF-doxygen/wiki/svfgedge-cha.png +0 -0
- package/SVF-doxygen/wiki/svfgnode-cha.png +0 -0
- package/SVF-doxygen/wiki/svfpic/README.md +0 -6
- package/SVF-doxygen/wiki/svfpic/ass-1debug1.png +0 -0
- package/SVF-doxygen/wiki/svfpic/ass-1debug2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/build.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/cmd.png +0 -0
- package/SVF-doxygen/wiki/svfpic/connect1.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/connect2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/connect3.png +0 -0
- package/SVF-doxygen/wiki/svfpic/connect4.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/connect5.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/connect6.png +0 -0
- package/SVF-doxygen/wiki/svfpic/connect7.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/continue.png +0 -0
- package/SVF-doxygen/wiki/svfpic/debug-new.png +0 -0
- package/SVF-doxygen/wiki/svfpic/debug-new2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/debug1.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/debug2.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/debug3.png +0 -0
- package/SVF-doxygen/wiki/svfpic/debug4.png +0 -0
- package/SVF-doxygen/wiki/svfpic/debug5.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/debug6.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/docker_sys_requirement.png +0 -0
- package/SVF-doxygen/wiki/svfpic/docker_sys_requirements.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuild.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuild2.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuild3.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuild4.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuild5.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuildimage.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockercmd.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockercmd2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockercontainer.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb1.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb10.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb2.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb3.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb4.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb5.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb6.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb7.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb8.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb9.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerfinshbuilt.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerimage.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockernameImage.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerpull.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerpull2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/download.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/extension1.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/extension2.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/graphviz.png +0 -0
- package/SVF-doxygen/wiki/svfpic/hellodb.png +0 -0
- package/SVF-doxygen/wiki/svfpic/hellodb2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/hviz_0.png +0 -0
- package/SVF-doxygen/wiki/svfpic/hviz_1.png +0 -0
- package/SVF-doxygen/wiki/svfpic/hviz_2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/installC:C++Ext.png +0 -0
- package/SVF-doxygen/wiki/svfpic/installCMakeExt.png +0 -0
- package/SVF-doxygen/wiki/svfpic/installRCext.png +0 -0
- package/SVF-doxygen/wiki/svfpic/installdockerext.png +0 -0
- package/SVF-doxygen/wiki/svfpic/launch1.png +0 -0
- package/SVF-doxygen/wiki/svfpic/openfile.png +0 -0
- package/SVF-doxygen/wiki/svfpic/pathfolder.png +0 -0
- package/SVF-doxygen/wiki/svfpic/restart.png +0 -0
- package/SVF-doxygen/wiki/svfpic/rundocker.png +0 -0
- package/SVF-doxygen/wiki/svfpic/runinCLI.png +0 -0
- package/SVF-doxygen/wiki/svfpic/screen.png +0 -0
- package/SVF-doxygen/wiki/svfpic/settings1.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/settings2.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/settings3.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/shortlists.png +0 -0
- package/SVF-doxygen/wiki/svfpic/start.png +0 -0
- package/SVF-doxygen/wiki/svfpic/start1.png +0 -0
- package/SVF-doxygen/wiki/svfpic/update0.png +0 -0
- package/SVF-doxygen/wiki/svfpic/verify_docker.png +0 -0
- package/SVF-doxygen/wiki/svfpic/vs_entry_window.png +0 -0
- package/SVF-doxygen/wiki/svfpic/wsl.png +0 -0
- package/SVF-doxygen/wiki/svfpic/wsl_1.png +0 -0
- package/SVF-doxygen/wiki/svfpic/wsl_2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/wsl_3.png +0 -0
- package/SVF-doxygen/wiki/tools.png +0 -0
- package/SVF-doxygen/wiki/users.png +0 -0
- package/SVF-doxygen/wiki/vm1.png +0 -0
- package/SVF-doxygen/wiki/vm2.png +0 -0
- package/SVF-doxygen/wiki/vm3.png +0 -0
- package/SVF-doxygen/wiki/vm4.png +0 -0
- package/SVF-doxygen/wiki/vm5.png +0 -0
- package/SVF-doxygen/wiki/vscode_build_tasks.png +0 -0
- package/SVF-doxygen/wiki/vscode_cpp_extension.png +0 -0
- package/SVF-doxygen/wiki/vscode_debug_list.png +0 -0
- package/SVF-doxygen/wiki/vscode_dir_structure.png +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1090",
|
|
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": {
|
|
@@ -161,6 +161,7 @@ public:
|
|
|
161
161
|
|
|
162
162
|
/**
|
|
163
163
|
* @brief Updates the offset of a GEP object from its base.
|
|
164
|
+
* @param as Reference to the abstract state.
|
|
164
165
|
* @param gepAddrs Address value for GEP.
|
|
165
166
|
* @param objAddrs Address value for the object.
|
|
166
167
|
* @param offset The interval value of the offset.
|
|
@@ -358,6 +359,7 @@ public:
|
|
|
358
359
|
*/
|
|
359
360
|
bool isUninit(AbstractValue v)
|
|
360
361
|
{
|
|
362
|
+
// uninitialized value has neither interval value nor address value
|
|
361
363
|
bool is = v.getAddrs().isBottom() && v.getInterval().isBottom();
|
|
362
364
|
return is;
|
|
363
365
|
}
|
|
@@ -63,12 +63,14 @@ void BufOverflowDetector::detect(AbstractState& as, const ICFGNode* node)
|
|
|
63
63
|
{
|
|
64
64
|
NodeID objId = as.getIDFromAddr(addr);
|
|
65
65
|
u32_t size = 0;
|
|
66
|
+
// like `int arr[10]` which has constant size before runtime
|
|
66
67
|
if (svfir->getBaseObject(objId)->isConstantByteSize())
|
|
67
68
|
{
|
|
68
69
|
size = svfir->getBaseObject(objId)->getByteSizeOfObj();
|
|
69
70
|
}
|
|
70
71
|
else
|
|
71
72
|
{
|
|
73
|
+
// like `int len = ***; int arr[len]`, whose size can only be known in runtime
|
|
72
74
|
const ICFGNode* addrNode = svfir->getBaseObject(objId)->getICFGNode();
|
|
73
75
|
for (const SVFStmt* stmt2 : addrNode->getSVFStmts())
|
|
74
76
|
{
|
|
@@ -146,8 +148,7 @@ void BufOverflowDetector::handleStubFunctions(const SVF::CallICFGNode* callNode)
|
|
|
146
148
|
}
|
|
147
149
|
else if (funcName == "UNSAFE_BUFACCESS")
|
|
148
150
|
{
|
|
149
|
-
//
|
|
150
|
-
//void UNSAFE_BUFACCESS(void* data, int size);
|
|
151
|
+
// void UNSAFE_BUFACCESS(void* data, int size);
|
|
151
152
|
AbstractInterpretation::getAEInstance().checkpoints.erase(callNode);
|
|
152
153
|
if (callNode->arg_size() < 2) return;
|
|
153
154
|
AbstractState&as = AbstractInterpretation::getAEInstance().getAbsStateFromTrace(callNode);
|
|
@@ -313,14 +314,16 @@ IntervalValue BufOverflowDetector::getAccessOffset(SVF::AbstractState& as, SVF::
|
|
|
313
314
|
SVFIR* svfir = PAG::getPAG();
|
|
314
315
|
auto obj = svfir->getGNode(objId);
|
|
315
316
|
|
|
316
|
-
// if the object is a BaseObjVar, return the byte offset directly
|
|
317
317
|
if (SVFUtil::isa<BaseObjVar>(obj))
|
|
318
318
|
{
|
|
319
|
+
// if the object is a BaseObjVar, return the byte offset directly
|
|
320
|
+
// like `int arr[10]; arr[5] = 1;` arr is the baseObjVar
|
|
319
321
|
return as.getByteOffset(gep);
|
|
320
322
|
}
|
|
321
323
|
else if (SVFUtil::isa<GepObjVar>(obj))
|
|
322
324
|
{
|
|
323
325
|
// if the object is a GepObjVar, return the offset from the base object
|
|
326
|
+
// like `int arr[10]; int* p=arr+5; p[3] = 1`, p is the GepObjVar from arr.
|
|
324
327
|
return getGepObjOffsetFromBase(SVFUtil::cast<GepObjVar>(obj)) + as.getByteOffset(gep);
|
|
325
328
|
}
|
|
326
329
|
else
|
|
@@ -348,9 +351,12 @@ void BufOverflowDetector::updateGepObjOffsetFromBase(AbstractState& as, SVF::Add
|
|
|
348
351
|
{
|
|
349
352
|
NodeID objId = as.getIDFromAddr(objAddr);
|
|
350
353
|
auto obj = svfir->getGNode(objId);
|
|
351
|
-
|
|
354
|
+
|
|
352
355
|
if (SVFUtil::isa<BaseObjVar>(obj))
|
|
353
356
|
{
|
|
357
|
+
// if the object is a BaseObjVar, add the offset directly
|
|
358
|
+
// like llvm bc `arr = alloc i8 12; p = gep arr, 4`
|
|
359
|
+
// we write key value pair {gep, 4}
|
|
354
360
|
for (const auto& gepAddr : gepAddrs)
|
|
355
361
|
{
|
|
356
362
|
NodeID gepObj = as.getIDFromAddr(gepAddr);
|
|
@@ -367,6 +373,8 @@ void BufOverflowDetector::updateGepObjOffsetFromBase(AbstractState& as, SVF::Add
|
|
|
367
373
|
else if (SVFUtil::isa<GepObjVar>(obj))
|
|
368
374
|
{
|
|
369
375
|
// if the object is a GepObjVar, add the offset from the base object
|
|
376
|
+
// like llvm bc `arr = alloc i8 12; p = gep arr, 4; q = gep p, 6`
|
|
377
|
+
// we retreive {p, 4} and write {q, 4+6}
|
|
370
378
|
const GepObjVar* objVar = SVFUtil::cast<GepObjVar>(obj);
|
|
371
379
|
for (const auto& gepAddr : gepAddrs)
|
|
372
380
|
{
|
|
@@ -518,6 +526,8 @@ void NullptrDerefDetector::detect(AbstractState& as, const ICFGNode* node)
|
|
|
518
526
|
{
|
|
519
527
|
if (SVFUtil::isa<CallICFGNode>(node))
|
|
520
528
|
{
|
|
529
|
+
// external API like memset(*dst, elem, sz)
|
|
530
|
+
// we check if it's external api and check the corrisponding index
|
|
521
531
|
const CallICFGNode* callNode = SVFUtil::cast<CallICFGNode>(node);
|
|
522
532
|
if (SVFUtil::isExtCall(callNode->getCalledFunction()))
|
|
523
533
|
{
|
|
@@ -530,6 +540,8 @@ void NullptrDerefDetector::detect(AbstractState& as, const ICFGNode* node)
|
|
|
530
540
|
{
|
|
531
541
|
if (const GepStmt* gep = SVFUtil::dyn_cast<GepStmt>(stmt))
|
|
532
542
|
{
|
|
543
|
+
// like llvm bitcode `p = gep p, idx`
|
|
544
|
+
// we check rhs p's all address are valid mem
|
|
533
545
|
SVFVar* rhs = gep->getRHSVar();
|
|
534
546
|
if (!canSafelyDerefPtr(as, rhs))
|
|
535
547
|
{
|
|
@@ -539,6 +551,8 @@ void NullptrDerefDetector::detect(AbstractState& as, const ICFGNode* node)
|
|
|
539
551
|
}
|
|
540
552
|
else if (const LoadStmt* load = SVFUtil::dyn_cast<LoadStmt>(stmt))
|
|
541
553
|
{
|
|
554
|
+
// like llvm bitcode `p = load q`
|
|
555
|
+
// we check lhs p's all address are valid mem
|
|
542
556
|
SVFVar* lhs = load->getLHSVar();
|
|
543
557
|
if ( !canSafelyDerefPtr(as, lhs))
|
|
544
558
|
{
|
|
@@ -665,16 +679,19 @@ bool NullptrDerefDetector::canSafelyDerefPtr(AbstractState& as, const SVFVar* va
|
|
|
665
679
|
{
|
|
666
680
|
NodeID value_id = value->getId();
|
|
667
681
|
AbstractValue AbsVal = as[value_id];
|
|
682
|
+
// uninit value cannot be dereferenced, return unsafe
|
|
668
683
|
if (isUninit(AbsVal)) return false;
|
|
684
|
+
// Interval Value (non-addr) is not the checkpoint of nullptr dereference, return safe
|
|
669
685
|
if (!AbsVal.isAddr()) return true;
|
|
670
686
|
for (const auto &addr: AbsVal.getAddrs())
|
|
671
687
|
{
|
|
688
|
+
// if the addr itself is invalid mem, report unsafe
|
|
672
689
|
if (AbstractState::isInvalidMem(addr))
|
|
673
|
-
{
|
|
674
690
|
return false;
|
|
675
|
-
|
|
691
|
+
// if nullptr is detected, return unsafe
|
|
676
692
|
else if (AbstractState::isNullMem(addr))
|
|
677
693
|
return false;
|
|
694
|
+
// if addr is labeled freed mem, report unsafe
|
|
678
695
|
else if (as.isFreedMem(addr))
|
|
679
696
|
return false;
|
|
680
697
|
}
|