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: <Z2LsFoXotl_SHmNk@kbusch-mbp.dhcp.thefacebook.com>
Date: Wed, 18 Dec 2024 08:36:54 -0700
From: Keith Busch <kbusch@...nel.org>
To: Ryo Takakura <ryotkkr98@...il.com>
Cc: lgoncalv@...hat.com, bhelgaas@...gle.com, jonathan.derrick@...ux.dev,
	kw@...ux.com, lpieralisi@...nel.org,
	manivannan.sadhasivam@...aro.org, nirmal.patel@...ux.intel.com,
	robh@...nel.org, bigeasy@...utronix.de, rostedt@...dmis.org,
	linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org,
	linux-rt-devel@...ts.linux.dev
Subject: Re: [PATCH v2] PCI: vmd: Fix spinlock usage on config access for RT
 kernel

On Wed, Dec 18, 2024 at 08:59:51PM +0900, Ryo Takakura wrote:
> PCI config access is locked with pci_lock which serializes
> pci_user/bus_write_config*() and pci_user/bus_read_config*().
> The subsequently invoked vmd_pci_write() and vmd_pci_read() are also
> serialized as they are only invoked by them respectively.
> 
> Remove cfg_lock which is taken by vmd_pci_write() and vmd_pci_read()
> for their serialization as its already serialized by pci_lock.

That's only true if CONFIG_PCI_LOCKLESS_CONFIG isn't set, so pci_lock
won't help with concurrent kernel config access in such a setup. I think
the previous change to raw lock proposal was the correct approach.
 
> @@ -385,13 +384,11 @@ static int vmd_pci_read(struct pci_bus *bus, unsigned int devfn, int reg,
>  {
>  	struct vmd_dev *vmd = vmd_from_bus(bus);
>  	void __iomem *addr = vmd_cfg_addr(vmd, bus, devfn, reg, len);
> -	unsigned long flags;
>  	int ret = 0;
>  
>  	if (!addr)
>  		return -EFAULT;
>  
> -	spin_lock_irqsave(&vmd->cfg_lock, flags);
>  	switch (len) {
>  	case 1:
>  		*value = readb(addr);

There's a comment above this function explaining the need for the lock,
which doesn't make a lot of sense after this patch.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ