From: Rainer Weikusat <rweikusat@mobileactivedefense.com>
To: Jason Baron <jbaron@akamai.com>
Cc: Mathias Krause <minipli@googlemail.com>,
netdev@vger.kernel.org,
"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Eric Wong <normalperson@yhbt.net>,
Eric Dumazet <eric.dumazet@gmail.com>,
Rainer Weikusat <rweikusat@mobileactivedefense.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Davide Libenzi <davidel@xmailserver.org>,
Davidlohr Bueso <dave@stgolabs.net>,
Olivier Mauras <olivier@mauras.ch>,
PaX Team <pageexec@freemail.hu>,
Linus Torvalds <torvalds@linux-foundation.org>,
"peterz\@infradead.org" <peterz@infradead.org>,
"davem\@davemloft.net" <davem@davemloft.net>
Subject: Re: List corruption on epoll_ctl(EPOLL_CTL_DEL) an AF_UNIX socket
Date: Thu, 01 Oct 2015 13:58:42 +0100 [thread overview]
Message-ID: <87y4fm4uf1.fsf@doppelsaurus.mobileactivedefense.com> (raw)
In-Reply-To: <87bnciiybf.fsf@doppelsaurus.mobileactivedefense.com> (Rainer Weikusat's message of "Thu, 01 Oct 2015 13:10:44 +0100")
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).
next prev parent reply other threads:[~2015-10-01 12:59 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-13 19:53 List corruption on epoll_ctl(EPOLL_CTL_DEL) an AF_UNIX socket Mathias Krause
2015-09-14 2:39 ` Eric Wong
2015-09-29 18:09 ` Mathias Krause
2015-09-29 19:09 ` Jason Baron
2015-09-30 5:54 ` Mathias Krause
2015-09-30 7:34 ` Michal Kubecek
2015-10-01 2:55 ` Jason Baron
2015-09-30 10:56 ` Rainer Weikusat
2015-09-30 11:55 ` Mathias Krause
2015-09-30 13:25 ` Rainer Weikusat
2015-09-30 13:38 ` Mathias Krause
2015-09-30 13:51 ` Rainer Weikusat
2015-10-01 2:39 ` Jason Baron
2015-10-01 10:33 ` Rainer Weikusat
2015-10-01 12:10 ` Rainer Weikusat
2015-10-01 12:58 ` Rainer Weikusat [this message]
2015-09-15 17:07 ` Rainer Weikusat
2015-09-15 18:15 ` Mathias Krause
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=87y4fm4uf1.fsf@doppelsaurus.mobileactivedefense.com \
--to=rweikusat@mobileactivedefense.com \
--cc=dave@stgolabs.net \
--cc=davem@davemloft.net \
--cc=davidel@xmailserver.org \
--cc=eric.dumazet@gmail.com \
--cc=jbaron@akamai.com \
--cc=linux-kernel@vger.kernel.org \
--cc=minipli@googlemail.com \
--cc=netdev@vger.kernel.org \
--cc=normalperson@yhbt.net \
--cc=olivier@mauras.ch \
--cc=pageexec@freemail.hu \
--cc=peterz@infradead.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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