lkml.org 
[lkml]   [2015]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Endless getdents() in vfat filesystem
From
Date
Am 14.11.2015 um 15:28 schrieb OGAWA Hirofumi:
> Vegard Nossum <vegard.nossum@oracle.com> writes:
>
>> 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,
>
> I made cleanup and made sure fake_offset is corrected.
>
> Richard, Signed-off-by was missed in your patch, so I added. Can you
> agree to Signed-off-by?

Sure!

Thanks,
//richard


\
 
 \ /
  Last update: 2015-11-14 16:41    [W:0.567 / U:0.776 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site