From: Andreas Dilger <adilger@clusterfs.com>
To: Andrew Morton <akpm@zip.com.au>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
linux-fsdevel@vger.kernel.org, ext2-devel@lists.sourceforge.net
Subject: Re: ext3 -> crash -> fsck -> readlink -> oops
Date: Fri, 17 May 2002 02:55:08 -0600 [thread overview]
Message-ID: <20020517085508.GP12975@turbolinux.com> (raw)
In-Reply-To: <3CE46CF0.E0C9BCC5@zip.com.au>
On May 16, 2002 19:37 -0700, Andrew Morton wrote:
> You seem have a 4k symlink. I'd have expected fsck to detect that.
I just took a look (built a simple testcase) and it does not detect
string overflows for long symlinks. It does for fast symlinks, because
the data is available right away when it is checking the inode data,
but the block data isn't validated at that time, nor later in the run.
> 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))
This will fix the oops on behalf of the kernel. I'm just working on a
patch to e2fsck to fix that side of things.
Cheers, Andreas
--
Andreas Dilger
http://www-mddsp.enel.ucalgary.ca/People/adilger/
http://sourceforge.net/projects/ext2resize/
next prev parent reply other threads:[~2002-05-17 8:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-17 0:50 ext3 -> crash -> fsck -> readlink -> oops H. Peter Anvin
2002-05-17 2:37 ` Andrew Morton
2002-05-17 2:48 ` H. Peter Anvin
2002-05-17 8:55 ` Andreas Dilger [this message]
2002-05-17 9:40 ` [Ext2-devel] " Stephen C. Tweedie
2002-05-17 10:01 ` Andreas Dilger
2002-05-18 20:38 ` Andreas Dilger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020517085508.GP12975@turbolinux.com \
--to=adilger@clusterfs.com \
--cc=akpm@zip.com.au \
--cc=ext2-devel@lists.sourceforge.net \
--cc=hpa@zytor.com \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.