qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [Bug 1504513] [NEW] Socket leak on each call to qemu_socket


From: Mark Pizzolato
Subject: [Qemu-devel] [Bug 1504513] [NEW] Socket leak on each call to qemu_socket()
Date: Fri, 09 Oct 2015 11:48:53 -0000

Public bug reported:

On any host platform where SOCK_CLOEXEC is defined (Linux at least), a
socket is leaked on each call to qemu_socket() AND the socket returned
hasn't been created with the desired SOCK_CLOEXEC attribute.  The
qemu_socket routine is:

Line 272 of util/osdep.c:
/*
 * Opens a socket with FD_CLOEXEC set
 */
int qemu_socket(int domain, int type, int protocol)
{
    int ret;

#ifdef SOCK_CLOEXEC
    ret = socket(domain, type | SOCK_CLOEXEC, protocol);
    if (ret != -1 || errno != EINVAL) {
        return ret;
    }
#endif
    ret = socket(domain, type, protocol);
    if (ret >= 0) {
        qemu_set_cloexec(ret);
    }

    return ret;
}

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1504513

Title:
  Socket leak on each call to qemu_socket()

Status in QEMU:
  New

Bug description:
  On any host platform where SOCK_CLOEXEC is defined (Linux at least), a
  socket is leaked on each call to qemu_socket() AND the socket returned
  hasn't been created with the desired SOCK_CLOEXEC attribute.  The
  qemu_socket routine is:

  Line 272 of util/osdep.c:
  /*
   * Opens a socket with FD_CLOEXEC set
   */
  int qemu_socket(int domain, int type, int protocol)
  {
      int ret;

  #ifdef SOCK_CLOEXEC
      ret = socket(domain, type | SOCK_CLOEXEC, protocol);
      if (ret != -1 || errno != EINVAL) {
          return ret;
      }
  #endif
      ret = socket(domain, type, protocol);
      if (ret >= 0) {
          qemu_set_cloexec(ret);
      }

      return ret;
  }

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1504513/+subscriptions



reply via email to

[Prev in Thread] Current Thread [Next in Thread]