Re: [PATCH] iommufd/selftest: Rework TEST_LENGTH to test min_size explicitly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> ---
> 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@xxxxxxxxx/
> 
> 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



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux