lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20231121013937.GH10140@ziepe.ca>
Date:   Mon, 20 Nov 2023 21:39:37 -0400
From:   Jason Gunthorpe <jgg@...pe.ca>
To:     "Tian, Kevin" <kevin.tian@...el.com>
Cc:     Robin Murphy <robin.murphy@....com>,
        Joao Martins <joao.m.martins@...cle.com>,
        "iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] iommufd/selftest: Fix dirty_bitmap tests

On Fri, Nov 17, 2023 at 03:15:25AM +0000, Tian, Kevin wrote:
> > From: Robin Murphy <robin.murphy@....com>
> > Sent: Friday, November 17, 2023 1:44 AM
> > 
> > On 16/11/2023 5:28 pm, Joao Martins wrote:
> > > On 16/11/2023 16:52, Robin Murphy wrote:
> > >> The ASSERT_EQ() macro sneakily expands to two statements, so the loop
> > >> here needs braces to ensure it captures both and actually terminates the
> > >> test upon failure.
> > >
> > > Ugh
> > >
> > >> Where these tests are currently failing on my arm64
> > >> machine, this reduces the number of logged lines from a rather
> > >> unreasonable ~197,000 down to 10. While we're at it, we can also clean
> > >> up the tautologous "count" calculations whose assertions can never fail
> > >> unless mathematics and/or the C language become fundamentally broken.
> > >>
> > >> Fixes: a9af47e382a4 ("iommufd/selftest: Test
> > IOMMU_HWPT_GET_DIRTY_BITMAP")
> > >> Signed-off-by: Robin Murphy <robin.murphy@....com>
> > >
> > > I was going to say that the second assert is useful, but we are already test
> > the
> > > number of bits we set against what the mock domain set after
> > > mock_domain_set_dirty(). So the second is redundantly testing the same,
> > and can
> > > be removed as you are doing. Thanks for fixing this.
> > 
> > Yeah, it's still effectively just counting half the number of loop
> > iterations executed, but since there's no control flow that could exit
> > the loop early and still reach the assertion, it must always be true
> > following the previous assertion that out_dirty == nr == nbits/2.
> > 
> > > I would suggest the subject to:
> > >
> > > 	iommufd/selftest: Fix _test_mock_dirty_bitmaps()
> > >
> > > Because dirty-bitmap tests seems to imply the whole fixture, which covers
> > more
> > > than the bitmaps.
> > 
> > Sure, that sounds reasonable. Jason, Kevin, would you want a v2 for that
> > or could it be fixed up when applying?
> > 
> 
> Jason can help fix it when applying.
> 
> Reviewed-by: Kevin Tian <kevin.tian@...el.com>

Done

Thanks,
Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ