The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [Question] mshv: unpopulated parts of a movable region after removal
@ 2026-11-12 19:23 Yuho Choi
  0 siblings, 0 replies; only message in thread
From: Yuho Choi @ 2026-11-12 19:23 UTC (permalink / raw)
  To: Wei Liu, Haiyang Zhang, Dexuan Cui, Stanislav Kinsburskii
  Cc: Nuno Das Neves, linux-hyperv, linux-kernel, Yuho Choi

Hi,

I have a question about how a movable memory region is unmapped when it
is removed (mainline 067c5c24cef2), and would appreciate your view.

When a movable region is created, mshv_map_user_memory() maps its whole
GPA range with HV_MAP_GPA_NO_ACCESS. mshv_region_range_fault() later
fills in the page array and remaps the faulted pages with access, and
mshv_region_interval_invalidate() remaps invalidated pages with no
access again and clears their entries in the page array.

When the region is destroyed, mshv_region_destroy() calls
mshv_region_unmap(), which goes through mshv_region_process_range().
That walk skips the entries that have no page, so only the parts that
currently have pages are unmapped. The parts that were never faulted in,
or were invalidated, are not unmapped. Before commit abceb4297bf8
("mshv: Fix huge page handling in memory region traversal"), the whole
GPA range was unmapped with one hv_call_unmap_gpa_pages() call.

If I read this correctly, the hypervisor keeps those GPAs mapped with no
access after the region is removed. A guest access to them would then
come back as HVMSG_GPA_INTERCEPT rather than HVMSG_UNMAPPED_GPA, and the
mappings would stay until the GPAs are mapped again or the partition is
destroyed.

Is this intended, for example because the hypervisor treats a no-access
mapping like an unmapped GPA? Or should mshv_region_destroy() unmap
these parts as well? If so, does the unmap need to follow how they were
mapped: 4K pages when the region is created, and large pages when an
invalidated range covered a huge page?

I found this during in-house security research and have not reproduced it.

Thanks,
Yuho

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-12 19:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12 19:23 [Question] mshv: unpopulated parts of a movable region after removal Yuho Choi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox