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: <r7fgb5xrn6ocstq6ctq4q7r4o2esgh4rqr44c3u234kcep6thk@bge2vzl33ptb>
Date: Thu, 3 Jul 2025 18:18:29 +0530
From: Manivannan Sadhasivam <mani@...nel.org>
To: 拴何 <heshuan@...edance.com>
Cc: Sunil V L <sunilvl@...tanamicro.com>, bhelgaas@...gle.com, 
	cuiyunhui@...edance.com, linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [External] Re: [RFC 0/1] PCI: Fix pci devices double register
 WARNING in the kernel starting process

On Thu, Jul 03, 2025 at 07:31:10PM GMT, 拴何 wrote:
> Hi Sunil,
> Thanks for your reply! (really appricate it).
> This WARNING truly occurred. Through the added debug info, I found
> that the device was registered to proc via pci_proc_init and
> acpi_pci_root_add paths respectively, which ultimately triggered
> the warning message.
> Let me try to reproduce it on qemu first. I'll keep you updated.
> Thanks again.
> 

I think you have uncovered a valid bug. There is nothing preventing (except the
blessings of the initcall order) the occurence of the race between
pci_proc_init() and pci_bus_add_device(). I think it went mostly unnoticed
because, pci_proc_init() gets called very early before any PCI devices were
registered. So for_each_pci_dev() loop never gets executed.

But in your case, looks like the PCI device is available somehow before
pci_proc_init() gets executed. Now, it is not very clear to me how the device
becomes available at this point. It might be due to some other issue. But in
anycase, I think we need to get rid of calling pci_proc_attach_device() from
pci_proc_init() as I don't see a reason to call this function from two
different places. pci_bus_add_device() should be the one calling this function
as it is the one adding the PCI device.

Ironically, I do see a similar pattern for sysfs also. Maybe there is (or was) a
reason to create these files from two different places?

- Mani

-- 
மணிவண்ணன் சதாசிவம்

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ