public inbox for ntfs3@lists.linux.dev
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>,
	Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
	Andrew Morton <akpm@linux-foundation.org>,
	Namjae Jeon <linkinjeon@kernel.org>,
	Shigeru Yoshida <syoshida@redhat.com>
Cc: syzbot <syzbot+1631f09646bc214d2e76@syzkaller.appspotmail.com>,
	syzkaller-bugs@googlegroups.com, ntfs3@lists.linux.dev,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] fs/ntfs3: fix negative shift size in true_sectors_per_clst()
Date: Fri, 23 Sep 2022 09:07:54 -0700	[thread overview]
Message-ID: <1e9159c8-48f5-cf1d-bc5a-e7e33ec0bf04@infradead.org> (raw)
In-Reply-To: <1bf6d8ea-9e81-f65a-d7dc-6e94fa12da7b@paragon-software.com>

Hi,

On 9/23/22 04:58, Konstantin Komarov wrote:
> 
> 
> On 9/23/22 03:38, Randy Dunlap wrote:
>> Hi,
>>
>> On 9/20/22 08:59, Tetsuo Handa wrote:
>>> syzbot is reporting shift-out-of-bounds in true_sectors_per_clst() [1], for
>>> commit a3b774342fa752a5 ("fs/ntfs3: validate BOOT sectors_per_clusters")
>>> did not address that (0 - boot->sectors_per_clusters) < 0 because "u8" was
>>> chosen for type of boot->sectors_per_clusters because 0x80 needs to be
>>> positive in order to support 64K clusters. Use "s8" cast in order to make
>>> sure that (0 - (s8) boot->sectors_per_clusters) > 0.
>>>
>>> Link: https://syzkaller.appspot.com/bug?extid=1631f09646bc214d2e76 [1]
>>> Reported-by: syzbot <syzbot+1631f09646bc214d2e76@syzkaller.appspotmail.com>
>>> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
>>> Tested-by: syzbot <syzbot+1631f09646bc214d2e76@syzkaller.appspotmail.com>
>>> Fixes: a3b774342fa752a5 ("fs/ntfs3: validate BOOT sectors_per_clusters")
>>>
>>> diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
>>> index 47012c9bf505..c7ffd21fb255 100644
>>> --- a/fs/ntfs3/super.c
>>> +++ b/fs/ntfs3/super.c
>>> @@ -672,7 +672,7 @@ static u32 true_sectors_per_clst(const struct NTFS_BOOT *boot)
>>>       if (boot->sectors_per_clusters <= 0x80)
>>>           return boot->sectors_per_clusters;
>>>       if (boot->sectors_per_clusters >= 0xf4) /* limit shift to 2MB max */
>>> -        return 1U << (0 - boot->sectors_per_clusters);
>>> +        return 1U << (0 - (s8) boot->sectors_per_clusters);
>>>       return -EINVAL;
>>>   }
>>>   
>>
>> I slightly prefer the earlier patch:
>>
>> https://lore.kernel.org/all/20220823144625.1627736-1-syoshida@redhat.com/
>>
>> but it appears that the NTFS3 maintainer is MIA again. :(
>>
> 
> Hello
> 
> I've sent patches on 12.09, so I'm not MIA.
> I plan to look at patches next week, there are quite a lot of them.

OK, good news. Thanks.

-- 
~Randy

  reply	other threads:[~2022-09-23 16:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21  8:16 [syzbot] UBSAN: shift-out-of-bounds in ntfs_fill_super syzbot
2022-04-21  8:37 ` syzbot
2022-04-21 12:29 ` syzbot
2022-09-20 15:59 ` [PATCH] fs/ntfs3: fix negative shift size in true_sectors_per_clst() Tetsuo Handa
2022-09-23  0:38   ` Randy Dunlap
2022-09-23  0:47     ` Joe Perches
2022-09-23  1:14       ` Randy Dunlap
2022-09-23  9:59       ` Dan Carpenter
2022-09-23  1:25     ` Tetsuo Handa
2022-09-23 11:58       ` Aleksandr Nogikh
2022-09-23 14:35         ` Tetsuo Handa
2022-09-24 11:58           ` Aleksandr Nogikh
2022-09-24 12:03             ` Aleksandr Nogikh
2022-09-23 11:58     ` Konstantin Komarov
2022-09-23 16:07       ` Randy Dunlap [this message]
2022-09-30 16:34   ` Konstantin Komarov

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=1e9159c8-48f5-cf1d-bc5a-e7e33ec0bf04@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntfs3@lists.linux.dev \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=syoshida@redhat.com \
    --cc=syzbot+1631f09646bc214d2e76@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.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