public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Evgeniy Dushistov <dushistov@mail.ru>
To: Duane Griffin <duaneg@dghda.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] ufs: ensure fast symlinks are NUL-terminated
Date: Sat, 27 Dec 2008 15:22:15 +0300	[thread overview]
Message-ID: <20081227122215.GA25619@rain> (raw)
In-Reply-To: <20081216231850.GA12692@dastardly.home.dghda.com>

On Tue, Dec 16, 2008 at 11:18:50PM +0000, Duane Griffin wrote:
> On Tue, Dec 16, 2008 at 10:40:55PM +0300, Evgeniy Dushistov wrote:
> > There is different types of ufs, one used 64 bit for "pointers to
> > blocks", another 32 bit,
> > so sizeof(UFS_I(inode)->i_u1.i_symlink))
> > is not right choice every time,
> > in ufs2 it should be
> > sizeof(UFS_I(inode)->i_u1.u2_i_data) which 2 times bigger,
> > 
> > also there is hint for *BSD ufs
> > 
> > fs/ufs/ufs_fs.h:
> > __fs32	fs_maxsymlinklen;/* max length of an internal symlink */
> > 
> > which may be used if ufs type ufs1 or ufs2
> 
> Hmm, I see. However it looks like ufs1_read_inode and ufs2_read_inode
> both copy the same, ((UFS_NDADDR + UFS_NINDIR) * 4), amount of inline
> symlink data. They also both copy it to ufs_inode_info->i_u1.i_symlink
> (not that that matters, I suppose). Perhaps I'm being obtuse, but it
> looks like inline ufs2 symlinks between 60 and 120 characters long are
> being truncated to 60 characters, no?
> 
> There also doesn't seem to be any validation of (f)s_maxsymlinklen being
> done. Unless I'm mistaken ufs_symlink could end up overwriting random
> memory if it contains a large bogus value.
> 
> Does that all sound correct? If so would you like me to whip up a couple
> of patches to fix it? I'll respin the NUL-termination patch on top of
> those, if so.
> 

Yes, it looks like there is typo in ufs2 variant of copying symlink names.
Typical value of superblock's maxsymlinklen field for ufs2 is 120.
Patches to fix this are welcome.

-- 
/Evgeniy


  reply	other threads:[~2008-12-27 12:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-16 15:51 [PATCH 0/8, v3] ensure symlinks are NUL-terminated Duane Griffin
2008-12-16 15:51 ` [PATCH] vfs: introduce helper function to safely NUL-terminate symlinks Duane Griffin
2008-12-16 15:51   ` [PATCH] vfs: ensure page symlinks are NUL-terminated Duane Griffin
2008-12-16 15:51     ` [PATCH] ext2: ensure fast " Duane Griffin
2008-12-16 15:51       ` [PATCH] ext3: " Duane Griffin
2008-12-16 15:51         ` [PATCH] ext4: " Duane Griffin
2008-12-16 15:51           ` [PATCH] ufs: " Duane Griffin
2008-12-16 15:51             ` [PATCH] sysv: " Duane Griffin
2008-12-16 15:52               ` [PATCH] freevxfs: " Duane Griffin
2008-12-16 19:40             ` [PATCH] ufs: " Evgeniy Dushistov
2008-12-16 23:18               ` Duane Griffin
2008-12-27 12:22                 ` Evgeniy Dushistov [this message]
2008-12-16 16:38   ` [PATCH] vfs: introduce helper function to safely NUL-terminate symlinks Al Viro
2008-12-16 23:46   ` Andreas Dilger
2008-12-17  0:26     ` Duane Griffin
2008-12-19 15:03       ` Duane Griffin
2008-12-19 19:28         ` Andrew Morton
2008-12-19 19:43         ` Al Viro
2008-12-16 17:03 ` [PATCH 0/8, v3] ensure symlinks are NUL-terminated Dave Kleikamp
2008-12-16 17:26   ` Duane Griffin

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=20081227122215.GA25619@rain \
    --to=dushistov@mail.ru \
    --cc=duaneg@dghda.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox