Re: kernel BUG at fs/inode.c:LINE!

From: Al Viro
Date: Tue Apr 09 2019 - 20:26:16 EST


On Tue, Apr 09, 2019 at 07:36:00AM -0700, syzbot wrote:
> Bisection is inconclusive: the first bad commit could be any of:

[snip the useless pile]

> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=15e1fc2b200000
> start commit: [unknown
> git tree: linux-next
> dashboard link: https://syzkaller.appspot.com/bug?extid=5399ed0832693e29f392
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=101032b3400000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16534063400000
>
> For information about bisection process see: https://goo.gl/tpsmEJ#bisection

If I'm not misreading the "crash report" there, it has injected an allocation
failure in dentry allocation in d_make_root() from autofs_fill_super() (
root_inode = autofs_get_inode(s, S_IFDIR | 0755);
root = d_make_root(root_inode);
) which has triggered iput() on the inode passed to d_make_root() (as it ought
to). At which point it stepped into some BUG_ON() in fs/inode.c, but I've
no idea which one it is - line numbers do not match anything in linux-next
or in mainline. Reported line 1566 is
if (inode->i_nlink && (inode->i_state & I_DIRTY_TIME)) {
in all of them; as the matter of fact, the diff in fs/inode.c between
-next and mainline is empty.

There is a BUG_ON() several lines prior, and in 4.20 it used to be line 1566,
so _probably_ that's what it is. With that assumption, it's
BUG_ON(inode->i_state & I_CLEAR);
IOW, we'd got I_CLEAR in the inode passed to d_make_root() there. Which
should not happen - the inode must have come from new_inode(), which
gets it from new_inode_pseudo(), which zeroes ->i_state. And I_CLEAR
is set only in clear_inode(). For autofs inodes that can come only
from autofs_evict_inode(), called as ->evict() from evict_inode().
Which should never ever be called for inode with positive ->i_count...

It might be memory corruption; it might be a dangling inode pointer
somewhere, it might be something else.

To get any further we really need a confirmation of the identity of
triggered BUG_ON().

As an aside, your "sample crash reports" would've been much more useful if
they went with commit SHA1 in question, especially when they contain line
numbers.