<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/pci/msi, branch linux-6.10.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.10.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.10.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2024-06-24T21:33:38Z</updated>
<entry>
<title>PCI/MSI: Fix UAF in msi_capability_init</title>
<updated>2024-06-24T21:33:38Z</updated>
<author>
<name>Mostafa Saleh</name>
</author>
<published>2024-06-24T20:37:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9eee5330656bf92f51cb1f09b2dc9f8cf975b3d1'/>
<id>urn:sha1:9eee5330656bf92f51cb1f09b2dc9f8cf975b3d1</id>
<content type='text'>
KFENCE reports the following UAF:

 BUG: KFENCE: use-after-free read in __pci_enable_msi_range+0x2c0/0x488

 Use-after-free read at 0x0000000024629571 (in kfence-#12):
  __pci_enable_msi_range+0x2c0/0x488
  pci_alloc_irq_vectors_affinity+0xec/0x14c
  pci_alloc_irq_vectors+0x18/0x28

 kfence-#12: 0x0000000008614900-0x00000000e06c228d, size=104, cache=kmalloc-128

 allocated by task 81 on cpu 7 at 10.808142s:
  __kmem_cache_alloc_node+0x1f0/0x2bc
  kmalloc_trace+0x44/0x138
  msi_alloc_desc+0x3c/0x9c
  msi_domain_insert_msi_desc+0x30/0x78
  msi_setup_msi_desc+0x13c/0x184
  __pci_enable_msi_range+0x258/0x488
  pci_alloc_irq_vectors_affinity+0xec/0x14c
  pci_alloc_irq_vectors+0x18/0x28

 freed by task 81 on cpu 7 at 10.811436s:
  msi_domain_free_descs+0xd4/0x10c
  msi_domain_free_locked.part.0+0xc0/0x1d8
  msi_domain_alloc_irqs_all_locked+0xb4/0xbc
  pci_msi_setup_msi_irqs+0x30/0x4c
  __pci_enable_msi_range+0x2a8/0x488
  pci_alloc_irq_vectors_affinity+0xec/0x14c
  pci_alloc_irq_vectors+0x18/0x28

Descriptor allocation done in:
__pci_enable_msi_range
    msi_capability_init
        msi_setup_msi_desc
            msi_insert_msi_desc
                msi_domain_insert_msi_desc
                    msi_alloc_desc
                        ...

Freed in case of failure in __msi_domain_alloc_locked()
__pci_enable_msi_range
    msi_capability_init
        pci_msi_setup_msi_irqs
            msi_domain_alloc_irqs_all_locked
                msi_domain_alloc_locked
                    __msi_domain_alloc_locked =&gt; fails
                    msi_domain_free_locked
                        ...

That failure propagates back to pci_msi_setup_msi_irqs() in
msi_capability_init() which accesses the descriptor for unmasking in the
error exit path.

Cure it by copying the descriptor and using the copy for the error exit path
unmask operation.

[ tglx: Massaged change log ]

Fixes: bf6e054e0e3f ("genirq/msi: Provide msi_device_populate/destroy_sysfs()")
Suggested-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Mostafa Saleh &lt;smostafa@google.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Bjorn Heelgas &lt;bhelgaas@google.com&gt;
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240624203729.1094506-1-smostafa@google.com
</content>
</entry>
<entry>
<title>Merge branch 'pci/ims-removal'</title>
<updated>2024-05-16T23:14:14Z</updated>
<author>
<name>Bjorn Helgaas</name>
</author>
<published>2024-05-16T23:14:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=375a99fd867cb6b91685708886ccf23e5dee39d4'/>
<id>urn:sha1:375a99fd867cb6b91685708886ccf23e5dee39d4</id>
<content type='text'>
- Remove unused Interrupt Message Store (IMS) support (Bjorn Helgaas)

* pci/ims-removal:
  Revert "genirq/msi: Provide constants for PCI/IMS support"
  Revert "x86/apic/msi: Enable PCI/IMS"
  Revert "iommu/vt-d: Enable PCI/IMS"
  Revert "iommu/amd: Enable PCI/IMS"
  Revert "PCI/MSI: Provide IMS (Interrupt Message Store) support"
  Revert "PCI/MSI: Provide pci_ims_alloc/free_irq()"
  Revert "PCI/MSI: Provide stubs for IMS functions"
</content>
</entry>
<entry>
<title>Merge branch 'pci/msi'</title>
<updated>2024-05-16T23:14:11Z</updated>
<author>
<name>Bjorn Helgaas</name>
</author>
<published>2024-05-16T23:14:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ed11a28cb709a9ab69c4cd4e0669079a455f9a8d'/>
<id>urn:sha1:ed11a28cb709a9ab69c4cd4e0669079a455f9a8d</id>
<content type='text'>
- Update coding style to "mainline is normal path, errors are the
  exceptions" (Andy Shevchenko)

* pci/msi:
  PCI/MSI: Make error path handling follow the standard pattern
</content>
</entry>
<entry>
<title>Revert "PCI/MSI: Provide IMS (Interrupt Message Store) support"</title>
<updated>2024-05-15T22:01:54Z</updated>
<author>
<name>Bjorn Helgaas</name>
</author>
<published>2024-04-10T22:13:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b966b1102871ad3842708294f6ec018eede75463'/>
<id>urn:sha1:b966b1102871ad3842708294f6ec018eede75463</id>
<content type='text'>
This reverts commit 0194425af0c87acaad457989a2c6d90dba58e776.

IMS (Interrupt Message Store) support appeared in v6.2, but there are no
users yet.

Remove it for now.  We can add it back when a user comes along.  If this is
re-added later, the relevant part of 41efa431244f ("PCI/MSI: Provide stubs
for IMS functions") should be squashed into it.

Link: https://lore.kernel.org/r/20240410221307.2162676-4-helgaas@kernel.org
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Kevin Tian &lt;kevin.tian@intel.com&gt;
Reviewed-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>Revert "PCI/MSI: Provide pci_ims_alloc/free_irq()"</title>
<updated>2024-05-15T22:01:51Z</updated>
<author>
<name>Bjorn Helgaas</name>
</author>
<published>2024-04-10T22:13:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1794808fb1b34c30bac9f1e5d41b9df628f54260'/>
<id>urn:sha1:1794808fb1b34c30bac9f1e5d41b9df628f54260</id>
<content type='text'>
This reverts commit c9e5bea273834a63b5e9ba90ad94b305ba50704e.

IMS (Interrupt Message Store) support appeared in v6.2, but there are no
users yet.

Remove it for now.  We can add it back when a user comes along.  If this is
re-added later, the relevant part of 41efa431244f ("PCI/MSI: Provide stubs
for IMS functions") should be squashed into it.

Link: https://lore.kernel.org/r/20240410221307.2162676-3-helgaas@kernel.org
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Kevin Tian &lt;kevin.tian@intel.com&gt;
Reviewed-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>PCI/MSI: Make error path handling follow the standard pattern</title>
<updated>2024-04-26T22:04:20Z</updated>
<author>
<name>Andy Shevchenko</name>
</author>
<published>2024-04-26T14:40:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0ba5cd94bbc2d21ffb392b6a3b23ee288b4778d5'/>
<id>urn:sha1:0ba5cd94bbc2d21ffb392b6a3b23ee288b4778d5</id>
<content type='text'>
Make error path handling follow the standard pattern, i.e.  checking for
errors first. This makes code much easier to read and understand despite
being a bit longer.

Link: https://lore.kernel.org/r/20240426144039.557907-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
</content>
</entry>
<entry>
<title>PCI/MSI: Use PCI_IRQ_INTX instead of PCI_IRQ_LEGACY</title>
<updated>2024-04-25T17:53:29Z</updated>
<author>
<name>Damien Le Moal</name>
</author>
<published>2024-03-25T07:09:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bb14a6a870548d44e486c7d68d47c2114aafb395'/>
<id>urn:sha1:bb14a6a870548d44e486c7d68d47c2114aafb395</id>
<content type='text'>
In pci_alloc_irq_vectors_affinity(), use the macro PCI_IRQ_INTX instead of
the now deprecated PCI_IRQ_LEGACY macro.

Link: https://lore.kernel.org/r/20240325070944.3600338-2-dlemoal@kernel.org
Signed-off-by: Damien Le Moal &lt;dlemoal@kernel.org&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
</content>
</entry>
<entry>
<title>PCI/MSI: Prevent MSI hardware interrupt number truncation</title>
<updated>2024-02-19T15:11:01Z</updated>
<author>
<name>Vidya Sagar</name>
</author>
<published>2024-01-15T13:56:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=db744ddd59be798c2627efbfc71f707f5a935a40'/>
<id>urn:sha1:db744ddd59be798c2627efbfc71f707f5a935a40</id>
<content type='text'>
While calculating the hardware interrupt number for a MSI interrupt, the
higher bits (i.e. from bit-5 onwards a.k.a domain_nr &gt;= 32) of the PCI
domain number gets truncated because of the shifted value casting to return
type of pci_domain_nr() which is 'int'. This for example is resulting in
same hardware interrupt number for devices 0019:00:00.0 and 0039:00:00.0.

To address this cast the PCI domain number to 'irq_hw_number_t' before left
shifting it to calculate the hardware interrupt number.

Please note that this fixes the issue only on 64-bit systems and doesn't
change the behavior for 32-bit systems i.e. the 32-bit systems continue to
have the issue. Since the issue surfaces only if there are too many PCIe
controllers in the system which usually is the case in modern server
systems and they don't tend to run 32-bit kernels.

Fixes: 3878eaefb89a ("PCI/MSI: Enhance core to support hierarchy irqdomain")
Signed-off-by: Vidya Sagar &lt;vidyas@nvidia.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Tested-by: Shanker Donthineni &lt;sdonthineni@nvidia.com&gt;
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240115135649.708536-1-vidyas@nvidia.com
</content>
</entry>
<entry>
<title>PCI/MSI: Use FIELD_GET/PREP()</title>
<updated>2023-10-24T15:54:04Z</updated>
<author>
<name>Ilpo Järvinen</name>
</author>
<published>2023-10-18T11:32:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=682f5311e3a4f637ad3fae835a14494c2769bc2b'/>
<id>urn:sha1:682f5311e3a4f637ad3fae835a14494c2769bc2b</id>
<content type='text'>
Instead of custom masking and shifting, use FIELD_GET/PREP() with
register fields.

Link: https://lore.kernel.org/r/20231018113254.17616-8-ilpo.jarvinen@linux.intel.com
Signed-off-by: Ilpo Järvinen &lt;ilpo.jarvinen@linux.intel.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
</content>
</entry>
<entry>
<title>PCI: Fix typos in docs and comments</title>
<updated>2023-08-25T13:15:38Z</updated>
<author>
<name>Bjorn Helgaas</name>
</author>
<published>2023-08-24T16:44:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=86b4ad7d67b26973838b7f1d4428aba9483cb5ce'/>
<id>urn:sha1:86b4ad7d67b26973838b7f1d4428aba9483cb5ce</id>
<content type='text'>
Fix typos in docs and comments.

Link: https://lore.kernel.org/r/20230824193712.542167-11-helgaas@kernel.org
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Randy Dunlap &lt;rdunlap@infradead.org&gt;
Reviewed-by: Ilpo Järvinen &lt;ilpo.jarvinen@linux.intel.com&gt;
</content>
</entry>
</feed>
