]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Jun 2024 13:58:45 +0000 (15:58 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Jun 2024 13:58:45 +0000 (15:58 +0200)
added patches:
ata-ahci-do-not-apply-intel-pcs-quirk-on-intel-alder-lake.patch
ata-libata-core-add-ata_horkage_nolpm-for-amd-radeon-s3-ssd.patch
ata-libata-core-add-ata_horkage_nolpm-for-apacer-as340.patch
ata-libata-core-add-ata_horkage_nolpm-for-crucial-ct240bx500ssd1.patch
dma-buf-handle-testing-kthreads-creation-failure.patch
irqchip-gic-v3-its-fix-potential-race-condition-in-its_vlpi_prop_update.patch
irqchip-sifive-plic-chain-to-parent-irq-after-handlers-are-ready.patch
kheaders-explicitly-define-file-modes-for-archived-headers.patch
locking-atomic-scripts-fix-atomic-_sub_and_test-kerneldoc.patch
null_blk-print-correct-max-open-zones-limit-in-null_init_zoned_dev.patch
perf-auxtrace-fix-multiple-use-of-itrace-option.patch
perf-core-fix-missing-wakeup-when-waiting-for-context-reference.patch
perf-script-show-also-errors-for-insn-trace-option.patch
riscv-fix-overlap-of-allocated-page-and-ptr_err.patch
sock_map-avoid-race-between-sock_map_close-and-sk_psock_put.patch
spmi-hisi-spmi-controller-do-not-override-device-identifier.patch
tracing-add-module_description-to-preemptirq_delay_test.patch
tracing-selftests-fix-kprobe-event-name-test-for-.isra.-functions.patch
vmci-prevent-speculation-leaks-by-sanitizing-event-in-event_deliver.patch
wifi-cfg80211-validate-he-operation-element-parsing.patch
wifi-mt76-mt7615-add-missing-chanctx-ops.patch
wifi-rtlwifi-ignore-ieee80211_conf_change_retry_limits.patch
x86-amd_nb-check-for-invalid-smn-reads.patch
x86-kexec-fix-bug-with-call-depth-tracking.patch

25 files changed:
queue-6.9/ata-ahci-do-not-apply-intel-pcs-quirk-on-intel-alder-lake.patch [new file with mode: 0644]
queue-6.9/ata-libata-core-add-ata_horkage_nolpm-for-amd-radeon-s3-ssd.patch [new file with mode: 0644]
queue-6.9/ata-libata-core-add-ata_horkage_nolpm-for-apacer-as340.patch [new file with mode: 0644]
queue-6.9/ata-libata-core-add-ata_horkage_nolpm-for-crucial-ct240bx500ssd1.patch [new file with mode: 0644]
queue-6.9/dma-buf-handle-testing-kthreads-creation-failure.patch [new file with mode: 0644]
queue-6.9/irqchip-gic-v3-its-fix-potential-race-condition-in-its_vlpi_prop_update.patch [new file with mode: 0644]
queue-6.9/irqchip-sifive-plic-chain-to-parent-irq-after-handlers-are-ready.patch [new file with mode: 0644]
queue-6.9/kheaders-explicitly-define-file-modes-for-archived-headers.patch [new file with mode: 0644]
queue-6.9/locking-atomic-scripts-fix-atomic-_sub_and_test-kerneldoc.patch [new file with mode: 0644]
queue-6.9/null_blk-print-correct-max-open-zones-limit-in-null_init_zoned_dev.patch [new file with mode: 0644]
queue-6.9/perf-auxtrace-fix-multiple-use-of-itrace-option.patch [new file with mode: 0644]
queue-6.9/perf-core-fix-missing-wakeup-when-waiting-for-context-reference.patch [new file with mode: 0644]
queue-6.9/perf-script-show-also-errors-for-insn-trace-option.patch [new file with mode: 0644]
queue-6.9/riscv-fix-overlap-of-allocated-page-and-ptr_err.patch [new file with mode: 0644]
queue-6.9/series
queue-6.9/sock_map-avoid-race-between-sock_map_close-and-sk_psock_put.patch [new file with mode: 0644]
queue-6.9/spmi-hisi-spmi-controller-do-not-override-device-identifier.patch [new file with mode: 0644]
queue-6.9/tracing-add-module_description-to-preemptirq_delay_test.patch [new file with mode: 0644]
queue-6.9/tracing-selftests-fix-kprobe-event-name-test-for-.isra.-functions.patch [new file with mode: 0644]
queue-6.9/vmci-prevent-speculation-leaks-by-sanitizing-event-in-event_deliver.patch [new file with mode: 0644]
queue-6.9/wifi-cfg80211-validate-he-operation-element-parsing.patch [new file with mode: 0644]
queue-6.9/wifi-mt76-mt7615-add-missing-chanctx-ops.patch [new file with mode: 0644]
queue-6.9/wifi-rtlwifi-ignore-ieee80211_conf_change_retry_limits.patch [new file with mode: 0644]
queue-6.9/x86-amd_nb-check-for-invalid-smn-reads.patch [new file with mode: 0644]
queue-6.9/x86-kexec-fix-bug-with-call-depth-tracking.patch [new file with mode: 0644]

diff --git a/queue-6.9/ata-ahci-do-not-apply-intel-pcs-quirk-on-intel-alder-lake.patch b/queue-6.9/ata-ahci-do-not-apply-intel-pcs-quirk-on-intel-alder-lake.patch
new file mode 100644 (file)
index 0000000..98e0cdc
--- /dev/null
@@ -0,0 +1,56 @@
+From 9e2f46cd87473c70d01fcaf8a559809e6d18dd50 Mon Sep 17 00:00:00 2001
+From: Jason Nader <dev@kayoway.com>
+Date: Tue, 21 May 2024 22:36:24 +0900
+Subject: ata: ahci: Do not apply Intel PCS quirk on Intel Alder Lake
+
+From: Jason Nader <dev@kayoway.com>
+
+commit 9e2f46cd87473c70d01fcaf8a559809e6d18dd50 upstream.
+
+Commit b8b8b4e0c052 ("ata: ahci: Add Intel Alder Lake-P AHCI controller
+to low power chipsets list") added Intel Alder Lake to the ahci_pci_tbl.
+
+Because of the way that the Intel PCS quirk was implemented, having
+an explicit entry in the ahci_pci_tbl caused the Intel PCS quirk to
+be applied. (The quirk was not being applied if there was no explict
+entry.)
+
+Thus, entries that were added to the ahci_pci_tbl also got the Intel
+PCS quirk applied.
+
+The quirk was cleaned up in commit 7edbb6059274 ("ahci: clean up
+intel_pcs_quirk"), such that it is clear which entries that actually
+applies the Intel PCS quirk.
+
+Newer Intel AHCI controllers do not need the Intel PCS quirk,
+and applying it when not needed actually breaks some platforms.
+
+Do not apply the Intel PCS quirk for Intel Alder Lake.
+This is in line with how things worked before commit b8b8b4e0c052 ("ata:
+ahci: Add Intel Alder Lake-P AHCI controller to low power chipsets list"),
+such that certain platforms using Intel Alder Lake will work once again.
+
+Cc: stable@vger.kernel.org # 6.7
+Fixes: b8b8b4e0c052 ("ata: ahci: Add Intel Alder Lake-P AHCI controller to low power chipsets list")
+Signed-off-by: Jason Nader <dev@kayoway.com>
+Signed-off-by: Niklas Cassel <cassel@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/ata/ahci.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
+index 6548f10e61d9..07d66d2c5f0d 100644
+--- a/drivers/ata/ahci.c
++++ b/drivers/ata/ahci.c
+@@ -429,7 +429,6 @@ static const struct pci_device_id ahci_pci_tbl[] = {
+       { PCI_VDEVICE(INTEL, 0x02d7), board_ahci_pcs_quirk }, /* Comet Lake PCH RAID */
+       /* Elkhart Lake IDs 0x4b60 & 0x4b62 https://sata-io.org/product/8803 not tested yet */
+       { PCI_VDEVICE(INTEL, 0x4b63), board_ahci_pcs_quirk }, /* Elkhart Lake AHCI */
+-      { PCI_VDEVICE(INTEL, 0x7ae2), board_ahci_pcs_quirk }, /* Alder Lake-P AHCI */
+       /* JMicron 360/1/3/5/6, match class to avoid IDE function */
+       { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
+-- 
+2.45.2
+
diff --git a/queue-6.9/ata-libata-core-add-ata_horkage_nolpm-for-amd-radeon-s3-ssd.patch b/queue-6.9/ata-libata-core-add-ata_horkage_nolpm-for-amd-radeon-s3-ssd.patch
new file mode 100644 (file)
index 0000000..9999415
--- /dev/null
@@ -0,0 +1,58 @@
+From 473880369304cfd4445720cdd8bae4c6f1e16e60 Mon Sep 17 00:00:00 2001
+From: Niklas Cassel <cassel@kernel.org>
+Date: Thu, 30 May 2024 23:32:44 +0200
+Subject: ata: libata-core: Add ATA_HORKAGE_NOLPM for AMD Radeon S3 SSD
+
+From: Niklas Cassel <cassel@kernel.org>
+
+commit 473880369304cfd4445720cdd8bae4c6f1e16e60 upstream.
+
+Commit 7627a0edef54 ("ata: ahci: Drop low power policy board type")
+dropped the board_ahci_low_power board type, and instead enables LPM if:
+-The AHCI controller reports that it supports LPM (Partial/Slumber), and
+-CONFIG_SATA_MOBILE_LPM_POLICY != 0, and
+-The port is not defined as external in the per port PxCMD register, and
+-The port is not defined as hotplug capable in the per port PxCMD
+ register.
+
+Partial and Slumber LPM states can either be initiated by HIPM or DIPM.
+
+For HIPM (host initiated power management) to get enabled, both the AHCI
+controller and the drive have to report that they support HIPM.
+
+For DIPM (device initiated power management) to get enabled, only the
+drive has to report that it supports DIPM. However, the HBA will reject
+device requests to enter LPM states which the HBA does not support.
+
+The problem is that AMD Radeon S3 SSD drives do not handle low power modes
+correctly. The problem was most likely not seen before because no one
+had used this drive with a AHCI controller with LPM enabled.
+
+Add a quirk so that we do not enable LPM for this drive, since we see
+command timeouts if we do (even though the drive claims to support both
+HIPM and DIPM).
+
+Fixes: 7627a0edef54 ("ata: ahci: Drop low power policy board type")
+Cc: stable@vger.kernel.org
+Reported-by: Doru Iorgulescu <doru.iorgulescu1@gmail.com>
+Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218832
+Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
+Signed-off-by: Niklas Cassel <cassel@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/ata/libata-core.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/ata/libata-core.c
++++ b/drivers/ata/libata-core.c
+@@ -4203,6 +4203,9 @@ static const struct ata_blacklist_entry
+       /* Apacer models with LPM issues */
+       { "Apacer AS340*",              NULL,   ATA_HORKAGE_NOLPM },
++      /* AMD Radeon devices with broken LPM support */
++      { "R3SL240G",                   NULL,   ATA_HORKAGE_NOLPM },
++
+       /* These specific Samsung models/firmware-revs do not handle LPM well */
+       { "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_HORKAGE_NOLPM },
+       { "SAMSUNG SSD PM830 mSATA *",  "CXM13D1Q", ATA_HORKAGE_NOLPM },
diff --git a/queue-6.9/ata-libata-core-add-ata_horkage_nolpm-for-apacer-as340.patch b/queue-6.9/ata-libata-core-add-ata_horkage_nolpm-for-apacer-as340.patch
new file mode 100644 (file)
index 0000000..4d9a939
--- /dev/null
@@ -0,0 +1,57 @@
+From 3cb648c4dd3e8dde800fb3659250ed11f2d9efa5 Mon Sep 17 00:00:00 2001
+From: Niklas Cassel <cassel@kernel.org>
+Date: Thu, 30 May 2024 23:27:04 +0200
+Subject: ata: libata-core: Add ATA_HORKAGE_NOLPM for Apacer AS340
+
+From: Niklas Cassel <cassel@kernel.org>
+
+commit 3cb648c4dd3e8dde800fb3659250ed11f2d9efa5 upstream.
+
+Commit 7627a0edef54 ("ata: ahci: Drop low power policy board type")
+dropped the board_ahci_low_power board type, and instead enables LPM if:
+-The AHCI controller reports that it supports LPM (Partial/Slumber), and
+-CONFIG_SATA_MOBILE_LPM_POLICY != 0, and
+-The port is not defined as external in the per port PxCMD register, and
+-The port is not defined as hotplug capable in the per port PxCMD
+ register.
+
+Partial and Slumber LPM states can either be initiated by HIPM or DIPM.
+
+For HIPM (host initiated power management) to get enabled, both the AHCI
+controller and the drive have to report that they support HIPM.
+
+For DIPM (device initiated power management) to get enabled, only the
+drive has to report that it supports DIPM. However, the HBA will reject
+device requests to enter LPM states which the HBA does not support.
+
+The problem is that Apacer AS340 drives do not handle low power modes
+correctly. The problem was most likely not seen before because no one
+had used this drive with a AHCI controller with LPM enabled.
+
+Add a quirk so that we do not enable LPM for this drive, since we see
+command timeouts if we do (even though the drive claims to support DIPM).
+
+Fixes: 7627a0edef54 ("ata: ahci: Drop low power policy board type")
+Cc: stable@vger.kernel.org
+Reported-by: Tim Teichmann <teichmanntim@outlook.de>
+Closes: https://lore.kernel.org/linux-ide/87bk4pbve8.ffs@tglx/
+Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
+Signed-off-by: Niklas Cassel <cassel@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/ata/libata-core.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/ata/libata-core.c
++++ b/drivers/ata/libata-core.c
+@@ -4199,6 +4199,9 @@ static const struct ata_blacklist_entry
+                                               ATA_HORKAGE_ZERO_AFTER_TRIM |
+                                               ATA_HORKAGE_NOLPM },
++      /* Apacer models with LPM issues */
++      { "Apacer AS340*",              NULL,   ATA_HORKAGE_NOLPM },
++
+       /* These specific Samsung models/firmware-revs do not handle LPM well */
+       { "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_HORKAGE_NOLPM },
+       { "SAMSUNG SSD PM830 mSATA *",  "CXM13D1Q", ATA_HORKAGE_NOLPM },
diff --git a/queue-6.9/ata-libata-core-add-ata_horkage_nolpm-for-crucial-ct240bx500ssd1.patch b/queue-6.9/ata-libata-core-add-ata_horkage_nolpm-for-crucial-ct240bx500ssd1.patch
new file mode 100644 (file)
index 0000000..f632de8
--- /dev/null
@@ -0,0 +1,58 @@
+From 86aaa7e9d641c1ad1035ed2df88b8d0b48c86b30 Mon Sep 17 00:00:00 2001
+From: Niklas Cassel <cassel@kernel.org>
+Date: Thu, 30 May 2024 23:28:17 +0200
+Subject: ata: libata-core: Add ATA_HORKAGE_NOLPM for Crucial CT240BX500SSD1
+
+From: Niklas Cassel <cassel@kernel.org>
+
+commit 86aaa7e9d641c1ad1035ed2df88b8d0b48c86b30 upstream.
+
+Commit 7627a0edef54 ("ata: ahci: Drop low power policy board type")
+dropped the board_ahci_low_power board type, and instead enables LPM if:
+-The AHCI controller reports that it supports LPM (Partial/Slumber), and
+-CONFIG_SATA_MOBILE_LPM_POLICY != 0, and
+-The port is not defined as external in the per port PxCMD register, and
+-The port is not defined as hotplug capable in the per port PxCMD
+ register.
+
+Partial and Slumber LPM states can either be initiated by HIPM or DIPM.
+
+For HIPM (host initiated power management) to get enabled, both the AHCI
+controller and the drive have to report that they support HIPM.
+
+For DIPM (device initiated power management) to get enabled, only the
+drive has to report that it supports DIPM. However, the HBA will reject
+device requests to enter LPM states which the HBA does not support.
+
+The problem is that Crucial CT240BX500SSD1 drives do not handle low power
+modes correctly. The problem was most likely not seen before because no
+one had used this drive with a AHCI controller with LPM enabled.
+
+Add a quirk so that we do not enable LPM for this drive, since we see
+command timeouts if we do (even though the drive claims to support DIPM).
+
+Fixes: 7627a0edef54 ("ata: ahci: Drop low power policy board type")
+Cc: stable@vger.kernel.org
+Reported-by: Aarrayy <lp610mh@gmail.com>
+Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218832
+Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
+Signed-off-by: Niklas Cassel <cassel@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/ata/libata-core.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/ata/libata-core.c
++++ b/drivers/ata/libata-core.c
+@@ -4180,8 +4180,9 @@ static const struct ata_blacklist_entry
+       { "PIONEER BD-RW   BDR-207M",   NULL,   ATA_HORKAGE_NOLPM },
+       { "PIONEER BD-RW   BDR-205",    NULL,   ATA_HORKAGE_NOLPM },
+-      /* Crucial BX100 SSD 500GB has broken LPM support */
++      /* Crucial devices with broken LPM support */
+       { "CT500BX100SSD1",             NULL,   ATA_HORKAGE_NOLPM },
++      { "CT240BX500SSD1",             NULL,   ATA_HORKAGE_NOLPM },
+       /* 512GB MX100 with MU01 firmware has both queued TRIM and LPM issues */
+       { "Crucial_CT512MX100*",        "MU01", ATA_HORKAGE_NO_NCQ_TRIM |
diff --git a/queue-6.9/dma-buf-handle-testing-kthreads-creation-failure.patch b/queue-6.9/dma-buf-handle-testing-kthreads-creation-failure.patch
new file mode 100644 (file)
index 0000000..f612921
--- /dev/null
@@ -0,0 +1,44 @@
+From 6cb05d89fd62a76a9b74bd16211fb0930e89fea8 Mon Sep 17 00:00:00 2001
+From: Fedor Pchelkin <pchelkin@ispras.ru>
+Date: Wed, 22 May 2024 21:13:08 +0300
+Subject: dma-buf: handle testing kthreads creation failure
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Fedor Pchelkin <pchelkin@ispras.ru>
+
+commit 6cb05d89fd62a76a9b74bd16211fb0930e89fea8 upstream.
+
+kthread creation may possibly fail inside race_signal_callback(). In
+such a case stop the already started threads, put the already taken
+references to them and return with error code.
+
+Found by Linux Verification Center (linuxtesting.org).
+
+Fixes: 2989f6451084 ("dma-buf: Add selftests for dma-fence")
+Cc: stable@vger.kernel.org
+Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
+Reviewed-by: T.J. Mercier <tjmercier@google.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240522181308.841686-1-pchelkin@ispras.ru
+Signed-off-by: Christian König <christian.koenig@amd.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/dma-buf/st-dma-fence.c |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/dma-buf/st-dma-fence.c
++++ b/drivers/dma-buf/st-dma-fence.c
+@@ -540,6 +540,12 @@ static int race_signal_callback(void *ar
+                       t[i].before = pass;
+                       t[i].task = kthread_run(thread_signal_callback, &t[i],
+                                               "dma-fence:%d", i);
++                      if (IS_ERR(t[i].task)) {
++                              ret = PTR_ERR(t[i].task);
++                              while (--i >= 0)
++                                      kthread_stop_put(t[i].task);
++                              return ret;
++                      }
+                       get_task_struct(t[i].task);
+               }
diff --git a/queue-6.9/irqchip-gic-v3-its-fix-potential-race-condition-in-its_vlpi_prop_update.patch b/queue-6.9/irqchip-gic-v3-its-fix-potential-race-condition-in-its_vlpi_prop_update.patch
new file mode 100644 (file)
index 0000000..1f5c272
--- /dev/null
@@ -0,0 +1,141 @@
+From b97e8a2f7130a4b30d1502003095833d16c028b3 Mon Sep 17 00:00:00 2001
+From: Hagar Hemdan <hagarhem@amazon.com>
+Date: Fri, 31 May 2024 16:21:44 +0000
+Subject: irqchip/gic-v3-its: Fix potential race condition in its_vlpi_prop_update()
+
+From: Hagar Hemdan <hagarhem@amazon.com>
+
+commit b97e8a2f7130a4b30d1502003095833d16c028b3 upstream.
+
+its_vlpi_prop_update() calls lpi_write_config() which obtains the
+mapping information for a VLPI without lock held. So it could race
+with its_vlpi_unmap().
+
+Since all calls from its_irq_set_vcpu_affinity() require the same
+lock to be held, hoist the locking there instead of sprinkling the
+locking all over the place.
+
+This bug was discovered using Coverity Static Analysis Security Testing
+(SAST) by Synopsys, Inc.
+
+[ tglx: Use guard() instead of goto ]
+
+Fixes: 015ec0386ab6 ("irqchip/gic-v3-its: Add VLPI configuration handling")
+Suggested-by: Marc Zyngier <maz@kernel.org>
+Signed-off-by: Hagar Hemdan <hagarhem@amazon.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: stable@vger.kernel.org
+Reviewed-by: Marc Zyngier <maz@kernel.org>
+Link: https://lore.kernel.org/r/20240531162144.28650-1-hagarhem@amazon.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/irqchip/irq-gic-v3-its.c |   44 ++++++++++-----------------------------
+ 1 file changed, 12 insertions(+), 32 deletions(-)
+
+--- a/drivers/irqchip/irq-gic-v3-its.c
++++ b/drivers/irqchip/irq-gic-v3-its.c
+@@ -1846,28 +1846,22 @@ static int its_vlpi_map(struct irq_data
+ {
+       struct its_device *its_dev = irq_data_get_irq_chip_data(d);
+       u32 event = its_get_event_id(d);
+-      int ret = 0;
+       if (!info->map)
+               return -EINVAL;
+-      raw_spin_lock(&its_dev->event_map.vlpi_lock);
+-
+       if (!its_dev->event_map.vm) {
+               struct its_vlpi_map *maps;
+               maps = kcalloc(its_dev->event_map.nr_lpis, sizeof(*maps),
+                              GFP_ATOMIC);
+-              if (!maps) {
+-                      ret = -ENOMEM;
+-                      goto out;
+-              }
++              if (!maps)
++                      return -ENOMEM;
+               its_dev->event_map.vm = info->map->vm;
+               its_dev->event_map.vlpi_maps = maps;
+       } else if (its_dev->event_map.vm != info->map->vm) {
+-              ret = -EINVAL;
+-              goto out;
++              return -EINVAL;
+       }
+       /* Get our private copy of the mapping information */
+@@ -1899,46 +1893,32 @@ static int its_vlpi_map(struct irq_data
+               its_dev->event_map.nr_vlpis++;
+       }
+-out:
+-      raw_spin_unlock(&its_dev->event_map.vlpi_lock);
+-      return ret;
++      return 0;
+ }
+ static int its_vlpi_get(struct irq_data *d, struct its_cmd_info *info)
+ {
+       struct its_device *its_dev = irq_data_get_irq_chip_data(d);
+       struct its_vlpi_map *map;
+-      int ret = 0;
+-
+-      raw_spin_lock(&its_dev->event_map.vlpi_lock);
+       map = get_vlpi_map(d);
+-      if (!its_dev->event_map.vm || !map) {
+-              ret = -EINVAL;
+-              goto out;
+-      }
++      if (!its_dev->event_map.vm || !map)
++              return -EINVAL;
+       /* Copy our mapping information to the incoming request */
+       *info->map = *map;
+-out:
+-      raw_spin_unlock(&its_dev->event_map.vlpi_lock);
+-      return ret;
++      return 0;
+ }
+ static int its_vlpi_unmap(struct irq_data *d)
+ {
+       struct its_device *its_dev = irq_data_get_irq_chip_data(d);
+       u32 event = its_get_event_id(d);
+-      int ret = 0;
+-      raw_spin_lock(&its_dev->event_map.vlpi_lock);
+-
+-      if (!its_dev->event_map.vm || !irqd_is_forwarded_to_vcpu(d)) {
+-              ret = -EINVAL;
+-              goto out;
+-      }
++      if (!its_dev->event_map.vm || !irqd_is_forwarded_to_vcpu(d))
++              return -EINVAL;
+       /* Drop the virtual mapping */
+       its_send_discard(its_dev, event);
+@@ -1962,9 +1942,7 @@ static int its_vlpi_unmap(struct irq_dat
+               kfree(its_dev->event_map.vlpi_maps);
+       }
+-out:
+-      raw_spin_unlock(&its_dev->event_map.vlpi_lock);
+-      return ret;
++      return 0;
+ }
+ static int its_vlpi_prop_update(struct irq_data *d, struct its_cmd_info *info)
+@@ -1992,6 +1970,8 @@ static int its_irq_set_vcpu_affinity(str
+       if (!is_v4(its_dev->its))
+               return -EINVAL;
++      guard(raw_spinlock_irq)(&its_dev->event_map.vlpi_lock);
++
+       /* Unmap request? */
+       if (!info)
+               return its_vlpi_unmap(d);
diff --git a/queue-6.9/irqchip-sifive-plic-chain-to-parent-irq-after-handlers-are-ready.patch b/queue-6.9/irqchip-sifive-plic-chain-to-parent-irq-after-handlers-are-ready.patch
new file mode 100644 (file)
index 0000000..81b5e40
--- /dev/null
@@ -0,0 +1,113 @@
+From e306a894bd511804ba9db7c00ca9cc05b55df1f2 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel.holland@sifive.com>
+Date: Wed, 29 May 2024 14:54:56 -0700
+Subject: irqchip/sifive-plic: Chain to parent IRQ after handlers are ready
+
+From: Samuel Holland <samuel.holland@sifive.com>
+
+commit e306a894bd511804ba9db7c00ca9cc05b55df1f2 upstream.
+
+Now that the PLIC uses a platform driver, the driver is probed later in the
+boot process, where interrupts from peripherals might already be pending.
+
+As a result, plic_handle_irq() may be called as early as the call to
+irq_set_chained_handler() completes. But this call happens before the
+per-context handler is completely set up, so there is a window where
+plic_handle_irq() can see incomplete per-context state and crash.
+
+Avoid this by delaying the call to irq_set_chained_handler() until all
+handlers from all PLICs are initialized.
+
+Fixes: 8ec99b033147 ("irqchip/sifive-plic: Convert PLIC driver into a platform driver")
+Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Reviewed-by: Anup Patel <anup@brainfault.org>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240529215458.937817-1-samuel.holland@sifive.com
+Closes: https://lore.kernel.org/r/CAMuHMdVYFFR7K5SbHBLY-JHhb7YpgGMS_hnRWm8H0KD-wBo+4A@mail.gmail.com/
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/irqchip/irq-sifive-plic.c |   34 +++++++++++++++++-----------------
+ 1 file changed, 17 insertions(+), 17 deletions(-)
+
+--- a/drivers/irqchip/irq-sifive-plic.c
++++ b/drivers/irqchip/irq-sifive-plic.c
+@@ -85,7 +85,7 @@ struct plic_handler {
+       struct plic_priv        *priv;
+ };
+ static int plic_parent_irq __ro_after_init;
+-static bool plic_cpuhp_setup_done __ro_after_init;
++static bool plic_global_setup_done __ro_after_init;
+ static DEFINE_PER_CPU(struct plic_handler, plic_handlers);
+ static int plic_irq_set_type(struct irq_data *d, unsigned int type);
+@@ -490,10 +490,8 @@ static int plic_probe(struct platform_de
+       unsigned long plic_quirks = 0;
+       struct plic_handler *handler;
+       u32 nr_irqs, parent_hwirq;
+-      struct irq_domain *domain;
+       struct plic_priv *priv;
+       irq_hw_number_t hwirq;
+-      bool cpuhp_setup;
+       if (is_of_node(dev->fwnode)) {
+               const struct of_device_id *id;
+@@ -552,14 +550,6 @@ static int plic_probe(struct platform_de
+                       continue;
+               }
+-              /* Find parent domain and register chained handler */
+-              domain = irq_find_matching_fwnode(riscv_get_intc_hwnode(), DOMAIN_BUS_ANY);
+-              if (!plic_parent_irq && domain) {
+-                      plic_parent_irq = irq_create_mapping(domain, RV_IRQ_EXT);
+-                      if (plic_parent_irq)
+-                              irq_set_chained_handler(plic_parent_irq, plic_handle_irq);
+-              }
+-
+               /*
+                * When running in M-mode we need to ignore the S-mode handler.
+                * Here we assume it always comes later, but that might be a
+@@ -600,25 +590,35 @@ done:
+               goto fail_cleanup_contexts;
+       /*
+-       * We can have multiple PLIC instances so setup cpuhp state
++       * We can have multiple PLIC instances so setup global state
+        * and register syscore operations only once after context
+        * handlers of all online CPUs are initialized.
+        */
+-      if (!plic_cpuhp_setup_done) {
+-              cpuhp_setup = true;
++      if (!plic_global_setup_done) {
++              struct irq_domain *domain;
++              bool global_setup = true;
++
+               for_each_online_cpu(cpu) {
+                       handler = per_cpu_ptr(&plic_handlers, cpu);
+                       if (!handler->present) {
+-                              cpuhp_setup = false;
++                              global_setup = false;
+                               break;
+                       }
+               }
+-              if (cpuhp_setup) {
++
++              if (global_setup) {
++                      /* Find parent domain and register chained handler */
++                      domain = irq_find_matching_fwnode(riscv_get_intc_hwnode(), DOMAIN_BUS_ANY);
++                      if (domain)
++                              plic_parent_irq = irq_create_mapping(domain, RV_IRQ_EXT);
++                      if (plic_parent_irq)
++                              irq_set_chained_handler(plic_parent_irq, plic_handle_irq);
++
+                       cpuhp_setup_state(CPUHP_AP_IRQ_SIFIVE_PLIC_STARTING,
+                                         "irqchip/sifive/plic:starting",
+                                         plic_starting_cpu, plic_dying_cpu);
+                       register_syscore_ops(&plic_irq_syscore_ops);
+-                      plic_cpuhp_setup_done = true;
++                      plic_global_setup_done = true;
+               }
+       }
diff --git a/queue-6.9/kheaders-explicitly-define-file-modes-for-archived-headers.patch b/queue-6.9/kheaders-explicitly-define-file-modes-for-archived-headers.patch
new file mode 100644 (file)
index 0000000..6c22c09
--- /dev/null
@@ -0,0 +1,37 @@
+From 3bd27a847a3a4827a948387cc8f0dbc9fa5931d5 Mon Sep 17 00:00:00 2001
+From: Matthias Maennich <maennich@google.com>
+Date: Tue, 28 May 2024 11:32:43 +0000
+Subject: kheaders: explicitly define file modes for archived headers
+
+From: Matthias Maennich <maennich@google.com>
+
+commit 3bd27a847a3a4827a948387cc8f0dbc9fa5931d5 upstream.
+
+Build environments might be running with different umask settings
+resulting in indeterministic file modes for the files contained in
+kheaders.tar.xz. The file itself is served with 444, i.e. world
+readable. Archive the files explicitly with 744,a+X to improve
+reproducibility across build environments.
+
+--mode=0444 is not suitable as directories need to be executable. Also,
+444 makes it hard to delete all the readonly files after extraction.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Matthias Maennich <maennich@google.com>
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/gen_kheaders.sh |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/kernel/gen_kheaders.sh
++++ b/kernel/gen_kheaders.sh
+@@ -89,7 +89,7 @@ find $cpio_dir -type f -print0 |
+ # Create archive and try to normalize metadata for reproducibility.
+ tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \
+-    --owner=0 --group=0 --sort=name --numeric-owner \
++    --owner=0 --group=0 --sort=name --numeric-owner --mode=u=rw,go=r,a+X \
+     -I $XZ -cf $tarfile -C $cpio_dir/ . > /dev/null
+ echo $headers_md5 > kernel/kheaders.md5
diff --git a/queue-6.9/locking-atomic-scripts-fix-atomic-_sub_and_test-kerneldoc.patch b/queue-6.9/locking-atomic-scripts-fix-atomic-_sub_and_test-kerneldoc.patch
new file mode 100644 (file)
index 0000000..0427023
--- /dev/null
@@ -0,0 +1,118 @@
+From f92a59f6d12e31ead999fee9585471b95a8ae8a3 Mon Sep 17 00:00:00 2001
+From: Carlos Llamas <cmllamas@google.com>
+Date: Wed, 15 May 2024 13:37:10 +0000
+Subject: locking/atomic: scripts: fix ${atomic}_sub_and_test() kerneldoc
+
+From: Carlos Llamas <cmllamas@google.com>
+
+commit f92a59f6d12e31ead999fee9585471b95a8ae8a3 upstream.
+
+For ${atomic}_sub_and_test() the @i parameter is the value to subtract,
+not add. Fix the typo in the kerneldoc template and generate the headers
+with this update.
+
+Fixes: ad8110706f38 ("locking/atomic: scripts: generate kerneldoc comments")
+Suggested-by: Mark Rutland <mark.rutland@arm.com>
+Signed-off-by: Carlos Llamas <cmllamas@google.com>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Acked-by: Mark Rutland <mark.rutland@arm.com>
+Reviewed-by: Kees Cook <keescook@chromium.org>
+Cc: stable@vger.kernel.org
+Link: https://lkml.kernel.org/r/20240515133844.3502360-1-cmllamas@google.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/atomic/atomic-arch-fallback.h |    6 +++---
+ include/linux/atomic/atomic-instrumented.h  |    8 ++++----
+ include/linux/atomic/atomic-long.h          |    4 ++--
+ scripts/atomic/kerneldoc/sub_and_test       |    2 +-
+ 4 files changed, 10 insertions(+), 10 deletions(-)
+
+--- a/include/linux/atomic/atomic-arch-fallback.h
++++ b/include/linux/atomic/atomic-arch-fallback.h
+@@ -2242,7 +2242,7 @@ raw_atomic_try_cmpxchg_relaxed(atomic_t
+ /**
+  * raw_atomic_sub_and_test() - atomic subtract and test if zero with full ordering
+- * @i: int value to add
++ * @i: int value to subtract
+  * @v: pointer to atomic_t
+  *
+  * Atomically updates @v to (@v - @i) with full ordering.
+@@ -4368,7 +4368,7 @@ raw_atomic64_try_cmpxchg_relaxed(atomic6
+ /**
+  * raw_atomic64_sub_and_test() - atomic subtract and test if zero with full ordering
+- * @i: s64 value to add
++ * @i: s64 value to subtract
+  * @v: pointer to atomic64_t
+  *
+  * Atomically updates @v to (@v - @i) with full ordering.
+@@ -4690,4 +4690,4 @@ raw_atomic64_dec_if_positive(atomic64_t
+ }
+ #endif /* _LINUX_ATOMIC_FALLBACK_H */
+-// 14850c0b0db20c62fdc78ccd1d42b98b88d76331
++// b565db590afeeff0d7c9485ccbca5bb6e155749f
+--- a/include/linux/atomic/atomic-instrumented.h
++++ b/include/linux/atomic/atomic-instrumented.h
+@@ -1349,7 +1349,7 @@ atomic_try_cmpxchg_relaxed(atomic_t *v,
+ /**
+  * atomic_sub_and_test() - atomic subtract and test if zero with full ordering
+- * @i: int value to add
++ * @i: int value to subtract
+  * @v: pointer to atomic_t
+  *
+  * Atomically updates @v to (@v - @i) with full ordering.
+@@ -2927,7 +2927,7 @@ atomic64_try_cmpxchg_relaxed(atomic64_t
+ /**
+  * atomic64_sub_and_test() - atomic subtract and test if zero with full ordering
+- * @i: s64 value to add
++ * @i: s64 value to subtract
+  * @v: pointer to atomic64_t
+  *
+  * Atomically updates @v to (@v - @i) with full ordering.
+@@ -4505,7 +4505,7 @@ atomic_long_try_cmpxchg_relaxed(atomic_l
+ /**
+  * atomic_long_sub_and_test() - atomic subtract and test if zero with full ordering
+- * @i: long value to add
++ * @i: long value to subtract
+  * @v: pointer to atomic_long_t
+  *
+  * Atomically updates @v to (@v - @i) with full ordering.
+@@ -5050,4 +5050,4 @@ atomic_long_dec_if_positive(atomic_long_
+ #endif /* _LINUX_ATOMIC_INSTRUMENTED_H */
+-// ce5b65e0f1f8a276268b667194581d24bed219d4
++// 8829b337928e9508259079d32581775ececd415b
+--- a/include/linux/atomic/atomic-long.h
++++ b/include/linux/atomic/atomic-long.h
+@@ -1535,7 +1535,7 @@ raw_atomic_long_try_cmpxchg_relaxed(atom
+ /**
+  * raw_atomic_long_sub_and_test() - atomic subtract and test if zero with full ordering
+- * @i: long value to add
++ * @i: long value to subtract
+  * @v: pointer to atomic_long_t
+  *
+  * Atomically updates @v to (@v - @i) with full ordering.
+@@ -1809,4 +1809,4 @@ raw_atomic_long_dec_if_positive(atomic_l
+ }
+ #endif /* _LINUX_ATOMIC_LONG_H */
+-// 1c4a26fc77f345342953770ebe3c4d08e7ce2f9a
++// eadf183c3600b8b92b91839dd3be6bcc560c752d
+--- a/scripts/atomic/kerneldoc/sub_and_test
++++ b/scripts/atomic/kerneldoc/sub_and_test
+@@ -1,7 +1,7 @@
+ cat <<EOF
+ /**
+  * ${class}${atomicname}() - atomic subtract and test if zero with ${desc_order} ordering
+- * @i: ${int} value to add
++ * @i: ${int} value to subtract
+  * @v: pointer to ${atomic}_t
+  *
+  * Atomically updates @v to (@v - @i) with ${desc_order} ordering.
diff --git a/queue-6.9/null_blk-print-correct-max-open-zones-limit-in-null_init_zoned_dev.patch b/queue-6.9/null_blk-print-correct-max-open-zones-limit-in-null_init_zoned_dev.patch
new file mode 100644 (file)
index 0000000..37a006e
--- /dev/null
@@ -0,0 +1,34 @@
+From 233e27b4d21c3e44eb863f03e566d3a22e81a7ae Mon Sep 17 00:00:00 2001
+From: Damien Le Moal <dlemoal@kernel.org>
+Date: Tue, 28 May 2024 15:28:52 +0900
+Subject: null_blk: Print correct max open zones limit in null_init_zoned_dev()
+
+From: Damien Le Moal <dlemoal@kernel.org>
+
+commit 233e27b4d21c3e44eb863f03e566d3a22e81a7ae upstream.
+
+When changing the maximum number of open zones, print that number
+instead of the total number of zones.
+
+Fixes: dc4d137ee3b7 ("null_blk: add support for max open/active zone limit for zoned devices")
+Cc: stable@vger.kernel.org
+Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
+Reviewed-by: Niklas Cassel <cassel@kernel.org>
+Link: https://lore.kernel.org/r/20240528062852.437599-1-dlemoal@kernel.org
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/block/null_blk/zoned.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/block/null_blk/zoned.c
++++ b/drivers/block/null_blk/zoned.c
+@@ -113,7 +113,7 @@ int null_init_zoned_dev(struct nullb_dev
+       if (dev->zone_max_active && dev->zone_max_open > dev->zone_max_active) {
+               dev->zone_max_open = dev->zone_max_active;
+               pr_info("changed the maximum number of open zones to %u\n",
+-                      dev->nr_zones);
++                      dev->zone_max_open);
+       } else if (dev->zone_max_open >= dev->nr_zones - dev->zone_nr_conv) {
+               dev->zone_max_open = 0;
+               pr_info("zone_max_open limit disabled, limit >= zone count\n");
diff --git a/queue-6.9/perf-auxtrace-fix-multiple-use-of-itrace-option.patch b/queue-6.9/perf-auxtrace-fix-multiple-use-of-itrace-option.patch
new file mode 100644 (file)
index 0000000..8932293
--- /dev/null
@@ -0,0 +1,66 @@
+From bb69c912c4e8005cf1ee6c63782d2fc28838dee2 Mon Sep 17 00:00:00 2001
+From: Adrian Hunter <adrian.hunter@intel.com>
+Date: Fri, 15 Mar 2024 09:13:34 +0200
+Subject: perf auxtrace: Fix multiple use of --itrace option
+
+From: Adrian Hunter <adrian.hunter@intel.com>
+
+commit bb69c912c4e8005cf1ee6c63782d2fc28838dee2 upstream.
+
+If the --itrace option is used more than once, the options are
+combined, but "i" and "y" (sub-)options can be corrupted because
+itrace_do_parse_synth_opts() incorrectly overwrites the period type and
+period with default values.
+
+For example, with:
+
+       --itrace=i0ns --itrace=e
+
+The processing of "--itrace=e", resets the "i" period from 0 nanoseconds
+to the default 100 microseconds.
+
+Fix by performing the default setting of period type and period only if
+"i" or "y" are present in the currently processed --itrace value.
+
+Fixes: f6986c95af84ff2a ("perf session: Add instruction tracing options")
+Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
+Cc: Adrian Hunter <adrian.hunter@intel.com>
+Cc: Andi Kleen <ak@linux.intel.com>
+Cc: Ian Rogers <irogers@google.com>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240315071334.3478-2-adrian.hunter@intel.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/perf/util/auxtrace.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/tools/perf/util/auxtrace.c
++++ b/tools/perf/util/auxtrace.c
+@@ -1466,6 +1466,7 @@ int itrace_do_parse_synth_opts(struct it
+       char *endptr;
+       bool period_type_set = false;
+       bool period_set = false;
++      bool iy = false;
+       synth_opts->set = true;
+@@ -1484,6 +1485,7 @@ int itrace_do_parse_synth_opts(struct it
+               switch (*p++) {
+               case 'i':
+               case 'y':
++                      iy = true;
+                       if (p[-1] == 'y')
+                               synth_opts->cycles = true;
+                       else
+@@ -1649,7 +1651,7 @@ int itrace_do_parse_synth_opts(struct it
+               }
+       }
+ out:
+-      if (synth_opts->instructions || synth_opts->cycles) {
++      if (iy) {
+               if (!period_type_set)
+                       synth_opts->period_type =
+                                       PERF_ITRACE_DEFAULT_PERIOD_TYPE;
diff --git a/queue-6.9/perf-core-fix-missing-wakeup-when-waiting-for-context-reference.patch b/queue-6.9/perf-core-fix-missing-wakeup-when-waiting-for-context-reference.patch
new file mode 100644 (file)
index 0000000..08fe5ee
--- /dev/null
@@ -0,0 +1,106 @@
+From 74751ef5c1912ebd3e65c3b65f45587e05ce5d36 Mon Sep 17 00:00:00 2001
+From: Haifeng Xu <haifeng.xu@shopee.com>
+Date: Mon, 13 May 2024 10:39:48 +0000
+Subject: perf/core: Fix missing wakeup when waiting for context reference
+
+From: Haifeng Xu <haifeng.xu@shopee.com>
+
+commit 74751ef5c1912ebd3e65c3b65f45587e05ce5d36 upstream.
+
+In our production environment, we found many hung tasks which are
+blocked for more than 18 hours. Their call traces are like this:
+
+[346278.191038] __schedule+0x2d8/0x890
+[346278.191046] schedule+0x4e/0xb0
+[346278.191049] perf_event_free_task+0x220/0x270
+[346278.191056] ? init_wait_var_entry+0x50/0x50
+[346278.191060] copy_process+0x663/0x18d0
+[346278.191068] kernel_clone+0x9d/0x3d0
+[346278.191072] __do_sys_clone+0x5d/0x80
+[346278.191076] __x64_sys_clone+0x25/0x30
+[346278.191079] do_syscall_64+0x5c/0xc0
+[346278.191083] ? syscall_exit_to_user_mode+0x27/0x50
+[346278.191086] ? do_syscall_64+0x69/0xc0
+[346278.191088] ? irqentry_exit_to_user_mode+0x9/0x20
+[346278.191092] ? irqentry_exit+0x19/0x30
+[346278.191095] ? exc_page_fault+0x89/0x160
+[346278.191097] ? asm_exc_page_fault+0x8/0x30
+[346278.191102] entry_SYSCALL_64_after_hwframe+0x44/0xae
+
+The task was waiting for the refcount become to 1, but from the vmcore,
+we found the refcount has already been 1. It seems that the task didn't
+get woken up by perf_event_release_kernel() and got stuck forever. The
+below scenario may cause the problem.
+
+Thread A                                       Thread B
+...                                            ...
+perf_event_free_task                           perf_event_release_kernel
+                                                  ...
+                                                  acquire event->child_mutex
+                                                  ...
+                                                  get_ctx
+   ...                                            release event->child_mutex
+   acquire ctx->mutex
+   ...
+   perf_free_event (acquire/release event->child_mutex)
+   ...
+   release ctx->mutex
+   wait_var_event
+                                                  acquire ctx->mutex
+                                                  acquire event->child_mutex
+                                                  # move existing events to free_list
+                                                  release event->child_mutex
+                                                  release ctx->mutex
+                                                  put_ctx
+...                                            ...
+
+In this case, all events of the ctx have been freed, so we couldn't
+find the ctx in free_list and Thread A will miss the wakeup. It's thus
+necessary to add a wakeup after dropping the reference.
+
+Fixes: 1cf8dfe8a661 ("perf/core: Fix race between close() and fork()")
+Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
+Acked-by: Mark Rutland <mark.rutland@arm.com>
+Cc: stable@vger.kernel.org
+Link: https://lkml.kernel.org/r/20240513103948.33570-1-haifeng.xu@shopee.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/events/core.c |   13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+--- a/kernel/events/core.c
++++ b/kernel/events/core.c
+@@ -5365,6 +5365,7 @@ int perf_event_release_kernel(struct per
+ again:
+       mutex_lock(&event->child_mutex);
+       list_for_each_entry(child, &event->child_list, child_list) {
++              void *var = NULL;
+               /*
+                * Cannot change, child events are not migrated, see the
+@@ -5405,11 +5406,23 @@ again:
+                        * this can't be the last reference.
+                        */
+                       put_event(event);
++              } else {
++                      var = &ctx->refcount;
+               }
+               mutex_unlock(&event->child_mutex);
+               mutex_unlock(&ctx->mutex);
+               put_ctx(ctx);
++
++              if (var) {
++                      /*
++                       * If perf_event_free_task() has deleted all events from the
++                       * ctx while the child_mutex got released above, make sure to
++                       * notify about the preceding put_ctx().
++                       */
++                      smp_mb(); /* pairs with wait_var_event() */
++                      wake_up_var(var);
++              }
+               goto again;
+       }
+       mutex_unlock(&event->child_mutex);
diff --git a/queue-6.9/perf-script-show-also-errors-for-insn-trace-option.patch b/queue-6.9/perf-script-show-also-errors-for-insn-trace-option.patch
new file mode 100644 (file)
index 0000000..36b1e32
--- /dev/null
@@ -0,0 +1,41 @@
+From d4a98b45fbe6d06f4b79ed90d0bb05ced8674c23 Mon Sep 17 00:00:00 2001
+From: Adrian Hunter <adrian.hunter@intel.com>
+Date: Fri, 15 Mar 2024 09:13:33 +0200
+Subject: perf script: Show also errors for --insn-trace option
+
+From: Adrian Hunter <adrian.hunter@intel.com>
+
+commit d4a98b45fbe6d06f4b79ed90d0bb05ced8674c23 upstream.
+
+The trace could be misleading if trace errors are not taken into
+account, so display them also by adding the itrace "e" option.
+
+Note --call-trace and --call-ret-trace already add the itrace "e"
+option.
+
+Fixes: b585ebdb5912cf14 ("perf script: Add --insn-trace for instruction decoding")
+Reviewed-by: Andi Kleen <ak@linux.intel.com>
+Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
+Cc: Andi Kleen <ak@linux.intel.com>
+Cc: Ian Rogers <irogers@google.com>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240315071334.3478-1-adrian.hunter@intel.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/perf/builtin-script.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/tools/perf/builtin-script.c
++++ b/tools/perf/builtin-script.c
+@@ -3806,7 +3806,7 @@ static int parse_insn_trace(const struct
+       if (ret < 0)
+               return ret;
+-      itrace_parse_synth_opts(opt, "i0ns", 0);
++      itrace_parse_synth_opts(opt, "i0nse", 0);
+       symbol_conf.nanosecs = true;
+       return 0;
+ }
diff --git a/queue-6.9/riscv-fix-overlap-of-allocated-page-and-ptr_err.patch b/queue-6.9/riscv-fix-overlap-of-allocated-page-and-ptr_err.patch
new file mode 100644 (file)
index 0000000..ffe3272
--- /dev/null
@@ -0,0 +1,69 @@
+From 994af1825a2aa286f4903ff64a1c7378b52defe6 Mon Sep 17 00:00:00 2001
+From: Nam Cao <namcao@linutronix.de>
+Date: Thu, 25 Apr 2024 13:52:01 +0200
+Subject: riscv: fix overlap of allocated page and PTR_ERR
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Nam Cao <namcao@linutronix.de>
+
+commit 994af1825a2aa286f4903ff64a1c7378b52defe6 upstream.
+
+On riscv32, it is possible for the last page in virtual address space
+(0xfffff000) to be allocated. This page overlaps with PTR_ERR, so that
+shouldn't happen.
+
+There is already some code to ensure memblock won't allocate the last page.
+However, buddy allocator is left unchecked.
+
+Fix this by reserving physical memory that would be mapped at virtual
+addresses greater than 0xfffff000.
+
+Reported-by: Björn Töpel <bjorn@kernel.org>
+Closes: https://lore.kernel.org/linux-riscv/878r1ibpdn.fsf@all.your.base.are.belong.to.us
+Fixes: 76d2a0493a17 ("RISC-V: Init and Halt Code")
+Signed-off-by: Nam Cao <namcao@linutronix.de>
+Cc: <stable@vger.kernel.org>
+Tested-by: Björn Töpel <bjorn@rivosinc.com>
+Reviewed-by: Björn Töpel <bjorn@rivosinc.com>
+Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
+Link: https://lore.kernel.org/r/20240425115201.3044202-1-namcao@linutronix.de
+Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/riscv/mm/init.c |   21 +++++++++++----------
+ 1 file changed, 11 insertions(+), 10 deletions(-)
+
+--- a/arch/riscv/mm/init.c
++++ b/arch/riscv/mm/init.c
+@@ -235,18 +235,19 @@ static void __init setup_bootmem(void)
+               kernel_map.va_pa_offset = PAGE_OFFSET - phys_ram_base;
+       /*
+-       * memblock allocator is not aware of the fact that last 4K bytes of
+-       * the addressable memory can not be mapped because of IS_ERR_VALUE
+-       * macro. Make sure that last 4k bytes are not usable by memblock
+-       * if end of dram is equal to maximum addressable memory.  For 64-bit
+-       * kernel, this problem can't happen here as the end of the virtual
+-       * address space is occupied by the kernel mapping then this check must
+-       * be done as soon as the kernel mapping base address is determined.
++       * Reserve physical address space that would be mapped to virtual
++       * addresses greater than (void *)(-PAGE_SIZE) because:
++       *  - This memory would overlap with ERR_PTR
++       *  - This memory belongs to high memory, which is not supported
++       *
++       * This is not applicable to 64-bit kernel, because virtual addresses
++       * after (void *)(-PAGE_SIZE) are not linearly mapped: they are
++       * occupied by kernel mapping. Also it is unrealistic for high memory
++       * to exist on 64-bit platforms.
+        */
+       if (!IS_ENABLED(CONFIG_64BIT)) {
+-              max_mapped_addr = __pa(~(ulong)0);
+-              if (max_mapped_addr == (phys_ram_end - 1))
+-                      memblock_set_current_limit(max_mapped_addr - 4096);
++              max_mapped_addr = __va_to_pa_nodebug(-PAGE_SIZE);
++              memblock_reserve(max_mapped_addr, (phys_addr_t)-max_mapped_addr);
+       }
+       min_low_pfn = PFN_UP(phys_ram_base);
index 4dd0fd3df21d11b568219ad6cfcffc50c97136f3..ef4a316ac67a511e218d5e243ac04088bc107977 100644 (file)
@@ -217,3 +217,27 @@ drm-exynos-hdmi-report-safe-640x480-mode-as-a-fallback-when-no-edid-found.patch
 mptcp-ensure-snd_una-is-properly-initialized-on-connect.patch
 mptcp-pm-inc-rmaddr-mib-counter-once-per-rm_addr-id.patch
 mptcp-pm-update-add_addr-counters-after-connect.patch
+irqchip-sifive-plic-chain-to-parent-irq-after-handlers-are-ready.patch
+irqchip-gic-v3-its-fix-potential-race-condition-in-its_vlpi_prop_update.patch
+x86-kexec-fix-bug-with-call-depth-tracking.patch
+x86-amd_nb-check-for-invalid-smn-reads.patch
+perf-core-fix-missing-wakeup-when-waiting-for-context-reference.patch
+perf-auxtrace-fix-multiple-use-of-itrace-option.patch
+perf-script-show-also-errors-for-insn-trace-option.patch
+wifi-cfg80211-validate-he-operation-element-parsing.patch
+wifi-rtlwifi-ignore-ieee80211_conf_change_retry_limits.patch
+wifi-mt76-mt7615-add-missing-chanctx-ops.patch
+locking-atomic-scripts-fix-atomic-_sub_and_test-kerneldoc.patch
+riscv-fix-overlap-of-allocated-page-and-ptr_err.patch
+tracing-selftests-fix-kprobe-event-name-test-for-.isra.-functions.patch
+kheaders-explicitly-define-file-modes-for-archived-headers.patch
+null_blk-print-correct-max-open-zones-limit-in-null_init_zoned_dev.patch
+ata-ahci-do-not-apply-intel-pcs-quirk-on-intel-alder-lake.patch
+ata-libata-core-add-ata_horkage_nolpm-for-apacer-as340.patch
+ata-libata-core-add-ata_horkage_nolpm-for-crucial-ct240bx500ssd1.patch
+ata-libata-core-add-ata_horkage_nolpm-for-amd-radeon-s3-ssd.patch
+sock_map-avoid-race-between-sock_map_close-and-sk_psock_put.patch
+dma-buf-handle-testing-kthreads-creation-failure.patch
+tracing-add-module_description-to-preemptirq_delay_test.patch
+vmci-prevent-speculation-leaks-by-sanitizing-event-in-event_deliver.patch
+spmi-hisi-spmi-controller-do-not-override-device-identifier.patch
diff --git a/queue-6.9/sock_map-avoid-race-between-sock_map_close-and-sk_psock_put.patch b/queue-6.9/sock_map-avoid-race-between-sock_map_close-and-sk_psock_put.patch
new file mode 100644 (file)
index 0000000..53f4a64
--- /dev/null
@@ -0,0 +1,115 @@
+From 4b4647add7d3c8530493f7247d11e257ee425bf0 Mon Sep 17 00:00:00 2001
+From: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
+Date: Fri, 24 May 2024 11:47:02 -0300
+Subject: sock_map: avoid race between sock_map_close and sk_psock_put
+
+From: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
+
+commit 4b4647add7d3c8530493f7247d11e257ee425bf0 upstream.
+
+sk_psock_get will return NULL if the refcount of psock has gone to 0, which
+will happen when the last call of sk_psock_put is done. However,
+sk_psock_drop may not have finished yet, so the close callback will still
+point to sock_map_close despite psock being NULL.
+
+This can be reproduced with a thread deleting an element from the sock map,
+while the second one creates a socket, adds it to the map and closes it.
+
+That will trigger the WARN_ON_ONCE:
+
+------------[ cut here ]------------
+WARNING: CPU: 1 PID: 7220 at net/core/sock_map.c:1701 sock_map_close+0x2a2/0x2d0 net/core/sock_map.c:1701
+Modules linked in:
+CPU: 1 PID: 7220 Comm: syz-executor380 Not tainted 6.9.0-syzkaller-07726-g3c999d1ae3c7 #0
+Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
+RIP: 0010:sock_map_close+0x2a2/0x2d0 net/core/sock_map.c:1701
+Code: df e8 92 29 88 f8 48 8b 1b 48 89 d8 48 c1 e8 03 42 80 3c 20 00 74 08 48 89 df e8 79 29 88 f8 4c 8b 23 eb 89 e8 4f 15 23 f8 90 <0f> 0b 90 48 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d e9 13 26 3d 02
+RSP: 0018:ffffc9000441fda8 EFLAGS: 00010293
+RAX: ffffffff89731ae1 RBX: ffffffff94b87540 RCX: ffff888029470000
+RDX: 0000000000000000 RSI: ffffffff8bcab5c0 RDI: ffffffff8c1faba0
+RBP: 0000000000000000 R08: ffffffff92f9b61f R09: 1ffffffff25f36c3
+R10: dffffc0000000000 R11: fffffbfff25f36c4 R12: ffffffff89731840
+R13: ffff88804b587000 R14: ffff88804b587000 R15: ffffffff89731870
+FS:  000055555e080380(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
+CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+CR2: 0000000000000000 CR3: 00000000207d4000 CR4: 0000000000350ef0
+Call Trace:
+ <TASK>
+ unix_release+0x87/0xc0 net/unix/af_unix.c:1048
+ __sock_release net/socket.c:659 [inline]
+ sock_close+0xbe/0x240 net/socket.c:1421
+ __fput+0x42b/0x8a0 fs/file_table.c:422
+ __do_sys_close fs/open.c:1556 [inline]
+ __se_sys_close fs/open.c:1541 [inline]
+ __x64_sys_close+0x7f/0x110 fs/open.c:1541
+ do_syscall_x64 arch/x86/entry/common.c:52 [inline]
+ do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83
+ entry_SYSCALL_64_after_hwframe+0x77/0x7f
+RIP: 0033:0x7fb37d618070
+Code: 00 00 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d4 e8 10 2c 00 00 80 3d 31 f0 07 00 00 74 17 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 48 c3 0f 1f 80 00 00 00 00 48 83 ec 18 89 7c
+RSP: 002b:00007ffcd4a525d8 EFLAGS: 00000202 ORIG_RAX: 0000000000000003
+RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007fb37d618070
+RDX: 0000000000000010 RSI: 00000000200001c0 RDI: 0000000000000004
+RBP: 0000000000000000 R08: 0000000100000000 R09: 0000000100000000
+R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000000
+R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
+ </TASK>
+
+Use sk_psock, which will only check that the pointer is not been set to
+NULL yet, which should only happen after the callbacks are restored. If,
+then, a reference can still be gotten, we may call sk_psock_stop and cancel
+psock->work.
+
+As suggested by Paolo Abeni, reorder the condition so the control flow is
+less convoluted.
+
+After that change, the reproducer does not trigger the WARN_ON_ONCE
+anymore.
+
+Suggested-by: Paolo Abeni <pabeni@redhat.com>
+Reported-by: syzbot+07a2e4a1a57118ef7355@syzkaller.appspotmail.com
+Closes: https://syzkaller.appspot.com/bug?extid=07a2e4a1a57118ef7355
+Fixes: aadb2bb83ff7 ("sock_map: Fix a potential use-after-free in sock_map_close()")
+Fixes: 5b4a79ba65a1 ("bpf, sockmap: Don't let sock_map_{close,destroy,unhash} call itself")
+Cc: stable@vger.kernel.org
+Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
+Acked-by: Jakub Sitnicki <jakub@cloudflare.com>
+Link: https://lore.kernel.org/r/20240524144702.1178377-1-cascardo@igalia.com
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/core/sock_map.c |   16 ++++++++++------
+ 1 file changed, 10 insertions(+), 6 deletions(-)
+
+--- a/net/core/sock_map.c
++++ b/net/core/sock_map.c
+@@ -1639,19 +1639,23 @@ void sock_map_close(struct sock *sk, lon
+       lock_sock(sk);
+       rcu_read_lock();
+-      psock = sk_psock_get(sk);
+-      if (unlikely(!psock)) {
+-              rcu_read_unlock();
+-              release_sock(sk);
+-              saved_close = READ_ONCE(sk->sk_prot)->close;
+-      } else {
++      psock = sk_psock(sk);
++      if (likely(psock)) {
+               saved_close = psock->saved_close;
+               sock_map_remove_links(sk, psock);
++              psock = sk_psock_get(sk);
++              if (unlikely(!psock))
++                      goto no_psock;
+               rcu_read_unlock();
+               sk_psock_stop(psock);
+               release_sock(sk);
+               cancel_delayed_work_sync(&psock->work);
+               sk_psock_put(sk, psock);
++      } else {
++              saved_close = READ_ONCE(sk->sk_prot)->close;
++no_psock:
++              rcu_read_unlock();
++              release_sock(sk);
+       }
+       /* Make sure we do not recurse. This is a bug.
diff --git a/queue-6.9/spmi-hisi-spmi-controller-do-not-override-device-identifier.patch b/queue-6.9/spmi-hisi-spmi-controller-do-not-override-device-identifier.patch
new file mode 100644 (file)
index 0000000..a36eef2
--- /dev/null
@@ -0,0 +1,36 @@
+From eda4923d78d634482227c0b189d9b7ca18824146 Mon Sep 17 00:00:00 2001
+From: Vamshi Gajjela <vamshigajjela@google.com>
+Date: Tue, 7 May 2024 14:07:41 -0700
+Subject: spmi: hisi-spmi-controller: Do not override device identifier
+
+From: Vamshi Gajjela <vamshigajjela@google.com>
+
+commit eda4923d78d634482227c0b189d9b7ca18824146 upstream.
+
+'nr' member of struct spmi_controller, which serves as an identifier
+for the controller/bus. This value is a dynamic ID assigned in
+spmi_controller_alloc, and overriding it from the driver results in an
+ida_free error "ida_free called for id=xx which is not allocated".
+
+Signed-off-by: Vamshi Gajjela <vamshigajjela@google.com>
+Fixes: 70f59c90c819 ("staging: spmi: add Hikey 970 SPMI controller driver")
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240228185116.1269-1-vamshigajjela@google.com
+Signed-off-by: Stephen Boyd <sboyd@kernel.org>
+Link: https://lore.kernel.org/r/20240507210809.3479953-5-sboyd@kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/spmi/hisi-spmi-controller.c |    1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/drivers/spmi/hisi-spmi-controller.c
++++ b/drivers/spmi/hisi-spmi-controller.c
+@@ -300,7 +300,6 @@ static int spmi_controller_probe(struct
+       spin_lock_init(&spmi_controller->lock);
+-      ctrl->nr = spmi_controller->channel;
+       ctrl->dev.parent = pdev->dev.parent;
+       ctrl->dev.of_node = of_node_get(pdev->dev.of_node);
diff --git a/queue-6.9/tracing-add-module_description-to-preemptirq_delay_test.patch b/queue-6.9/tracing-add-module_description-to-preemptirq_delay_test.patch
new file mode 100644 (file)
index 0000000..6351460
--- /dev/null
@@ -0,0 +1,34 @@
+From 23748e3e0fbfe471eff5ce439921629f6a427828 Mon Sep 17 00:00:00 2001
+From: Jeff Johnson <quic_jjohnson@quicinc.com>
+Date: Sat, 18 May 2024 15:54:49 -0700
+Subject: tracing: Add MODULE_DESCRIPTION() to preemptirq_delay_test
+
+From: Jeff Johnson <quic_jjohnson@quicinc.com>
+
+commit 23748e3e0fbfe471eff5ce439921629f6a427828 upstream.
+
+Fix the 'make W=1' warning:
+
+WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/trace/preemptirq_delay_test.o
+
+Link: https://lore.kernel.org/linux-trace-kernel/20240518-md-preemptirq_delay_test-v1-1-387d11b30d85@quicinc.com
+
+Cc: stable@vger.kernel.org
+Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+Fixes: f96e8577da10 ("lib: Add module for testing preemptoff/irqsoff latency tracers")
+Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
+Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
+Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/trace/preemptirq_delay_test.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/kernel/trace/preemptirq_delay_test.c
++++ b/kernel/trace/preemptirq_delay_test.c
+@@ -215,4 +215,5 @@ static void __exit preemptirq_delay_exit
+ module_init(preemptirq_delay_init)
+ module_exit(preemptirq_delay_exit)
++MODULE_DESCRIPTION("Preempt / IRQ disable delay thread to test latency tracers");
+ MODULE_LICENSE("GPL v2");
diff --git a/queue-6.9/tracing-selftests-fix-kprobe-event-name-test-for-.isra.-functions.patch b/queue-6.9/tracing-selftests-fix-kprobe-event-name-test-for-.isra.-functions.patch
new file mode 100644 (file)
index 0000000..18c3db0
--- /dev/null
@@ -0,0 +1,50 @@
+From 23a4b108accc29a6125ed14de4a044689ffeda78 Mon Sep 17 00:00:00 2001
+From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
+Date: Mon, 20 May 2024 20:57:37 -0400
+Subject: tracing/selftests: Fix kprobe event name test for .isra. functions
+
+From: Steven Rostedt (Google) <rostedt@goodmis.org>
+
+commit 23a4b108accc29a6125ed14de4a044689ffeda78 upstream.
+
+The kprobe_eventname.tc test checks if a function with .isra. can have a
+kprobe attached to it. It loops through the kallsyms file for all the
+functions that have the .isra. name, and checks if it exists in the
+available_filter_functions file, and if it does, it uses it to attach a
+kprobe to it.
+
+The issue is that kprobes can not attach to functions that are listed more
+than once in available_filter_functions. With the latest kernel, the
+function that is found is: rapl_event_update.isra.0
+
+  # grep rapl_event_update.isra.0 /sys/kernel/tracing/available_filter_functions
+  rapl_event_update.isra.0
+  rapl_event_update.isra.0
+
+It is listed twice. This causes the attached kprobe to it to fail which in
+turn fails the test. Instead of just picking the function function that is
+found in available_filter_functions, pick the first one that is listed
+only once in available_filter_functions.
+
+Cc: stable@vger.kernel.org
+Fixes: 604e3548236d ("selftests/ftrace: Select an existing function in kprobe_eventname test")
+Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
+Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
+Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc
++++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc
+@@ -30,7 +30,8 @@ find_dot_func() {
+       fi
+       grep " [tT] .*\.isra\..*" /proc/kallsyms | cut -f 3 -d " " | while read f; do
+-              if grep -s $f available_filter_functions; then
++              cnt=`grep -s $f available_filter_functions | wc -l`;
++              if [ $cnt -eq 1 ]; then
+                       echo $f
+                       break
+               fi
diff --git a/queue-6.9/vmci-prevent-speculation-leaks-by-sanitizing-event-in-event_deliver.patch b/queue-6.9/vmci-prevent-speculation-leaks-by-sanitizing-event-in-event_deliver.patch
new file mode 100644 (file)
index 0000000..bec9e30
--- /dev/null
@@ -0,0 +1,56 @@
+From 8003f00d895310d409b2bf9ef907c56b42a4e0f4 Mon Sep 17 00:00:00 2001
+From: Hagar Gamal Halim Hemdan <hagarhem@amazon.com>
+Date: Tue, 30 Apr 2024 08:59:16 +0000
+Subject: vmci: prevent speculation leaks by sanitizing event in event_deliver()
+
+From: Hagar Gamal Halim Hemdan <hagarhem@amazon.com>
+
+commit 8003f00d895310d409b2bf9ef907c56b42a4e0f4 upstream.
+
+Coverity spotted that event_msg is controlled by user-space,
+event_msg->event_data.event is passed to event_deliver() and used
+as an index without sanitization.
+
+This change ensures that the event index is sanitized to mitigate any
+possibility of speculative information leaks.
+
+This bug was discovered and resolved using Coverity Static Analysis
+Security Testing (SAST) by Synopsys, Inc.
+
+Only compile tested, no access to HW.
+
+Fixes: 1d990201f9bb ("VMCI: event handling implementation.")
+Cc: stable <stable@kernel.org>
+Signed-off-by: Hagar Gamal Halim Hemdan <hagarhem@amazon.com>
+Link: https://lore.kernel.org/stable/20231127193533.46174-1-hagarhem%40amazon.com
+Link: https://lore.kernel.org/r/20240430085916.4753-1-hagarhem@amazon.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/misc/vmw_vmci/vmci_event.c |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/drivers/misc/vmw_vmci/vmci_event.c
++++ b/drivers/misc/vmw_vmci/vmci_event.c
+@@ -9,6 +9,7 @@
+ #include <linux/vmw_vmci_api.h>
+ #include <linux/list.h>
+ #include <linux/module.h>
++#include <linux/nospec.h>
+ #include <linux/sched.h>
+ #include <linux/slab.h>
+ #include <linux/rculist.h>
+@@ -86,9 +87,12 @@ static void event_deliver(struct vmci_ev
+ {
+       struct vmci_subscription *cur;
+       struct list_head *subscriber_list;
++      u32 sanitized_event, max_vmci_event;
+       rcu_read_lock();
+-      subscriber_list = &subscriber_array[event_msg->event_data.event];
++      max_vmci_event = ARRAY_SIZE(subscriber_array);
++      sanitized_event = array_index_nospec(event_msg->event_data.event, max_vmci_event);
++      subscriber_list = &subscriber_array[sanitized_event];
+       list_for_each_entry_rcu(cur, subscriber_list, node) {
+               cur->callback(cur->id, &event_msg->event_data,
+                             cur->callback_data);
diff --git a/queue-6.9/wifi-cfg80211-validate-he-operation-element-parsing.patch b/queue-6.9/wifi-cfg80211-validate-he-operation-element-parsing.patch
new file mode 100644 (file)
index 0000000..ee85678
--- /dev/null
@@ -0,0 +1,39 @@
+From 4dc3a3893dae5a7f73e5809273aca0f1f3548d55 Mon Sep 17 00:00:00 2001
+From: Johannes Berg <johannes.berg@intel.com>
+Date: Thu, 23 May 2024 12:05:33 +0200
+Subject: wifi: cfg80211: validate HE operation element parsing
+
+From: Johannes Berg <johannes.berg@intel.com>
+
+commit 4dc3a3893dae5a7f73e5809273aca0f1f3548d55 upstream.
+
+Validate that the HE operation element has the correct
+length before parsing it.
+
+Cc: stable@vger.kernel.org
+Fixes: 645f3d85129d ("wifi: cfg80211: handle UHB AP and STA power type")
+Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
+Link: https://msgid.link/20240523120533.677025eb4a92.I44c091029ef113c294e8fe8b9bf871bf5dbeeb27@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/wireless/scan.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/net/wireless/scan.c b/net/wireless/scan.c
+index 127853877a0a..8daed8232b05 100644
+--- a/net/wireless/scan.c
++++ b/net/wireless/scan.c
+@@ -2128,7 +2128,8 @@ static bool cfg80211_6ghz_power_type_valid(const u8 *ie, size_t ielen,
+       struct ieee80211_he_operation *he_oper;
+       tmp = cfg80211_find_ext_elem(WLAN_EID_EXT_HE_OPERATION, ie, ielen);
+-      if (tmp && tmp->datalen >= sizeof(*he_oper) + 1) {
++      if (tmp && tmp->datalen >= sizeof(*he_oper) + 1 &&
++          tmp->datalen >= ieee80211_he_oper_size(tmp->data + 1)) {
+               const struct ieee80211_he_6ghz_oper *he_6ghz_oper;
+               he_oper = (void *)&tmp->data[1];
+-- 
+2.45.2
+
diff --git a/queue-6.9/wifi-mt76-mt7615-add-missing-chanctx-ops.patch b/queue-6.9/wifi-mt76-mt7615-add-missing-chanctx-ops.patch
new file mode 100644 (file)
index 0000000..59c62a0
--- /dev/null
@@ -0,0 +1,42 @@
+From 40cecacabc460f5074398753feb9ed7d43e8dfa6 Mon Sep 17 00:00:00 2001
+From: Johannes Berg <johannes.berg@intel.com>
+Date: Tue, 28 May 2024 14:23:08 +0200
+Subject: wifi: mt76: mt7615: add missing chanctx ops
+
+From: Johannes Berg <johannes.berg@intel.com>
+
+commit 40cecacabc460f5074398753feb9ed7d43e8dfa6 upstream.
+
+Here's another one I missed during the initial conversion,
+fix that.
+
+Cc: stable@vger.kernel.org
+Reported-by: Rene Petersen <renepetersen@posteo.de>
+Fixes: 0a44dfc07074 ("wifi: mac80211: simplify non-chanctx drivers")
+Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218895
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Kalle Valo <kvalo@kernel.org>
+Link: https://msgid.link/20240528142308.3f7db1821e68.I531135d7ad76331a50244d6d5288e14aa9668390@changeid
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/wireless/mediatek/mt76/mt7615/main.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
+index 0971c164b57e..c27acaf0eb1c 100644
+--- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c
++++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
+@@ -1326,6 +1326,10 @@ static void mt7615_set_rekey_data(struct ieee80211_hw *hw,
+ #endif /* CONFIG_PM */
+ const struct ieee80211_ops mt7615_ops = {
++      .add_chanctx = ieee80211_emulate_add_chanctx,
++      .remove_chanctx = ieee80211_emulate_remove_chanctx,
++      .change_chanctx = ieee80211_emulate_change_chanctx,
++      .switch_vif_chanctx = ieee80211_emulate_switch_vif_chanctx,
+       .tx = mt7615_tx,
+       .start = mt7615_start,
+       .stop = mt7615_stop,
+-- 
+2.45.2
+
diff --git a/queue-6.9/wifi-rtlwifi-ignore-ieee80211_conf_change_retry_limits.patch b/queue-6.9/wifi-rtlwifi-ignore-ieee80211_conf_change_retry_limits.patch
new file mode 100644 (file)
index 0000000..ddc22c3
--- /dev/null
@@ -0,0 +1,58 @@
+From 819bda58e77bb67974f94dc1aa11b0556b6f6889 Mon Sep 17 00:00:00 2001
+From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
+Date: Wed, 29 May 2024 20:19:47 +0300
+Subject: wifi: rtlwifi: Ignore IEEE80211_CONF_CHANGE_RETRY_LIMITS
+
+From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
+
+commit 819bda58e77bb67974f94dc1aa11b0556b6f6889 upstream.
+
+Since commit 0a44dfc07074 ("wifi: mac80211: simplify non-chanctx
+drivers") ieee80211_hw_config() is no longer called with changed = ~0.
+rtlwifi relied on ~0 in order to ignore the default retry limits of
+4/7, preferring 48/48 in station mode and 7/7 in AP/IBSS.
+
+RTL8192DU has a lot of packet loss with the default limits from
+mac80211. Fix it by ignoring IEEE80211_CONF_CHANGE_RETRY_LIMITS
+completely, because it's the simplest solution.
+
+Link: https://lore.kernel.org/linux-wireless/cedd13d7691f4692b2a2fa5a24d44a22@realtek.com/
+Cc: stable@vger.kernel.org # 6.9.x
+Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
+Acked-by: Ping-Ke Shih <pkshih@realtek.com>
+Signed-off-by: Kalle Valo <kvalo@kernel.org>
+Link: https://msgid.link/1fabb8e4-adf3-47ae-8462-8aea963bc2a5@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/wireless/realtek/rtlwifi/core.c | 15 ---------------
+ 1 file changed, 15 deletions(-)
+
+diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c
+index 2e60a6991ca1..42b7db12b1bd 100644
+--- a/drivers/net/wireless/realtek/rtlwifi/core.c
++++ b/drivers/net/wireless/realtek/rtlwifi/core.c
+@@ -633,21 +633,6 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
+               }
+       }
+-      if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) {
+-              rtl_dbg(rtlpriv, COMP_MAC80211, DBG_LOUD,
+-                      "IEEE80211_CONF_CHANGE_RETRY_LIMITS %x\n",
+-                      hw->conf.long_frame_max_tx_count);
+-              /* brought up everything changes (changed == ~0) indicates first
+-               * open, so use our default value instead of that of wiphy.
+-               */
+-              if (changed != ~0) {
+-                      mac->retry_long = hw->conf.long_frame_max_tx_count;
+-                      mac->retry_short = hw->conf.long_frame_max_tx_count;
+-                      rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RETRY_LIMIT,
+-                              (u8 *)(&hw->conf.long_frame_max_tx_count));
+-              }
+-      }
+-
+       if (changed & IEEE80211_CONF_CHANGE_CHANNEL &&
+           !rtlpriv->proximity.proxim_on) {
+               struct ieee80211_channel *channel = hw->conf.chandef.chan;
+-- 
+2.45.2
+
diff --git a/queue-6.9/x86-amd_nb-check-for-invalid-smn-reads.patch b/queue-6.9/x86-amd_nb-check-for-invalid-smn-reads.patch
new file mode 100644 (file)
index 0000000..cfbcc39
--- /dev/null
@@ -0,0 +1,59 @@
+From c625dabbf1c4a8e77e4734014f2fde7aa9071a1f Mon Sep 17 00:00:00 2001
+From: Yazen Ghannam <yazen.ghannam@amd.com>
+Date: Mon, 3 Apr 2023 16:42:44 +0000
+Subject: x86/amd_nb: Check for invalid SMN reads
+
+From: Yazen Ghannam <yazen.ghannam@amd.com>
+
+commit c625dabbf1c4a8e77e4734014f2fde7aa9071a1f upstream.
+
+AMD Zen-based systems use a System Management Network (SMN) that
+provides access to implementation-specific registers.
+
+SMN accesses are done indirectly through an index/data pair in PCI
+config space. The PCI config access may fail and return an error code.
+This would prevent the "read" value from being updated.
+
+However, the PCI config access may succeed, but the return value may be
+invalid. This is in similar fashion to PCI bad reads, i.e. return all
+bits set.
+
+Most systems will return 0 for SMN addresses that are not accessible.
+This is in line with AMD convention that unavailable registers are
+Read-as-Zero/Writes-Ignored.
+
+However, some systems will return a "PCI Error Response" instead. This
+value, along with an error code of 0 from the PCI config access, will
+confuse callers of the amd_smn_read() function.
+
+Check for this condition, clear the return value, and set a proper error
+code.
+
+Fixes: ddfe43cdc0da ("x86/amd_nb: Add SMN and Indirect Data Fabric access for AMD Fam17h")
+Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
+Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20230403164244.471141-1-yazen.ghannam@amd.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kernel/amd_nb.c |    9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+--- a/arch/x86/kernel/amd_nb.c
++++ b/arch/x86/kernel/amd_nb.c
+@@ -215,7 +215,14 @@ out:
+ int amd_smn_read(u16 node, u32 address, u32 *value)
+ {
+-      return __amd_smn_rw(node, address, value, false);
++      int err = __amd_smn_rw(node, address, value, false);
++
++      if (PCI_POSSIBLE_ERROR(*value)) {
++              err = -ENODEV;
++              *value = 0;
++      }
++
++      return err;
+ }
+ EXPORT_SYMBOL_GPL(amd_smn_read);
diff --git a/queue-6.9/x86-kexec-fix-bug-with-call-depth-tracking.patch b/queue-6.9/x86-kexec-fix-bug-with-call-depth-tracking.patch
new file mode 100644 (file)
index 0000000..b047836
--- /dev/null
@@ -0,0 +1,56 @@
+From 93c1800b3799f17375989b0daf76497dd3e80922 Mon Sep 17 00:00:00 2001
+From: David Kaplan <david.kaplan@amd.com>
+Date: Sun, 2 Jun 2024 13:19:09 -0500
+Subject: x86/kexec: Fix bug with call depth tracking
+
+From: David Kaplan <david.kaplan@amd.com>
+
+commit 93c1800b3799f17375989b0daf76497dd3e80922 upstream.
+
+The call to cc_platform_has() triggers a fault and system crash if call depth
+tracking is active because the GS segment has been reset by load_segments() and
+GS_BASE is now 0 but call depth tracking uses per-CPU variables to operate.
+
+Call cc_platform_has() earlier in the function when GS is still valid.
+
+  [ bp: Massage. ]
+
+Fixes: 5d8213864ade ("x86/retbleed: Add SKL return thunk")
+Signed-off-by: David Kaplan <david.kaplan@amd.com>
+Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
+Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
+Cc: <stable@kernel.org>
+Link: https://lore.kernel.org/r/20240603083036.637-1-bp@kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kernel/machine_kexec_64.c |   11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+--- a/arch/x86/kernel/machine_kexec_64.c
++++ b/arch/x86/kernel/machine_kexec_64.c
+@@ -295,8 +295,15 @@ void machine_kexec_cleanup(struct kimage
+ void machine_kexec(struct kimage *image)
+ {
+       unsigned long page_list[PAGES_NR];
+-      void *control_page;
++      unsigned int host_mem_enc_active;
+       int save_ftrace_enabled;
++      void *control_page;
++
++      /*
++       * This must be done before load_segments() since if call depth tracking
++       * is used then GS must be valid to make any function calls.
++       */
++      host_mem_enc_active = cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT);
+ #ifdef CONFIG_KEXEC_JUMP
+       if (image->preserve_context)
+@@ -358,7 +365,7 @@ void machine_kexec(struct kimage *image)
+                                      (unsigned long)page_list,
+                                      image->start,
+                                      image->preserve_context,
+-                                     cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT));
++                                     host_mem_enc_active);
+ #ifdef CONFIG_KEXEC_JUMP
+       if (image->preserve_context)