[dm-devel] A kernel panic (or soft lockup) due to stack overflow by recursive dm-table reload

Alasdair G Kergon agk at redhat.com
Wed Aug 24 19:04:57 UTC 2022


On Thu, Aug 25, 2022 at 12:49:06AM +0800, Coly Li wrote:
> 5, reload dm table for dm-0
> # cat dm-table-reload | dmsetup reload /dev/dm-0
> And the content of dm-table-reload is,
> 	0 1 linear /dev/dm-0 0
> 	1 181065566 linear /dev/dm-0 1 
 
> 1) Does anyone observe or encounter such panic or deadlock before?
> 2) To permit recursive dm-table reload, is it a bug or just as-designed ?
 
It's one of those 'That is a stupid thing to do!' situations.
Don't do it!

We have some detection for recursion in our userspace code but we can't
catch everything.

But arguably that specific case of a self-reference is an easy one to
detect kernel-side - table_load could ensure dm_table_get_devices() does
not include the device itself - so it might be worth patching.

Alasdair


More information about the dm-devel mailing list