Uploaded image for project: 'ACS'
  1. ACS
  2. ACS-8

ACS Makefile links module .a before .so libraries

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Medium Medium
    • None

      The usual priority is to use .so libraries if present and your objective is to produce a .so library, but the ACS Makefile has a small bug that resorts to .a libraries before the .so one.

      This usually is inoffensive (although resulting in bigger binaries than required), however there are some cases that could result in double free of static symbols, which end up with a segmentation fault at exit.

      An example is with the loggingClient:

      free(): double free detected in tcache 2
      Program received signal SIGABRT, Aborted.
      0x00007ffff5a5570f in raise () from /lib64/libc.so.6
      Missing separate debuginfos, use: yum debuginfo-install libgcc-8.3.1-5.el8.0.2.x86_64 libstdc++-8.3.1-5.el8.0.2.x86_64
      (gdb) bt
      #0  0x00007ffff5a5570f in raise () from /lib64/libc.so.6
      #1  0x00007ffff5a3fb25 in abort () from /lib64/libc.so.6
      #2  0x00007ffff5a98897 in __libc_message () from /lib64/libc.so.6
      #3  0x00007ffff5a9efdc in malloc_printerr () from /lib64/libc.so.6
      #4  0x00007ffff5aa0d4d in _int_free () from /lib64/libc.so.6
      #5  0x00007ffff5a583c7 in __cxa_finalize () from /lib64/libc.so.6
      #6  0x00007ffff7977897 in __do_global_dtors_aux () from /alma/ACS-2021FEB/ACSSW/lib/libbaselogging.so
      #7  0x00007fffffffdd20 in ?? ()
      #8  0x00007ffff7de42a6 in _dl_fini () from /lib64/ld-linux-x86-64.so.2
      Backtrace stopped: frame did not save the P
      

      ==1423370== Invalid free() / delete / delete[] / realloc()
      ==1423370==    at 0x4C325CC: operator delete(void*) (vg_replace_malloc.c:586)
      ==1423370==    by 0x6E6C3C6: __cxa_finalize (in /usr/lib64/libc-2.28.so)
      ==1423370==    by 0x507E896: ??? (in /alma/ACS-2021FEB/ACSSW/lib/libbaselogging.so)
      ==1423370==    by 0x40102A5: _dl_fini (in /usr/lib64/ld-2.28.so)
      ==1423370==    by 0x6E6BE9B: __run_exit_handlers (in /usr/lib64/libc-2.28.so)
      ==1423370==    by 0x6E6BFCF: exit (in /usr/lib64/libc-2.28.so)
      ==1423370==    by 0x413733: getParams(int, char**) (loggingClient.cpp:632)
      ==1423370==    by 0x416805: main (loggingClient.cpp:525)
      ==1423370==  Address 0xbb918c0 is 0 bytes inside a block of size 19 free'd
      ==1423370==    at 0x4C325CC: operator delete(void*) (vg_replace_malloc.c:586)
      ==1423370==    by 0x6E6BE9B: __run_exit_handlers (in /usr/lib64/libc-2.28.so)
      ==1423370==    by 0x6E6BFCF: exit (in /usr/lib64/libc-2.28.so)
      ==1423370==    by 0x413733: getParams(int, char**) (loggingClient.cpp:632)
      ==1423370==    by 0x416805: main (loggingClient.cpp:525)
      ==1423370==  Block was alloc'd at
      ==1423370==    at 0x4C31556: operator new(unsigned long) (vg_replace_malloc.c:344)
      ==1423370==    by 0x416C99: void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char const*, char const*, std::forward_iterator_tag) (basic_string.tcc:219)
      ==1423370==    by 0x428A48: __static_initialization_and_destruction_0 (loggingBaseLog.cpp:37)
      ==1423370==    by 0x428A48: _GLOBAL__sub_I_loggingBaseLog.cpp (loggingBaseLog.cpp:71)
      ==1423370==    by 0x436F8C: __libc_csu_init (in /alma/ACS-2021FEB/ACSSW/bin/loggingClient)
      ==1423370==    by 0x6E5562D: (below main) (in /usr/lib64/libc-2.28.so)
      

      A workaround is to compile with the MAKE_NOSTATIC environment variable set, however this should not be a requirement.


              jaodev JAO Software Development (Inactive)
              Tomas.Staig Tomas Staig
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: