From: "Ding, Xuan" <xuan.ding@intel.com>
To: David Marchand <david.marchand@redhat.com>,
"Burakov, Anatoly" <anatoly.burakov@intel.com>
Cc: dev <dev@dpdk.org>, Maxime Coquelin <maxime.coquelin@redhat.com>
Subject: Re: [dpdk-dev] [PATCH v1 1/1] vfio: fix partial unmap check
Date: Thu, 28 Oct 2021 06:05:45 +0000 [thread overview]
Message-ID: <BN9PR11MB551388F77C6EC758447FF3F4E7869@BN9PR11MB5513.namprd11.prod.outlook.com> (raw)
In-Reply-To: <CAJFAV8zVgJpdoqn50mk7avhMhcBzzfowtpueVncuRjV9cWoqcA@mail.gmail.com>
Hi David,
>-----Original Message-----
>From: David Marchand <david.marchand@redhat.com>
>Sent: Wednesday, October 27, 2021 10:49 PM
>To: Burakov, Anatoly <anatoly.burakov@intel.com>; Ding, Xuan
><xuan.ding@intel.com>
>Cc: dev <dev@dpdk.org>; Maxime Coquelin <maxime.coquelin@redhat.com>
>Subject: Re: [dpdk-dev] [PATCH v1 1/1] vfio: fix partial unmap check
>
>On Tue, Oct 26, 2021 at 3:30 PM Anatoly Burakov
><anatoly.burakov@intel.com> wrote:
>>
>> Partial unmap support was introduced in commit c13ca4e81cac, and with it
>> was added a check that dereferenced the IOMMU type to determine
>whether
>> partial ummapping is supported for currently configured IOMMU type. In
>> certain circumstances (such as when VFIO is supported, but no devices
>> were bound to the VFIO driver), the IOMMU type pointer can be NULL.
>>
>> However, dereferencing of IOMMU type was guarded by access to the user
>> maps list - that is, we were always checking the user map list first,
>> and then, if we found a memory region that encloses the one we're trying
>> to unmap, we would have performed the IOMMU type check.
>>
>> This ensured that the IOMMU type check will not cause any NULL pointer
>> dereferences, because in order for an IOMMU type check to have been
>> performed, there necessarily must have been at least one memory region
>> that was previously mapped successfully, and that implies having a
>> defined IOMMU type.
>>
>> When 56259f7fc010 was introduced, the IOMMU type check was moved to
>> before we were traversing the user mem maps list, thereby introducing a
>> potential NULL dereference, because the IOMMU type access was no longer
>> guarded by the user mem maps list traversal.
>>
>> Fix the issue by moving the IOMMU type check to after the user mem maps
>> traversal, thereby ensuring that by the time the check happens, the
>> IOMMU type is always valid.
>>
>> Fixes: 56259f7fc010 ("vfio: allow partially unmapping adjacent memory")
>> Cc: xuan.ding@intel.com
>>
>> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
>Reviewed-by: David Marchand <david.marchand@redhat.com>
>
>I guess Xuan tested it too, since we have a vhost patch on top of this
>vfio patch.
>Can you just confirm it is ok to merge?
Yes, I tested it and it works fine.
Tested-by: Xuan Ding <xuan.ding@intel.com>
Regards,
Xuan
>
>Thanks.
>
>
>--
>David Marchand
next prev parent reply other threads:[~2021-10-28 6:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-26 13:26 Anatoly Burakov
2021-10-27 14:49 ` David Marchand
2021-10-28 6:05 ` Ding, Xuan [this message]
2021-10-28 7:52 ` David Marchand
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=BN9PR11MB551388F77C6EC758447FF3F4E7869@BN9PR11MB5513.namprd11.prod.outlook.com \
--to=xuan.ding@intel.com \
--cc=anatoly.burakov@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
/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).