RE: KASAN: use-after-free Read in rxe_query_port

From: Yanjun Zhu
Date: Mon Mar 09 2020 - 22:43:58 EST


Hi, Jason

I checked the source code and the symptoms.
1. In dmesg " rdma_rxe: ignoring netdev event = 10 for netdevsim0 ", this indicates that the NIC which the rxe is based on is set to down.
Then the following will run:
"
ib_unregister_work
__ib_unregister_device
disable_device
remove_client_context
kfree
"
Finally the port is freed.
2. Cocurrently this port is accessed by the function
"
ib_query_port
__ib_query_port
rxe_query_port
"
So the use-after-free problem occurs.

Please comment.

Thanks a lot.
Zhu Yanjun

-----Original Message-----
From: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
Sent: Tuesday, March 10, 2020 1:35 AM
To: syzbot <syzbot+e11efb687f5ab7f01f3d@xxxxxxxxxxxxxxxxxxxxxxxxx>
Cc: dledford@xxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-rdma@xxxxxxxxxxxxxxx; Moni Shoua <monis@xxxxxxxxxxxx>; syzkaller-bugs@xxxxxxxxxxxxxxxx; Yanjun Zhu <yanjunz@xxxxxxxxxxxx>
Subject: Re: KASAN: use-after-free Read in rxe_query_port

On Sun, Mar 01, 2020 at 03:20:12AM -0800, syzbot wrote:
> Hello,
>
> syzbot found the following crash on:
>
> HEAD commit: f8788d86 Linux 5.6-rc3
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=132d3645e00000
> kernel config: https://syzkaller.appspot.com/x/.config?x=9833e26bab355358
> dashboard link: https://syzkaller.appspot.com/bug?extid=e11efb687f5ab7f01f3d
> compiler: gcc (GCC) 9.0.0 20181231 (experimental)
>
> Unfortunately, I don't have any reproducer for this crash yet.
>
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+e11efb687f5ab7f01f3d@xxxxxxxxxxxxxxxxxxxxxxxxx

Yanjun, do you have some idea what this could be?

Thanks,
Jason