mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ira Weiny <ira.weiny@intel.com>
To: Janakarajan Natarajan <Janakarajan.Natarajan@amd.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
	Sean Christopherson <sean.j.christopherson@intel.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>,
	"H . Peter Anvin" <hpa@zytor.com>,
	Mike Marshall <hubcap@omnibond.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Brijesh Singh <brijesh.singh@amd.com>
Subject: Re: [PATCH] KVM: SVM: Change flag passed to GUP fast in sev_pin_memory()
Date: Thu, 23 Apr 2020 13:34:24 -0700	[thread overview]
Message-ID: <20200423203424.GA3997014@iweiny-DESK2.sc.intel.com> (raw)
In-Reply-To: <20200423152419.87202-1-Janakarajan.Natarajan@amd.com>

On Thu, Apr 23, 2020 at 10:24:19AM -0500, Janakarajan Natarajan wrote:
> When trying to lock read-only pages, sev_pin_memory() fails because FOLL_WRITE
> is used as the flag for get_user_pages_fast().
> 
> Commit 73b0140bf0fe ("mm/gup: change GUP fast to use flags rather than a write
> 'bool'") updated the get_user_pages_fast() call sites to use flags, but
> incorrectly updated the call in sev_pin_memory(). As the original coding of this
> call was correct, revert the change made by that commit.
> 
> Fixes: 73b0140bf0fe ("mm/gup: change GUP fast to use flags rather than a write 'bool'")
> Signed-off-by: Janakarajan Natarajan <Janakarajan.Natarajan@amd.com>

Reviewed-by: Ira Weiny <ira.weiny@intel.com>

> ---
>  arch/x86/kvm/svm/sev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> index cf912b4aaba8..89f7f3aebd31 100644
> --- a/arch/x86/kvm/svm/sev.c
> +++ b/arch/x86/kvm/svm/sev.c
> @@ -345,7 +345,7 @@ static struct page **sev_pin_memory(struct kvm *kvm, unsigned long uaddr,
>  		return NULL;
>  
>  	/* Pin the user virtual address. */
> -	npinned = get_user_pages_fast(uaddr, npages, FOLL_WRITE, pages);
> +	npinned = get_user_pages_fast(uaddr, npages, write ? FOLL_WRITE : 0, pages);
>  	if (npinned != npages) {
>  		pr_err("SEV: Failure locking %lu pages.\n", npages);
>  		goto err;
> -- 
> 2.17.1
> 

      reply	other threads:[~2020-04-23 20:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-23 15:24 Janakarajan Natarajan
2020-04-23 20:34 ` Ira Weiny [this message]

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=20200423203424.GA3997014@iweiny-DESK2.sc.intel.com \
    --to=ira.weiny@intel.com \
    --cc=Janakarajan.Natarajan@amd.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=brijesh.singh@amd.com \
    --cc=hpa@zytor.com \
    --cc=hubcap@omnibond.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=sean.j.christopherson@intel.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®