From: Paolo Bonzini <pbonzini@redhat.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
syzbot <syzbot+35666cba7f0a337e2e79@syzkaller.appspotmail.com>,
syzkaller-bugs@googlegroups.com
Cc: hpa@zytor.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
mingo@redhat.com, rkrcmar@redhat.com, tglx@linutronix.de,
x86@kernel.org, Roman Kagan <rkagan@virtuozzo.com>,
Cathy Avery <cavery@redhat.com>
Subject: Re: WARNING in __mutex_unlock_slowpath
Date: Tue, 8 May 2018 14:24:35 +0200 [thread overview]
Message-ID: <7f2ca5eb-a052-bbae-155a-5961e3b0ee61@redhat.com> (raw)
In-Reply-To: <a92c15a3-ac06-c8b8-6f39-a5ad49dc2818@I-love.SAKURA.ne.jp>
On 07/05/2018 23:49, Tetsuo Handa wrote:
> On 2018/05/08 2:19, Paolo Bonzini wrote:
>>> ------------[ cut here ]------------
>>> DEBUG_LOCKS_WARN_ON(__owner_task(owner) != current)
>>> WARNING: CPU: 0 PID: 4525 at kernel/locking/mutex.c:1032
>>> __mutex_unlock_slowpath+0x62e/0x8a0 kernel/locking/mutex.c:1032
>>> Kernel panic - not syncing: panic_on_warn set ...
>>
>> This doesn't make much sense, unless it's a "generic" memory corruption,
>> but at least the reproducer seems to be simple, just (in pseudocode)
>>
>> ioctl(kvm_vm_fd, KVM_HYPERV_EVENTFD,
>> { fd = some_eventfd, conn_id = 0, flags = 0 })
>> ioctl(kvm_vm_fd, KVM_HYPERV_EVENTFD,
>> { fd = -1, conn_id = 5, flags = KVM_HYPERV_EVENTFD_DEASSIGN })
>>
>
> This makes much sense if this is use-after-free memory access which was
> manifested differently due to reallocated after released.
>
> mutex_lock(&hv->hv_lock);
> eventfd = idr_remove(&hv->conn_to_evt, conn_id); // <= Memory block containing hv->hv_lock was released by other thread and reallocated by other thread.
> mutex_unlock(&hv->hv_lock); // <= Hence, __owner_task(owner) != current at this point.
Yes, but hv is part of the "struct kvm" and it should only be freed
after kvm_vm_fd (in the above pseudocode) is gone, so after both ioctls
are finished. Unlike other syzkaller testcases this one doesn't really
require parallelism.
Paolo
next prev parent reply other threads:[~2018-05-08 12:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-29 17:00 syzbot
2018-05-07 17:19 ` Paolo Bonzini
2018-05-07 17:31 ` Dmitry Vyukov
2018-05-07 17:38 ` Paolo Bonzini
2018-05-07 21:49 ` Tetsuo Handa
2018-05-08 12:24 ` Paolo Bonzini [this message]
2018-05-08 16:41 ` Roman Kagan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7f2ca5eb-a052-bbae-155a-5961e3b0ee61@redhat.com \
--to=pbonzini@redhat.com \
--cc=cavery@redhat.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=rkagan@virtuozzo.com \
--cc=rkrcmar@redhat.com \
--cc=syzbot+35666cba7f0a337e2e79@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®