lkml.org 
[lkml]   [2023]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2 4/8] x86/sev: Enable PVALIDATE for PFNs without a valid virtual address
Date
On Tue, 2023-11-21 at 13:20 -0800, mhkelley58@gmail.com wrote:
> +static int pvalidate_pfn(unsigned long vaddr, unsigned int size,
> +                        unsigned long pfn, bool validate, int *rc2)
> +{
> +       int rc;
> +       struct page *page = pfn_to_page(pfn);
> +
> +       *rc2 = vmap_pages_range(vaddr, vaddr + PAGE_SIZE,
> +                       PAGE_KERNEL, &page, PAGE_SHIFT);

Can't this fail and then the pvalidate below would encounter trouble?

Sort of separately, if those vmalloc objections can't be worked
through, did you consider doing something like text_poke() does (create
the temporary mapping in a temporary MM) for pvalidate purposes? I
don't know enough about what kind of special exceptions might popup
during that operation though, might be playing with fire...

> +       rc = pvalidate(vaddr, size, validate);
> +       vunmap_range(vaddr, vaddr + PAGE_SIZE);
> +
> +       return rc;
> +}

\
 
 \ /
  Last update: 2023-11-27 22:39    [W:0.197 / U:0.752 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site