-
Notifications
You must be signed in to change notification settings - Fork 435
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
Error on wpa -ander -svfg -dump-svfg example.bc #17
Comments
Hi Kim, This is not a bug in SVF. You may wish to check your g++/clang++ options when compiling the source code of LLVM-3.8.0. If you use std=c++11 to compile llvm-3.8.0, but use std=c++98 to compile SVF, or the other way around, then you may see this error. This error occurs when you use "autoconf" to build SVF, you have to manually correct it to make the options consistent. "autoconf" will be deprecated soon in later versions of LLVM. I suggest you use cmake (https://github.com/unsw-corg/SVF/wiki/Setup-Guide-(CMake)) to build SVF. The error will disappear when you use cmake build. Thanks |
Hmm, I'm seeing this issue
This issue happens 100% of the time when using #18, however I don't know that it's caused by those changes--it seems it just gets less lucky with the underlying bug. @rockysui can you verify that running For me, on the current master (using LLVM 3.8) as well as the LLVM 4 changes valgrind reports errors resulting from accessing MemSSA bits that have been deleted. Looking at the code it's easy to see why--indeed they /have/ been deleted. I'm not sure why this happens less on master, and AFAICT has little to do with the C++ standard used to compile the code. I have patched this issue in my fork which fixes the crash on LLVM 4 and the valgrind errors in both versions. If indeed this is a problem, perhaps you should be less quick to close bugs (at least wait for the OP to confirm they're resolved)? |
Hi WIll, Thanks for confirming this issue and your attempts to fix it! The aim of building MemSSA is to create SVFG, so MemSSA is an intermediate data structure and will be discarded later. When creating a SVFG, a local instance of memSSA is created (Please take a look at here). This might be the issue when any of its fields is referred later (e.g., dumpSVFG). I don't know whether we can have a quick workaround fix by simply allocating the MemSSA instance on the heap. @jcarlson23 |
I've implemented a quickfix here: dtzWill@49a0464 One implication is the mssa is preserved for the lifetime of the SVFG, which for this use case is desired but I don't know about what other clients might want. For convenience and lack of familiarity with the codebase I just used unique_ptr, anyway it seems to work for me so I thought I'd share in case it's useful to someone else. 👍 |
Thanks, Will! A very good fix using unique_ptr. The C++11 style is not consistent with SVF. I have committed a quick fix by allocating the "mssa' on the heap instead of a local instance, and also I have kept a "ReleaseMemory" function to be called by users (see f752075). Anyway, SVF folks could make their own choices to use any of the fixes. |
Hi, I am trying to understand and check SVF capabilities.
However, I found some error with a toy code.
I also attached error messages.
--------------------------- Code ------------------------------------------------
#include
#include
using namespace std;
class Profile
{
public:
void printProfile()
{
cout << "Name : " << _name.c_str() << endl;
cout << "Phone Number : " << _phoneNumber.c_str() <<endl;
}
void setName(string name)
{
_name = name;
}
void setPhoneNumber(string phoneNumber)
{
_phoneNumber = phoneNumber;
}
private:
string _name;
string _phoneNumber;
};
int main()
{
Profile myProfile;
myProfile.setName("Hong");
myProfile.setPhoneNumber("012319562");
myProfile.printProfile();
return 0;
}
------------------------ Error message --------------------------------------
Writing 'ander_svfg.dot'...#0 0x0000000000e7870b llvm::sys::PrintStackTrace(llvm::raw_ostream&) (
/SVF/build/bin/wpa+0xe7870b)/SVF/build/bin/wpa+0xe78a20)#1 0x0000000000e78a20 PrintStackTraceSignalHandler(void*) (
#2 0x0000000000e7706d llvm::sys::RunSignalHandlers() (
/SVF/build/bin/wpa+0xe7706d)/SVF/build/bin/wpa+0xe78181)#3 0x0000000000e78181 SignalHandler(int) (
#4 0x00007fe76b13b330 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#5 0x000000000045ed78 MRVer::getSSAVersion() const (
/SVF/build/bin/wpa+0x45ed78)/SVF/build/bin/wpa+0x463d4f)#6 0x0000000000463d4f llvm::DOTGraphTraits<SVFG*>::getCompleteNodeLabel(SVFGNode*, SVFG*) (
#7 0x0000000000462e08 llvm::DOTGraphTraits<SVFG*>::getNodeLabel(SVFGNode*, SVFG*) (
/SVF/build/bin/wpa+0x462e08)/SVF/build/bin/wpa+0x47bec9)#8 0x000000000047bec9 llvm::GraphWriter<SVFG*>::writeNode(SVFGNode*) (
#9 0x0000000000479fe7 llvm::GraphWriter<SVFG*>::writeNodes() (
/SVF/build/bin/wpa+0x479fe7)/SVF/build/bin/wpa+0x4769a3)#10 0x00000000004769a3 llvm::GraphWriter<SVFG*>::writeGraph(std::string const&) (
#11 0x000000000047095d llvm::raw_ostream& llvm::WriteGraph<SVFG*>(llvm::raw_ostream&, SVFG* const&, bool, llvm::Twine const&) (
/SVF/build/bin/wpa+0x47095d)/SVF/build/bin/wpa+0x46a10b)#12 0x000000000046a10b void llvm::GraphPrinter::WriteGraphToFile<SVFG*>(llvm::raw_ostream&, std::string const&, SVFG* const&, bool) (
#13 0x000000000045c593 SVFG::dump(std::string const&, bool) (
/SVF/build/bin/wpa+0x45c593)/SVF/build/bin/wpa+0x409bc6)#14 0x0000000000409bc6 WPAPass::runPointerAnalysis(llvm::Module&, unsigned int) (
#15 0x0000000000409964 WPAPass::runOnModule(llvm::Module&) (
/SVF/build/bin/wpa+0x409964)/SVF/build/bin/wpa+0x7b92b6)#16 0x00000000007b92b6 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) (
#17 0x00000000007b9a20 llvm::legacy::PassManagerImpl::run(llvm::Module&) (
/SVF/build/bin/wpa+0x7b9a20)/SVF/build/bin/wpa+0x7b9c61)#18 0x00000000007b9c61 llvm::legacy::PassManager::run(llvm::Module&) (
#19 0x000000000040772b main (
/SVF/build/bin/wpa+0x40772b)/SVF/build/bin/wpa+0x407289)#20 0x00007fe76a34ef45 __libc_start_main /build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#21 0x0000000000407289 _start (
Stack dump:
0. Program arguments: wpa -ander -svfg -dump-svfg c++.bc
#0 0x0000000000e7870b llvm::sys::PrintStackTrace(llvm::raw_ostream&) (
/SVF/build/bin/wpa+0xe7870b)/SVF/build/bin/wpa+0xe78a20)Merge with master #1 0x0000000000e78a20 PrintStackTraceSignalHandler(void*) (
singleton instances, unclear memory ownership #2 0x0000000000e7706d llvm::sys::RunSignalHandlers() (
/SVF/build/bin/wpa+0xe7706d)/SVF/build/bin/wpa+0xe78181)Add missing paren in stat print. #3 0x0000000000e78181 SignalHandler(int) (
Fix memory bug in ConsG, copy to avoid ref into dead object. #4 0x00007fe76b13b330 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
cmake build support (required for use with LLVM newer than 3.8 release) #5 0x000000000045ed78 MRVer::getSSAVersion() const (
/SVF/build/bin/wpa+0x45ed78)/SVF/build/bin/wpa+0x463d4f)AndersenLCD implementation "incomplete": documentation and efficiency #6 0x0000000000463d4f llvm::DOTGraphTraits<SVFG*>::getCompleteNodeLabel(SVFGNode*, SVFG*) (
PAG: "black hole" and "variant GEP" edges? #7 0x0000000000462e08 llvm::DOTGraphTraits<SVFG*>::getNodeLabel(SVFGNode*, SVFG*) (
/SVF/build/bin/wpa+0x462e08)/SVF/build/bin/wpa+0x47bec9)Added CMake support for SVF #8 0x000000000047bec9 llvm::GraphWriter<SVFG*>::writeNode(SVFGNode*) (
Moved CUDD tests from lib dir to tests dir #9 0x0000000000479fe7 llvm::GraphWriter<SVFG*>::writeNodes() (
/SVF/build/bin/wpa+0x479fe7)/SVF/build/bin/wpa+0x4769a3)SVFG: Calling a function twice with global pointers as a parameter #10 0x00000000004769a3 llvm::GraphWriter<SVFG*>::writeGraph(std::string const&) (
Buffer index sensitivity with non variant GEP instructions #11 0x000000000047095d llvm::raw_ostream& llvm::WriteGraph<SVFG*>(llvm::raw_ostream&, SVFG* const&, bool, llvm::Twine const&) (
/SVF/build/bin/wpa+0x47095d)/SVF/build/bin/wpa+0x46a10b)Assertion triggered after modifying code #12 0x000000000046a10b void llvm::GraphPrinter::WriteGraphToFile<SVFG*>(llvm::raw_ostream&, std::string const&, SVFG* const&, bool) (
SVFG: Obtain SVFGNode corresponding to argument of CallSite #13 0x000000000045c593 SVFG::dump(std::string const&, bool) (
/SVF/build/bin/wpa+0x45c593)/SVF/build/bin/wpa+0x409bc6)Migrating SVF to LLVM 4 #14 0x0000000000409bc6 WPAPass::runPointerAnalysis(llvm::Module&, unsigned int) (
Missing a function in musl's PointsTo #15 0x0000000000409964 WPAPass::runOnModule(llvm::Module&) (
/SVF/build/bin/wpa+0x409964)/SVF/build/bin/wpa+0x7b92b6)Question for source sink analysis #16 0x00000000007b92b6 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) (
Error on wpa -ander -svfg -dump-svfg example.bc #17 0x00000000007b9a20 llvm::legacy::PassManagerImpl::run(llvm::Module&) (
/SVF/build/bin/wpa+0x7b9a20)/SVF/build/bin/wpa+0x7b9c61)LLVM 4 #18 0x00000000007b9c61 llvm::legacy::PassManager::run(llvm::Module&) (
cppUtil::DemangledName cppUtil::demangle does not work in some case #19 0x000000000040772b main (
/SVF/build/bin/wpa+0x40772b)/SVF/build/bin/wpa+0x407289)Merging in SUPA implementation? #20 0x00007fe76a34ef45 __libc_start_main /build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
valgrind errors with "wpa -anders" and PTABen #21 0x0000000000407289 _start (
llvmhelper.sh: line 26: 26518 Segmentation fault (core dumped) wpa -ander -svfg -dump-svfg $1.bc
The text was updated successfully, but these errors were encountered: