madscientist / google-coredumper

Google coredumper library
BSD 3-Clause "New" or "Revised" License
2 stars 4 forks source link

coredumper_unittest fails on Ubuntu 20.04 #6

Closed madscientist closed 3 weeks ago

madscientist commented 2 years ago

If I compile and run the tests on Red Hat EL 7.x, they all pass fine.

If I compile and run the tests on Ubuntu 20.04 LTS, the coredumper_unittest fails in the GDB test because the generated core cannot be read and so it times out waiting for the expected results:

GNU gdb (GDB) 10.1
...
Reading symbols from /proc/193258/exe...

warning: core file may not match specified executable file.
Core was generated by `.libs/coredumper_unittest'.
#0  0x00007f5468a3f9ac in ?? ()
[Current thread is 1 (LWP 193258)]
(gdb)   Id   Target Id         Frame
* 1    LWP 193258        0x00007f5468a3f9ac in ?? ()
  2    LWP 193274        0x000055e969ac4a67 in ?? ()
  3    LWP 193273        0x000055e969ac4a69 in ?? ()

and if I try to use GDB on the core I get:

$ gdb -c core-test .libs/coredumper_unittest
Reading symbols from .libs/coredumper_unittest...

warning: core file may not match specified executable file.
Core was generated by `.libs/coredumper_unittest'.
#0  0x00007f5468a3f9ac in ?? ()
[Current thread is 1 (LWP 193258)]
(gdb) thr a a bt

Thread 3 (LWP 193273):
#0  0x000055e969ac4a69 in ?? ()
#1  0x00007f5468a01609 in ?? ()
#2  0x0000000000000000 in ?? ()

Thread 2 (LWP 193274):
#0  0x000055e969ac4a67 in ?? ()
#1  0x00007f5468a01609 in ?? ()
#2  0x0000000000000000 in ?? ()

Thread 1 (LWP 193258):
#0  0x00007f5468a3f9ac in ?? ()
Backtrace stopped: Cannot access memory at address 0x5aa4da70

But if I compile on a Red Hat 7.x system it works (note, it works even on an Ubuntu system: it doesn't matter where we RUN the test only where we compile it).

There must be some change in the system headers etc. from RHEL 7 to Ubuntu 20.04 that causes the coredumper code to be miscompiled so that it cannot write a valid core file any longer. For posterity here is the output from the core generated by coredumper_unittest compiled on RHEL 7:

warning: core file may not match specified executable file.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./coredumper_unittest'.
#0  0x00000000004044fa in WriteCoreDump ()
[Current thread is 1 (Thread 0x7f5ae8ca2740 (LWP 4077741))]
(gdb)   Id   Target Id                           Frame
* 1    Thread 0x7f5ae8ca2740 (LWP 4077741) 0x00000000004044fa in WriteCoreDump ()
  2    Thread 0x7f5ae84a0700 (LWP 4077745) 0x0000000000401b16 in Busy ()
  3    Thread 0x7f5ae8ca1700 (LWP 4077744) 0x0000000000401b21 in Busy ()
(gdb)
Romain-Geissler-1A commented 3 months ago

I wonder if this is what I fixed recently here: https://github.com/AmadeusITGroup/CoreDumper/commit/c146060e80fcd90c3b5dab0217986dab13732fcb

madscientist commented 3 weeks ago

@Romain-Geissler-1A thank you that is indeed what the problem was. Once I apply this patch, the tests pass.

It's unfortunate (for me) that your repo is not a fork of the original(?) anatol repo. I wasn't able to find your repo without the link above so thanks for that.

madscientist commented 3 weeks ago

Seems to be fixed with d0ed37c8e4a083c8ef1405ed9b20ce839fd62a03