]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Bug 491394i - (vgModuleLocal_addDiCfSI): Assertion 'di->fsm.have_rx_map && di->fsm...
authorPaul Floyd <pjfloyd@wanadoo.fr>
Tue, 20 Aug 2024 19:44:00 +0000 (21:44 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Wed, 21 Aug 2024 19:26:05 +0000 (21:26 +0200)
.gitignore
NEWS
configure.ac
coregrind/m_debuginfo/storage.c
drd/tests/condvar2.cpp [new file with mode: 0644]
none/tests/Makefile.am
none/tests/bug491394.c [new file with mode: 0644]
none/tests/bug491394.stderr.exp [new file with mode: 0644]
none/tests/bug491394.vgtest [new file with mode: 0644]

index 08598edbff70157703386ecaebbccebde8f59cc1..921d868cfbed52ea99cdbe73bea03ef2c4a07031 100644 (file)
 /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 b6bdd1613f8a37ac62df9741b50faebc9b17a180..6818089feefff273363e641b7df0cb1e9b2fde8f 100644 (file)
--- 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
index 911bccaa849e7a1f918d5f126ed9b828eab1ee36..aa24b6382a66cd03d97065185d87437e6c233dbb 100755 (executable)
@@ -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
index 148de6f17e711a9e56fd1955181be4844e4e4426..ef6a400510b6c75d884ab8e7d4f7f73c83285bc9 100644 (file)
@@ -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 (file)
index 0000000..04fd723
--- /dev/null
@@ -0,0 +1,40 @@
+#include <iostream>
+#include <atomic>
+#include <condition_variable>
+#include <thread>
+#include <chrono>
+using namespace std::chrono_literals;
+std::condition_variable cv;
+std::mutex cv_m;
+std::atomic<int> i{0};
+void waits(int idx)
+{
+    std::unique_lock<std::mutex> 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();
+}
index 8c1bc014bc3ad634547feaa9ec0c6b4eeeeb239a..924c409575b10e4acb5087cabca5b838f95c7a95 100644 (file)
@@ -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 (file)
index 0000000..34749ea
--- /dev/null
@@ -0,0 +1,6 @@
+#include <unistd.h>
+
+void _start(void) {
+       _exit(0);
+}
+
diff --git a/none/tests/bug491394.stderr.exp b/none/tests/bug491394.stderr.exp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/none/tests/bug491394.vgtest b/none/tests/bug491394.vgtest
new file mode 100644 (file)
index 0000000..213c702
--- /dev/null
@@ -0,0 +1,4 @@
+prereq: test -x ./bug491394
+prog: bug491394
+vgopts: -q
+