Skip to content
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

free():invalid pointer #35

Closed
hjiang13 opened this issue Sep 19, 2022 · 3 comments
Closed

free():invalid pointer #35

hjiang13 opened this issue Sep 19, 2022 · 3 comments

Comments

@hjiang13
Copy link

When I run the instrument on /lltfi/sample_programs/factorial.ll
An error occurred:

`free(): invalid pointer
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /home/hailong/llvm-project/build/bin/opt -load /home/hailong/LLTFI/BUILD/lltfi/bin/../llvm_passes/llfi-passes.so -genllfiindexpass -enable-new-pm=0 -o /home/hailong/LLTFI/BUILD/lltfi/sample_programs/sum/llfi/sum-llfi_index.ll /home/hailong/LLTFI/BUILD/lltfi/sample_programs/sum/sum.ll -S
#0 0x00007f7d04c10374 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
#1 0x00007f7d04c0dc14 SignalHandler(int) Signals.cpp:0:0
#2 0x00007f7d0467f090 (/lib/x86_64-linux-gnu/libc.so.6+0x43090)
#3 0x00007f7d0467f00b raise /build/glibc-SzIz7B/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#4 0x00007f7d0465e859 abort /build/glibc-SzIz7B/glibc-2.31/stdlib/abort.c:81:7
#5 0x00007f7d046c926e __libc_message /build/glibc-SzIz7B/glibc-2.31/libio/../sysdeps/posix/libc_fatal.c:155:5
#6 0x00007f7d046d12fc /build/glibc-SzIz7B/glibc-2.31/malloc/malloc.c:5348:3
#7 0x00007f7d046d2b2c _int_free /build/glibc-SzIz7B/glibc-2.31/malloc/malloc.c:4173:5
#8 0x00007f7d049712af std::__cxx11::basic_string<char, std::char_traits, std::allocator >::_M_assign(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) (/lib/x86_64-linux-gnu/libstdc++.so.6+0x1432af)
#9 0x00007f7d035c53ae void llvm::cl::initializer<char [38]>::apply<llvm::cl::opt<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, false, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > >(llvm::cl::opt<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, false, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >&) const (/home/hailong/LLTFI/BUILD/lltfi/bin/../llvm_passes/llfi-passes.so+0xb83ae)
#10 0x00007f7d035c51df void llvm::cl::applicator<llvm::cl::initializer<char [38]> >::opt<llvm::cl::opt<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, false, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > >(llvm::cl::initializer<char [38]> const&, llvm::cl::opt<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, false, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >&) (/home/hailong/LLTFI/BUILD/lltfi/bin/../llvm_passes/llfi-passes.so+0xb81df)
#11 0x00007f7d035c4f3a void llvm::cl::apply<llvm::cl::opt<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, false, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >, llvm::cl::initializer<char [38]> >(llvm::cl::opt<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, false, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >, llvm::cl::initializer<char [38]> const&) (/home/hailong/LLTFI/BUILD/lltfi/bin/../llvm_passes/llfi-passes.so+0xb7f3a)
#12 0x00007f7d035c4ab0 void llvm::cl::apply<llvm::cl::opt<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, false, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >, llvm::cl::desc, llvm::cl::initializer<char [38]> >(llvm::cl::opt<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, false, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >
, llvm::cl::desc const&, llvm::cl::initializer<char [38]> const&) (/home/hailong/LLTFI/BUILD/lltfi/bin/../llvm_passes/llfi-passes.so+0xb7ab0)
#13 0x00007f7d035c43bb void llvm::cl::apply<llvm::cl::opt<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, false, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >, char [28], llvm::cl::desc, llvm::cl::initializer<char [38]> >(llvm::cl::opt<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, false, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >, char const (&) [28], llvm::cl::desc const&, llvm::cl::initializer<char [38]> const&) (/home/hailong/LLTFI/BUILD/lltfi/bin/../llvm_passes/llfi-passes.so+0xb73bb)
#14 0x00007f7d035c3b84 llvm::cl::opt<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, false, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >::opt<char [28], llvm::cl::desc, llvm::cl::initializer<char [38]> >(char const (&) [28], llvm::cl::desc const&, llvm::cl::initializer<char [38]> const&) (/home/hailong/LLTFI/BUILD/lltfi/bin/../llvm_passes/llfi-passes.so+0xb6b84)
#15 0x00007f7d035c2492 __static_initialization_and_destruction_0(int, int) SoftwareFailureAutoScanPass.cpp:0:0
#16 0x00007f7d035c2555 _GLOBAL__sub_I_SoftwareFailureAutoScanPass.cpp SoftwareFailureAutoScanPass.cpp:0:0
#17 0x00007f7d07750b9a call_init /build/glibc-SzIz7B/glibc-2.31/elf/dl-init.c:71:19
#18 0x00007f7d07750ca1 _dl_init /build/glibc-SzIz7B/glibc-2.31/elf/dl-init.c:118:9
#19 0x00007f7d0479c985 _dl_catch_exception /build/glibc-SzIz7B/glibc-2.31/elf/dl-error-skeleton.c:184:18
#20 0x00007f7d0775543d dl_open_worker /build/glibc-SzIz7B/glibc-2.31/elf/dl-open.c:763:5
#21 0x00007f7d0479c928 _dl_catch_exception /build/glibc-SzIz7B/glibc-2.31/elf/dl-error-skeleton.c:209:18
#22 0x00007f7d0775460a _dl_open /build/glibc-SzIz7B/glibc-2.31/elf/dl-open.c:837:17
#23 0x00007f7d03a1934c dlopen_doit /build/glibc-SzIz7B/glibc-2.31/dlfcn/dlopen.c:66:13
#24 0x00007f7d0479c928 _dl_catch_exception /build/glibc-SzIz7B/glibc-2.31/elf/dl-error-skeleton.c:209:18
#25 0x00007f7d0479c9f3 _dl_catch_error /build/glibc-SzIz7B/glibc-2.31/elf/dl-error-skeleton.c:228:12
#26 0x00007f7d03a19b59 _dlerror_run /build/glibc-SzIz7B/glibc-2.31/dlfcn/dlerror.c:174:40
#27 0x00007f7d03a193da dlopen /build/glibc-SzIz7B/glibc-2.31/dlfcn/dlopen.c:87:51
#28 0x00007f7d04bf0cb8 llvm::sys::DynamicLibrary::getPermanentLibrary(char const
, std::__cxx11::basic_string<char, std::char_traits, std::allocator >) (/home/hailong/llvm-project/build/bin/../lib/libLLVMSupport.so.15git+0x1cacb8)
#29 0x00007f7d04b4c2c3 llvm::PluginLoader::operator=(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) (/home/hailong/llvm-project/build/bin/../lib/libLLVMSupport.so.15git+0x1262c3)
#30 0x000055a3c6de01f1 llvm::cl::opt<llvm::PluginLoader, false, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >::handleOccurrence(unsigned int, llvm::StringRef, llvm::StringRef) (/home/hailong/llvm-project/build/bin/opt+0x341f1)
#31 0x00007f7d04ad4777 ProvideOption(llvm::cl::Option
, llvm::StringRef, llvm::StringRef, int, char const* const*, int&) CommandLine.cpp:0:0
#32 0x00007f7d04ae4292 llvm::cl::ParseCommandLineOptions(int, char const* const*, llvm::StringRef, llvm::raw_ostream*, char const*, bool) (/home/hailong/llvm-project/build/bin/../lib/libLLVMSupport.so.15git+0xbe292)
#33 0x000055a3c6dc9853 main (/home/hailong/llvm-project/build/bin/opt+0x1d853)
#34 0x00007f7d04660083 __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:342:3
#35 0x000055a3c6dcc6ae _start (/home/hailong/llvm-project/build/bin/opt+0x206ae)

ERROR: there was an error during running the instrumentation pass, please follow the provided instructions for instrument.`

@uditagarwal97
Copy link
Collaborator

Hi,

Thanks for submitting the bug report. Unfortunately, I'm not able to reproduce this bug on my side. Please provide the output of the following commands:
cat Makefile (Run this command after making factorial.c file from inside the factorial directory)
/home/hailong/llvm-project/build/bin/opt --version
opt --version
cat /etc/os-release
clang --version
Also, please provide the commit id of the LLTFI version you are using.

@hjiang13
Copy link
Author

Hi, Thank you for your reply.
This issue has been solved by moving to Clang-13 on Uhuntu 18.04.
This issue happened when I was using Clang 15 on Ubuntu 20.04.
I am not sure what caused it.
Thank you

@karthikp-ubc
Copy link
Contributor

Closing as it's now resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants