https://bugs.kde.org/show_bug.cgi?id=498317

            Bug ID: 498317
           Summary: FdBadUse is not a valid CoreError type in a
                    suppression even though it's generated by
                    --gen-suppressions=yes
    Classification: Developer tools
           Product: valgrind
           Version: 3.24 GIT
          Platform: Fedora RPMs
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: jsew...@acm.org
          Reporter: franti...@sumsal.cz
  Target Milestone: ---

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

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to