From: Pavel Skripkin <paskripkin@gmail.com>
To: syzbot <syzbot+717ed82268812a643b28@syzkaller.appspotmail.com>,
bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com,
jmattson@google.com, joro@8bytes.org, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org, mingo@redhat.com,
pbonzini@redhat.com, seanjc@google.com,
syzkaller-bugs@googlegroups.com, tglx@linutronix.de,
vkuznets@redhat.com, wanpengli@tencent.com, x86@kernel.org
Subject: Re: [syzbot] general protection fault in kvm_mmu_uninit_tdp_mmu
Date: Fri, 25 Mar 2022 18:51:40 +0300 [thread overview]
Message-ID: <1a1172db-12f6-1173-b526-89e4da00e96a@gmail.com> (raw)
In-Reply-To: <000000000000a5cb1305db0aaf48@google.com>
[-- Attachment #1: Type: text/plain, Size: 1318 bytes --]
On 3/25/22 16:10, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: f9006d9269ea Add linux-next specific files for 20220321
> git tree: linux-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=101191bd700000
> kernel config: https://syzkaller.appspot.com/x/.config?x=c1619ffa2b0259a1
> dashboard link: https://syzkaller.appspot.com/bug?extid=717ed82268812a643b28
> compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=109e8f5d700000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1666180b700000
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+717ed82268812a643b28@syzkaller.appspotmail.com
>
The following code is not safe:
arch/x86/kvm/mmu/tdp_mmu.c:
28 kvm->arch.tdp_mmu_zap_wq =
29 alloc_workqueue("kvm", WQ_UNBOUND|WQ_MEM_RECLAIM|WQ_CPU_INTENSIVE, 0);
30
31 return true;
Looks like kvm_mmu_init_tdp_mmu() error value is just ignored, and then
all kvm_*_init_vm() functions are void, so the easiest solution is to
check that tdp_mmu_zap_wq is valid pointer
#syz test:
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
With regards,
Pavel Skripkin
[-- Attachment #2: ph --]
[-- Type: text/plain, Size: 1228 bytes --]
diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c
index e7e7876251b3..b3e8ff7ac5b0 100644
--- a/arch/x86/kvm/mmu/tdp_mmu.c
+++ b/arch/x86/kvm/mmu/tdp_mmu.c
@@ -48,8 +48,10 @@ void kvm_mmu_uninit_tdp_mmu(struct kvm *kvm)
if (!kvm->arch.tdp_mmu_enabled)
return;
- flush_workqueue(kvm->arch.tdp_mmu_zap_wq);
- destroy_workqueue(kvm->arch.tdp_mmu_zap_wq);
+ if (kvm->arch.tdp_mmu_zap_wq) {
+ flush_workqueue(kvm->arch.tdp_mmu_zap_wq);
+ destroy_workqueue(kvm->arch.tdp_mmu_zap_wq);
+ }
WARN_ON(!list_empty(&kvm->arch.tdp_mmu_pages));
WARN_ON(!list_empty(&kvm->arch.tdp_mmu_roots));
@@ -119,9 +121,11 @@ static void tdp_mmu_zap_root_work(struct work_struct *work)
static void tdp_mmu_schedule_zap_root(struct kvm *kvm, struct kvm_mmu_page *root)
{
- root->tdp_mmu_async_data = kvm;
- INIT_WORK(&root->tdp_mmu_async_work, tdp_mmu_zap_root_work);
- queue_work(kvm->arch.tdp_mmu_zap_wq, &root->tdp_mmu_async_work);
+ if (kvm->arch.tdp_mmu_zap_wq) {
+ root->tdp_mmu_async_data = kvm;
+ INIT_WORK(&root->tdp_mmu_async_work, tdp_mmu_zap_root_work);
+ queue_work(kvm->arch.tdp_mmu_zap_wq, &root->tdp_mmu_async_work);
+ }
}
static inline bool kvm_tdp_root_mark_invalid(struct kvm_mmu_page *page)
next prev parent reply other threads:[~2022-03-25 15:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-25 13:10 syzbot
2022-03-25 15:51 ` Pavel Skripkin [this message]
2022-03-25 16:19 ` syzbot
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=1a1172db-12f6-1173-b526-89e4da00e96a@gmail.com \
--to=paskripkin@gmail.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=syzbot+717ed82268812a643b28@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--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®