]> sourceware.org Git - valgrind.git/commitdiff
bug465435 - m_libcfile.c:66 (vgPlain_safe_fd): Assertion 'newfd >= VG_(fd_hard_limit...
authorPaul Floyd <pjfloyd@wanadoo.fr>
Fri, 24 Feb 2023 20:31:35 +0000 (21:31 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Fri, 24 Feb 2023 20:32:08 +0000 (21:32 +0100)
NEWS
coregrind/m_libcfile.c

diff --git a/NEWS b/NEWS
index 5e61efbbfe3acbc3d1abc42ce8013f99673580f5..7fcfc667a288abe95e1669831dc7bd1cb77ed809 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -94,6 +94,7 @@ are not entered into bugzilla tend to get forgotten about or ignored.
 464476  Firefox fails to start under Valgrind
 464859  Build failures with GCC-13 (drd tsan_unittest)
 464969  D language demangling
+465435  m_libcfile.c:66 (vgPlain_safe_fd): Assertion 'newfd >= VG_(fd_hard_limit)' failed.
 
 To see details of a given bug, visit
   https://bugs.kde.org/show_bug.cgi?id=XXXXXX
index e98de3e96f06eb1b5ddb0769efa26aa49dc2f0c1..5d3a349f2bb2cc23d85a82f03e9fd87fa7cd723d 100644 (file)
@@ -57,13 +57,25 @@ Int VG_(safe_fd)(Int oldfd)
    vg_assert(VG_(fd_hard_limit) != -1);
 
    newfd = VG_(fcntl)(oldfd, VKI_F_DUPFD, VG_(fd_hard_limit));
-   if (newfd != -1)
-      VG_(close)(oldfd);
+
+   if (newfd == -1) {
+      VG_(debugLog)(0, "libcfile", "Valgrind: FATAL: "
+                       "Private file creation failed.\n"
+                       "   The current file descriptor limit is %d.\n"
+                       "   If you are running in Docker please consider\n"
+                       "   lowering this limit with the shell built-in limit command.\n",
+                       VG_(fd_hard_limit));
+      VG_(debugLog)(0, "libcfile", "Exiting now.\n");
+      VG_(exit)(1);
+   }
+
+   vg_assert(newfd >= VG_(fd_hard_limit));
+
+   VG_(close)(oldfd);
 
    /* Set the close-on-exec flag for this fd. */
    VG_(fcntl)(newfd, VKI_F_SETFD, VKI_FD_CLOEXEC);
 
-   vg_assert(newfd >= VG_(fd_hard_limit));
    return newfd;
 }
 
@@ -753,7 +765,11 @@ Int VG_(fcntl) ( Int fd, Int cmd, Addr arg )
 #  else
 #    error "Unknown OS"
 #  endif
-   return sr_isError(res) ? -1 : sr_Res(res);
+   if (sr_isError(res)) {
+      VG_(debugLog)(1, "VG_(fcntl)", "fcntl error %lu %s\n", sr_Err(res), VG_(strerror)(sr_Err(res)));
+      return -1;
+   }
+   return (Int)sr_Res(res);
 }
 
 Int VG_(rename) ( const HChar* old_name, const HChar* new_name )
This page took 0.03599 seconds and 5 git commands to generate.