Skip to content

Segmentation Fault #151

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

Open
azertyfun opened this issue Jul 19, 2017 · 4 comments
Open

Segmentation Fault #151

azertyfun opened this issue Jul 19, 2017 · 4 comments

Comments

@azertyfun
Copy link

When I run grive -P -p ~/myfolder, grive crashes (13160 Segmentation fault (core dumped) grive -P -p ~/myfolder).

Here is some gdb output:

(gdb) run -P -p ~/myfolder
Starting program: /usr/local/bin/grive -P -p ~/myfolder
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7ffff0cc5700 (LWP 13358)]
[Thread 0x7ffff0cc5700 (LWP 13358) exited]

Thread 1 "grive" received signal SIGSEGV, Segmentation fault.
0x0000555555ccdb50 in ?? ()
=> 0x0000555555ccdb50:  00 2d fd 55 55 55       add    BYTE PTR [rip+0x555555fd],ch        # 0x5555ab223153
(gdb) bt
#0  0x0000555555ccdb50 in ?? ()
#1  0x00005555557009ad in gr::SymbolInfo::SymbolInfo() ()
#2  0x00005555557010b8 in gr::SymbolInfo::Instance() ()
#3  0x000055555570051e in gr::Backtrace::Backtrace(unsigned long) ()
#4  0x00005555556f822b in gr::Exception::Exception() ()
#5  0x00005555556fab05 in gr::File::Error::Error() ()
#6  0x00005555556f9de9 in gr::File::Open(boost::filesystem::path const&, int, int) ()
#7  0x00005555556f9f37 in gr::File::OpenForRead(boost::filesystem::path const&) ()
#8  0x00005555556f9be3 in gr::File::File(boost::filesystem::path const&) ()
#9  0x00005555556bdc1a in gr::State::Read() ()
#10 0x00005555556bb2a3 in gr::State::State(boost::filesystem::path const&, gr::Val const&) ()
#11 0x00005555556b91e7 in gr::Drive::Drive(gr::Syncer*, gr::Val const&) ()
#12 0x000055555569ac52 in Main(int, char**) ()
#13 0x000055555569b472 in main ()
(gdb) 

I use ArchLinux and have the latest system updates. Grive-sync worked a few months ago when I last used it, but I had to recompile it because of a library version mismatch.

Any idea what could be the cause?

@azertyfun
Copy link
Author

Update: I took a look, and the crash occurs in libgrive/src/bfd/SymbolInfo.cc:90, somewhere in long storage_needed = bfd_get_symtab_upper_bound( m_impl->m_bfd ) ;. This is not caused by m_impl->m_bfd (of type *gr::SymbolInfo::Impl::m_bfd) being NULL.

My binutils version is 2.28.0-4. Can anyone for who grive works confirm their own binutils version?

@Artox
Copy link

Artox commented Aug 12, 2017

Can anyone for who grive works confirm their own binutils version?

2.26.1 here, working fine; did not try any other version.

@j0nn0
Copy link

j0nn0 commented Aug 15, 2017

Also 2.26.1 (2.26.1-1ubuntu1~16.04.3). There is a minor upgrade available, but not to 2.28.x in the Ubuntu repo yet.

@azertyfun
Copy link
Author

azertyfun commented Feb 15, 2018

For some reason this problem appeared again after a system upgrade (I now have binutils-2.29.1-2).

I decided to dig some more, and I'm not quire sure what is going on with the bfd struct here.

Here is a stripped-down version of the problematic code. Now I am not familiar with the BFD library, but the output for b->filename is absolutely not what I would expect (it's not even valid Unicode/ASCII):

$ ./bfd_test ./bfd_test
140
255
120
54
44
86

$ ./bfd_test ./bfd_test
140
191
41
62
98
85

Can someone who doesn't have this issue run this code for me? At this point I believe this might actually be a binutils bug, although I would have to learn more about the library to be sure.

Workaround

If anyone else has this bug, you can comment line 37 of libgrive/src/util/Exception.cc like so:
//*this << expt::Backtrace_( Backtrace() ) ;.

You presumably won't get a backtrace when grive crashes, but at least you will be able to run it.

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