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

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

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

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

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

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

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

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

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

2018-06-04 Thread Hatayama, Daisuke
ed...@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 verify it fixes your issue? >

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

2018-06-04 Thread Hatayama, Daisuke
ed...@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 verify it fixes your issue? >

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

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

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

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

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

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

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

2018-06-04 Thread Eric W. Biederman
inuxfoundation.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 bugs have crept into the code

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

2018-06-04 Thread Eric W. Biederman
inuxfoundation.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 bugs have crept into the code

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

2018-06-04 Thread Hatayama, Daisuke
ernel@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 general seeking > in kernf

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

2018-06-04 Thread Hatayama, Daisuke
ernel@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 general seeking > in kernf

[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

[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