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: <20220208234023.GA505306@bhelgaas>
Date:   Tue, 8 Feb 2022 17:40:23 -0600
From:   Bjorn Helgaas <helgaas@...nel.org>
To:     Krzysztof Hałasa <khalasa@...p.pl>
Cc:     Pali Rohár <pali@...nel.org>,
        Bjorn Helgaas <bhelgaas@...gle.com>, linux-pci@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
        Gregory Clement <gregory.clement@...tlin.com>,
        Andrew Lunn <andrew@...n.ch>,
        Krzysztof Wilczyński <kw@...ux.com>,
        Koen Vandeputte <koen.vandeputte@...ymesh.com>,
        Dexuan Cui <dexuan.linux@...il.com>
Subject: Re: PCI: Race condition in pci_create_sysfs_dev_files (can't boot)

[+cc Koen, Dexuan from this old thread:
https://lore.kernel.org/all/20200716110423.xtfyb3n6tn5ixedh@pali/]

On Mon, Jan 31, 2022 at 12:56:18PM +0100, Krzysztof Hałasa wrote:
> Bjorn Helgaas <helgaas@...nel.org> writes:
> 
> > Thanks.  e1d3f3268b0e and related patches converted individual files
> > ("config", "rom", "vpd", etc) to static attributes, but since the
> > problem you're seeing is with a directory, it's likely different.
> >
> > I opened this bugzilla report to try to keep this from getting lost:
> > https://bugzilla.kernel.org/show_bug.cgi?id=215515
> 
> Ok, thanks.

Koen collected some interesting logs at
https://lore.kernel.org/all/cd4812f0-1de3-0582-936c-ba30906595af@citymesh.com/
They're from v5.10, which was before all of Krzysztof W's nice work
converting to static attributes, but Koen's log shows the error
happening in the pci_sysfs_init() initcall, which is *after*
imx6_pcie_probe():

  imx6_pcie_probe                # probably device initcall (level 6)
    ...
      pci_create_sysfs_dev_files

  pci_sysfs_init                 # late initcall (level 7)
    pci_create_sysfs_dev_files
      "sysfs: cannot create duplicate filename"

Krzysztof, you're running v5.14, which includes Krzysztof W's work,
but that shouldn't affect the imx6_pcie_probe()/pci_sysfs_init()
ordering.  Your log shows the error in imx6_pcie_probe().

Would you mind adding the patch below and attaching a complete dmesg
log to the bugzilla?

Bjorn

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 7bbf2673c7f2..6a2b62fe7704 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -1200,6 +1200,9 @@ static int pci_create_attr(struct pci_dev *pdev, int num, int write_combine)
 	res_attr->attr.mode = 0600;
 	res_attr->size = pci_resource_len(pdev, num);
 	res_attr->private = (void *)(unsigned long)num;
+	pci_info(pdev, "pci_create_attr:");
+	print_hex_dump(KERN_INFO, "", DUMP_PREFIX_OFFSET, 16, 1,
+			res_attr, 64, true);
 	retval = sysfs_create_bin_file(&pdev->dev.kobj, res_attr);
 	if (retval)
 		kfree(res_attr);
@@ -1380,6 +1383,9 @@ static const struct attribute_group pci_dev_reset_attr_group = {
 
 int __must_check pci_create_sysfs_dev_files(struct pci_dev *pdev)
 {
+	pci_info(pdev, "pci_create_sysfs_dev_files\n");
+	dump_stack();
+
 	if (!sysfs_initialized)
 		return -EACCES;
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ