Re: [4/4] rhashtable: improve rhashtable_walk stability when stop/start used.

From: NeilBrown
Date: Sat Jul 07 2018 - 18:12:14 EST


On Thu, Jul 05 2018, Paolo Abeni wrote:

>
> While testing new code that uses the rhashtable walker, I'm obeserving
> an use after free, that is apparently caused by the above:
>
> [ 146.834815] ==================================================================
> [ 146.842933] BUG: KASAN: use-after-free in inet_frag_worker+0x9f/0x210
^^^^^^^^^^^^^^^^^^^^^^^^^^^

Hi,
did you get a chance to run ./scripts/faddr2line on this address and
find out where it is crashing? I had a look in the code you posted and
couldn't see anything obvious.


> [ 146.850120] Read of size 4 at addr ffff881b6b9342d8 by task kworker/13:1/177
> [ 146.857984]
> [ 146.859645] CPU: 13 PID: 177 Comm: kworker/13:1 Not tainted 4.18.0-rc3.mirror_unclone_6_frag_dbg+ #1974
> [ 146.870128] Hardware name: Dell Inc. PowerEdge R730/072T6D, BIOS 2.1.7 06/16/2016
> [ 146.878478] Workqueue: events inet_frag_worker
> [ 146.883433] Call Trace:
> [ 146.886162] dump_stack+0x90/0xe3
> [ 146.889861] print_address_description+0x6a/0x2a0
> [ 146.895109] kasan_report+0x176/0x2d0
> [ 146.899193] ? inet_frag_worker+0x9f/0x210
> [ 146.903762] inet_frag_worker+0x9f/0x210
> [ 146.908142] process_one_work+0x24f/0x6e0
> [ 146.912614] ? process_one_work+0x1a6/0x6e0
> [ 146.917285] worker_thread+0x4e/0x3d0
> [ 146.921373] kthread+0x106/0x140
> [ 146.924970] ? process_one_work+0x6e0/0x6e0
> [ 146.929637] ? kthread_bind+0x10/0x10
> [ 146.933723] ret_from_fork+0x3a/0x50
> [ 146.937717]
> [ 146.939377] Allocated by task 177:
> [ 146.943170] kasan_kmalloc+0x86/0xb0
> [ 146.947158] __kmalloc_node+0x181/0x430
> [ 146.951438] kvmalloc_node+0x4f/0x70
> [ 146.955427] alloc_bucket_spinlocks+0x34/0xa0

This seems to suggest that it is one of the bucket spinlocks that is
being incorrectly referenced, but they aren't referenced in the failing
code at all. I cannot imagine how to interpret that.

Thanks,
NeilBrown

Attachment: signature.asc
Description: PGP signature