Bug 238696 - fcntl command F_DUPFD_CLOEXEC not supported
Summary: fcntl command F_DUPFD_CLOEXEC not supported
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.5.0
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: wanted3.5.1
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-24 17:14 UTC by Adrien BUSTANY
Modified: 2010-09-02 10:23 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adrien BUSTANY 2010-05-24 17:14:26 UTC
Version:           3.5.0 (using KDE 4.4.3) 
OS:                Linux

When using a program calling the fcntl command F_DUPFD_CLOEXEC, valgrind will stop with the following trace:

valgrind: m_syswrap/syswrap-linux.c:3536 (vgSysWrap_linux_sys_fcntl_before): Assertion 'Unimplemented functionality' failed.
valgrind: valgrind
==5198==    at 0x3802A9A4: report_and_quit (m_libcassert.c:145)
==5198==    by 0x3802AC17: vgPlain_assert_fail (m_libcassert.c:217)
==5198==    by 0x38076E33: vgSysWrap_linux_sys_fcntl_before (syswrap-linux.c:3536)
==5198==    by 0x38065651: vgPlain_client_syscall (syswrap-main.c:1392)
==5198==    by 0x3806225D: handle_syscall (scheduler.c:873)
==5198==    by 0x380630B9: vgPlain_scheduler (scheduler.c:1069)
==5198==    by 0x3808C1C4: run_a_thread_NORETURN (syswrap-linux.c:91)

DBus 1.3 does for example use that functionality to pass UNIX file descriptors  between programs.

Reproducible: Always

Steps to Reproduce:
Valgrind a program that uses F_DUPFD_CLOEXEC

Actual Results:  
Valgrind stops

Expected Results:  
Valgrind should valgrind, as it always valgrin'ed
Comment 1 Julian Seward 2010-05-24 17:21:20 UTC
Could you please supply a short program that shows the failure?
Comment 2 Adrien BUSTANY 2010-05-24 18:46:51 UTC
Here is a very simple code:

#include <fcntl.h>
#include <unistd.h>

int 
main (int argc, char **argv)
{
    int pipefd[2];
    int dupped_pipe;

    pipe (pipefd);

    dupped_pipe = fcntl (pipefd[0], F_DUPFD_CLOEXEC, 3);

    close (pipefd[0]);
    close (pipefd[1]);
    close (dupped_pipe);
}
Comment 3 Adrien BUSTANY 2010-05-28 16:45:27 UTC
Would that be something difficult to implement? I might take a try at it, but not if it involves one month of learning Valgrind's codebase :)
Comment 4 Julian Seward 2010-09-01 17:08:59 UTC
Tom, any chance you can look into this one?
Comment 5 Tom Hughes 2010-09-02 10:23:42 UTC
Fixed in r11316.