Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Nicolin Chen <nicolinc@nvidia.com>
Cc: kevin.tian@intel.com, yi.l.liu@intel.com, shuah@kernel.org,
	iommu@lists.linux.dev, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH] iommufd/selftest: Rework TEST_LENGTH to test min_size explicitly
Date: Mon, 16 Oct 2023 11:09:21 -0300	[thread overview]
Message-ID: <20231016140921.GU3952@nvidia.com> (raw)
In-Reply-To: <20231015074648.24185-1-nicolinc@nvidia.com>

On Sun, Oct 15, 2023 at 12:46:48AM -0700, Nicolin Chen wrote:
> TEST_LENGTH passing ".size = sizeof(struct _struct) - 1" expects -EINVAL
> from "if (ucmd.user_size < op->min_size)" check in iommufd_fops_ioctl().
> This has been working when min_size is exactly the size of the structure.
> 
> However, if the size of the structure becomes larger than min_size, i.e.
> the passing size above is larger than min_size, that min_size sanity no
> longer works.
> 
> Since the first test in TEST_LENGTH() was to test that min_size sanity
> routine, rework it to support a min_size calculation, rather than using
> the full size of the structure.
> 
> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
> ---
> Hi Jason/Kevin,
> 
> This was a part of the nesting series. Its link in v4:
> https://lore.kernel.org/linux-iommu/20230921075138.124099-13-yi.l.liu@intel.com/
> 
> I just realized that this should go in prior to the nesting series.
> One of the nesting patches changes the IOMMU_HWPT_ALLOC structure,
> which would break the cmd_length test without this patch.
> 
> Thanks!
> Nicolin
> 
>  tools/testing/selftests/iommu/iommufd.c | 29 ++++++++++++++-----------
>  1 file changed, 16 insertions(+), 13 deletions(-)

Applied to iommufd for-next

Thanks,
Jason

      parent reply	other threads:[~2023-10-16 14:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-15  7:46 [PATCH] iommufd/selftest: Rework TEST_LENGTH to test min_size explicitly Nicolin Chen
2023-10-16  8:48 ` Tian, Kevin
2023-10-16 14:09 ` Jason Gunthorpe [this message]

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=20231016140921.GU3952@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=iommu@lists.linux.dev \
    --cc=kevin.tian@intel.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=nicolinc@nvidia.com \
    --cc=shuah@kernel.org \
    --cc=yi.l.liu@intel.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