linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Matthew Wilcox <willy@infradead.org>
Cc: Jan Kara <jack@suse.cz>,
	linux-fsdevel@vger.kernel.org,
	Nathan Wilson <nate@chickenbrittle.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] udf: Fix crash after seekdir
Date: Wed, 10 Nov 2021 12:35:30 +0100	[thread overview]
Message-ID: <20211110113530.GB4048@quack2.suse.cz> (raw)
In-Reply-To: <YYqhRmm/+XHrCgxP@casper.infradead.org>

On Tue 09-11-21 16:26:46, Matthew Wilcox wrote:
> On Tue, Nov 09, 2021 at 12:48:41PM +0100, Jan Kara wrote:
> > udf_readdir() didn't validate the directory position it should start
> > reading from. Thus when user uses lseek(2) on directory file descriptor
> > it can trick udf_readdir() into reading from a position in the middle of
> > directory entry which then upsets directory parsing code resulting in
> > errors or even possible kernel crashes. Similarly when the directory is
> > modified between two readdir calls, the directory position need not be
> > valid anymore.
> 
> ... We don't have an xfstest for this already?  Actually, two.  One for
> lseek() and one for modifying the directory as it's being read.

Good question which I also wanted to investigate. We do have generic/310
which tests the seek + readdir case (but for some reason it does not hit
any problem with udf). Also tests using fsstress can in principle hit the
readdir + dir modification case although because glibc implementation of
readdir(3) does a lot of caching (directories smaller than 32k worth of dir
entries are read in one go), hiting some problematic cornercase is rare I
guess. So I guess the coverage needs some expansion.  I'll have a look into
it.

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

      reply	other threads:[~2021-11-10 11:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09 11:48 [PATCH] udf: Fix crash after seekdir Jan Kara
2021-11-09 16:26 ` Matthew Wilcox
2021-11-10 11:35   ` Jan Kara [this message]

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=20211110113530.GB4048@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=nate@chickenbrittle.com \
    --cc=stable@vger.kernel.org \
    --cc=willy@infradead.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;
as well as URLs for NNTP newsgroup(s).