[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200423203424.GA3997014@iweiny-DESK2.sc.intel.com>
Date: Thu, 23 Apr 2020 13:34:24 -0700
From: Ira Weiny <ira.weiny@...el.com>
To: Janakarajan Natarajan <Janakarajan.Natarajan@....com>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org, kvm@...r.kernel.org,
Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <sean.j.christopherson@...el.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H . Peter Anvin" <hpa@...or.com>,
Mike Marshall <hubcap@...ibond.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Brijesh Singh <brijesh.singh@....com>
Subject: Re: [PATCH] KVM: SVM: Change flag passed to GUP fast in
sev_pin_memory()
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@....com>
Reviewed-by: Ira Weiny <ira.weiny@...el.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
>
Powered by blists - more mailing lists