Re: [CFT][PATCH] kernfs: Correct kernfs directory seeks.

2018-06-07 Thread Al Viro
On Tue, Jun 05, 2018 at 12:47:33PM -0500, Eric W. Biederman wrote: > Sigh, I have found another issue with kernfs_fop_readdir. > > We are not currently protecting file->private_data with the kernfs_mutex > or any other kind of serialization. Which means if two processes are > calling readdir on

Re: [CFT][PATCH] kernfs: Correct kernfs directory seeks.

2018-06-05 Thread Eric W. Biederman
"'t...@kernel.org'" writes: > Hello, > > On Tue, Jun 05, 2018 at 10:31:36AM -0500, Eric W. Biederman wrote: >> What I have above is not the clearest, and in fact the logic could be >> better. >> >> The fundamental challenge is because hash collisions are possible a file >> offset does not hold c

Re: [CFT][PATCH] kernfs: Correct kernfs directory seeks.

2018-06-05 Thread 't...@kernel.org'
Hello, On Tue, Jun 05, 2018 at 10:31:36AM -0500, Eric W. Biederman wrote: > What I have above is not the clearest, and in fact the logic could be > better. > > The fundamental challenge is because hash collisions are possible a file > offset does not hold complete position information in a direct

Re: [CFT][PATCH] kernfs: Correct kernfs directory seeks.

2018-06-05 Thread Eric W. Biederman
"Hatayama, Daisuke" writes: >> >> + >> >> + /* Is the saved position usable? */ >> >> + if (saved) { >> >> + /* Proper parent and hash? */ >> >> + if ((parent != saved->parent) || (saved->hash != hash)) { >> >> + saved = NULL; >> > >> > name is uninitialized in thi

RE: [CFT][PATCH] kernfs: Correct kernfs directory seeks.

2018-06-04 Thread Hatayama, Daisuke
ernel.org; > 'ebied...@aristanetworks.com' > Subject: Re: [CFT][PATCH] kernfs: Correct kernfs directory seeks. > > ebied...@xmission.com (Eric W. Biederman) writes: > > > "Hatayama, Daisuke" writes: > > > >>> Can you test this and please v

RE: [CFT][PATCH] kernfs: Correct kernfs directory seeks.

2018-06-04 Thread Hatayama, Daisuke
ernel.org; > 'ebied...@aristanetworks.com' > Subject: Re: [CFT][PATCH] kernfs: Correct kernfs directory seeks. > > "Hatayama, Daisuke" writes: > > > Hello, > > > > Thanks for this patch, Eric. > > > >> -Original Message

Re: [CFT][PATCH] kernfs: Correct kernfs directory seeks.

2018-06-04 Thread Eric W. Biederman
ebied...@xmission.com (Eric W. Biederman) writes: > "Hatayama, Daisuke" writes: > >>> Can you test this and please verify it fixes your issue? >> >> I tried this patch on top of v4.17 but the system fails to boot >> without detecting root disks by dracut like this: [snip] >> OTOH, there's no iss

Re: [CFT][PATCH] kernfs: Correct kernfs directory seeks.

2018-06-04 Thread Eric W. Biederman
...@linuxfoundation.org' ; >> 't...@kernel.org' ; Okajima, Toshiyuki >> ; linux-kernel@vger.kernel.org; >> 'ebied...@aristanetworks.com' >> Subject: [CFT][PATCH] kernfs: Correct kernfs directory seeks. >> >> >> Over the years two

RE: [CFT][PATCH] kernfs: Correct kernfs directory seeks.

2018-06-04 Thread Hatayama, Daisuke
yuki > ; linux-kernel@vger.kernel.org; > 'ebied...@aristanetworks.com' > Subject: [CFT][PATCH] kernfs: Correct kernfs directory seeks. > > > Over the years two bugs have crept into the code that handled the last > returned kernfs directory being deleted, and handled

[CFT][PATCH] kernfs: Correct kernfs directory seeks.

2018-06-03 Thread Eric W. Biederman
Over the years two bugs have crept into the code that handled the last returned kernfs directory being deleted, and handled general seeking in kernfs directories. The result is that reading the /sys/module directory while moduled are loading and unloading will sometimes skip over a module that w