Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1237394

Re: List corruption on epoll_ctl(EPOLL_CTL_DEL) an AF_UNIX socket

From Rainer Weikusat <rweikusat@mobileactivedefense.com>
Newsgroups linux.kernel
Subject Re: List corruption on epoll_ctl(EPOLL_CTL_DEL) an AF_UNIX socket
Date 2015-10-01 15:00 +0200
Message-ID <qeLCN-4xp-3@gated-at.bofh.it> (permalink)
References (3 earlier) <qe8Bs-78E-27@gated-at.bofh.it> <qeiAO-4r8-3@gated-at.bofh.it> <qeC6t-7m7-5@gated-at.bofh.it> <qeJrj-1qD-1@gated-at.bofh.it> <qeL06-3Kc-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Rainer Weikusat <rw@doppelsaurus.mobileactivedefense.com> writes:
> Rainer Weikusat <rw@doppelsaurus.mobileactivedefense.com> writes:
>> Jason Baron <jbaron@akamai.com> writes:
>>> On 09/30/2015 01:54 AM, Mathias Krause wrote:
>>>> On 29 September 2015 at 21:09, Jason Baron <jbaron@akamai.com> wrote:
>>>>> However, if we call connect on socket 's', to connect to a new socket 'o2', we
>>>>> drop the reference on the original socket 'o'. Thus, we can now close socket
>>>>> 'o' without unregistering from epoll. Then, when we either close the ep
>>>>> or unregister 'o', we end up with this list corruption. Thus, this is not a
>>>>> race per se, but can be triggered sequentially.

[...]


> Test program (assumes that it can execute itself as ./a.out):
>
> -------------
> #include <fcntl.h>
> #include <pthread.h>
> #include <string.h>
> #include <sys/socket.h>
> #include <sys/un.h>
> #include <sys/epoll.h>
> #include <signal.h>
> #include <unistd.h>
>
> static int sk;
>
> static void *epoller(void *unused)
> {
>     struct epoll_event epev;
>     int epfd;
>     
>     epfd = epoll_create(1);
>
>     epev.events = EPOLLOUT;
>     epoll_ctl(epfd, EPOLL_CTL_ADD, sk, &epev);
>     epoll_wait(epfd, &epev, 1, 5000);
>
>     execl("./a.out", "./a.out", (void *)0);
>
>     return NULL;
> }

[...]

Possibly interesting additional bit of information: The list corruption
warnings appear only if the 2nd connect is there and both the sk and
epfd file descriptors are left open accross the exec. Closing either of
both still triggers the _destructor warnings but nothing else (until the
process runs out of file descriptors).
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: List corruption on epoll_ctl(EPOLL_CTL_DEL) an AF_UNIX socket Mathias Krause <minipli@googlemail.com> - 2015-09-29 20:20 +0200
  Re: List corruption on epoll_ctl(EPOLL_CTL_DEL) an AF_UNIX socket Jason Baron <jbaron@akamai.com> - 2015-09-29 21:20 +0200
    Re: List corruption on epoll_ctl(EPOLL_CTL_DEL) an AF_UNIX socket Mathias Krause <minipli@googlemail.com> - 2015-09-30 08:00 +0200
      Re: List corruption on epoll_ctl(EPOLL_CTL_DEL) an AF_UNIX socket Michal Kubecek <mkubecek@suse.cz> - 2015-09-30 09:40 +0200
        Re: List corruption on epoll_ctl(EPOLL_CTL_DEL) an AF_UNIX socket Jason Baron <jbaron@akamai.com> - 2015-10-01 05:00 +0200
      Re: List corruption on epoll_ctl(EPOLL_CTL_DEL) an AF_UNIX socket Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2015-09-30 13:00 +0200
        Re: List corruption on epoll_ctl(EPOLL_CTL_DEL) an AF_UNIX socket Mathias Krause <minipli@googlemail.com> - 2015-09-30 14:00 +0200
          Re: List corruption on epoll_ctl(EPOLL_CTL_DEL) an AF_UNIX socket Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2015-09-30 15:30 +0200
            Re: List corruption on epoll_ctl(EPOLL_CTL_DEL) an AF_UNIX socket Mathias Krause <minipli@googlemail.com> - 2015-09-30 15:40 +0200
              Re: List corruption on epoll_ctl(EPOLL_CTL_DEL) an AF_UNIX socket Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2015-09-30 16:00 +0200
      Re: List corruption on epoll_ctl(EPOLL_CTL_DEL) an AF_UNIX socket Jason Baron <jbaron@akamai.com> - 2015-10-01 04:50 +0200
        Re: List corruption on epoll_ctl(EPOLL_CTL_DEL) an AF_UNIX socket Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2015-10-01 12:40 +0200
          Re: List corruption on epoll_ctl(EPOLL_CTL_DEL) an AF_UNIX socket Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2015-10-01 14:20 +0200
            Re: List corruption on epoll_ctl(EPOLL_CTL_DEL) an AF_UNIX socket Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2015-10-01 15:00 +0200

csiph-web