public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/12539] New: need a way to atomically set FD_CLOEXEC on fds transferred via SCM_RIGHTS
@ 2011-03-03 21:10 eblake at redhat dot com
  2011-03-04 16:17 ` [Bug libc/12539] " bonzini at gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: eblake at redhat dot com @ 2011-03-03 21:10 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12539

           Summary: need a way to atomically set FD_CLOEXEC on fds
                    transferred via SCM_RIGHTS
           Product: glibc
           Version: 2.13
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper.fsp@gmail.com
        ReportedBy: eblake@redhat.com


It seems a shame that after all the effort that went into allowing atomic
creation of fds with FD_CLOEXEC set (accept4, pipe2, epoll_create1, ...) that
there's still no way to transfer fds using recvmsg while having the resulting
fd start life as cloexec.  This is a two-part bug report - the kernel would
need to learn SCM_RIGHTS_CLOEXEC (identical behavior to SCM_RIGHTS on sendmsg,
and atomically sets FD_CLOEXEC on recvmsg), and glibc needs to learn to use it.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libc/12539] need a way to atomically set FD_CLOEXEC on fds transferred via SCM_RIGHTS
  2011-03-03 21:10 [Bug libc/12539] New: need a way to atomically set FD_CLOEXEC on fds transferred via SCM_RIGHTS eblake at redhat dot com
@ 2011-03-04 16:17 ` bonzini at gnu dot org
  2011-03-04 17:09 ` eblake at redhat dot com
  2014-06-27 13:48 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: bonzini at gnu dot org @ 2011-03-04 16:17 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12539

Paolo Bonzini <bonzini at gnu dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bonzini at gnu dot org
         Resolution|                            |INVALID

--- Comment #1 from Paolo Bonzini <bonzini at gnu dot org> 2011-03-04 16:16:43 UTC ---
This is already present, but the choice of whether to close-on-exec is done by
the receiver, not the sender:

   MSG_CMSG_CLOEXEC (recvmsg() only; since Linux 2.6.23)
          Set  the close-on-exec flag for the file descriptor received via a
Unix 
          domain file descriptor using the SCM_RIGHTS operation (described in 
          unix(7)).  This flag is useful for the same reasons as the O_CLOEXEC
          flag of open(2).

/* Bits in the FLAGS argument to `send', `recv', et al.  */
enum
  {
    MSG_CMSG_CLOEXEC    = 0x40000000    /* Set close_on_exit for file
                                           descriptor received through
                                           SCM_RIGHTS.  */
#define MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC
  };

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libc/12539] need a way to atomically set FD_CLOEXEC on fds transferred via SCM_RIGHTS
  2011-03-03 21:10 [Bug libc/12539] New: need a way to atomically set FD_CLOEXEC on fds transferred via SCM_RIGHTS eblake at redhat dot com
  2011-03-04 16:17 ` [Bug libc/12539] " bonzini at gnu dot org
@ 2011-03-04 17:09 ` eblake at redhat dot com
  2014-06-27 13:48 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: eblake at redhat dot com @ 2011-03-04 17:09 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12539

--- Comment #2 from Eric Blake <eblake at redhat dot com> 2011-03-04 17:09:16 UTC ---
Since 'man recvmsg' doesn't describe SCM_RIGHTS (other than the one mention of
the term in MSG_CMSG_CLOEXEC), and 'man csmg' didn't discuss MSG_CMSG_CLOEXEC,
I hadn't put two and two together.  Thanks for correcting me, and glad to know
it already exists.

Hmm, that means I should open a bug against the man-pages project.  'man cmsg'
only talks about SCM_RIGHTS creating descriptors as if by dup(2), but it should
also discuss that the addition of the MSG_CMSG_CLOEXEC flags can create
descriptors as if by fcntl(,F_DUPFD_CLOEXEC,0) instead.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libc/12539] need a way to atomically set FD_CLOEXEC on fds transferred via SCM_RIGHTS
  2011-03-03 21:10 [Bug libc/12539] New: need a way to atomically set FD_CLOEXEC on fds transferred via SCM_RIGHTS eblake at redhat dot com
  2011-03-04 16:17 ` [Bug libc/12539] " bonzini at gnu dot org
  2011-03-04 17:09 ` eblake at redhat dot com
@ 2014-06-27 13:48 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: fweimer at redhat dot com @ 2014-06-27 13:48 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=12539

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-06-27 13:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-03 21:10 [Bug libc/12539] New: need a way to atomically set FD_CLOEXEC on fds transferred via SCM_RIGHTS eblake at redhat dot com
2011-03-04 16:17 ` [Bug libc/12539] " bonzini at gnu dot org
2011-03-04 17:09 ` eblake at redhat dot com
2014-06-27 13:48 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).