|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v7 01/50] x86/mm: introduce populate_perdomain_mapping()
On Tue, Nov 24, 2026 at 10:52 AM Andrew Cooper <andrew.cooper3@xxxxxxxxxx> wrote: > > On 23/11/2026 1:25 pm, Jan Beulich wrote: > > On 19.11.2026 22:06, George Dunlap wrote: > >> From: Roger Pau Monné <roger.pau@xxxxxxxxxx> > >> > >> The per-domain area has central machinery for building its page-tables > >> and for managing the backing pages it owns itself: > >> create_perdomain_mapping() / destroy_perdomain_mapping(), used by the > >> mapcache and the compat argument-translation area. What the interface > >> lacks is a way to install a caller's own pages at a chosen address, > >> which a per-vCPU state window, introduced by a later patch, needs: its > >> users allocate their pages themselves and map them there. > >> > >> Introduce populate_perdomain_mapping(v, va, mfn, nr, flags) for this. > >> It writes the given MFNs, with the given page-table flags, into v's view > >> of the per-domain area, walking the per-domain page-table structures > >> with transient mappings, so v need not be current. Callers don't need > >> to know where the page-tables live or how the area is structured. > >> > >> We require the range to already have been populated down to the L1 > >> tables by create_perdomain_mapping(). TLB flushing is left to the > >> caller. A present entry not owned by the area (!_PAGE_AVAIL0) is > >> replaced. A present entry owned by the area (_PAGE_AVAIL0, installed > >> by create_perdomain_mapping() itself) is never expected: such a page is > >> referenced only by the mapping, and no caller replaces area-owned > >> backing. Should one ever do so, the page is leaked with a message > >> rather than freed. > >> > >> The function is not for contexts with interrupts off: its users map > >> their pages when allocating them. > >> > >> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> > >> Assisted-by: Claude Code:claude-fable-5, Claude Code:claude-opus-4-8, > >> Claude Code:claude-opus-5-5 > >> Signed-off-by: George Dunlap <gwd@xxxxxxxxxxxxxx> > > Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> > > > > From AI review: > > 9f9e2532c2 x86/mm: introduce populate_perdomain_mapping() > > > - Suggested hardening: add ASSERT(!(flags & _PAGE_AVAIL0)). In the > per-domain area, that flag marks a page as owned by the area. > destroy_perdomain_mapping() and free_perdomain_mappings() free any > present L1 entry carrying it. So if a caller ever passed it in flags, > Xen would free a page the caller still owns, and the caller would free > it a second time. Oops -- v2 had it, but it got lost on the conversion over to HVM-first. I'll add a fix as the first patch of v8, unless you'd like something else. Looking at it again, I think we should probably ASSERT() but also mask out the bit as an extra safety measure. What should I put in the suggested-by? Normally there's a model I think. -George
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |