[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201116032942.GV3576660@ZenIV.linux.org.uk>
Date: Mon, 16 Nov 2020 03:29:42 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Nathan Chancellor <natechancellor@...il.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Christoph Hellwig <hch@....de>,
Greg KH <gregkh@...uxfoundation.org>,
Alexey Dobriyan <adobriyan@...il.com>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
kys@...rosoft.com, haiyangz@...rosoft.com, sthemmin@...rosoft.com,
wei.liu@...nel.org, linux-hyperv@...r.kernel.org
Subject: Re: [PATCH 1/6] seq_file: add seq_read_iter
On Sun, Nov 15, 2020 at 05:34:16PM -0700, Nathan Chancellor wrote:
> Still good.
>
> Tested-by: Nathan Chancellor <natechancellor@...il.com>
Pushed into #fixes
> > BTW, is that call of readv() really coming from init? And if it
> > is, what version of init are you using?
>
> I believe that it is but since this is WSL2, I believe that /init is a
> proprietary Microsoft implementation, rather than systemd or another
> init system:
>
> https://wiki.ubuntu.com/WSL#Keeping_Ubuntu_Updated_in_WSL
>
> So I am not sure how possible it is to see exactly what is going on or
> getting it improved.
Oh, well... Anyway, as a regression test it's interesting:
#include <sys/uio.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
main()
{
static char s[1024];
static struct iovec v[2] = {{NULL, 0}, {s, 1024}};
for(;;) {
ssize_t n = readv(0, v, 2), m, w;
if (n < 0) {
perror("readv");
return -1;
}
if (!n)
return 0;
for (m = 0; m < n; m += w) {
w = write(1, s + m, n - m);
if (w < 0)
perror("write");
}
}
}
which ought to copy stdin to stdout; with this bug it would (on sufficiently
large seq_file-based files) fail with "readv: Bad address" (-EFAULT, that is).
Powered by blists - more mailing lists