From: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
To: Tigran Aivazian <aivazian.tigran@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
syzbot <syzbot+71c6b5d68e91149fc8a4@syzkaller.appspotmail.com>,
syzkaller-bugs <syzkaller-bugs@googlegroups.com>
Subject: Re: [PATCH] bfs: add sanity check at bfs_fill_super().
Date: Fri, 15 Jun 2018 07:18:19 +0900 [thread overview]
Message-ID: <0e4fb819-706c-6028-704b-393919ce8b26@i-love.sakura.ne.jp> (raw)
In-Reply-To: <CAK+_RLnJ7WtJBSy1SYqyshS3kKB59LTZoZxdtOmk-8eun-9BGg@mail.gmail.com>
On 2018/06/15 4:00, Tigran Aivazian wrote:
>> However, that doesn't address the issue of the _upper_ limit of
>> s_start, i.e. it can still get (on an invalid image pretending to be
>> BFS) arbitrarily large and cause the allocation to fail as you
>> described. I will dig a bit more (in my memories :) and try to come up
>> with the check which doesn't reject a valid BFS image and at the same
>> time restricts s_start (or imap_len which ultimately depends on it)
>> sufficiently to prevent wild kernel memory allocation requests.
>>
>> Btw, I included in the WikiPedia article "Boot File System" a
>> reference to the original "BFS kernel support" webpage from those
>> ancient days: http://ftp.linux.org.uk/pub/linux/iBCS/bfs/
>
> Ah, it turned out easier than I thought! The maximum number of inodes
> of a BFS filesystem is 512, so an inode map cannot be longer than 65
> bytes. Well, we can be generous and restrict imap_len to 128 and be
> done with it :)
>
> Namely, if the calculated imap_len turns out to be greater than 128,
> then something is definitely wrong and the filesystem image should be
> rejected as corrupted.
>
So, the constraint is
if (le32_to_cpu(bfs_sb->s_start) > le32_to_cpu(bfs_sb->s_end) ||
le32_to_cpu(bfs_sb->s_end) > What_is_the_number_here)
you can write the fix yourself...
next prev parent reply other threads:[~2018-06-14 22:18 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-09 10:35 [PATCH] bfs: add sanity check at bfs_fill_super() Tetsuo Handa
2018-05-09 23:06 ` Andrew Morton
[not found] ` <201805092346.w49NkINl045657@www262.sakura.ne.jp>
2018-05-09 23:53 ` Andrew Morton
2018-06-13 13:33 ` Tetsuo Handa
2018-06-13 13:49 ` Tigran Aivazian
2018-06-13 16:00 ` Dmitry Vyukov
2018-06-14 12:23 ` Tigran Aivazian
2018-06-14 12:38 ` Dmitry Vyukov
2018-06-14 13:05 ` Tigran Aivazian
2018-06-14 13:12 ` Dmitry Vyukov
2018-06-14 13:28 ` Tetsuo Handa
2018-06-14 15:13 ` Tigran Aivazian
2018-06-14 16:15 ` Tigran Aivazian
2018-06-14 19:00 ` Tigran Aivazian
2018-06-14 22:18 ` Tetsuo Handa [this message]
2018-06-15 10:45 ` Tigran Aivazian
2018-06-13 22:09 ` Tetsuo Handa
2018-06-14 7:38 ` Tigran Aivazian
2018-06-14 10:45 ` Tetsuo Handa
2018-06-14 12:11 ` Tigran Aivazian
2018-05-10 0:53 ` Matthew Wilcox
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=0e4fb819-706c-6028-704b-393919ce8b26@i-love.sakura.ne.jp \
--to=penguin-kernel@i-love.sakura.ne.jp \
--cc=aivazian.tigran@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dvyukov@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=syzbot+71c6b5d68e91149fc8a4@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;
as well as URLs for NNTP newsgroup(s).