From: Jan Beulich <jbeulich@suse.com>
To: Julien Grall <julien@xen.org>
Cc: hongyxia@amazon.co.uk, iwj@xenproject.org,
Julien Grall <jgrall@amazon.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Kevin Tian <kevin.tian@intel.com>, Paul Durrant <paul@xen.org>,
xen-devel@lists.xenproject.org
Subject: Re: [for-4.15][PATCH v3 1/3] xen/iommu: x86: Clear the root page-table before freeing the page-tables
Date: Wed, 17 Feb 2021 15:54:21 +0100 [thread overview]
Message-ID: <d20d31ed-4392-a7fb-66ee-575eb254ae84@suse.com> (raw)
In-Reply-To: <20210217142458.3769-2-julien@xen.org>
On 17.02.2021 15:24, Julien Grall wrote:
> --- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
> +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
> @@ -381,9 +381,18 @@ static int amd_iommu_assign_device(struct domain *d, u8 devfn,
> return reassign_device(pdev->domain, d, devfn, pdev);
> }
>
> +static void iommu_clear_root_pgtable(struct domain *d)
Nit: amd_iommu_ as a prefix would be okay here considering other
(static) functions also use it. Since it is a static function,
no prefix at all would also do (my personal preference). But
iommu_ as a prefix isn't helpful and results in needless re-use
of VT-d's name.
> --- a/xen/drivers/passthrough/x86/iommu.c
> +++ b/xen/drivers/passthrough/x86/iommu.c
> @@ -267,6 +267,15 @@ int iommu_free_pgtables(struct domain *d)
> struct page_info *pg;
> unsigned int done = 0;
>
> + if ( !is_iommu_enabled(d) )
> + return 0;
> +
> + /*
> + * Pages will be moved to the free list below. So we want to
> + * clear the root page-table to avoid any potential use after-free.
> + */
> + hd->platform_ops->clear_root_pgtable(d);
Taking amd_iommu_alloc_root() as example, is this really correct
prior to what is now patch 2? What guarantees a new root table
won't get allocated subsequently?
Jan
next prev parent reply other threads:[~2021-02-17 14:54 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-17 14:24 [for-4.15][PATCH v3 0/3] xen/iommu: Collection of bug fixes for IOMMU teadorwn Julien Grall
2021-02-17 14:24 ` [for-4.15][PATCH v3 1/3] xen/iommu: x86: Clear the root page-table before freeing the page-tables Julien Grall
2021-02-17 14:54 ` Jan Beulich [this message]
2021-02-17 15:00 ` Julien Grall
2021-02-17 15:17 ` Jan Beulich
2021-02-17 16:48 ` Julien Grall
2021-02-17 14:24 ` [for-4.15][PATCH v3 2/3] xen/x86: iommu: Ignore IOMMU mapping requests when a domain is dying Julien Grall
2021-02-17 15:01 ` Jan Beulich
2021-02-17 16:07 ` Julien Grall
2021-02-18 13:05 ` Jan Beulich
2021-02-18 13:25 ` Julien Grall
2021-02-19 8:49 ` Jan Beulich
2021-02-19 9:24 ` Julien Grall
2021-02-18 14:00 ` Paul Durrant
2021-02-19 8:56 ` Jan Beulich
2021-02-17 14:24 ` [for-4.15][PATCH v3 3/3] xen/iommu: x86: Harden the IOMMU page-table allocator Julien Grall
2021-02-17 15:13 ` Jan Beulich
2021-02-17 16:29 ` Julien Grall
2021-02-18 13:10 ` Jan Beulich
2021-02-18 13:19 ` Julien Grall
2021-02-18 17:04 ` Jan Beulich
2021-02-18 17:41 ` Julien Grall
2021-02-19 8:46 ` Jan Beulich
2021-02-19 8:57 ` Julien Grall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d20d31ed-4392-a7fb-66ee-575eb254ae84@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=hongyxia@amazon.co.uk \
--cc=iwj@xenproject.org \
--cc=jgrall@amazon.com \
--cc=julien@xen.org \
--cc=kevin.tian@intel.com \
--cc=paul@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).