From: Jason Gunthorpe <jgg@nvidia.com>
To: Nicolin Chen <nicolinc@nvidia.com>
Cc: kevin.tian@intel.com, iommu@lists.linux.dev,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH rc v1 0/4] iommufd: Fix veventq_depth boundary
Date: Thu, 21 May 2026 11:30:04 -0300 [thread overview]
Message-ID: <20260521143004.GJ3602937@nvidia.com> (raw)
In-Reply-To: <cover.1779070992.git.nicolinc@nvidia.com>
On Sun, May 17, 2026 at 07:28:45PM -0700, Nicolin Chen wrote:
> The upper bound of veventq_depth has been missing for veventq allocation,
> leaving a vulnerability where userspace could exhaust atomic memory pool.
>
> Fix it properly:
> - Allocate outside the spinlock to avoid GFP_ATOMIC
> - Cap the veventq_depth upper bound
> - Fix event_data byte-count
> - Add selftest coverage
>
> Note that QEMU's SMMU has been already allocating veventq using a "HW"
> EVTQ entry number. So, picking 19 as the known use case, for a minimal
> level of ABI consistency.
>
> This is on github:
> https://github.com/nicolinc/iommufd/commits/fix_veventq_depth-v1
>
> Nicolin Chen (4):
> iommufd: Move vevent memory allocation outside spinlock
> iommufd: Set veventq_depth upper bound
> iommufd: Fix data_len byte-count vs element-count mismatch
> iommufd/selftest: Add boundary tests for veventq_depth
Please adjust for the sashiko remarks:
1) Put "iommufd: Fix data_len byte-count vs element-count mismatch"
first
2) This "Returning -ENOMEM for allocation failures but 0 for queue overflows treats
the conditions differently, which seems to contradict the stated
intent." Seems bogus, I think adjust the commit message. We do want
0 for queue full conditions.
3) Let's fix the "Will this lockless read concurrent with a plain write cause a
data race?" by removing the optimization, just pre-allocate and
fail. We don't expect this to be a normal condition worth
optimizing
4) I'm OK with ENOMEM here, leave it, EAGAIN should mean it is
pollable and it won't become pollable..
5) The sizeof(hdr) has been fixed in my rc branch. You can rebase on
top of that and also ensure to send a base-commit trailer to help
Sashiko apply the patches properly
6) What do you think about the "but done has
already been incremented by sizeof(*hdr)" ? unrelated issue? If it
is simple lets add a patch here to fix it
Jason
next prev parent reply other threads:[~2026-05-21 14:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 2:28 [PATCH rc v1 0/4] iommufd: Fix veventq_depth boundary Nicolin Chen
2026-05-18 2:28 ` [PATCH rc v1 1/4] iommufd: Move vevent memory allocation outside spinlock Nicolin Chen
2026-05-18 2:28 ` [PATCH rc v1 2/4] iommufd: Set veventq_depth upper bound Nicolin Chen
2026-05-18 2:28 ` [PATCH rc v1 3/4] iommufd: Fix data_len byte-count vs element-count mismatch Nicolin Chen
2026-05-18 2:28 ` [PATCH rc v1 4/4] iommufd/selftest: Add boundary tests for veventq_depth Nicolin Chen
2026-05-18 18:11 ` [PATCH rc v1 0/4] iommufd: Fix veventq_depth boundary Jason Gunthorpe
2026-05-21 14:30 ` Jason Gunthorpe [this message]
2026-05-21 18:01 ` Nicolin Chen
2026-05-21 23:27 ` Jason Gunthorpe
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=20260521143004.GJ3602937@nvidia.com \
--to=jgg@nvidia.com \
--cc=iommu@lists.linux.dev \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=nicolinc@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.