libext2fs: write only core inode in update_path()
Quoted 14 lines
Quoted 2 lines · number9652 wrote:
--- On Wed, 6/17/09, Eric Sandeen wrote:
right way to fix it, however. I am concernedthat I may have
Quoted 1 line
basically broken
write_inode_fullon any inode withextents. For
Quoted 1 line
example, there is another call to
write_inode_fullin
extent.cthatQuoted 1 line
might exhibit this same problem. I think the
right fix would be to
Quoted 1 line
return to reading the full inode into memory in the
extent_open
Quoted 8 lines
If this is the case (that it's broken now), then we really need
something in the regression suite to catch it - all tests pass in 1.41.6
....-Eric
I was too general in my statement above about what it broke. I think (didn't test) if a program follows this path:extent_open(...,*handle)write_inode_full(...,handle->inode,...)
that it will read uninitialized memory in write_inode_full. It seems clear that all previously written code assumes that this path is valid, and fixing all that to not assume that would seemingly be much more than just what your patch fixes and require more time to test. If you only use read/write_inode_full, everything is still okay.
I think that in this case, even when only using the handle to read the inode, we want to have the full inode available (by handle->inode) so it is possible (for example) to check the file creation time with the returned handle structure.
Nic
Quoted 28 lines · number9652 wrote:
Quoted 10 lines
Quoted 2 lines · number9652 wrote:
--- On Wed, 6/17/09, Eric Sandeen wrote: right way to fix it, however. I am concerned
that I may have
Quoted 1 line
basically broken
write_inode_fullon any inode withextents. For
Quoted 1 line
example, there is another call to
write_inode_fullin
extent.cthatQuoted 1 line
might exhibit this same problem. I think the
right fix would be to
Quoted 9 lines
Quoted 1 line
return to reading the full inode into memory in the
extent_openIf this is the case (that it's broken now), then we really need something in the regression suite to catch it - all tests pass in 1.41.6 ....
-Eric
I was too general in my statement above about what it broke. I think (didn't test) if a program follows this path:
extent_open(...,*handle)write_inode_full(...,handle->inode,...)that it will read uninitialized memory inwrite_inode_full. It seems clear that all previously written code assumes that this path is valid, and fixing all that to not assume that would seemingly be much more than just what your patch fixes and require more time to test. If you only use read/write_inode_full, everything is still okay.
Quoted 4 lines
I think that in this case, even when only using the handle to read the inode, we want to have the full inode available (by
handle->inode) so it is possible (for example) to check the file creation time with the returned handle structure.
Seems reasonable to me ...
FWIW, I have Yet Another Case where resize is corrupting the larger inode, even with this fix and/or my fix.
Still digging into it, sigh.
-Eric
Quoted 9 lines · On Wed, Jun 17, 2009 at 02:32:18PM -0700, number9652 wrote:
I was too general in my statement above about what it broke. I think (didn't test) if a program follows this path:
extent_open(...,*handle)write_inode_full(...,handle->inode,...)
that it will read uninitialized memory inwrite_inode_full. It
seems clear that all previously written code assumes that this path
is valid, and fixing all that to not assume that would seemingly be
much more than just what your patch fixes and require more time to
test. If you only use read/write_inode_full, everything is still
okay.
Um, but that can't happen; the ext2_extent_handle_t type is an opaque type. So outside of code in lib/ext2fs/extent.c, no one else can see the inode in the ext2_handle_t.
The safest thing to do is to simply make the extent code only use ext2_write_inode and ext2_read_inode. Otherwise, we have to worry about a user passing in the smaller 128-byte inode form. The extent code doesn't need any of the extended inode fields, so this is completely safe.
- Ted