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] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB5276DCBA230A17136BEDB7FE8CC72@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Fri, 21 Feb 2025 04:27:32 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Nicolin Chen <nicolinc@...dia.com>, Jason Gunthorpe <jgg@...dia.com>
CC: "corbet@....net" <corbet@....net>, "will@...nel.org" <will@...nel.org>,
	"joro@...tes.org" <joro@...tes.org>, "suravee.suthikulpanit@....com"
	<suravee.suthikulpanit@....com>, "robin.murphy@....com"
	<robin.murphy@....com>, "dwmw2@...radead.org" <dwmw2@...radead.org>,
	"baolu.lu@...ux.intel.com" <baolu.lu@...ux.intel.com>, "shuah@...nel.org"
	<shuah@...nel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "iommu@...ts.linux.dev"
	<iommu@...ts.linux.dev>, "linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "linux-kselftest@...r.kernel.org"
	<linux-kselftest@...r.kernel.org>, "linux-doc@...r.kernel.org"
	<linux-doc@...r.kernel.org>, "eric.auger@...hat.com" <eric.auger@...hat.com>,
	"jean-philippe@...aro.org" <jean-philippe@...aro.org>, "mdf@...nel.org"
	<mdf@...nel.org>, "mshavit@...gle.com" <mshavit@...gle.com>,
	"shameerali.kolothum.thodi@...wei.com"
	<shameerali.kolothum.thodi@...wei.com>, "smostafa@...gle.com"
	<smostafa@...gle.com>, "ddutile@...hat.com" <ddutile@...hat.com>, "Liu, Yi L"
	<yi.l.liu@...el.com>, "patches@...ts.linux.dev" <patches@...ts.linux.dev>
Subject: RE: [PATCH v6 07/14] iommufd/viommu: Add iommufd_viommu_report_event
 helper

> From: Nicolin Chen <nicolinc@...dia.com>
> Sent: Friday, February 21, 2025 5:16 AM
> 
> On Wed, Feb 19, 2025 at 06:58:16AM +0000, Tian, Kevin wrote:
> > > From: Jason Gunthorpe <jgg@...dia.com>
> > > Sent: Tuesday, February 18, 2025 11:36 PM
> > >
> > > On Fri, Jan 24, 2025 at 04:30:36PM -0800, Nicolin Chen wrote:
> > > > +int iommufd_viommu_report_event(struct iommufd_viommu
> *viommu,
> > > > +				enum iommu_veventq_type type, void
> > > *event_data,
> > > > +				size_t data_len)
> > > > +{
> > > > +	struct iommufd_veventq *veventq;
> > > > +	struct iommufd_vevent *vevent;
> > > > +	int rc = 0;
> > > > +
> > > > +	if (WARN_ON_ONCE(!data_len || !event_data))
> > > > +		return -EINVAL;
> > > > +
> > > > +	down_read(&viommu->veventqs_rwsem);
> > > > +
> > > > +	veventq = iommufd_viommu_find_veventq(viommu, type);
> > > > +	if (!veventq) {
> > > > +		rc = -EOPNOTSUPP;
> > > > +		goto out_unlock_veventqs;
> > > > +	}
> > > > +
> > > > +	if (atomic_read(&veventq->num_events) == veventq->depth) {
> > > > +		vevent = &veventq->overflow;
> > > > +		goto out_set_header;
> > > > +	}
> > > > +
> > > > +	vevent = kmalloc(struct_size(vevent, event_data, data_len),
> > > GFP_KERNEL);
> > > > +	if (!vevent) {
> > > > +		rc = -ENOMEM;
> > > > +		goto out_unlock_veventqs;
> > >
> > > This should record an overflow too
> > >
> >
> > In that case probably we want to rename 'overflow' to 'lost_event'
> > which counts lost events for whatever reasons (overflow, oom, etc.)
> 
> Naming-wise, I think it may sound better to call the overflow node
> just an 'exception' that concludes with lost eventsfor different
> reasons.
> 
> A complication is that this 'exception' would give userspace a very
> implicit reason as the node just report the number of lost events
> v.s. providing the reason to each lost event.
> 
> With this, maybe the IOMMU_VEVENTQ_FLAG_OVERFLOW in the uAPI
> should
> be just IOMMU_VEVENTQ_FLAG_EXCEPTION? Any better idea?
> 

'Exception' is broader compared to lost events.

We may view it in this way. When the overflow node is not used, the
user detects the sequence gap between two event entries. In that
case the gap literally reveals about the number of lost events. No
reason for why those events are lost.

With that in mind we don't need provide reason for the static node,
and IOMMU_EVENTQ_FLAG_LOST_EVENTS sounds closer to the
real intention.

Given it's a renaming, let's have consensus from Jason before you
make a change.

Thanks
Kevin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ