2020-09-28 07:50:45

by syzbot

[permalink] [raw]
Subject: WARNING: filesystem loop0 was created with 512 inodes, the real maximum is 511, mounting anyway

Hello,

syzbot found the following issue on:

HEAD commit: c9c9e6a4 Merge tag 'trace-v5.9-rc5-2' of git://git.kernel...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12e98c8d900000
kernel config: https://syzkaller.appspot.com/x/.config?x=5f4c828c9e3cef97
dashboard link: https://syzkaller.appspot.com/bug?extid=54b10a5da9e59f1ed979
compiler: gcc (GCC) 10.1.0-syz 20200507
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=150881c3900000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1605b927900000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

BFS-fs: bfs_fill_super(): WARNING: filesystem loop0 was created with 512 inodes, the real maximum is 511, mounting anyway


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at [email protected].

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches


2020-09-28 07:53:22

by Dmitry Vyukov

[permalink] [raw]
Subject: Re: WARNING: filesystem loop0 was created with 512 inodes, the real maximum is 511, mounting anyway

On Mon, Sep 28, 2020 at 9:48 AM syzbot
<[email protected]> wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: c9c9e6a4 Merge tag 'trace-v5.9-rc5-2' of git://git.kernel...
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=12e98c8d900000
> kernel config: https://syzkaller.appspot.com/x/.config?x=5f4c828c9e3cef97
> dashboard link: https://syzkaller.appspot.com/bug?extid=54b10a5da9e59f1ed979
> compiler: gcc (GCC) 10.1.0-syz 20200507
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=150881c3900000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1605b927900000
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: [email protected]
>
> BFS-fs: bfs_fill_super(): WARNING: filesystem loop0 was created with 512 inodes, the real maximum is 511, mounting anyway

This looks like a BFS issue. +BFS maintainers.

> ---
> This report is generated by a bot. It may contain errors.
> See https://goo.gl/tpsmEJ for more information about syzbot.
> syzbot engineers can be reached at [email protected].
>
> syzbot will keep track of this issue. See:
> https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
> syzbot can test patches for this issue, for details see:
> https://goo.gl/tpsmEJ#testing-patches
>
> --
> You received this message because you are subscribed to the Google Groups "syzkaller-bugs" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-bugs/000000000000b7551005b05ae3b8%40google.com.

2020-09-28 08:25:19

by Tigran Aivazian

[permalink] [raw]
Subject: Re: WARNING: filesystem loop0 was created with 512 inodes, the real maximum is 511, mounting anyway

Hello Dmitry,

On Mon, 28 Sep 2020 at 08:51, Dmitry Vyukov <[email protected]> wrote:
> On Mon, Sep 28, 2020 at 9:48 AM syzbot
> <[email protected]> wrote:
> > BFS-fs: bfs_fill_super(): WARNING: filesystem loop0 was created with 512 inodes, the real maximum is 511, mounting anyway
>
> This looks like a BFS issue. +BFS maintainers.

No, this is not an issue. In the latest change to BFS I added the
following comment to the header fs/bfs/bfs.h, which explains it:

/* In theory BFS supports up to 512 inodes, numbered from 2 (for /) up
to 513 inclusive.
In actual fact, attempting to create the 512th inode (i.e. inode
No. 513 or file No. 511)
will fail with ENOSPC in bfs_add_entry(): the root directory cannot
contain so many entries, counting '..'.
So, mkfs.bfs(8) should really limit its -N option to 511 and not
512. For now, we just print a warning
if a filesystem is mounted with such "impossible to fill up" number
of inodes */

Kind regards,
Tigran

2020-09-28 08:31:06

by Dmitry Vyukov

[permalink] [raw]
Subject: Re: WARNING: filesystem loop0 was created with 512 inodes, the real maximum is 511, mounting anyway

On Mon, Sep 28, 2020 at 10:23 AM Tigran Aivazian
<[email protected]> wrote:
>
> Hello Dmitry,
>
> On Mon, 28 Sep 2020 at 08:51, Dmitry Vyukov <[email protected]> wrote:
> > On Mon, Sep 28, 2020 at 9:48 AM syzbot
> > <[email protected]> wrote:
> > > BFS-fs: bfs_fill_super(): WARNING: filesystem loop0 was created with 512 inodes, the real maximum is 511, mounting anyway
> >
> > This looks like a BFS issue. +BFS maintainers.
>
> No, this is not an issue. In the latest change to BFS I added the
> following comment to the header fs/bfs/bfs.h, which explains it:
>
> /* In theory BFS supports up to 512 inodes, numbered from 2 (for /) up
> to 513 inclusive.
> In actual fact, attempting to create the 512th inode (i.e. inode
> No. 513 or file No. 511)
> will fail with ENOSPC in bfs_add_entry(): the root directory cannot
> contain so many entries, counting '..'.
> So, mkfs.bfs(8) should really limit its -N option to 511 and not
> 512. For now, we just print a warning
> if a filesystem is mounted with such "impossible to fill up" number
> of inodes */

Hi Tigran,

There are rules for use of "WARNING" in output required to support
kernel testing:
https://github.com/torvalds/linux/blob/master/include/asm-generic/bug.h#L67-L80
This seems to be triggerable by exteranal inputs and breaks these rules.

2020-09-28 09:11:21

by Tigran Aivazian

[permalink] [raw]
Subject: Re: WARNING: filesystem loop0 was created with 512 inodes, the real maximum is 511, mounting anyway

On Mon, 28 Sep 2020 at 09:29, Dmitry Vyukov <[email protected]> wrote:
> On Mon, Sep 28, 2020 at 10:23 AM Tigran Aivazian
> > No, this is not an issue. In the latest change to BFS I added the
> > following comment to the header fs/bfs/bfs.h, which explains it:
> >
> > /* In theory BFS supports up to 512 inodes, numbered from 2 (for /) up
> > to 513 inclusive.
> > In actual fact, attempting to create the 512th inode (i.e. inode
> > No. 513 or file No. 511)
> > will fail with ENOSPC in bfs_add_entry(): the root directory cannot
> > contain so many entries, counting '..'.
> > So, mkfs.bfs(8) should really limit its -N option to 511 and not
> > 512. For now, we just print a warning
> > if a filesystem is mounted with such "impossible to fill up" number
> > of inodes */
>
> There are rules for use of "WARNING" in output required to support
> kernel testing:
> https://github.com/torvalds/linux/blob/master/include/asm-generic/bug.h#L67-L80
> This seems to be triggerable by exteranal inputs and breaks these rules.

Thank you, I didn't know about these rules. Ok, then, since this
warning does not "need prompt attention if it should ever occur at
runtime", the easiest solution is to change "WARNING" to lower case
"warning" in that printk in fs/bfs/inode.c:

--- fs/bfs/inode.c.0 2020-09-28 10:03:00.658549556 +0100
+++ fs/bfs/inode.c 2020-09-28 10:03:05.408548250 +0100
@@ -351,7 +351,7 @@

info->si_lasti = (le32_to_cpu(bfs_sb->s_start) - BFS_BSIZE) /
sizeof(struct bfs_inode) + BFS_ROOT_INO - 1;
if (info->si_lasti == BFS_MAX_LASTI)
- printf("WARNING: filesystem %s was created with 512 inodes, the real
maximum is 511, mounting anyway\n", s->s_id);
+ printf("warning: filesystem %s was created with 512 inodes, the real
maximum is 511, mounting anyway\n", s->s_id);
else if (info->si_lasti > BFS_MAX_LASTI) {
printf("Impossible last inode number %lu > %d on %s\n",
info->si_lasti, BFS_MAX_LASTI, s->s_id);
goto out1;

If you want to submit this patch to the appropriate place(s), feel
free to do this -- I approve it. If the comment in asm/bug.h is
inaccurate and its mention of "BUG/WARNING" implies the lowercase
"bug/warning" also, then one can remove the prefix "warning: " from
the patch altogether and proper case "filesystem" to "Filesystem".

Kind regards,
Tigran

Acked-By: Tigran Aivazian <[email protected]>
Approved-By: Tigran Aivazian <[email protected]>

2020-12-07 13:16:45

by Dmitry Vyukov

[permalink] [raw]
Subject: Re: WARNING: filesystem loop0 was created with 512 inodes, the real maximum is 511, mounting anyway

On Mon, Sep 28, 2020 at 11:08 AM Tigran Aivazian
<[email protected]> wrote:
>
> On Mon, 28 Sep 2020 at 09:29, Dmitry Vyukov <[email protected]> wrote:
> > On Mon, Sep 28, 2020 at 10:23 AM Tigran Aivazian
> > > No, this is not an issue. In the latest change to BFS I added the
> > > following comment to the header fs/bfs/bfs.h, which explains it:
> > >
> > > /* In theory BFS supports up to 512 inodes, numbered from 2 (for /) up
> > > to 513 inclusive.
> > > In actual fact, attempting to create the 512th inode (i.e. inode
> > > No. 513 or file No. 511)
> > > will fail with ENOSPC in bfs_add_entry(): the root directory cannot
> > > contain so many entries, counting '..'.
> > > So, mkfs.bfs(8) should really limit its -N option to 511 and not
> > > 512. For now, we just print a warning
> > > if a filesystem is mounted with such "impossible to fill up" number
> > > of inodes */
> >
> > There are rules for use of "WARNING" in output required to support
> > kernel testing:
> > https://github.com/torvalds/linux/blob/master/include/asm-generic/bug.h#L67-L80
> > This seems to be triggerable by exteranal inputs and breaks these rules.
>
> Thank you, I didn't know about these rules. Ok, then, since this
> warning does not "need prompt attention if it should ever occur at
> runtime", the easiest solution is to change "WARNING" to lower case
> "warning" in that printk in fs/bfs/inode.c:
>
> --- fs/bfs/inode.c.0 2020-09-28 10:03:00.658549556 +0100
> +++ fs/bfs/inode.c 2020-09-28 10:03:05.408548250 +0100
> @@ -351,7 +351,7 @@
>
> info->si_lasti = (le32_to_cpu(bfs_sb->s_start) - BFS_BSIZE) /
> sizeof(struct bfs_inode) + BFS_ROOT_INO - 1;
> if (info->si_lasti == BFS_MAX_LASTI)
> - printf("WARNING: filesystem %s was created with 512 inodes, the real
> maximum is 511, mounting anyway\n", s->s_id);
> + printf("warning: filesystem %s was created with 512 inodes, the real
> maximum is 511, mounting anyway\n", s->s_id);
> else if (info->si_lasti > BFS_MAX_LASTI) {
> printf("Impossible last inode number %lu > %d on %s\n",
> info->si_lasti, BFS_MAX_LASTI, s->s_id);
> goto out1;
>
> If you want to submit this patch to the appropriate place(s), feel
> free to do this -- I approve it. If the comment in asm/bug.h is
> inaccurate and its mention of "BUG/WARNING" implies the lowercase
> "bug/warning" also, then one can remove the prefix "warning: " from
> the patch altogether and proper case "filesystem" to "Filesystem".
>
> Kind regards,
> Tigran
>
> Acked-By: Tigran Aivazian <[email protected]>
> Approved-By: Tigran Aivazian <[email protected]>


#syz fix: bfs: don't use WARNING: string when it's just info.