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: <BN9PR11MB52762A0081F7A1679850142A8C099@BN9PR11MB5276.namprd11.prod.outlook.com>
Date:   Fri, 18 Nov 2022 08:17:23 +0000
From:   "Tian, Kevin" <kevin.tian@...el.com>
To:     Thomas Gleixner <tglx@...utronix.de>,
        LKML <linux-kernel@...r.kernel.org>
CC:     "x86@...nel.org" <x86@...nel.org>, Joerg Roedel <joro@...tes.org>,
        "Will Deacon" <will@...nel.org>,
        "linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        "Lorenzo Pieralisi" <lorenzo.pieralisi@....com>,
        Marc Zyngier <maz@...nel.org>,
        "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
        Jason Gunthorpe <jgg@...lanox.com>,
        "Jiang, Dave" <dave.jiang@...el.com>,
        Alex Williamson <alex.williamson@...hat.com>,
        "Williams, Dan J" <dan.j.williams@...el.com>,
        Logan Gunthorpe <logang@...tatee.com>,
        "Raj, Ashok" <ashok.raj@...el.com>, Jon Mason <jdmason@...zu.us>,
        Allen Hubbe <allenbh@...il.com>,
        "Ahmed S. Darwish" <darwi@...utronix.de>,
        "Chatre, Reinette" <reinette.chatre@...el.com>
Subject: RE: [patch 12/20] genirq/msi: Make descriptor freeing domain aware

> From: Thomas Gleixner <tglx@...utronix.de>
> Sent: Friday, November 11, 2022 9:57 PM
> 
>  int msi_domain_insert_msi_desc(struct device *dev, unsigned int domid,
>  			       struct msi_desc *init_desc);
>  /**
> - * msi_insert_msi_desc - Allocate and initialize a MSI descriptor in the
> default domain
> + * msi_insert_msi_desc - Allocate and initialize a MSI descriptor in the
> default irqdomain
> + *

belong to last patch

> +/**
> + * struct msi_ctrl - MSI internal management control structure
> + * @domid:	ID of the domain on which management operations should
> be done
> + * @first:	First (hardware) slot index to operate on
> + * @last:	Last (hardware) slot index to operate on
> + */
> +struct msi_ctrl {
> +	unsigned int			domid;
> +	unsigned int			first;
> +	unsigned int			last;
> +};
> +

this really contains the range information. what about msi_range and
then msi_range_valid()?

> +static void msi_domain_free_descs(struct device *dev, struct msi_ctrl *ctrl)
>  {
>  	struct xarray *xa = &dev->msi.data->__store;
>  	struct msi_desc *desc;
>  	unsigned long idx;
> +	int base;
> +
> +	lockdep_assert_held(&dev->msi.data->mutex);
> 
> -	if (WARN_ON_ONCE(first_index >= MSI_MAX_INDEX || last_index >=
> MSI_MAX_INDEX))
> +	if (!msi_ctrl_valid(dev, ctrl))
>  		return;
> 
> -	lockdep_assert_held(&dev->msi.data->mutex);
> +	base = msi_get_domain_base_index(dev, ctrl->domid);
> +	if (base < 0)
> +		return;

What about putting domid checks in msi_ctrl_valid() then here could
be a simple calculation on domid * MSI_XA_DOMAIN_SIZE.

domid is part of msi_ctrl. then it sound reasonable to validate it
together with first/last.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ