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: <Z6opssGJ91MVWgRC@ryzen>
Date: Mon, 10 Feb 2025 17:30:42 +0100
From: Niklas Cassel <cassel@...nel.org>
To: Kunihiko Hayashi <hayashi.kunihiko@...ionext.com>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
	Krzysztof Wilczynski <kw@...ux.com>,
	Kishon Vijay Abraham I <kishon@...nel.org>,
	Arnd Bergmann <arnd@...db.de>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Lorenzo Pieralisi <lpieralisi@...nel.org>,
	Gustavo Pimentel <gustavo.pimentel@...opsys.com>,
	Bjorn Helgaas <bhelgaas@...gle.com>, linux-pci@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 4/5] misc: pci_endpoint_test: Remove global irq_type

On Mon, Feb 10, 2025 at 04:58:11PM +0900, Kunihiko Hayashi wrote:
> The global variable "irq_type" preserves the current value of
> ioctl(GET_IRQTYPE), however, it's enough to use test->irq_type.
> Remove the variable, and replace with test->irq_type.

I think the commit message is missing the biggest point.

ioctl(SET_IRQTYPE) sets test->irq_type.
PCITEST_WRITE/PCITEST_READ/PCITEST_COPY all use test->irq_type when
writing the PCI_ENDPOINT_TEST_IRQ_TYPE register in test_reg_bar.

The endpoint function driver (pci-epf-test) will look at
PCI_ENDPOINT_TEST_IRQ_TYPE register in test_reg_bar when determining
which type of IRQ it should raise.

This means that the kernel module parameter is basically useless,
since it is unused if anyone has called ioctl(SET_IRQTYPE).

Both the old pcitest.sh and the new pci_endpoint_test kselftest call
ioctl(SET_IRQTYPE), so in practice the irq_type kernel module parameter
is dead code.


> 
> The ioctl(GET_IRQTYPE) returns an error if test->irq_type has
> IRQ_TYPE_UNDEFINED.
> 
> Suggested-by: Niklas Cassel <cassel@...nel.org>
> Suggested-by: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@...ionext.com>
> ---
>  drivers/misc/pci_endpoint_test.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
> index 6a0972e7674f..8d98cd18634d 100644
> --- a/drivers/misc/pci_endpoint_test.c
> +++ b/drivers/misc/pci_endpoint_test.c
> @@ -100,10 +100,6 @@ static bool no_msi;
>  module_param(no_msi, bool, 0444);
>  MODULE_PARM_DESC(no_msi, "Disable MSI interrupt in pci_endpoint_test");

Considering that you are removing the irq_type kernel module parameter,
it doesn't make sense to keep the no_msi kernel module parameter IMO.

The exact same argument for why we are removing irq_type, can be made for
no_msi.


Kind regards,
Niklas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ