Possible fix for 2.6.24 xfs_file_readdir crash
PATCH 1/1 Possible fix for 2.6.24 xfs_file_readdir crash
Sven, Tomas, Andrea:
Can you try the patch attached below to see if it fixes the xfs_file_readdir() oops you are seeing and let me know if it fixes the problem?
It looks like we're deferencing a pointer beyond the end of a buffer if the buffer is filled exactly. This bug does not crash ia64 (even with memory poisoning enabled), which is why the targeted corner case testing I did a while back did not pick this up when fixing a similar bug a month ago.
Cheers,
Dave.
Signature · 33 lines
Dave Chinner Principal Engineer SGI Australian Software Group --- Fix yet another corner case oops in xfs_file_readdir(). Signed-off-by: Dave Chinner <[email protected]> --- fs/xfs/linux-2.6/xfs_file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) Index: 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_file.c =================================================================== --- 2.6.x-xfs-new.orig/fs/xfs/linux-2.6/xfs_file.c 2008-01-16 16:24:01.000000000 +1100 +++ 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_file.c 2008-02-05 15:13:17.153110696 +1100 @@ -351,8 +351,8 @@ xfs_file_readdir( size = buf.used; de = (struct hack_dirent *)buf.dirent; - curr_offset = de->offset /* & 0x7fffffff */; while (size > 0) { + curr_offset = de->offset /* & 0x7fffffff */; if (filldir(dirent, de->name, de->namlen, curr_offset & 0x7fffffff, de->ino, de->d_type)) { @@ -363,7 +363,6 @@ xfs_file_readdir( sizeof(u64)); size -= reclen; de = (struct hack_dirent *)((char *)de + reclen); - curr_offset = de->offset /* & 0x7fffffff */; } }
Looks good to me. Well not really good but like fixing the corner case. We really need to get rid of this stupid loop. I'll put fixing nfsd up higher in my todo list.
Quoted 5 lines · David Chinner
Sven, Tomas, Andrea:
Can you try the patch attached below to see if it fixes the
xfs_file_readdir()oops you are seeing and let me know if it fixes the problem?
Works for me(TM) :)
My testbox survived 24h with this patch, no problems.
Tobias
Quoted 45 lines
It looks like we're deferencing a pointer beyond the end of a buffer if the buffer is filled exactly. This bug does not crash ia64 (even with memory poisoning enabled), which is why the targeted corner case testing I did a while back did not pick this up when fixing a similar bug a month ago.
Cheers,
Dave.
Signature · 14 lines
Dave Chinner Principal Engineer SGI Australian Software Group --- Fix yet another corner case oops in xfs_file_readdir(). Signed-off-by: Dave Chinner <[email protected]> --- fs/xfs/linux-2.6/xfs_file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) Index: 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_file.c ===================================================================fs/xfs/linux-2.6/xfs_file.c +1
-2@@ -351,8 +351,8 @@ xfs_file_readdir( size = buf.used; de = (struct hack_dirent *)buf.dirent; - curr_offset = de->offset/* & 0x7fffffff */ ;while (size >0 ) { + curr_offset = de->offset/* & 0x7fffffff */ ;if (filldir (dirent, de->name, de->namlen, curr_offset &0x7fffffff , de->ino, de->d_type)) {@@ -363,7 +363,6 @@ xfs_file_readdir( sizeof(u64)); size -= reclen; de = (struct hack_dirent *)((char *)de + reclen); - curr_offset = de->offset/* & 0x7fffffff */ ; } }
Quoted 5 lines
Sven, Tomas, Andrea:
Can you try the patch attached below to see if it fixes the
xfs_file_readdir()oops you are seeing and let me know if it fixes the problem?
Works like a charm here :D
Thank you for your fast fix !
cheers
Andrea
David Chinner schrieb am Dienstag, den 05. Februar um 06:24 Uhr:
Quoted 1 line
Can you try the patch attached below
Am I correct in the assumption, that this did not make it into 2.6.24.1?
Can we reckon that this patch will get included in one of the next minor releases?
Sven
Signature · 4 lines
The main thing to note is that when you choose open source you don't
get a Windows operating system.
(from http://www.dell.com/ubuntu)
/me is giggls@ircnet, http://sven.gegg.us/ on the WebQuoted 6 lines · Sven Geggus
David Chinner schrieb am Dienstag, den 05. Februar um 06:24 Uhr:
Quoted 1 line
Can you try the patch attached below
Am I correct in the assumption, that this did not make it into 2.6.24.1?
Right - the fix wasn't in Linus' kernel by the time 2.6.24.1 was released.
Quoted 2 lines
Can we reckon that this patch will get included in one of the next minor releases?
Already queued for 2.6.24.2.
Cheers,
Dave.
Signature · 3 lines
Dave Chinner Principal Engineer SGI Australian Software Group
Quoted 4 lines · David Chinner
Quoted 2 lines
Can we reckon that this patch will get included in one of the next minor releases?
Already queued for 2.6.24.2.
2.6.24.2 has been released to address the vmsplice issue. Unfortunately, no other changes seem to have been included. Hopefully, the xfs_file_readdir patch will make it to 2.6.24.3.
Signature · 3 lines
Federico Sevilla III F S 3 Consulting Inc. http://www.fs3.ph
Quoted 3 lines · Federico Sevilla III
2.6.24.2 has been released to address the vmsplice issue. Unfortunately, no other changes seem to have been included. Hopefully, the
xfs_file_readdirpatch will make it to 2.6.24.3.
Which platforms are affected? My machines are x86_64, and I've just upgraded to avoid the vmsplice exploit.
Of course, I could compile a patched kernel but if this platform isn't affected then I might as well wait for 2.6.24.3.
I know that's a really lazy kind of question.