[valgrind] [Bug 381815] Assertion 'newfd >= VG_(fd_hard_limit)' failed
https://bugs.kde.org/show_bug.cgi?id=381815 Kirill A. Korinsky changed: What|Removed |Added CC||kir...@korins.ky -- You are receiving this mail because: You are watching all bug changes.
[valgrind] [Bug 381815] Assertion 'newfd >= VG_(fd_hard_limit)' failed
https://bugs.kde.org/show_bug.cgi?id=381815 --- Comment #6 from Kirill A. Korinsky --- Anyway, I just fixed it :) -- You are receiving this mail because: You are watching all bug changes.
[valgrind] [Bug 381815] Assertion 'newfd >= VG_(fd_hard_limit)' failed
https://bugs.kde.org/show_bug.cgi?id=381815 --- Comment #5 from Kirill A. Korinsky --- Created attachment 106527 --> https://bugs.kde.org/attachment.cgi?id=106527&action=edit don't crash on huge limits -- You are receiving this mail because: You are watching all bug changes.
[valgrind] [Bug 381815] Assertion 'newfd >= VG_(fd_hard_limit)' failed
https://bugs.kde.org/show_bug.cgi?id=381815 --- Comment #4 from Kirill A. Korinsky --- Hey, I can't trace valgrind because it calls fcntl over this code: https://gist.github.com/catap/a20b8b1f46b0ba79b9f7297e73df0563 But I can run it in lldb ant provide some output to you. With ulimit -n 1024: ➜ bin ulimit -n 1024 ➜ bin env RETRACE_CONFIG=./retrace.conf.rnp VALGRIND_LAUNCHER=/Users/catap/Documents/Riboseinc/valgrind/bin/executable_path=./valgrind lldb -- ../lib/valgrind/memcheck-amd64-darwin /tmp/a.out (lldb) target create "../lib/valgrind/memcheck-amd64-darwin" Current executable set to '../lib/valgrind/memcheck-amd64-darwin' (x86_64). (lldb) settings set -- target.run-args "/tmp/a.out" (lldb) b vgPlain_safe_fd Breakpoint 1: where = memcheck-amd64-darwin`vgPlain_safe_fd + 18 at m_libcfile.c:59, address = 0x000258081452 (lldb) r Process 14822 launched: '../lib/valgrind/memcheck-amd64-darwin' (x86_64) Process 14822 stopped * thread #1, stop reason = breakpoint 1.1 frame #0: 0x000258081452 memcheck-amd64-darwin`vgPlain_safe_fd(oldfd=3) at m_libcfile.c:59 56 { 57 Int newfd; 58 -> 59 vg_assert(VG_(fd_hard_limit) != -1); 60 61 newfd = VG_(fcntl)(oldfd, VKI_F_DUPFD, VG_(fd_hard_limit)); 62 if (newfd != -1) (lldb) n Process 14822 stopped * thread #1, stop reason = step over frame #0: 0x0002580814ac memcheck-amd64-darwin`vgPlain_safe_fd(oldfd=3) at m_libcfile.c:61 58 59 vg_assert(VG_(fd_hard_limit) != -1); 60 -> 61 newfd = VG_(fcntl)(oldfd, VKI_F_DUPFD, VG_(fd_hard_limit)); 62 if (newfd != -1) 63 VG_(close)(oldfd); 64 (lldb) n Process 14822 stopped * thread #1, stop reason = step over frame #0: 0x0002580814ba memcheck-amd64-darwin`vgPlain_safe_fd(oldfd=3) at m_libcfile.c:62 59 vg_assert(VG_(fd_hard_limit) != -1); 60 61 newfd = VG_(fcntl)(oldfd, VKI_F_DUPFD, VG_(fd_hard_limit)); -> 62 if (newfd != -1) 63 VG_(close)(oldfd); 64 65 /* Set the close-on-exec flag for this fd. */ (lldb) p newfd (Int) $0 = 1024 (lldb) ^D With ulimit 262144: ➜ bin env RETRACE_CONFIG=./retrace.conf.rnp VALGRIND_LAUNCHER=/Users/catap/Documents/Riboseinc/valgrind/bin/executable_path=./valgrind lldb -- ../lib/valgrind/memcheck-amd64-darwin /tmp/a.out (lldb) target create "../lib/valgrind/memcheck-amd64-darwin" Current executable set to '../lib/valgrind/memcheck-amd64-darwin' (x86_64). (lldb) settings set -- target.run-args "/tmp/a.out" (lldb) b vgPlain_safe_fd Breakpoint 1: where = memcheck-amd64-darwin`vgPlain_safe_fd + 18 at m_libcfile.c:59, address = 0x000258081452 (lldb) r Process 14653 launched: '../lib/valgrind/memcheck-amd64-darwin' (x86_64) Process 14653 stopped * thread #1, stop reason = breakpoint 1.1 frame #0: 0x000258081452 memcheck-amd64-darwin`vgPlain_safe_fd(oldfd=3) at m_libcfile.c:59 56 { 57 Int newfd; 58 -> 59 vg_assert(VG_(fd_hard_limit) != -1); 60 61 newfd = VG_(fcntl)(oldfd, VKI_F_DUPFD, VG_(fd_hard_limit)); 62 if (newfd != -1) (lldb) n Process 14653 stopped * thread #1, stop reason = step over frame #0: 0x0002580814ac memcheck-amd64-darwin`vgPlain_safe_fd(oldfd=3) at m_libcfile.c:61 58 59 vg_assert(VG_(fd_hard_limit) != -1); 60 -> 61 newfd = VG_(fcntl)(oldfd, VKI_F_DUPFD, VG_(fd_hard_limit)); 62 if (newfd != -1) 63 VG_(close)(oldfd); 64 (lldb) n Process 14653 stopped * thread #1, stop reason = step over frame #0: 0x0002580814ba memcheck-amd64-darwin`vgPlain_safe_fd(oldfd=3) at m_libcfile.c:62 59 vg_assert(VG_(fd_hard_limit) != -1); 60 61 newfd = VG_(fcntl)(oldfd, VKI_F_DUPFD, VG_(fd_hard_limit)); -> 62 if (newfd != -1) 63 VG_(close)(oldfd); 64 65 /* Set the close-on-exec flag for this fd. */ (lldb) p newfd (Int) $0 = -1 (lldb) -- You are receiving this mail because: You are watching all bug changes.
[valgrind] [Bug 381815] Assertion 'newfd >= VG_(fd_hard_limit)' failed
https://bugs.kde.org/show_bug.cgi?id=381815 --- Comment #3 from Kirill A. Korinsky --- Tom, I have one idea. Can you confirm that fd_hard_limit is getting from getrlimit? If so I think the right way to OS X is using getdtablesize and be sure that F_DUPFD argument less that returned value by getdtablesize. -- You are receiving this mail because: You are watching all bug changes.
[valgrind] [Bug 381815] Assertion 'newfd >= VG_(fd_hard_limit)' failed
https://bugs.kde.org/show_bug.cgi?id=381815 --- Comment #2 from Kirill A. Korinsky --- Thanks for update. OS X doesn't have strace but it has dtruss that works only from root. and this bug doesn't reproduce from root user. Let me take some time to find a way to get the trace. -- You are receiving this mail because: You are watching all bug changes.
[valgrind] [Bug 381815] New: Assertion 'newfd >= VG_(fd_hard_limit)' failed
https://bugs.kde.org/show_bug.cgi?id=381815 Bug ID: 381815 Summary: Assertion 'newfd >= VG_(fd_hard_limit)' failed Product: valgrind Version: unspecified Platform: unspecified OS: OS X Status: UNCONFIRMED Severity: normal Priority: NOR Component: general Assignee: jsew...@acm.org Reporter: kir...@korins.ky Target Milestone: --- Good day! I've tried to run valgrind (trunk, revision 16457) on macOS 10.12.5 and it failed if I setup a huge number as file descriptors at ulimit. For example: ➜ /tmp cat test.c int main() { return 0; } ➜ /tmp clang test.c ➜ /tmp ulimit -n 1024 ➜ /tmp valgrind ./a.out ==28447== Memcheck, a memory error detector ==28447== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==28447== Using Valgrind-3.14.0.SVN and LibVEX; rerun with -h for copyright info ==28447== Command: ./a.out ==28447== ==28447== Syscall param msg->desc.port.name points to uninitialised byte(s) ==28447==at 0x1003A734A: mach_msg_trap (in /usr/lib/system/libsystem_kernel.dylib) ==28447==by 0x1003A6796: mach_msg (in /usr/lib/system/libsystem_kernel.dylib) ==28447==by 0x1003A0485: task_set_special_port (in /usr/lib/system/libsystem_kernel.dylib) ==28447==by 0x10053C10E: _os_trace_create_debug_control_port (in /usr/lib/system/libsystem_trace.dylib) ==28447==by 0x10053C458: _libtrace_init (in /usr/lib/system/libsystem_trace.dylib) ==28447==by 0x1000A59DF: libSystem_initializer (in /usr/lib/libSystem.B.dylib) ==28447==by 0x100017A1A: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld) ==28447==by 0x100017C1D: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld) ==28447==by 0x1000134A9: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld) ==28447==by 0x100013440: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld) ==28447==by 0x100012523: ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld) ==28447==by 0x1000125B8: ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld) ==28447== Address 0x10488accc is on thread 1's stack ==28447== in frame #2, created by task_set_special_port (???:) ==28447== ==28447== ==28447== HEAP SUMMARY: ==28447== in use at exit: 18,307 bytes in 162 blocks ==28447== total heap usage: 178 allocs, 16 frees, 24,451 bytes allocated ==28447== ==28447== LEAK SUMMARY: ==28447==definitely lost: 408 bytes in 8 blocks ==28447==indirectly lost: 6,888 bytes in 8 blocks ==28447== possibly lost: 72 bytes in 3 blocks ==28447==still reachable: 32 bytes in 1 blocks ==28447== suppressed: 10,907 bytes in 142 blocks ==28447== Rerun with --leak-check=full to see details of leaked memory ==28447== ==28447== For counts of detected and suppressed errors, rerun with: -v ==28447== Use --track-origins=yes to see where uninitialised values come from ==28447== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4) ➜ /tmp ulimit -n 262144 ➜ /tmp valgrind ./a.out valgrind: m_libcfile.c:68 (Int vgPlain_safe_fd(Int)): Assertion 'newfd >= VG_(fd_hard_limit)' failed. [1]28477 segmentation fault valgrind ./a.out ➜ /tmp -- You are receiving this mail because: You are watching all bug changes.