Re: [PATCH v5 15/18] iommufd: Persist iommu hardware pagetables for live update

From: John Starks

Date: Wed Sep 23 2026 - 19:59:46 EST


On Mon, Sep 21, 2026 at 12:48:31AM +0000, Samiullah Khawaja wrote:
> From: YiFei Zhu <zhuyifei@xxxxxxxxxx>
> +
> + /*
> + * When this memory file was mapped it should be sealed and seal
> + * should be sealed. This means that since mapping was done the
> + * memory file was not grown or shrink and the pages being used
> + * until now remain pinned and preserved.
> + */
> + if ((pages->seals & req_seals) != req_seals) {
> + ret = -EINVAL;
> + break;
> + }
> +

Is this sealing business sufficient? Even with the specified
seals, user mode can still punch a hole in the memfd after it
has been mapped. This will disassociate those pages from the memfd
but leave them referenced by the HWPT.

Then, when the memfd gets preserved, the hole will be filled
by a new set of pages, and only those pages that will be
preserved across the kexec. The original set, unless I'm missing
something, will be dangling in the HWPT, allowing attached
devices to DMA to the wrong memory.