From: Li Yu <liyu.yukiteru@bytedance.com>
To: pbonzini@redhat.com
Cc: liyu.yukiteru@bytedance.com,
Sean Christopherson <seanjc@google.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] KVM: x86/mmu: Warn on nx_huge_pages when initializing kvm
Date: Tue, 19 Oct 2021 20:18:48 +0800 [thread overview]
Message-ID: <20211019121848.245347-1-liyu.yukiteru@bytedance.com> (raw)
Add warning when `nx_huge_pages` is enabled by kvm mmu for hint that
huge pages may be splited by kernel.
Signed-off-by: Li Yu <liyu.yukiteru@bytedance.com>
---
arch/x86/kvm/mmu/mmu.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 1a64ba5b9437..b75dbaf29f2d 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -6091,12 +6091,17 @@ static int set_nx_huge_pages(const char *val, const struct kernel_param *kp)
return 0;
}
+#define ITLB_MULTIHIT_MSG "iTLB multi-hit CPU bug present and cpu mitigations enabled, huge pages may be splited by kernel for security. See CVE-2018-12207 and https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/multihit.html for details.\n"
+
int kvm_mmu_module_init(void)
{
int ret = -ENOMEM;
- if (nx_huge_pages == -1)
+ if (nx_huge_pages == -1) {
__set_nx_huge_pages(get_nx_auto_mode());
+ if (is_nx_huge_page_enabled())
+ pr_warn_once(ITLB_MULTIHIT_MSG);
+ }
/*
* MMU roles use union aliasing which is, generally speaking, an
--
2.11.0
next reply other threads:[~2021-10-19 12:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-19 12:18 Li Yu [this message]
2021-10-19 12:56 ` [PATCH] KVM: x86/mmu: Warn on nx_huge_pages when initializing kvm Paolo Bonzini
2021-10-19 14:11 ` [PATCH] KVM: x86/mmu: Warn on nx_huge_pages for possible problems Li Yu
2021-10-19 16:23 ` Sean Christopherson
2021-10-20 4:31 ` [PATCH v3] KVM: x86/mmu: Warn on iTLB multi-hit " Li Yu
2021-12-08 18:40 ` Sean Christopherson
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=20211019121848.245347-1-liyu.yukiteru@bytedance.com \
--to=liyu.yukiteru@bytedance.com \
--cc=bp@alien8.de \
--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=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;
as well as URLs for NNTP newsgroup(s).