Re: [PATCH 1/6] seq_file: add seq_read_iter

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

 



On Sun, Nov 15, 2020 at 05:34:16PM -0700, Nathan Chancellor wrote:
 
> Still good.
> 
> Tested-by: Nathan Chancellor <natechancellor@xxxxxxxxx>

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).



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux