public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vegard Nossum <vegard.nossum@oracle.com>
To: Richard Weinberger <richard.weinberger@gmail.com>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: Endless getdents() in vfat filesystem
Date: Sat, 14 Nov 2015 13:42:23 +0100	[thread overview]
Message-ID: <56472C2F.5090207@oracle.com> (raw)
In-Reply-To: <CAFLxGvyzbMJA_=iy_=ZaQiJ_cqdRdiK-MF3rDYi=uaZ6fdWKHw@mail.gmail.com>

On 11/14/2015 11:32 AM, Richard Weinberger wrote:
> On Sat, Nov 14, 2015 at 2:19 AM, Vegard Nossum <vegard.nossum@oracle.com> wrote:
>> Hi,
>>
>> Using the attached disk image I observe that getdents() never returns
>> the end of the directory, i.e. mounting the disk image on a loopback
>> device and running 'ls' under strace shows an endless stream of:
>>
>> getdents(3, /* 2 entries */, 32768)     = 48
>> getdents(3, /* 2 entries */, 32768)     = 48
>> getdents(3, /* 2 entries */, 32768)     = 48
>> ...
>
> Please more details. Is this image hand crafted?
> If not, how has it been created? Is is supposed to work?

It was created by fuzzing, it is not supposed to work per se.

>  From a quick look it seems as the root directory is bad but we report
> progress in ->iterate.
> ctx->pos is 2, we set it back to 0, because of the faked dot entries.
> but fat_get_entry() did not make any progress and we report 0 back to VFS.
> So, VFS sees progress and the game continues.
>
> Does the attached patch help?

Yes, it does fixes the problem here, but I can't really comment on the
correctness of the patch.

Thanks for the quick reponse,


Vegard

  reply	other threads:[~2015-11-14 12:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-14  1:19 Endless getdents() in vfat filesystem Vegard Nossum
2015-11-14 10:32 ` Richard Weinberger
2015-11-14 12:42   ` Vegard Nossum [this message]
2015-11-14 14:28     ` OGAWA Hirofumi
2015-11-14 15:06       ` Richard Weinberger
2015-11-14 18:19         ` OGAWA Hirofumi
2015-11-15 11:05           ` Vegard Nossum
2015-11-15 11:24             ` Richard Weinberger
2015-11-15 12:59               ` OGAWA Hirofumi

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=56472C2F.5090207@oracle.com \
    --to=vegard.nossum@oracle.com \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richard.weinberger@gmail.com \
    /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