Re: [syzbot] KASAN: use-after-free Read in rxrpc_lookup_local

From: David Howells
Date: Wed Dec 07 2022 - 07:00:38 EST


Hillf Danton <hdanton@xxxxxxxx> wrote:

> To fix the uaf, destroy local in workqueue because of hlist_del under mutex.

Hmmm... That can't be the whole explanation. As you say, the hlist_del is
done under the mutex in rxrpc_destroy_local() - the same as the
hlist_add/hlist_replace and the search in rxrpc_lookup_local().

There should be no need to bump it off to a worker thread - the destruction is
in process context already - and doing the destruction not in the I/O thread
violates other assumptions, so I'm not convinced this patch is a valid fix.

I wonder if, under some circumstances, the I/O thread is managing to start and
destroy itself *before* rxrpc_lookup_local() adds itself to the
local_endpoints list. Possibly I should offload the add to the I/O thread and
use a completion to wait for it to set up.

David