From: Qian Cai <cai@lca.pw>
To: Marco Elver <elver@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
"paul E. McKenney" <paulmck@kernel.org>,
kasan-dev <kasan-dev@googlegroups.com>,
LKML <linux-kernel@vger.kernel.org>,
kvm@vger.kernel.org
Subject: Re: KCSAN + KVM = host reset
Date: Fri, 10 Apr 2020 15:57:12 -0400 [thread overview]
Message-ID: <C4FED226-E3DE-44AE-BBED-2B56B9F5B12F@lca.pw> (raw)
In-Reply-To: <CANpmjNPqQHKUjqAzcFym5G8kHX0mjProOpGu8e4rBmuGRykAUg@mail.gmail.com>
> On Apr 10, 2020, at 7:35 AM, Marco Elver <elver@google.com> wrote:
>
> On Fri, 10 Apr 2020 at 13:25, Qian Cai <cai@lca.pw> wrote:
>>
>>
>>
>>> On Apr 10, 2020, at 5:47 AM, Marco Elver <elver@google.com> wrote:
>>>
>>> That would contradict what you said about it working if KCSAN is
>>> "off". What kernel are you attempting to use in the VM?
>
> Ah, sorry this was a typo,
> s/working if KCSAN/not working if KCSAN/
>
>> Well, I said set KCSAN debugfs to “off” did not help, i.e., it will reset the host running kvm.sh. It is the vanilla ubuntu 18.04 kernel in VM.
>>
>> github.com/cailca/linux-mm/blob/master/kvm.sh
>
> So, if you say that CONFIG_KCSAN_INTERRUPT_WATCHER=n works, that
> contradicts it not working when KCSAN is "off". Because if KCSAN is
> off, it never sets up any watchpoints, and whether or not
> KCSAN_INTERRUPT_WATCHER is selected or not shouldn't matter. Does that
> make more sense?
Yes, you are right. CONFIG_KCSAN_INTERRUPT_WATCHER=n does not
make it work. It was a mistake when I tested it because there was a stale svm.o
leftover from the previous run, and then it will not trigger a rebuild (a bug?) when
only modify the Makefile to remove KCSAN_SANITIZE := n. Sorry for the misleading
information. I should be checking if svm.o was really recompiled in the first place.
Anyway, I’ll send a patch to add __no_kcsan for svm_vcpu_run() because I tried
to narrow down more with a kcsan_[disable|enable]_current() pair, but it does NOT
work even by enclosing the almost whole function below until Marcro has more ideas?
diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index 2be5bbae3a40..e58b2d5a575c 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -3286,6 +3286,7 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
svm->vmcb->save.rsp = vcpu->arch.regs[VCPU_REGS_RSP];
svm->vmcb->save.rip = vcpu->arch.regs[VCPU_REGS_RIP];
+ kcsan_disable_current();
/*
* A vmexit emulation is required before the vcpu can be executed
* again.
@@ -3410,6 +3411,7 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
svm_handle_mce(svm);
mark_all_clean(svm->vmcb);
+ kcsan_enable_current();
}
STACK_FRAME_NON_STANDARD(svm_vcpu_run);
next prev parent reply other threads:[~2020-04-10 19:57 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-08 20:59 KCSAN + KVM = host reset Qian Cai
2020-04-08 21:25 ` Paolo Bonzini
2020-04-08 21:29 ` Qian Cai
2020-04-09 7:03 ` Marco Elver
2020-04-09 15:10 ` Qian Cai
2020-04-09 15:22 ` Marco Elver
2020-04-09 15:30 ` Qian Cai
2020-04-09 16:03 ` Marco Elver
2020-04-09 21:28 ` Qian Cai
2020-04-09 23:00 ` Qian Cai
2020-04-10 9:47 ` Marco Elver
2020-04-10 11:25 ` Qian Cai
2020-04-10 11:35 ` Marco Elver
2020-04-10 15:50 ` Qian Cai
2020-04-10 16:04 ` Paolo Bonzini
2020-04-10 16:06 ` Sean Christopherson
2020-04-10 19:57 ` Qian Cai [this message]
2020-04-13 8:35 ` Marco Elver
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=C4FED226-E3DE-44AE-BBED-2B56B9F5B12F@lca.pw \
--to=cai@lca.pw \
--cc=elver@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=pbonzini@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).