xen/domain: Disallow XENMEM_claim_pages on dying domains

XENMEM_claim_pages can be issued on a domain in the later stages of
domain_kill().  In that case, the claimed memory is leaked, as there's no way
to subsequently release the claim.

Claims are intended for use during domain construction; to reserve sufficient
RAM to construct the domain fully.  There's no legitimate reason to be calling
it on a dying domain.

Fixes: 65c9792df6 ("mmu: Introduce XENMEM_claim_pages (subop of memory ops)")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: 2379ca04fe
master date: 2025-12-17 17:35:24 +0000
This commit is contained in:
Andrew Cooper authored and Jan Beulich committed 2026-01-29 13:47:19 +01:00
1 parent 495cfdccc5
commit 4eb4bb4e0b
1 file changed
+3
+3
View File
@@ -1678,6 +1678,9 @@ long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
rc = xsm_claim_pages(XSM_PRIV, d);
if ( !rc && d->is_dying )
rc = -EINVAL;
if ( !rc )
rc = domain_set_outstanding_pages(d, reservation.nr_extents);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.