Re: [syzbot] WARNING: refcount bug in sys_memfd_secret

From: Mike Rapoport
Date: Sat Oct 23 2021 - 11:35:15 EST


On Fri, Oct 22, 2021 at 05:07:40PM +0200, Dmitry Vyukov wrote:
> On Fri, 22 Oct 2021 at 17:02, syzbot
> <syzbot+b904a1de3ec43711eba5@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > Hello,
> >
> > syzbot found the following issue on:
> >
> > HEAD commit: 64222515138e Merge tag 'drm-fixes-2021-10-22' of git://ano..
> > git tree: upstream
> > console output: https://syzkaller.appspot.com/x/log.txt?x=178e86c4b00000
> > kernel config: https://syzkaller.appspot.com/x/.config?x=be398dd7862f4b36
> > dashboard link: https://syzkaller.appspot.com/bug?extid=b904a1de3ec43711eba5
> > compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> >
> > Unfortunately, I don't have any reproducer for this issue yet.
> >
> > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > Reported-by: syzbot+b904a1de3ec43711eba5@xxxxxxxxxxxxxxxxxxxxxxxxx
>
> +Mike, Jordy for secretmem.c

I was actually the first to report it ;-)

https://lore.kernel.org/all/YXJjuWyY0h+Qaj5U@xxxxxxxxxx/

and my first reaction was to send a revert the untested commit 110860541f44
("mm/secretmem: use refcount_t instead of atomic_t").

Anyway, this should fix it: