From: Tigran Aivazian <aivazian.tigran@gmail.com>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
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: Thu, 14 Jun 2018 16:13:29 +0100 [thread overview]
Message-ID: <CAK+_RLk3ntTB4aJgT9U3CctoYq581juzu=ZMNosN+pbJ5vBk0g@mail.gmail.com> (raw)
In-Reply-To: <f8e7cc6b-78d0-a03d-3d6e-3fe685a7feea@i-love.sakura.ne.jp>
On 14 June 2018 at 14:28, Tetsuo Handa
<penguin-kernel@i-love.sakura.ne.jp> wrote:
> What is possible largest value for imap_len ?
>
> info->si_lasti = (le32_to_cpu(bfs_sb->s_start) - BFS_BSIZE) / sizeof(struct bfs_inode) + BFS_ROOT_INO - 1;
> imap_len = (info->si_lasti / 8) + 1;
> info->si_imap = kzalloc(imap_len, GFP_KERNEL);
>
> Since sizeof(struct bfs_inode) is 64 and bfs_sb->s_start is unsigned 32bits integer
> (where constraints is BFS_BSIZE <= bfs_sb->s_start <= bfs_sb->s_end), theoretically
> it is possible to assign bfs_sb->s_start > 2GB (apart from whether such value makes
> sense). Then, isn't it possible that imap_len > 4M and still hit KMALLOC_MAX_SIZE limit?
You are correct, but the proper fix should be to restrict imap_len to
whatever the maximum value allowed by BFS filesystem layout and reject
anything beyond it. I will try to remember what it was from the notes
I made when I wrote BFS back in 1999. Please wait (possibly a few
days) and I will let you know what those values are.
Kind regards,
Tigran
next prev parent reply other threads:[~2018-06-14 15:13 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 [this message]
2018-06-14 16:15 ` Tigran Aivazian
2018-06-14 19:00 ` Tigran Aivazian
2018-06-14 22:18 ` Tetsuo Handa
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='CAK+_RLk3ntTB4aJgT9U3CctoYq581juzu=ZMNosN+pbJ5vBk0g@mail.gmail.com' \
--to=aivazian.tigran@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dvyukov@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--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).