qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Nathan Froyd <froydnj@codesourcery.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Don't leak file descriptors
Date: Fri, 13 Nov 2009 16:44:00 +0100	[thread overview]
Message-ID: <4AFD7EC0.4010906@redhat.com> (raw)
In-Reply-To: <20091113154118.GL31393@codesourcery.com>

Am 13.11.2009 16:41, schrieb Nathan Froyd:
> On Fri, Nov 13, 2009 at 04:17:16PM +0100, Kevin Wolf wrote:
>> We're leaking file descriptors to child processes. Set FD_CLOEXEC on file
>> descriptors that don't need to be passed to children to stop this
>> misbehaviour.
>>
>>> --- a/gdbstub.c
>> +++ b/gdbstub.c
>> @@ -2356,6 +2356,9 @@ static void gdb_accept(void)
>>              perror("accept");
>>              return;
>>          } else if (fd >= 0) {
>> +#ifndef _WIN32
>> +            fcntl(fd, F_SETFD, FD_CLOEXEC);
>> +#endif
>>              break;
>>          }
>>      }
> 
> Why not just use the new accept wrapper here?

gdbstub.c is also used in the Linux userspace emulator where the accept
wrapper is not available. I tried to add osdep.c to the linux-user build
- after all, it looked easy enough - but it ended up being too much
Makefile magic. This is why I decided to go for the easy way and expand it.

Kevin

  reply	other threads:[~2009-11-13 15:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-13 15:17 [Qemu-devel] [PATCH] Don't leak file descriptors Kevin Wolf
2009-11-13 15:36 ` Scott Tsai
2009-11-16  2:15   ` Jamie Lokier
2009-11-13 15:41 ` Nathan Froyd
2009-11-13 15:44   ` Kevin Wolf [this message]
2009-11-13 21:05 ` Blue Swirl
2009-11-16 12:47   ` Kevin Wolf
2009-11-16 16:21     ` Blue Swirl
2009-11-16 16:46       ` Avi Kivity
2009-11-16 23:05       ` Jamie Lokier
2009-11-16 23:10         ` Jamie Lokier
2009-11-17  9:12         ` Kevin Wolf
2009-11-17 20:28           ` Blue Swirl
2009-11-16 23:26 ` Anthony Liguori
2009-11-16 23:44   ` Jamie Lokier
2009-11-17  9:00   ` Kevin Wolf

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=4AFD7EC0.4010906@redhat.com \
    --to=kwolf@redhat.com \
    --cc=froydnj@codesourcery.com \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).