Re: [PATCH v5 03/13] iommufd: Add iommufd_verify_unfinalized_object

From: Jason Gunthorpe
Date: Wed Oct 30 2024 - 08:54:07 EST


On Tue, Oct 29, 2024 at 09:05:14PM -0700, Nicolin Chen wrote:
> On Tue, Oct 29, 2024 at 03:55:58PM -0300, Jason Gunthorpe wrote:
> > On Tue, Oct 29, 2024 at 09:18:05AM -0700, Nicolin Chen wrote:
> > > I think we'd need the same change in iommufd_object_abort() too.
> >
> > Makes sense
>
> I found xa_cmpxchg() does xas_result to its returning value, which
> turns XA_ZERO_ENTRY into NULL failing our intended verifications.

Oh.. that is annoying, you can't actually tell if cmpxchg failed :\
NULL means success if it was XA_ZERO_ENTRY and failure of it was not
populated! Hmm, I might ask Matthew about this

Your version looks OK

Jason