SUMMARY I noticed a strange inconsistency while trying to temporarily work around a local issue. The application in question throws a "Warning: invalid file descriptor X in syscall fcntl()" warning when run under Valgrind which I wanted to temporarily suppress, but the suppression generated with the help of --gen-suppressions=yes doesn't work. STEPS TO REPRODUCE # cat >foo.c <<EOF #include <fcntl.h> int main(void) { fcntl(-1, F_GETFD); return 0; } # gcc -o foo foo.c # valgrind --track-fds=yes --gen-suppressions=yes ./foo # cat >foo.supp <<EOF { foo CoreError:FdBadUse fun:__fcntl64_nocancel_adjusted fun:fcntl fun:main } EOF # valgrind --track-fds=yes --suppressions=foo.supp ./foo OBSERVED RESULT # valgrind --track-fds=yes --gen-suppressions=yes ./foo ... ==2083== Memcheck, a memory error detector ==2083== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al. ==2083== Using Valgrind-3.24.0 and LibVEX; rerun with -h for copyright info ==2083== Command: ./foo ==2083== ==2083== File descriptor -1 Invalid file descriptor ==2083== at 0x494DF07: __fcntl64_nocancel_adjusted (fcntl_nocancel.c:63) ==2083== by 0x4948FF4: fcntl (fcntl64.c:51) ==2083== by 0x40113D: main (in /root/foo) ==2083== ==2083== ---- Print suppression ? --- [Return/N/n/Y/y/C/c] ---- y { <insert_a_suppression_name_here> CoreError:FdBadUse fun:__fcntl64_nocancel_adjusted fun:fcntl fun:main } ==2083== ==2083== FILE DESCRIPTORS: 3 open (3 std) at exit. ==2083== ==2083== HEAP SUMMARY: ==2083== in use at exit: 0 bytes in 0 blocks ==2083== total heap usage: 0 allocs, 0 frees, 0 bytes allocated ==2083== ==2083== All heap blocks were freed -- no leaks are possible ==2083== ==2083== For lists of detected and suppressed errors, rerun with: -s ==2083== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) # valgrind --track-fds=yes --suppressions=foo.supp ./foo ==2086== Memcheck, a memory error detector ==2086== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al. ==2086== Using Valgrind-3.24.0 and LibVEX; rerun with -h for copyright info ==2086== Command: ./foo ==2086== ==2086== FATAL: in suppressions file "foo.supp" near line 3: ==2086== unknown core suppression type ==2086== exiting now. EXPECTED RESULT The suppression rule should be accepted by Valgrind. SOFTWARE/OS VERSIONS Fedora Rawhide with valgrind-3.24.0-2.fc42.x86_64
Reproduced. I'll try to push a fix tomorrow (2025-01-07).
I'll add a Linux version of the test tonight - the suppression file needs to be different. commit 47bdc4a6f3de8e2071561d349fdd5f830388c489 (HEAD -> master, origin/users/paulf/try-bug498317, origin/master, origin/HEAD, bug498317) Author: Paul Floyd <pjfloyd@wanadoo.fr> Date: Tue Jan 7 08:05:20 2025 +0100 Bug 498317 - FdBadUse is not a valid CoreError type in a suppression even though it's generated by --gen-suppressions=yes
Also added to the VALGRIND_3_24_BRANCH commit febe1ccef09f70777b086f938c03f3e71989a7c8 Author: Paul Floyd <pjfloyd@wanadoo.fr> Date: Tue Jan 7 08:05:20 2025 +0100 Bug 498317 - FdBadUse is not a valid CoreError type in a suppression even though it's generated by --gen-suppressions=yes https://bugs.kde.org/show_bug.cgi?id=498317 (cherry picked from commit 47bdc4a6f3de8e2071561d349fdd5f830388c489)