Re: upstream boot error: can't ssh into the instance (2)

From: Jens Axboe
Date: Sun Jan 27 2019 - 08:35:54 EST


On 1/27/19 1:05 AM, Dmitry Vyukov wrote:
> On Sun, Jan 27, 2019 at 9:01 AM syzbot
> <syzbot+4df6ca820108fd248943@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>>
>> Hello,
>>
>> syzbot found the following crash on:
>>
>> HEAD commit: 7930851ef10c Merge tag 'scsi-fixes' of git://git.kernel.or..
>> git tree: upstream
>> console output: https://syzkaller.appspot.com/x/log.txt?x=1002c77f400000
>> kernel config: https://syzkaller.appspot.com/x/.config?x=505743eba4e4f68
>> dashboard link: https://syzkaller.appspot.com/bug?extid=4df6ca820108fd248943
>> compiler: gcc (GCC) 9.0.0 20181231 (experimental)
>>
>> Unfortunately, I don't have any reproducer for this crash yet.
>>
>> IMPORTANT: if you fix the bug, please add the following tag to the commit:
>> Reported-by: syzbot+4df6ca820108fd248943@xxxxxxxxxxxxxxxxxxxxxxxxx
>
>
> Mainline tree crashes on boot.
> +generic_make_request maintainers
>
> [ 7.485069] ==================================================================
> [ 7.486411] BUG: KASAN: use-after-free in generic_make_request+0x14dd/0x1810
> [ 7.487539] Read of size 2 at addr ffff8880a39618d4 by task swapper/0/1
> [ 7.488689]

Ah duh, not sure how I missed that:

+ bio_set_flag(bio, BIO_QUEUE_ENTERED);
ret = q->make_request_fn(q, bio);
+ bio_clear_flag(bio, BIO_QUEUE_ENTERED);

Ming, we can't touch bio after ->make_request_fn(), it could very well be
completed already.

--
Jens Axboe