libmicrohttpd
[Top][All Lists]
Advanced

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

[libmicrohttpd] v.0.9.46 "close failed" abort in daemon.c:2093


From: A. Mark
Subject: [libmicrohttpd] v.0.9.46 "close failed" abort in daemon.c:2093
Date: Thu, 14 Jan 2016 09:22:19 -0800

OS:Linux Fedora 20 x86_64

I'm getting the following segfault/abort:

"close failed" from libmicrohttpd v0.9.46.

I traced the issue to the following code in daemon.c:

---
      /* epoll documentation suggests that closing a FD
         automatically removes it from the epoll set; however,
         this is not true as if we fail to do manually remove it,
         we are still seeing an event for this fd in epoll,
         causing grief (use-after-free...) --- at least on my
         system. */
      if (0 != epoll_ctl (daemon->epoll_fd,
                  EPOLL_CTL_DEL,
                  pos->socket_fd,
                  NULL))
        MHD_PANIC ("Failed to remove FD from epoll set\n");
      pos->epoll_state &= ~MHD_EPOLL_STATE_IN_EPOLL_SET;
    }
#endif
      if (NULL != pos->response)
    {
      MHD_destroy_response (pos->response);
      pos->response = NULL;
    }
      if (MHD_INVALID_SOCKET != pos->socket_fd)
    {
#ifdef WINDOWS
      shutdown (pos->socket_fd, SHUT_WR);
#endif
      if (0 != MHD_socket_close_ (pos->socket_fd))
        MHD_PANIC ("close failed\n");
    }
---

Any remedies? This suggests that there is an issue with epoll?

Thanks, Mark

reply via email to

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