On Mon, Feb 21, 2022 at 09:23:04PM +0530, Anirudh Rayabharam
wrote:>On Mon, Feb 21, 2022 at 03:12:33PM +0100, Stefano Garzarella wrote:
>> #syz test:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
>> f71077a4d84b
>>
>> Patch sent upstream:
>> https://lore.kernel.org/virtualization/20220221114916.107045-1-sgarzare
at redhat.com/T/#u
>
>I don't see how your patch fixes this issue. It looks unrelated. It is
>surprising that syzbot is happy with it.
>
>I have sent a patch for this issue here:
>https://lore.kernel.org/lkml/20220221072852.31820-1-mail at anirudhrb.com/
It is related because the worker thread is accessing the iotlb that is
going to be freed, so it could be corrupted/invalid.
Your patch seems right, but simply prevents iotlb from being set for the
the specific test case, so it remains NULL and iotlb_access_ok() exits
immediately.
Anyway, currently if nregions is 0 vhost_set_memory() sets an iotlb with
no regions (the for loop is not executed), so I'm not sure
iotlb_access_ok() cycles infinitely.
Stefano