Thread (5 messages) 5 messages, 3 authors, 2002-05-18

Re: ext3 -> crash -> fsck -> readlink -> oops

From: Andreas Dilger <hidden>
Date: 2002-05-18 20:38:00

On May 16, 2002  19:37 -0700, Andrew Morton wrote:
quoted hunk ↗ jump to hunk
"H. Peter Anvin" wrote:
quoted
Hi there,

We just suffered some SCSI bus problems on kernel.org that resulted in
significant data loss on our mirror volume, but not enough to ditch
the whole filesystem and start over (rsync --checksum is a good
thing.)  However, we keep getting oopses, ostensibly as the result of
a garbaged symlink.  This filesystem has been run through fsck -y
(e2fstools 1.26).

Oops details at:

    http://userweb.kernel.org/~hpa/oops-20020516/

The kernel running is 2.4.19-pre8.
I assume that was `fsck -fy'?

You seem have a 4k symlink.   I'd have expected fsck to detect that.

It crashed because vfs_readlink ran off the end of the page.
--- linux-2.4.19-pre8/fs/namei.c	Thu May  2 17:44:56 2002
+++ linux-akpm/fs/namei.c	Thu May 16 19:34:57 2002
@@ -1947,7 +1947,7 @@ int vfs_readlink(struct dentry *dentry, 
 	if (IS_ERR(link))
 		goto out;
 
-	len = strlen(link);
+	len = strnlen(link, PAGE_CACHE_SIZE);
 	if (len > (unsigned) buflen)
 		len = buflen;
 	if (copy_to_user(buffer, link, len))
OK, I posted a patch to e2fsck on ext2-devel (against Ted's BK
repository, but should be OK with 1.27) which should detect and
fix (i.e. remove) the symlinks without nul termination that are
causing this problem.  Let me know how it works (you might want
to try 'e2fsck -fn <dev>' first just to see that it detects the
problem without actually changing the filesystem.

Cheers, Andreas
--
Andreas Dilger
http://www-mddsp.enel.ucalgary.ca/People/adilger/
http://sourceforge.net/projects/ext2resize/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help