From: Eric Dumazet <eric.dumazet@gmail.com>
To: Dave Jones <davej@redhat.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
axboe@kernel.dk, Tom Herbert <therbert@google.com>
Subject: Re: vmsplice triggering bug in kfree.
Date: Thu, 07 Jun 2012 09:47:08 +0200 [thread overview]
Message-ID: <1339055228.26966.103.camel@edumazet-glaptop> (raw)
In-Reply-To: <1339048365.26966.89.camel@edumazet-glaptop>
On Thu, 2012-06-07 at 07:52 +0200, Eric Dumazet wrote:
> On Thu, 2012-06-07 at 06:40 +0200, Eric Dumazet wrote:
> > On Thu, 2012-06-07 at 06:27 +0200, Eric Dumazet wrote:
> >
> > > Thanks Dave, I'll take a look today on this report.
> > >
> >
> > OK, trivial bug, I am testing a fix, thanks again.
> >
>
> Not sure if you can reproduce this bug easily, if so could you test
> following patch ?
By the way, following program triggers the bug instantly :
#define __USE_GNU 1
#define _GNU_SOURCE
#include <fcntl.h>
#include <pthread.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
int pfd[2];
void *worker(void *arg)
{
unsigned int page_size = 4096;
while (1) {
fcntl(pfd[1], F_SETPIPE_SZ, 16 * page_size);
fcntl(pfd[1], F_SETPIPE_SZ, 64 * page_size);
}
}
char buffer[1024*1024];
int main(int argc, char *argv[])
{
pthread_t tid;
int res, fdnull = open("/dev/null", O_WRONLY);
if (pipe(pfd) == -1) {
perror("pipe");
return 1;
}
res = pthread_create(&tid, NULL, worker, NULL);
if (res) {
errno = res;
perror("pthread_create");
return 1;
}
while (1) {
struct iovec iov[1];
int wr;
iov[0].iov_base = buffer;
iov[0].iov_len = 1024*1024;
wr = vmsplice(pfd[1], iov, 1, SPLICE_F_GIFT);
if (wr > 0) {
wr = splice(pfd[0], NULL,
fdnull, NULL,
wr, SPLICE_F_MOVE | SPLICE_F_MORE);
}
}
}
next prev parent reply other threads:[~2012-06-07 7:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-07 2:51 Dave Jones
2012-06-07 4:27 ` Eric Dumazet
2012-06-07 4:40 ` Eric Dumazet
2012-06-07 5:52 ` Eric Dumazet
2012-06-07 7:47 ` Eric Dumazet [this message]
2012-06-08 18:04 ` Dave Jones
2012-06-07 10:36 ` [PATCH] splice: fix racy pipe->buffers uses Eric Dumazet
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=1339055228.26966.103.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=axboe@kernel.dk \
--cc=davej@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=therbert@google.com \
/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
all inboxes | Powered by JetHome®