Description
In the Linux kernel, the following vulnerability has been resolved: SUNRPC: Fix UAF in svc_tcp_listen_data_ready() After the listener svc_sock is freed, and before invoking svc_tcp_accept() for the established child sock, there is a window that the newsock retaining a freed listener svc_sock in sk_user_data which cloning from parent. In the race window, if data is received on the newsock, we will observe use-after-free report in svc_tcp_listen_data_ready(). Reproduce by two tasks: 1. while :; do rpc.nfsd 0 ; rpc.nfsd; done 2. while :; do echo “” | ncat -4 127.0.0.1 2049 ; done KASAN report: ================================================================== BUG: KASAN: slab-use-after-free in svc_tcp_listen_data_ready+0x1cf/0x1f0 [sunrpc] Read of size 8 at addr ffff888139d96228 by task nc/102553 CPU: 7 PID: 102553 Comm: nc Not tainted 6.3.0+ #18 Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 11/12/2020 Call Trace:
References
https://git.kernel.org/stable/c/c7b8c2d06e437639694abe76978e915cfb73f428
https://git.kernel.org/stable/c/dfc896c4a75cb8cd7cb2dfd9b469cf1e3f004254
https://git.kernel.org/stable/c/42725e5c1b181b757ba11d804443922982334d9b
https://git.kernel.org/stable/c/cd5ec3ee52ce4b7e283cc11facfa420c297c8065
https://git.kernel.org/stable/c/fbf4ace39b2e4f3833236afbb2336edbafd75eee
https://git.kernel.org/stable/c/ef047411887ff0845afd642d6a687819308e1a4e
https://git.kernel.org/stable/c/7e1f989055622fd086c5dfb291fc72adf5660b6f
https://git.kernel.org/stable/c/fc80fc2d4e39137869da3150ee169b40bf879287