Re: [PATCH v2 4/8] x86/sev: Enable PVALIDATE for PFNs without a valid virtual address
From: Edgecombe, Rick P
Date: Mon Nov 27 2023 - 16:39:20 EST
On Tue, 2023-11-21 at 13:20 -0800, mhkelley58@xxxxxxxxx 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;
> +}