LINUX.ORG.RU

Не хочет работать valgrind

 , ,


1

2

Операционка Astra Linux 1.3.

В системе стоит Valgrind 3.7.0. При попытке запуска под valgrind программы, собранной на этой же машине, происходит ошибка:

$ valgrind --tool=callgrind ./iks
==29808== Callgrind, a call-graph generating cache profiler
==29808== Copyright (C) 2002-2011, and GNU GPL'd, by Josef Weidendorfer et al.
==29808== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==29808== Command: ./iks
==29808==
==29808== For interactive control, run 'callgrind_control -h'.

valgrind: m_debuginfo/readelf.c:2386 (vgModuleLocal_read_elf_debug_info): Assertion 'di->bss_size == shdr->sh_size' failed.
==29808==    at 0x3803BA6F: ??? (in /usr/lib/valgrind/callgrind-amd64-linux)
==29808==    by 0x3803BBB2: ??? (in /usr/lib/valgrind/callgrind-amd64-linux)
==29808==    by 0x38068CDC: ??? (in /usr/lib/valgrind/callgrind-amd64-linux)
==29808==    by 0x38061069: ??? (in /usr/lib/valgrind/callgrind-amd64-linux)
==29808==    by 0x38081BF8: ??? (in /usr/lib/valgrind/callgrind-amd64-linux)
==29808==    by 0x380A894A: ??? (in /usr/lib/valgrind/callgrind-amd64-linux)
==29808==    by 0x3807E938: ??? (in /usr/lib/valgrind/callgrind-amd64-linux)
==29808==    by 0x3807B63F: ??? (in /usr/lib/valgrind/callgrind-amd64-linux)
==29808==    by 0x3807C798: ??? (in /usr/lib/valgrind/callgrind-amd64-linux)
==29808==    by 0x3808C339: ??? (in /usr/lib/valgrind/callgrind-amd64-linux)

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable
==29808==    at 0x40162AA: ??? (in /lib/x86_64-linux-gnu/ld-2.13.so)
==29808==    by 0x4006747: ??? (in /lib/x86_64-linux-gnu/ld-2.13.so)
==29808==    by 0x40080D2: ??? (in /lib/x86_64-linux-gnu/ld-2.13.so)
==29808==    by 0x400C351: ??? (in /lib/x86_64-linux-gnu/ld-2.13.so)
==29808==    by 0x400E005: ??? (in /lib/x86_64-linux-gnu/ld-2.13.so)
==29808==    by 0x400C56E: ??? (in /lib/x86_64-linux-gnu/ld-2.13.so)
==29808==    by 0x4002ADD: ??? (in /lib/x86_64-linux-gnu/ld-2.13.so)
==29808==    by 0x40141CD: ??? (in /lib/x86_64-linux-gnu/ld-2.13.so)
==29808==    by 0x4004D07: ??? (in /lib/x86_64-linux-gnu/ld-2.13.so)
==29808==    by 0x40014E7: ??? (in /lib/x86_64-linux-gnu/ld-2.13.so)


Note: see also the FAQ in the source distribution.
It contains workarounds to several common problems.
In particular, if Valgrind aborted or crashed after
identifying problems in your program, there's a good chance
that fixing those problems will prevent Valgrind aborting or
crashing, especially if it happened in m_mallocfree.c.

If that doesn't help, please report this bug to: www.valgrind.org

In the bug report, send all the above text, the valgrind
version, and what OS and version you are using.  Thanks.

Гуглеж ничего не дал, за исключением совета, что надо собрать более свежий valgrind. Океюшки, деинсталлирую родной valgrind 3.7.0, собираю из исходников актуальный 3.15.0, устанавливаю.

Запуск под 3.15.0 завершается все с той же ошибкой:
$ valgrind --tool=callgrind ./iks
==3760== Callgrind, a call-graph generating cache profiler
==3760== Copyright (C) 2002-2017, and GNU GPL'd, by Josef Weidendorfer et al.
==3760== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==3760== Command: ./iks
==3760==
==3760== For interactive control, run 'callgrind_control -h'.

valgrind: m_debuginfo/readelf.c:2916 (vgModuleLocal_read_elf_debug_info): Assertion 'di->bss_size == a_shdr.sh_size' failed.

host stacktrace:
==3760==    at 0x58029189: ??? (in /usr/lib/valgrind/callgrind-amd64-linux)
==3760==    by 0x58029297: ??? (in /usr/lib/valgrind/callgrind-amd64-linux)
==3760==    by 0x58029431: ??? (in /usr/lib/valgrind/callgrind-amd64-linux)
==3760==    by 0x58058AC7: ??? (in /usr/lib/valgrind/callgrind-amd64-linux)
==3760==    by 0x5804AA07: ??? (in /usr/lib/valgrind/callgrind-amd64-linux)
==3760==    by 0x580787DF: ??? (in /usr/lib/valgrind/callgrind-amd64-linux)
==3760==    by 0x58083EBA: ??? (in /usr/lib/valgrind/callgrind-amd64-linux)
==3760==    by 0x58073BEE: ??? (in /usr/lib/valgrind/callgrind-amd64-linux)
==3760==    by 0x580700FA: ??? (in /usr/lib/valgrind/callgrind-amd64-linux)
==3760==    by 0x58072436: ??? (in /usr/lib/valgrind/callgrind-amd64-linux)
==3760==    by 0x580D8FE4: ??? (in /usr/lib/valgrind/callgrind-amd64-linux)

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable syscall 9 (lwpid 3760)
==3760==    at 0x40162AA: ??? (in /lib/x86_64-linux-gnu/ld-2.13.so)
==3760==    by 0x4006747: ??? (in /lib/x86_64-linux-gnu/ld-2.13.so)
==3760==    by 0x40080D2: ??? (in /lib/x86_64-linux-gnu/ld-2.13.so)
==3760==    by 0x400C351: ??? (in /lib/x86_64-linux-gnu/ld-2.13.so)
==3760==    by 0x400E005: ??? (in /lib/x86_64-linux-gnu/ld-2.13.so)
==3760==    by 0x400C56E: ??? (in /lib/x86_64-linux-gnu/ld-2.13.so)
==3760==    by 0x4002ADD: ??? (in /lib/x86_64-linux-gnu/ld-2.13.so)
==3760==    by 0x40141CD: ??? (in /lib/x86_64-linux-gnu/ld-2.13.so)
==3760==    by 0x4004D07: ??? (in /lib/x86_64-linux-gnu/ld-2.13.so)
==3760==    by 0x40014E7: ??? (in /lib/x86_64-linux-gnu/ld-2.13.so)
client stack range: [0x1FFEFFF000 0x1FFF000FFF] client SP: 0x1FFEFFF558
valgrind stack range: [0x100306A000 0x1003169FFF] top usage: 8344 of 1048576


Note: see also the FAQ in the source distribution.
It contains workarounds to several common problems.
In particular, if Valgrind aborted or crashed after
identifying problems in your program, there's a good chance
that fixing those problems will prevent Valgrind aborting or
crashing, especially if it happened in m_mallocfree.c.

If that doesn't help, please report this bug to: www.valgrind.org

In the bug report, send all the above text, the valgrind
version, and what OS and version you are using.  Thanks.


В исходниках valgrind проблемный код такой:
#           define FIND(_sec, _seg) \
            do { \
               ElfXX_Shdr a_shdr; \
               ML_(img_get)(&a_shdr, dimg, \
                            INDEX_BIS(shdr_dioff, i, shdr_dent_szB), \
                            sizeof(a_shdr)); \
               if (di->_sec##_present \
                   && 0 == ML_(img_strcmp_c)(dimg, shdr_strtab_dioff \
                                             + a_shdr.sh_name, "." #_sec)) { \
                  vg_assert(di->_sec##_size == a_shdr.sh_size); \
                  /* JRS 2013-Jun-01: the following assert doesn't contain */ \
                  /* any ==s, which seems to me to be suspicious. */ \
                  vg_assert(di->_sec##_avma +  a_shdr.sh_addr + _seg##_dbias); \
                  /* Assume we have a correct value for the main */ \
                  /* object's bias.  Use that to derive the debuginfo */ \
                  /* object's bias, by adding the difference in SVMAs */ \
                  /* for the corresponding sections in the two files. */ \
                  /* That should take care of all prelinking effects. */ \
                  di->_sec##_debug_svma = a_shdr.sh_addr; \
                  di->_sec##_debug_bias \
                     = di->_sec##_bias + \
                       di->_sec##_svma - di->_sec##_debug_svma; \
                  TRACE_SYMTAB("acquiring ." #_sec \
                               " debug svma = %#lx .. %#lx\n",       \
                               di->_sec##_debug_svma, \
                               di->_sec##_debug_svma + di->_sec##_size - 1); \
                  TRACE_SYMTAB("acquiring ." #_sec " debug bias = %#lx\n", \
                               (UWord)di->_sec##_debug_bias);           \
               } \
            } while (0);

            /* SECTION   SEGMENT */
            FIND(text,   rx)
            FIND(data,   rw)
            FIND(sdata,  rw)
            FIND(rodata, rw)
            FIND(bss,    rw) <!-- Вот тут проблема
            FIND(sbss,   rw)

#           undef FIND


Вопрос: что еще где надо докрутить, чтобы valgrind нормально работал?

★★★★★

Последнее исправление: Xintrea (всего исправлений: 1)

я бы начал с опции –verbose
хотя 1.3 это именно special edition, могли сертифицированного гавнеца добавить, пинай их на ихнем форуме

x905 ★★★★★
()
Ответ на: комментарий от x905

Пока что поступил проще: тупо закомментировал ассерт:

vg_assert(di->_sec##_size == a_shdr.sh_size);

и пересобрал valgrind. Почему под Астрой размер секции bss не попадает под это условие, непонятно, но вроде как некритично.

В любом случае, valgrind стартанул, и, главное, больше нигде не заткнулся. Пока что поработаю так.

Xintrea ★★★★★
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.