From: Eric Dumazet <dada1@cosmosbay.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
mingo@elte.hu, tglx@linutronix.de, torvalds@linux-foundation.org
Subject: Re: [PATCHv5 4/5] Allow setting O_NONBLOCK flag for new sockets
Date: Sat, 24 Nov 2007 09:28:54 +0100 [thread overview]
Message-ID: <4747E0C6.5010900@cosmosbay.com> (raw)
In-Reply-To: <4747D610.6040108@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 883 bytes --]
Ulrich Drepper a écrit :
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Eric Dumazet wrote:
>> 1) Can the fd passing with recvmsg() on AF_UNIX also gets O_CLOEXEC
>> support ?
>
> Already there, see MSG_CMSG_CLOEXEC.
OK, but maybe for consistency, we might accept the two mechanisms.
The one added in 2.6.23, and the more general indirect() way.
(See attached untested patch for the general idea, you'll have to also add
#if INDSYSCALL(recvmsg)
case INDSYSCALL(recvmsg):
#endif
)
>> 2) Why this O_NONBLOCK ability is needed for sockets ? Is it a security
>> issue, and if yes could you remind it to me ?
>
> No security issue. But look at any correct network program, all need to
> set the mode to non-blocking. Adding this support to the syscall comes
> at almost no cost and it cuts the cost for every program down by one or
> two syscalls.
>
OK, thank you.
[-- Attachment #2: scm.patch --]
[-- Type: text/plain, Size: 531 bytes --]
diff --git a/net/core/scm.c b/net/core/scm.c
index 100ba6d..38a0b77 100644
--- a/net/core/scm.c
+++ b/net/core/scm.c
@@ -230,11 +230,12 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm)
i++, cmfptr++)
{
int new_fd;
+ int flags = INDIRECT_PARAM(file_flags, flags) & O_CLOEXEC;
err = security_file_receive(fp[i]);
if (err)
break;
err = get_unused_fd_flags(MSG_CMSG_CLOEXEC & msg->msg_flags
- ? O_CLOEXEC : 0);
+ ? O_CLOEXEC : flags);
if (err < 0)
break;
new_fd = err;
next prev parent reply other threads:[~2007-11-24 8:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-21 7:28 [PATCHv5 4/5] Allow setting O_NONBLOCK flag for new sockets Ulrich Drepper
2007-11-24 7:17 ` Eric Dumazet
2007-11-24 7:43 ` Ulrich Drepper
2007-11-24 8:28 ` Eric Dumazet [this message]
2007-11-24 16:11 ` Ulrich Drepper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4747E0C6.5010900@cosmosbay.com \
--to=dada1@cosmosbay.com \
--cc=akpm@linux-foundation.org \
--cc=drepper@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox