Re: [syzbot] general protection fault in list_lru_add

From: Linus Torvalds
Date: Fri Mar 25 2022 - 16:29:29 EST


On Fri, Mar 25, 2022 at 2:52 AM Muchun Song <songmuchun@xxxxxxxxxxxxx> wrote:
>
> We can see that we put the dentry (ffff88807ebda0f8) into
> the list_lru (ffff888011bd47f0). But we do not allocate struct
> list_lru_one for the memcg (ffff88801c530000). Then it panics.

Hmm.

Looking at memcg_slab_pre_alloc_hook(), I note that it will return
success without doing the LRU checking for several cases.

So since you can reproduce the problem, I would suggest you add some
debug code to __d_alloc() that prints out something big if it gets a
dentry but you can't look up the list_lru_one() for that dentry.

Hmm?

The only other situation I can think of is if dentry->d_sb were to
change during the dentry lifetime, but I don't think that can happen.
The only assignment I can find with "git grep" is that

dentry->d_sb = sb;

in __d_alloc(), and while it's possible my grep pattern was bogus, it
sounds unlikely.

Linus