From: Paul Floyd Date: Tue, 20 Aug 2024 19:44:00 +0000 (+0200) Subject: Bug 491394i - (vgModuleLocal_addDiCfSI): Assertion 'di->fsm.have_rx_map && di->fsm... X-Git-Tag: VALGRIND_3_24_0~81 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b87649504136fc3e72684b176651912ba1514c6d;p=thirdparty%2Fvalgrind.git Bug 491394i - (vgModuleLocal_addDiCfSI): Assertion 'di->fsm.have_rx_map && di->fsm.rw_map_count' failed. --- diff --git a/.gitignore b/.gitignore index 08598edbf..921d868cf 100644 --- a/.gitignore +++ b/.gitignore @@ -1531,6 +1531,7 @@ /none/tests/blockfault /none/tests/bug129866 /none/tests/bug234814 +/none/tests/bug491394 /none/tests/closeall /none/tests/coolo_sigaction /none/tests/coolo_strlen diff --git a/NEWS b/NEWS index b6bdd1613..6818089fe 100644 --- a/NEWS +++ b/NEWS @@ -57,6 +57,8 @@ are not entered into bugzilla tend to get forgotten about or ignored. 489338 arm64: Instruction fcvtas should round 322.5 to 323, but result is 322. 489676 vgdb handle EINTR and EAGAIN more consistently 490651 Stop using -flto-partition=one +491394 (vgModuleLocal_addDiCfSI): Assertion 'di->fsm.have_rx_map && + di->fsm.rw_map_count' failed To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/configure.ac b/configure.ac index 911bccaa8..aa24b6382 100755 --- a/configure.ac +++ b/configure.ac @@ -5205,6 +5205,27 @@ CFLAGS=$saved_CFLAGS LDFLAGS="$saved_LDFLAGS" AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes) +#---------------------------------------------------------------------------- +# static libc check +#---------------------------------------------------------------------------- +AC_MSG_CHECKING([if static libc is available]) + +saved_LDFLAGS="$LDFLAGS" +LDFLAGS="-nostdlib -lc -static" +AC_LINK_IFELSE([AC_LANG_SOURCE([[ +int main(void) +{ +} +]])], [ +ac_have_static_libc=yes +AC_MSG_RESULT([yes]) +], [ +ac_have_static_libc=no +AC_MSG_RESULT([no]) +]) +LDFLAGS="$saved_LDFLAGS" +AM_CONDITIONAL(HAVE_STATIC_LIBC, test x$ac_have_static_libc = xyes) + #---------------------------------------------------------------------------- # Other library checks diff --git a/coregrind/m_debuginfo/storage.c b/coregrind/m_debuginfo/storage.c index 148de6f17..ef6a40051 100644 --- a/coregrind/m_debuginfo/storage.c +++ b/coregrind/m_debuginfo/storage.c @@ -793,7 +793,7 @@ void ML_(addDiCfSI) ( struct _DebugInfo* di, "warning: DiCfSI %#lx .. %#lx is huge; length = %u (%s)\n", base, base + len - 1, len, di->soname); - vg_assert(di->fsm.have_rx_map && di->fsm.rw_map_count); + vg_assert(di->fsm.have_rx_map); /* Find mapping where at least one end of the CFSI falls into. */ map = ML_(find_rx_mapping)(di, base, base); map2 = ML_(find_rx_mapping)(di, base + len - 1, @@ -1298,7 +1298,7 @@ void ML_(addVar)( struct _DebugInfo* di, seems a reasonable assumption to me. */ /* This is assured us by top level steering logic in debuginfo.c, and it is re-checked at the start of ML_(read_elf_object). */ - vg_assert(di->fsm.have_rx_map && di->fsm.rw_map_count); + vg_assert(di->fsm.have_rx_map); if (level > 0 && ML_(find_rx_mapping)(di, aMin, aMax) == NULL) { if (VG_(clo_verbosity) > 1) { VG_(message)(Vg_DebugMsg, diff --git a/drd/tests/condvar2.cpp b/drd/tests/condvar2.cpp new file mode 100644 index 000000000..04fd7236c --- /dev/null +++ b/drd/tests/condvar2.cpp @@ -0,0 +1,40 @@ +#include +#include +#include +#include +#include +using namespace std::chrono_literals; + +std::condition_variable cv; +std::mutex cv_m; +std::atomic i{0}; + +void waits(int idx) +{ + std::unique_lock lk(cv_m); + auto now = std::chrono::system_clock::now(); + if(cv.wait_until(lk, now + idx*100ms, [](){return i == 1;})) + std::cerr << "Thread " << idx << " finished waiting. i == " << i << '\n'; + else + std::cerr << "Thread " << idx << " timed out. i == " << i << '\n'; +} + +void signals() +{ + std::this_thread::sleep_for(120ms); + std::cerr << "Notifying...\n"; + cv.notify_all(); + std::this_thread::sleep_for(100ms); + i = 1; + std::cerr << "Notifying again...\n"; + cv.notify_all(); +} + +int main() +{ + std::thread t1(waits, 1), t2(waits, 2), t3(waits, 3), t4(signals); + t1.join(); + t2.join(); + t3.join(); + t4.join(); +} diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index 8c1bc014b..924c40957 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -102,6 +102,7 @@ EXTRA_DIST = \ bitfield1.stderr.exp bitfield1.vgtest \ bug129866.vgtest bug129866.stderr.exp bug129866.stdout.exp \ bug234814.vgtest bug234814.stderr.exp bug234814.stdout.exp \ + bug491394.vgtest bug491394.stderr.exp \ closeall.stderr.exp closeall.vgtest \ cmdline0.stderr.exp cmdline0.stdout.exp cmdline0.vgtest \ cmdline1.stderr.exp cmdline1.stdout.exp cmdline1.vgtest \ @@ -310,6 +311,17 @@ check_PROGRAMS = \ socket_close \ file_dclose +if HAVE_STATIC_LIBC +if ! VGCONF_OS_IS_LINUX + check_PROGRAMS += bug491394 +endif +if VGCONF_OS_IS_LINUX +if VGCONF_ARCHS_INCLUDE_AMD64 + check_PROGRAMS += bug491394 +endif +endif +endif + if HAVE_CLOSE_RANGE check_PROGRAMS += double_close_range endif @@ -341,6 +353,9 @@ AM_CXXFLAGS += $(AM_FLAG_M3264_PRI) # Extra stuff for C tests ansi_CFLAGS = $(AM_CFLAGS) -ansi +bug491394_LDADD = -lc +bug491394_LDFLAGS = -nostdlib -static +bug491394_CFLAGS = ${AM_CFLAGS} -Os execve_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_NONNULL@ if VGCONF_OS_IS_SOLARIS fcntl_setown_LDADD = -lsocket -lnsl diff --git a/none/tests/bug491394.c b/none/tests/bug491394.c new file mode 100644 index 000000000..34749ea23 --- /dev/null +++ b/none/tests/bug491394.c @@ -0,0 +1,6 @@ +#include + +void _start(void) { + _exit(0); +} + diff --git a/none/tests/bug491394.stderr.exp b/none/tests/bug491394.stderr.exp new file mode 100644 index 000000000..e69de29bb diff --git a/none/tests/bug491394.vgtest b/none/tests/bug491394.vgtest new file mode 100644 index 000000000..213c702c9 --- /dev/null +++ b/none/tests/bug491394.vgtest @@ -0,0 +1,4 @@ +prereq: test -x ./bug491394 +prog: bug491394 +vgopts: -q +