From: Paolo Bonzini <pbonzini@redhat.com>
To: Bandan Das <bsd@redhat.com>, kvm ML <kvm@vger.kernel.org>
Cc: "Marcelo Tosatti" <mtosatti@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] vmx: add missing entries in the l1d_param array
Date: Wed, 22 Aug 2018 13:41:48 +0200 [thread overview]
Message-ID: <714fa2a3-a690-21e4-0845-ac5827cc0f57@redhat.com> (raw)
In-Reply-To: <jpgd0ub4czi.fsf@linux.bootlegged.copy>
On 21/08/2018 23:38, Bandan Das wrote:
>
> This can cause a host crash if an access attempts
> to reach the missing entry. Future-proof the get
> function against any overflows as well.
>
> Signed-off-by: Bandan Das <bsd@redhat.com>
> ---
> arch/x86/kvm/vmx.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 46b428c0990e..42c27406b63e 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -203,6 +203,8 @@ static const struct {
> {"never", VMENTER_L1D_FLUSH_NEVER},
> {"cond", VMENTER_L1D_FLUSH_COND},
> {"always", VMENTER_L1D_FLUSH_ALWAYS},
> + {"disabled", VMENTER_L1D_FLUSH_EPT_DISABLED},
> + {"not required", VMENTER_L1D_FLUSH_NOT_REQUIRED},
> };
>
> #define L1D_CACHE_ORDER 4
> @@ -323,7 +325,17 @@ static int vmentry_l1d_flush_set(const char *s, const struct kernel_param *kp)
>
> static int vmentry_l1d_flush_get(char *s, const struct kernel_param *kp)
> {
> - return sprintf(s, "%s\n", vmentry_l1d_param[l1tf_vmx_mitigation].option);
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(vmentry_l1d_param); i++) {
> + if (vmentry_l1d_param[i].cmd == l1tf_vmx_mitigation)
> + break;
> + }
> +
> + if (i == ARRAY_SIZE(vmentry_l1d_param))
> + return -EINVAL;
> +
> + return sprintf(s, "%s\n", vmentry_l1d_param[i].option);
> }
>
> static const struct kernel_param_ops vmentry_l1d_flush_ops = {
>
Queued, thanks.
Paolo
next parent reply other threads:[~2018-08-22 11:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <jpgd0ub4czi.fsf@linux.bootlegged.copy>
2018-08-22 11:41 ` Paolo Bonzini [this message]
2018-08-22 11:46 ` Paolo Bonzini
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=714fa2a3-a690-21e4-0845-ac5827cc0f57@redhat.com \
--to=pbonzini@redhat.com \
--cc=bsd@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=rkrcmar@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
all inboxes | Powered by JetHome®