From da525542b07bf2ad69eec56911c830e1e02236ce Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 28 Oct 2024 01:36:44 +0100 Subject: [PATCH] 6.6-stable patches added patches: acpi-button-add-dmi-quirk-for-samsung-galaxy-book2-to-fix-initial-lid-detection-issue.patch acpi-prm-find-efi_memory_runtime-block-for-prm-handler-and-context.patch acpi-resource-add-lg-16t90sp-to-irq1_level_low_skip_override.patch alsa-hda-realtek-add-subwoofer-quirk-for-acer-predator-g9-593.patch alsa-hda-tas2781-select-crc32-instead-of-crc32_sarwate.patch btrfs-fix-passing-0-to-err_ptr-in-btrfs_search_dir_index_item.patch btrfs-zoned-fix-zone-unusable-accounting-for-freed-reserved-extent.patch drm-amd-display-disable-psr-su-on-parade-08-01-tcon-too.patch drm-amd-guard-against-bad-data-for-atif-acpi-method.patch hv_netvsc-fix-vf-namespace-also-in-synthetic-nic-netdev_register-event.patch kvm-arm64-don-t-eagerly-teardown-the-vgic-on-init-error.patch kvm-arm64-fix-shift-out-of-bounds-bug.patch kvm-nsvm-ignore-ncr3-when-loading-pdptes-from-memory.patch loongarch-enable-irq-if-do_ale-triggered-in-irq-enabled-context.patch loongarch-get-correct-cores_per_package-for-smt-systems.patch loongarch-make-kasan-usable-for-variable-cpu_vabits.patch nilfs2-fix-kernel-bug-due-to-missing-clearing-of-buffer-delay-flag.patch openat2-explicitly-return-e2big-for-usize-page_size.patch x86-lam-disable-address_masking-in-most-cases.patch xfrm-fix-one-more-kernel-infoleak-in-algo-dumping.patch --- ...2-to-fix-initial-lid-detection-issue.patch | 50 ++++++++ ...me-block-for-prm-handler-and-context.patch | 114 ++++++++++++++++++ ...90sp-to-irq1_level_low_skip_override.patch | 44 +++++++ ...oofer-quirk-for-acer-predator-g9-593.patch | 71 +++++++++++ ...elect-crc32-instead-of-crc32_sarwate.patch | 37 ++++++ ...r_ptr-in-btrfs_search_dir_index_item.patch | 59 +++++++++ ...accounting-for-freed-reserved-extent.patch | 51 ++++++++ ...able-psr-su-on-parade-08-01-tcon-too.patch | 44 +++++++ ...gainst-bad-data-for-atif-acpi-method.patch | 75 ++++++++++++ ...-synthetic-nic-netdev_register-event.patch | 75 ++++++++++++ ...erly-teardown-the-vgic-on-init-error.patch | 73 +++++++++++ ...vm-arm64-fix-shift-out-of-bounds-bug.patch | 61 ++++++++++ ...ncr3-when-loading-pdptes-from-memory.patch | 59 +++++++++ ...ale-triggered-in-irq-enabled-context.patch | 70 +++++++++++ ...ct-cores_per_package-for-smt-systems.patch | 58 +++++++++ ...kasan-usable-for-variable-cpu_vabits.patch | 36 ++++++ ...issing-clearing-of-buffer-delay-flag.patch | 55 +++++++++ ...tly-return-e2big-for-usize-page_size.patch | 35 ++++++ queue-6.6/series | 20 +++ ...isable-address_masking-in-most-cases.patch | 46 +++++++ ...more-kernel-infoleak-in-algo-dumping.patch | 101 ++++++++++++++++ 21 files changed, 1234 insertions(+) create mode 100644 queue-6.6/acpi-button-add-dmi-quirk-for-samsung-galaxy-book2-to-fix-initial-lid-detection-issue.patch create mode 100644 queue-6.6/acpi-prm-find-efi_memory_runtime-block-for-prm-handler-and-context.patch create mode 100644 queue-6.6/acpi-resource-add-lg-16t90sp-to-irq1_level_low_skip_override.patch create mode 100644 queue-6.6/alsa-hda-realtek-add-subwoofer-quirk-for-acer-predator-g9-593.patch create mode 100644 queue-6.6/alsa-hda-tas2781-select-crc32-instead-of-crc32_sarwate.patch create mode 100644 queue-6.6/btrfs-fix-passing-0-to-err_ptr-in-btrfs_search_dir_index_item.patch create mode 100644 queue-6.6/btrfs-zoned-fix-zone-unusable-accounting-for-freed-reserved-extent.patch create mode 100644 queue-6.6/drm-amd-display-disable-psr-su-on-parade-08-01-tcon-too.patch create mode 100644 queue-6.6/drm-amd-guard-against-bad-data-for-atif-acpi-method.patch create mode 100644 queue-6.6/hv_netvsc-fix-vf-namespace-also-in-synthetic-nic-netdev_register-event.patch create mode 100644 queue-6.6/kvm-arm64-don-t-eagerly-teardown-the-vgic-on-init-error.patch create mode 100644 queue-6.6/kvm-arm64-fix-shift-out-of-bounds-bug.patch create mode 100644 queue-6.6/kvm-nsvm-ignore-ncr3-when-loading-pdptes-from-memory.patch create mode 100644 queue-6.6/loongarch-enable-irq-if-do_ale-triggered-in-irq-enabled-context.patch create mode 100644 queue-6.6/loongarch-get-correct-cores_per_package-for-smt-systems.patch create mode 100644 queue-6.6/loongarch-make-kasan-usable-for-variable-cpu_vabits.patch create mode 100644 queue-6.6/nilfs2-fix-kernel-bug-due-to-missing-clearing-of-buffer-delay-flag.patch create mode 100644 queue-6.6/openat2-explicitly-return-e2big-for-usize-page_size.patch create mode 100644 queue-6.6/x86-lam-disable-address_masking-in-most-cases.patch create mode 100644 queue-6.6/xfrm-fix-one-more-kernel-infoleak-in-algo-dumping.patch diff --git a/queue-6.6/acpi-button-add-dmi-quirk-for-samsung-galaxy-book2-to-fix-initial-lid-detection-issue.patch b/queue-6.6/acpi-button-add-dmi-quirk-for-samsung-galaxy-book2-to-fix-initial-lid-detection-issue.patch new file mode 100644 index 00000000000..76d54e63f49 --- /dev/null +++ b/queue-6.6/acpi-button-add-dmi-quirk-for-samsung-galaxy-book2-to-fix-initial-lid-detection-issue.patch @@ -0,0 +1,50 @@ +From 8fa73ee44daefc884c53a25158c25a4107eb5a94 Mon Sep 17 00:00:00 2001 +From: Shubham Panwar +Date: Sun, 20 Oct 2024 15:20:46 +0530 +Subject: ACPI: button: Add DMI quirk for Samsung Galaxy Book2 to fix initial lid detection issue + +From: Shubham Panwar + +commit 8fa73ee44daefc884c53a25158c25a4107eb5a94 upstream. + +Add a DMI quirk for Samsung Galaxy Book2 to fix an initial lid state +detection issue. + +The _LID device incorrectly returns the lid status as "closed" during +boot, causing the system to enter a suspend loop right after booting. + +The quirk ensures that the correct lid state is reported initially, +preventing the system from immediately suspending after startup. It +only addresses the initial lid state detection and ensures proper +system behavior upon boot. + +Signed-off-by: Shubham Panwar +Link: https://patch.msgid.link/20241020095045.6036-2-shubiisp8@gmail.com +[ rjw: Changelog edits ] +Cc: All applicable +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman +--- + drivers/acpi/button.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/drivers/acpi/button.c ++++ b/drivers/acpi/button.c +@@ -130,6 +130,17 @@ static const struct dmi_system_id dmi_li + }, + .driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN, + }, ++ { ++ /* ++ * Samsung galaxybook2 ,initial _LID device notification returns ++ * lid closed. ++ */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "750XED"), ++ }, ++ .driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN, ++ }, + {} + }; + diff --git a/queue-6.6/acpi-prm-find-efi_memory_runtime-block-for-prm-handler-and-context.patch b/queue-6.6/acpi-prm-find-efi_memory_runtime-block-for-prm-handler-and-context.patch new file mode 100644 index 00000000000..fe67406f462 --- /dev/null +++ b/queue-6.6/acpi-prm-find-efi_memory_runtime-block-for-prm-handler-and-context.patch @@ -0,0 +1,114 @@ +From 088984c8d54c0053fc4ae606981291d741c5924b Mon Sep 17 00:00:00 2001 +From: Koba Ko +Date: Sun, 13 Oct 2024 04:50:10 +0800 +Subject: ACPI: PRM: Find EFI_MEMORY_RUNTIME block for PRM handler and context + +From: Koba Ko + +commit 088984c8d54c0053fc4ae606981291d741c5924b upstream. + +PRMT needs to find the correct type of block to translate the PA-VA +mapping for EFI runtime services. + +The issue arises because the PRMT is finding a block of type +EFI_CONVENTIONAL_MEMORY, which is not appropriate for runtime services +as described in Section 2.2.2 (Runtime Services) of the UEFI +Specification [1]. Since the PRM handler is a type of runtime service, +this causes an exception when the PRM handler is called. + + [Firmware Bug]: Unable to handle paging request in EFI runtime service + WARNING: CPU: 22 PID: 4330 at drivers/firmware/efi/runtime-wrappers.c:341 + __efi_queue_work+0x11c/0x170 + Call trace: + +Let PRMT find a block with EFI_MEMORY_RUNTIME for PRM handler and PRM +context. + +If no suitable block is found, a warning message will be printed, but +the procedure continues to manage the next PRM handler. + +However, if the PRM handler is actually called without proper allocation, +it would result in a failure during error handling. + +By using the correct memory types for runtime services, ensure that the +PRM handler and the context are properly mapped in the virtual address +space during runtime, preventing the paging request error. + +The issue is really that only memory that has been remapped for runtime +by the firmware can be used by the PRM handler, and so the region needs +to have the EFI_MEMORY_RUNTIME attribute. + +Link: https://uefi.org/sites/default/files/resources/UEFI_Spec_2_10_Aug29.pdf # [1] +Fixes: cefc7ca46235 ("ACPI: PRM: implement OperationRegion handler for the PlatformRtMechanism subtype") +Cc: All applicable +Signed-off-by: Koba Ko +Reviewed-by: Matthew R. Ochs +Reviewed-by: Zhang Rui +Reviewed-by: Ard Biesheuvel +Link: https://patch.msgid.link/20241012205010.4165798-1-kobak@nvidia.com +[ rjw: Subject and changelog edits ] +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman +--- + drivers/acpi/prmt.c | 27 ++++++++++++++++++++++----- + 1 file changed, 22 insertions(+), 5 deletions(-) + +--- a/drivers/acpi/prmt.c ++++ b/drivers/acpi/prmt.c +@@ -72,17 +72,21 @@ struct prm_module_info { + struct prm_handler_info handlers[]; + }; + +-static u64 efi_pa_va_lookup(u64 pa) ++static u64 efi_pa_va_lookup(efi_guid_t *guid, u64 pa) + { + efi_memory_desc_t *md; + u64 pa_offset = pa & ~PAGE_MASK; + u64 page = pa & PAGE_MASK; + + for_each_efi_memory_desc(md) { +- if (md->phys_addr < pa && pa < md->phys_addr + PAGE_SIZE * md->num_pages) ++ if ((md->attribute & EFI_MEMORY_RUNTIME) && ++ (md->phys_addr < pa && pa < md->phys_addr + PAGE_SIZE * md->num_pages)) { + return pa_offset + md->virt_addr + page - md->phys_addr; ++ } + } + ++ pr_warn("Failed to find VA for GUID: %pUL, PA: 0x%llx", guid, pa); ++ + return 0; + } + +@@ -148,9 +152,15 @@ acpi_parse_prmt(union acpi_subtable_head + th = &tm->handlers[cur_handler]; + + guid_copy(&th->guid, (guid_t *)handler_info->handler_guid); +- th->handler_addr = (void *)efi_pa_va_lookup(handler_info->handler_address); +- th->static_data_buffer_addr = efi_pa_va_lookup(handler_info->static_data_buffer_address); +- th->acpi_param_buffer_addr = efi_pa_va_lookup(handler_info->acpi_param_buffer_address); ++ th->handler_addr = ++ (void *)efi_pa_va_lookup(&th->guid, handler_info->handler_address); ++ ++ th->static_data_buffer_addr = ++ efi_pa_va_lookup(&th->guid, handler_info->static_data_buffer_address); ++ ++ th->acpi_param_buffer_addr = ++ efi_pa_va_lookup(&th->guid, handler_info->acpi_param_buffer_address); ++ + } while (++cur_handler < tm->handler_count && (handler_info = get_next_handler(handler_info))); + + return 0; +@@ -253,6 +263,13 @@ static acpi_status acpi_platformrt_space + if (!handler || !module) + goto invalid_guid; + ++ if (!handler->handler_addr || ++ !handler->static_data_buffer_addr || ++ !handler->acpi_param_buffer_addr) { ++ buffer->prm_status = PRM_HANDLER_ERROR; ++ return AE_OK; ++ } ++ + ACPI_COPY_NAMESEG(context.signature, "PRMC"); + context.revision = 0x0; + context.reserved = 0x0; diff --git a/queue-6.6/acpi-resource-add-lg-16t90sp-to-irq1_level_low_skip_override.patch b/queue-6.6/acpi-resource-add-lg-16t90sp-to-irq1_level_low_skip_override.patch new file mode 100644 index 00000000000..541bd1c6c6c --- /dev/null +++ b/queue-6.6/acpi-resource-add-lg-16t90sp-to-irq1_level_low_skip_override.patch @@ -0,0 +1,44 @@ +From 53f1a907d36fb3aa02a4d34073bcec25823a6c74 Mon Sep 17 00:00:00 2001 +From: Christian Heusel +Date: Thu, 17 Oct 2024 13:16:26 +0200 +Subject: ACPI: resource: Add LG 16T90SP to irq1_level_low_skip_override[] + +From: Christian Heusel + +commit 53f1a907d36fb3aa02a4d34073bcec25823a6c74 upstream. + +The LG Gram Pro 16 2-in-1 (2024) the 16T90SP has its keybopard IRQ (1) +described as ActiveLow in the DSDT, which the kernel overrides to EdgeHigh +which breaks the keyboard. + +Add the 16T90SP to the irq1_level_low_skip_override[] quirk table to fix +this. + +Reported-by: Dirk Holten +Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219382 +Cc: All applicable +Suggested-by: Dirk Holten +Signed-off-by: Christian Heusel +Link: https://patch.msgid.link/20241017-lg-gram-pro-keyboard-v2-1-7c8fbf6ff718@heusel.eu +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman +--- + drivers/acpi/resource.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/acpi/resource.c ++++ b/drivers/acpi/resource.c +@@ -498,6 +498,13 @@ static const struct dmi_system_id tongfa + DMI_MATCH(DMI_BOARD_NAME, "GMxRGxx"), + }, + }, ++ { ++ /* LG Electronics 16T90SP */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"), ++ DMI_MATCH(DMI_BOARD_NAME, "16T90SP"), ++ }, ++ }, + { } + }; + diff --git a/queue-6.6/alsa-hda-realtek-add-subwoofer-quirk-for-acer-predator-g9-593.patch b/queue-6.6/alsa-hda-realtek-add-subwoofer-quirk-for-acer-predator-g9-593.patch new file mode 100644 index 00000000000..b0b8db03cc5 --- /dev/null +++ b/queue-6.6/alsa-hda-realtek-add-subwoofer-quirk-for-acer-predator-g9-593.patch @@ -0,0 +1,71 @@ +From 35fdc6e1c16099078bcbd73a6c8f1733ae7f1909 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jos=C3=A9=20Relvas?= +Date: Sun, 20 Oct 2024 11:27:56 +0100 +Subject: ALSA: hda/realtek: Add subwoofer quirk for Acer Predator G9-593 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: José Relvas + +commit 35fdc6e1c16099078bcbd73a6c8f1733ae7f1909 upstream. + +The Acer Predator G9-593 has a 2+1 speaker system which isn't probed +correctly. +This patch adds a quirk with the proper pin connections. + +Note that I do not own this laptop, so I cannot guarantee that this +fixes the issue. +Testing was done by other users here: +https://discussion.fedoraproject.org/t/-/118482 + +This model appears to have two different dev IDs... + +- 0x1177 (as seen on the forum link above) +- 0x1178 (as seen on https://linux-hardware.org/?probe=127df9999f) + +I don't think the audio system was changed between model revisions, so +the patch applies for both IDs. + +Signed-off-by: José Relvas +Link: https://patch.msgid.link/20241020102756.225258-1-josemonsantorelvas@gmail.com +Cc: +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/hda/patch_realtek.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -7358,6 +7358,7 @@ enum { + ALC286_FIXUP_ACER_AIO_HEADSET_MIC, + ALC256_FIXUP_ASUS_HEADSET_MIC, + ALC256_FIXUP_ASUS_MIC_NO_PRESENCE, ++ ALC255_FIXUP_PREDATOR_SUBWOOFER, + ALC299_FIXUP_PREDATOR_SPK, + ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, + ALC289_FIXUP_DELL_SPK1, +@@ -8705,6 +8706,13 @@ static const struct hda_fixup alc269_fix + .chained = true, + .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE + }, ++ [ALC255_FIXUP_PREDATOR_SUBWOOFER] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x17, 0x90170151 }, /* use as internal speaker (LFE) */ ++ { 0x1b, 0x90170152 } /* use as internal speaker (back) */ ++ } ++ }, + [ALC299_FIXUP_PREDATOR_SPK] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl[]) { +@@ -9678,6 +9686,8 @@ static const struct snd_pci_quirk alc269 + SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK), + SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK), ++ SND_PCI_QUIRK(0x1025, 0x1177, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER), ++ SND_PCI_QUIRK(0x1025, 0x1178, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER), + SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK), + SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS), + SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE), diff --git a/queue-6.6/alsa-hda-tas2781-select-crc32-instead-of-crc32_sarwate.patch b/queue-6.6/alsa-hda-tas2781-select-crc32-instead-of-crc32_sarwate.patch new file mode 100644 index 00000000000..58589c0fa6d --- /dev/null +++ b/queue-6.6/alsa-hda-tas2781-select-crc32-instead-of-crc32_sarwate.patch @@ -0,0 +1,37 @@ +From 86c96e7289c5758284b562ac7b5c94429f48d2d9 Mon Sep 17 00:00:00 2001 +From: Eric Biggers +Date: Sun, 20 Oct 2024 10:56:24 -0700 +Subject: ALSA: hda/tas2781: select CRC32 instead of CRC32_SARWATE + +From: Eric Biggers + +commit 86c96e7289c5758284b562ac7b5c94429f48d2d9 upstream. + +Fix the kconfig option for the tas2781 HDA driver to select CRC32 rather +than CRC32_SARWATE. CRC32_SARWATE is an option from the kconfig +'choice' that selects the specific CRC32 implementation. Selecting a +'choice' option seems to have no effect, but even if it did work, it +would be incorrect for a random driver to override the user's choice. +CRC32 is the correct option to select for crc32() to be available. + +Fixes: 5be27f1e3ec9 ("ALSA: hda/tas2781: Add tas2781 HDA driver") +Cc: stable@vger.kernel.org +Signed-off-by: Eric Biggers +Link: https://patch.msgid.link/20241020175624.7095-1-ebiggers@kernel.org +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/hda/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/sound/pci/hda/Kconfig ++++ b/sound/pci/hda/Kconfig +@@ -173,7 +173,7 @@ config SND_HDA_SCODEC_TAS2781_I2C + depends on SND_SOC + select SND_SOC_TAS2781_COMLIB + select SND_SOC_TAS2781_FMWLIB +- select CRC32_SARWATE ++ select CRC32 + help + Say Y or M here to include TAS2781 I2C HD-audio side codec support + in snd-hda-intel driver, such as ALC287. diff --git a/queue-6.6/btrfs-fix-passing-0-to-err_ptr-in-btrfs_search_dir_index_item.patch b/queue-6.6/btrfs-fix-passing-0-to-err_ptr-in-btrfs_search_dir_index_item.patch new file mode 100644 index 00000000000..f838f77593b --- /dev/null +++ b/queue-6.6/btrfs-fix-passing-0-to-err_ptr-in-btrfs_search_dir_index_item.patch @@ -0,0 +1,59 @@ +From 75f49c3dc7b7423d3734f2e4dabe3dac8d064338 Mon Sep 17 00:00:00 2001 +From: Yue Haibing +Date: Tue, 22 Oct 2024 17:52:08 +0800 +Subject: btrfs: fix passing 0 to ERR_PTR in btrfs_search_dir_index_item() + +From: Yue Haibing + +commit 75f49c3dc7b7423d3734f2e4dabe3dac8d064338 upstream. + +The ret may be zero in btrfs_search_dir_index_item() and should not +passed to ERR_PTR(). Now btrfs_unlink_subvol() is the only caller to +this, reconstructed it to check ERR_PTR(-ENOENT) while ret >= 0. + +This fixes smatch warnings: + +fs/btrfs/dir-item.c:353 + btrfs_search_dir_index_item() warn: passing zero to 'ERR_PTR' + +Fixes: 9dcbe16fccbb ("btrfs: use btrfs_for_each_slot in btrfs_search_dir_index_item") +CC: stable@vger.kernel.org # 6.1+ +Reviewed-by: Johannes Thumshirn +Signed-off-by: Yue Haibing +Reviewed-by: David Sterba +Signed-off-by: David Sterba +Signed-off-by: Greg Kroah-Hartman +--- + fs/btrfs/dir-item.c | 4 ++-- + fs/btrfs/inode.c | 7 ++----- + 2 files changed, 4 insertions(+), 7 deletions(-) + +--- a/fs/btrfs/dir-item.c ++++ b/fs/btrfs/dir-item.c +@@ -347,8 +347,8 @@ btrfs_search_dir_index_item(struct btrfs + return di; + } + /* Adjust return code if the key was not found in the next leaf. */ +- if (ret > 0) +- ret = 0; ++ if (ret >= 0) ++ ret = -ENOENT; + + return ERR_PTR(ret); + } +--- a/fs/btrfs/inode.c ++++ b/fs/btrfs/inode.c +@@ -4293,11 +4293,8 @@ static int btrfs_unlink_subvol(struct bt + */ + if (btrfs_ino(inode) == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID) { + di = btrfs_search_dir_index_item(root, path, dir_ino, &fname.disk_name); +- if (IS_ERR_OR_NULL(di)) { +- if (!di) +- ret = -ENOENT; +- else +- ret = PTR_ERR(di); ++ if (IS_ERR(di)) { ++ ret = PTR_ERR(di); + btrfs_abort_transaction(trans, ret); + goto out; + } diff --git a/queue-6.6/btrfs-zoned-fix-zone-unusable-accounting-for-freed-reserved-extent.patch b/queue-6.6/btrfs-zoned-fix-zone-unusable-accounting-for-freed-reserved-extent.patch new file mode 100644 index 00000000000..1baf5ac2f5e --- /dev/null +++ b/queue-6.6/btrfs-zoned-fix-zone-unusable-accounting-for-freed-reserved-extent.patch @@ -0,0 +1,51 @@ +From bf9821ba4792a0d9a2e72803ae7b4341faf3d532 Mon Sep 17 00:00:00 2001 +From: Naohiro Aota +Date: Tue, 1 Oct 2024 17:03:32 +0900 +Subject: btrfs: zoned: fix zone unusable accounting for freed reserved extent + +From: Naohiro Aota + +commit bf9821ba4792a0d9a2e72803ae7b4341faf3d532 upstream. + +When btrfs reserves an extent and does not use it (e.g, by an error), it +calls btrfs_free_reserved_extent() to free the reserved extent. In the +process, it calls btrfs_add_free_space() and then it accounts the region +bytes as block_group->zone_unusable. + +However, it leaves the space_info->bytes_zone_unusable side not updated. As +a result, ENOSPC can happen while a space_info reservation succeeded. The +reservation is fine because the freed region is not added in +space_info->bytes_zone_unusable, leaving that space as "free". OTOH, +corresponding block group counts it as zone_unusable and its allocation +pointer is not rewound, we cannot allocate an extent from that block group. +That will also negate space_info's async/sync reclaim process, and cause an +ENOSPC error from the extent allocation process. + +Fix that by returning the space to space_info->bytes_zone_unusable. +Ideally, since a bio is not submitted for this reserved region, we should +return the space to free space and rewind the allocation pointer. But, it +needs rework on extent allocation handling, so let it work in this way for +now. + +Fixes: 169e0da91a21 ("btrfs: zoned: track unusable bytes for zones") +CC: stable@vger.kernel.org # 5.15+ +Reviewed-by: Johannes Thumshirn +Signed-off-by: Naohiro Aota +Reviewed-by: David Sterba +Signed-off-by: David Sterba +Signed-off-by: Greg Kroah-Hartman +--- + fs/btrfs/block-group.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/fs/btrfs/block-group.c ++++ b/fs/btrfs/block-group.c +@@ -3794,6 +3794,8 @@ void btrfs_free_reserved_bytes(struct bt + spin_lock(&cache->lock); + if (cache->ro) + space_info->bytes_readonly += num_bytes; ++ else if (btrfs_is_zoned(cache->fs_info)) ++ space_info->bytes_zone_unusable += num_bytes; + cache->reserved -= num_bytes; + space_info->bytes_reserved -= num_bytes; + space_info->max_extent_size = 0; diff --git a/queue-6.6/drm-amd-display-disable-psr-su-on-parade-08-01-tcon-too.patch b/queue-6.6/drm-amd-display-disable-psr-su-on-parade-08-01-tcon-too.patch new file mode 100644 index 00000000000..cc4f6f81a6e --- /dev/null +++ b/queue-6.6/drm-amd-display-disable-psr-su-on-parade-08-01-tcon-too.patch @@ -0,0 +1,44 @@ +From ba1959f71117b27f3099ee789e0815360b4081dd Mon Sep 17 00:00:00 2001 +From: Mario Limonciello +Date: Mon, 5 Feb 2024 15:12:33 -0600 +Subject: drm/amd/display: Disable PSR-SU on Parade 08-01 TCON too + +From: Mario Limonciello + +commit ba1959f71117b27f3099ee789e0815360b4081dd upstream. + +Stuart Hayhurst has found that both at bootup and fullscreen VA-API video +is leading to black screens for around 1 second and kernel WARNING [1] traces +when calling dmub_psr_enable() with Parade 08-01 TCON. + +These symptoms all go away with PSR-SU disabled for this TCON, so disable +it for now while DMUB traces [2] from the failure can be analyzed and the failure +state properly root caused. + +Cc: Marc Rossi +Cc: Hamza Mahfooz +Link: https://gitlab.freedesktop.org/drm/amd/uploads/a832dd515b571ee171b3e3b566e99a13/dmesg.log [1] +Link: https://gitlab.freedesktop.org/drm/amd/uploads/8f13ff3b00963c833e23e68aa8116959/output.log [2] +Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/2645 +Reviewed-by: Leo Li +Link: https://lore.kernel.org/r/20240205211233.2601-1-mario.limonciello@amd.com +Signed-off-by: Mario Limonciello +Signed-off-by: Alex Deucher +(cherry picked from commit afb634a6823d8d9db23c5fb04f79c5549349628b) +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/display/modules/power/power_helpers.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/gpu/drm/amd/display/modules/power/power_helpers.c ++++ b/drivers/gpu/drm/amd/display/modules/power/power_helpers.c +@@ -841,6 +841,8 @@ bool is_psr_su_specific_panel(struct dc_ + isPSRSUSupported = false; + else if (dpcd_caps->sink_dev_id_str[1] == 0x08 && dpcd_caps->sink_dev_id_str[0] == 0x03) + isPSRSUSupported = false; ++ else if (dpcd_caps->sink_dev_id_str[1] == 0x08 && dpcd_caps->sink_dev_id_str[0] == 0x01) ++ isPSRSUSupported = false; + else if (dpcd_caps->psr_info.force_psrsu_cap == 0x1) + isPSRSUSupported = true; + } diff --git a/queue-6.6/drm-amd-guard-against-bad-data-for-atif-acpi-method.patch b/queue-6.6/drm-amd-guard-against-bad-data-for-atif-acpi-method.patch new file mode 100644 index 00000000000..bc9f62bac2c --- /dev/null +++ b/queue-6.6/drm-amd-guard-against-bad-data-for-atif-acpi-method.patch @@ -0,0 +1,75 @@ +From bf58f03931fdcf7b3c45cb76ac13244477a60f44 Mon Sep 17 00:00:00 2001 +From: Mario Limonciello +Date: Fri, 11 Oct 2024 12:23:15 -0500 +Subject: drm/amd: Guard against bad data for ATIF ACPI method + +From: Mario Limonciello + +commit bf58f03931fdcf7b3c45cb76ac13244477a60f44 upstream. + +If a BIOS provides bad data in response to an ATIF method call +this causes a NULL pointer dereference in the caller. + +``` +? show_regs (arch/x86/kernel/dumpstack.c:478 (discriminator 1)) +? __die (arch/x86/kernel/dumpstack.c:423 arch/x86/kernel/dumpstack.c:434) +? page_fault_oops (arch/x86/mm/fault.c:544 (discriminator 2) arch/x86/mm/fault.c:705 (discriminator 2)) +? do_user_addr_fault (arch/x86/mm/fault.c:440 (discriminator 1) arch/x86/mm/fault.c:1232 (discriminator 1)) +? acpi_ut_update_object_reference (drivers/acpi/acpica/utdelete.c:642) +? exc_page_fault (arch/x86/mm/fault.c:1542) +? asm_exc_page_fault (./arch/x86/include/asm/idtentry.h:623) +? amdgpu_atif_query_backlight_caps.constprop.0 (drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:387 (discriminator 2)) amdgpu +? amdgpu_atif_query_backlight_caps.constprop.0 (drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:386 (discriminator 1)) amdgpu +``` + +It has been encountered on at least one system, so guard for it. + +Fixes: d38ceaf99ed0 ("drm/amdgpu: add core driver (v4)") +Acked-by: Alex Deucher +Signed-off-by: Mario Limonciello +Signed-off-by: Alex Deucher +(cherry picked from commit c9b7c809b89f24e9372a4e7f02d64c950b07fdee) +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +@@ -147,6 +147,7 @@ static union acpi_object *amdgpu_atif_ca + struct acpi_buffer *params) + { + acpi_status status; ++ union acpi_object *obj; + union acpi_object atif_arg_elements[2]; + struct acpi_object_list atif_arg; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; +@@ -169,16 +170,24 @@ static union acpi_object *amdgpu_atif_ca + + status = acpi_evaluate_object(atif->handle, NULL, &atif_arg, + &buffer); ++ obj = (union acpi_object *)buffer.pointer; + +- /* Fail only if calling the method fails and ATIF is supported */ ++ /* Fail if calling the method fails and ATIF is supported */ + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { + DRM_DEBUG_DRIVER("failed to evaluate ATIF got %s\n", + acpi_format_exception(status)); +- kfree(buffer.pointer); ++ kfree(obj); + return NULL; + } + +- return buffer.pointer; ++ if (obj->type != ACPI_TYPE_BUFFER) { ++ DRM_DEBUG_DRIVER("bad object returned from ATIF: %d\n", ++ obj->type); ++ kfree(obj); ++ return NULL; ++ } ++ ++ return obj; + } + + /** diff --git a/queue-6.6/hv_netvsc-fix-vf-namespace-also-in-synthetic-nic-netdev_register-event.patch b/queue-6.6/hv_netvsc-fix-vf-namespace-also-in-synthetic-nic-netdev_register-event.patch new file mode 100644 index 00000000000..f34523da277 --- /dev/null +++ b/queue-6.6/hv_netvsc-fix-vf-namespace-also-in-synthetic-nic-netdev_register-event.patch @@ -0,0 +1,75 @@ +From 4c262801ea60c518b5bebc22a09f5b78b3147da2 Mon Sep 17 00:00:00 2001 +From: Haiyang Zhang +Date: Fri, 18 Oct 2024 11:25:22 -0700 +Subject: hv_netvsc: Fix VF namespace also in synthetic NIC NETDEV_REGISTER event + +From: Haiyang Zhang + +commit 4c262801ea60c518b5bebc22a09f5b78b3147da2 upstream. + +The existing code moves VF to the same namespace as the synthetic NIC +during netvsc_register_vf(). But, if the synthetic device is moved to a +new namespace after the VF registration, the VF won't be moved together. + +To make the behavior more consistent, add a namespace check for synthetic +NIC's NETDEV_REGISTER event (generated during its move), and move the VF +if it is not in the same namespace. + +Cc: stable@vger.kernel.org +Fixes: c0a41b887ce6 ("hv_netvsc: move VF to same namespace as netvsc device") +Suggested-by: Stephen Hemminger +Signed-off-by: Haiyang Zhang +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/1729275922-17595-1-git-send-email-haiyangz@microsoft.com +Signed-off-by: Paolo Abeni +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/hyperv/netvsc_drv.c | 30 ++++++++++++++++++++++++++++++ + 1 file changed, 30 insertions(+) + +--- a/drivers/net/hyperv/netvsc_drv.c ++++ b/drivers/net/hyperv/netvsc_drv.c +@@ -2795,6 +2795,31 @@ static struct hv_driver netvsc_drv = { + }, + }; + ++/* Set VF's namespace same as the synthetic NIC */ ++static void netvsc_event_set_vf_ns(struct net_device *ndev) ++{ ++ struct net_device_context *ndev_ctx = netdev_priv(ndev); ++ struct net_device *vf_netdev; ++ int ret; ++ ++ vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev); ++ if (!vf_netdev) ++ return; ++ ++ if (!net_eq(dev_net(ndev), dev_net(vf_netdev))) { ++ ret = dev_change_net_namespace(vf_netdev, dev_net(ndev), ++ "eth%d"); ++ if (ret) ++ netdev_err(vf_netdev, ++ "Cannot move to same namespace as %s: %d\n", ++ ndev->name, ret); ++ else ++ netdev_info(vf_netdev, ++ "Moved VF to namespace with: %s\n", ++ ndev->name); ++ } ++} ++ + /* + * On Hyper-V, every VF interface is matched with a corresponding + * synthetic interface. The synthetic interface is presented first +@@ -2807,6 +2832,11 @@ static int netvsc_netdev_event(struct no + struct net_device *event_dev = netdev_notifier_info_to_dev(ptr); + int ret = 0; + ++ if (event_dev->netdev_ops == &device_ops && event == NETDEV_REGISTER) { ++ netvsc_event_set_vf_ns(event_dev); ++ return NOTIFY_DONE; ++ } ++ + ret = check_dev_is_matching_vf(event_dev); + if (ret != 0) + return NOTIFY_DONE; diff --git a/queue-6.6/kvm-arm64-don-t-eagerly-teardown-the-vgic-on-init-error.patch b/queue-6.6/kvm-arm64-don-t-eagerly-teardown-the-vgic-on-init-error.patch new file mode 100644 index 00000000000..8f61c26c7a0 --- /dev/null +++ b/queue-6.6/kvm-arm64-don-t-eagerly-teardown-the-vgic-on-init-error.patch @@ -0,0 +1,73 @@ +From df5fd75ee305cb5927e0b1a0b46cc988ad8db2b1 Mon Sep 17 00:00:00 2001 +From: Marc Zyngier +Date: Wed, 9 Oct 2024 19:36:03 +0100 +Subject: KVM: arm64: Don't eagerly teardown the vgic on init error + +From: Marc Zyngier + +commit df5fd75ee305cb5927e0b1a0b46cc988ad8db2b1 upstream. + +As there is very little ordering in the KVM API, userspace can +instanciate a half-baked GIC (missing its memory map, for example) +at almost any time. + +This means that, with the right timing, a thread running vcpu-0 +can enter the kernel without a GIC configured and get a GIC created +behind its back by another thread. Amusingly, it will pick up +that GIC and start messing with the data structures without the +GIC having been fully initialised. + +Similarly, a thread running vcpu-1 can enter the kernel, and try +to init the GIC that was previously created. Since this GIC isn't +properly configured (no memory map), it fails to correctly initialise. + +And that's the point where we decide to teardown the GIC, freeing all +its resources. Behind vcpu-0's back. Things stop pretty abruptly, +with a variety of symptoms. Clearly, this isn't good, we should be +a bit more careful about this. + +It is obvious that this guest is not viable, as it is missing some +important part of its configuration. So instead of trying to tear +bits of it down, let's just mark it as *dead*. It means that any +further interaction from userspace will result in -EIO. The memory +will be released on the "normal" path, when userspace gives up. + +Cc: stable@vger.kernel.org +Reported-by: Alexander Potapenko +Reviewed-by: Oliver Upton +Link: https://lore.kernel.org/r/20241009183603.3221824-1-maz@kernel.org +Signed-off-by: Marc Zyngier +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm64/kvm/arm.c | 3 +++ + arch/arm64/kvm/vgic/vgic-init.c | 6 +++--- + 2 files changed, 6 insertions(+), 3 deletions(-) + +--- a/arch/arm64/kvm/arm.c ++++ b/arch/arm64/kvm/arm.c +@@ -777,6 +777,9 @@ static int kvm_vcpu_suspend(struct kvm_v + static int check_vcpu_requests(struct kvm_vcpu *vcpu) + { + if (kvm_request_pending(vcpu)) { ++ if (kvm_check_request(KVM_REQ_VM_DEAD, vcpu)) ++ return -EIO; ++ + if (kvm_check_request(KVM_REQ_SLEEP, vcpu)) + kvm_vcpu_sleep(vcpu); + +--- a/arch/arm64/kvm/vgic/vgic-init.c ++++ b/arch/arm64/kvm/vgic/vgic-init.c +@@ -494,10 +494,10 @@ int kvm_vgic_map_resources(struct kvm *k + out: + mutex_unlock(&kvm->arch.config_lock); + out_slots: +- mutex_unlock(&kvm->slots_lock); +- + if (ret) +- kvm_vgic_destroy(kvm); ++ kvm_vm_dead(kvm); ++ ++ mutex_unlock(&kvm->slots_lock); + + return ret; + } diff --git a/queue-6.6/kvm-arm64-fix-shift-out-of-bounds-bug.patch b/queue-6.6/kvm-arm64-fix-shift-out-of-bounds-bug.patch new file mode 100644 index 00000000000..8c08593a756 --- /dev/null +++ b/queue-6.6/kvm-arm64-fix-shift-out-of-bounds-bug.patch @@ -0,0 +1,61 @@ +From c6c167afa090ea0451f91814e1318755a8fb8bb9 Mon Sep 17 00:00:00 2001 +From: Ilkka Koskinen +Date: Wed, 16 Oct 2024 19:57:01 -0700 +Subject: KVM: arm64: Fix shift-out-of-bounds bug + +From: Ilkka Koskinen + +commit c6c167afa090ea0451f91814e1318755a8fb8bb9 upstream. + +Fix a shift-out-of-bounds bug reported by UBSAN when running +VM with MTE enabled host kernel. + +UBSAN: shift-out-of-bounds in arch/arm64/kvm/sys_regs.c:1988:14 +shift exponent 33 is too large for 32-bit type 'int' +CPU: 26 UID: 0 PID: 7629 Comm: qemu-kvm Not tainted 6.12.0-rc2 #34 +Hardware name: IEI NF5280R7/Mitchell MB, BIOS 00.00. 2024-10-12 09:28:54 10/14/2024 +Call trace: + dump_backtrace+0xa0/0x128 + show_stack+0x20/0x38 + dump_stack_lvl+0x74/0x90 + dump_stack+0x18/0x28 + __ubsan_handle_shift_out_of_bounds+0xf8/0x1e0 + reset_clidr+0x10c/0x1c8 + kvm_reset_sys_regs+0x50/0x1c8 + kvm_reset_vcpu+0xec/0x2b0 + __kvm_vcpu_set_target+0x84/0x158 + kvm_vcpu_set_target+0x138/0x168 + kvm_arch_vcpu_ioctl_vcpu_init+0x40/0x2b0 + kvm_arch_vcpu_ioctl+0x28c/0x4b8 + kvm_vcpu_ioctl+0x4bc/0x7a8 + __arm64_sys_ioctl+0xb4/0x100 + invoke_syscall+0x70/0x100 + el0_svc_common.constprop.0+0x48/0xf0 + do_el0_svc+0x24/0x38 + el0_svc+0x3c/0x158 + el0t_64_sync_handler+0x120/0x130 + el0t_64_sync+0x194/0x198 + +Fixes: 7af0c2534f4c ("KVM: arm64: Normalize cache configuration") +Cc: stable@vger.kernel.org +Reviewed-by: Gavin Shan +Signed-off-by: Ilkka Koskinen +Reviewed-by: Anshuman Khandual +Link: https://lore.kernel.org/r/20241017025701.67936-1-ilkka@os.amperecomputing.com +Signed-off-by: Marc Zyngier +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm64/kvm/sys_regs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm64/kvm/sys_regs.c ++++ b/arch/arm64/kvm/sys_regs.c +@@ -1708,7 +1708,7 @@ static u64 reset_clidr(struct kvm_vcpu * + * one cache line. + */ + if (kvm_has_mte(vcpu->kvm)) +- clidr |= 2 << CLIDR_TTYPE_SHIFT(loc); ++ clidr |= 2ULL << CLIDR_TTYPE_SHIFT(loc); + + __vcpu_sys_reg(vcpu, r->reg) = clidr; + diff --git a/queue-6.6/kvm-nsvm-ignore-ncr3-when-loading-pdptes-from-memory.patch b/queue-6.6/kvm-nsvm-ignore-ncr3-when-loading-pdptes-from-memory.patch new file mode 100644 index 00000000000..89dba7aef85 --- /dev/null +++ b/queue-6.6/kvm-nsvm-ignore-ncr3-when-loading-pdptes-from-memory.patch @@ -0,0 +1,59 @@ +From f559b2e9c5c5308850544ab59396b7d53cfc67bd Mon Sep 17 00:00:00 2001 +From: Sean Christopherson +Date: Wed, 9 Oct 2024 07:08:38 -0700 +Subject: KVM: nSVM: Ignore nCR3[4:0] when loading PDPTEs from memory + +From: Sean Christopherson + +commit f559b2e9c5c5308850544ab59396b7d53cfc67bd upstream. + +Ignore nCR3[4:0] when loading PDPTEs from memory for nested SVM, as bits +4:0 of CR3 are ignored when PAE paging is used, and thus VMRUN doesn't +enforce 32-byte alignment of nCR3. + +In the absolute worst case scenario, failure to ignore bits 4:0 can result +in an out-of-bounds read, e.g. if the target page is at the end of a +memslot, and the VMM isn't using guard pages. + +Per the APM: + + The CR3 register points to the base address of the page-directory-pointer + table. The page-directory-pointer table is aligned on a 32-byte boundary, + with the low 5 address bits 4:0 assumed to be 0. + +And the SDM's much more explicit: + + 4:0 Ignored + +Note, KVM gets this right when loading PDPTRs, it's only the nSVM flow +that is broken. + +Fixes: e4e517b4be01 ("KVM: MMU: Do not unconditionally read PDPTE from guest memory") +Reported-by: Kirk Swidowski +Cc: Andy Nguyen +Cc: 3pvd <3pvd@google.com> +Cc: stable@vger.kernel.org +Signed-off-by: Sean Christopherson +Message-ID: <20241009140838.1036226-1-seanjc@google.com> +Signed-off-by: Paolo Bonzini +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/kvm/svm/nested.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/arch/x86/kvm/svm/nested.c ++++ b/arch/x86/kvm/svm/nested.c +@@ -63,8 +63,12 @@ static u64 nested_svm_get_tdp_pdptr(stru + u64 pdpte; + int ret; + ++ /* ++ * Note, nCR3 is "assumed" to be 32-byte aligned, i.e. the CPU ignores ++ * nCR3[4:0] when loading PDPTEs from memory. ++ */ + ret = kvm_vcpu_read_guest_page(vcpu, gpa_to_gfn(cr3), &pdpte, +- offset_in_page(cr3) + index * 8, 8); ++ (cr3 & GENMASK(11, 5)) + index * 8, 8); + if (ret) + return 0; + return pdpte; diff --git a/queue-6.6/loongarch-enable-irq-if-do_ale-triggered-in-irq-enabled-context.patch b/queue-6.6/loongarch-enable-irq-if-do_ale-triggered-in-irq-enabled-context.patch new file mode 100644 index 00000000000..167680c2ff1 --- /dev/null +++ b/queue-6.6/loongarch-enable-irq-if-do_ale-triggered-in-irq-enabled-context.patch @@ -0,0 +1,70 @@ +From 69cc6fad5df4ce652d969be69acc60e269e5eea1 Mon Sep 17 00:00:00 2001 +From: Huacai Chen +Date: Mon, 21 Oct 2024 22:11:19 +0800 +Subject: LoongArch: Enable IRQ if do_ale() triggered in irq-enabled context + +From: Huacai Chen + +commit 69cc6fad5df4ce652d969be69acc60e269e5eea1 upstream. + +Unaligned access exception can be triggered in irq-enabled context such +as user mode, in this case do_ale() may call get_user() which may cause +sleep. Then we will get: + + BUG: sleeping function called from invalid context at arch/loongarch/kernel/access-helper.h:7 + in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 129, name: modprobe + preempt_count: 0, expected: 0 + RCU nest depth: 0, expected: 0 + CPU: 0 UID: 0 PID: 129 Comm: modprobe Tainted: G W 6.12.0-rc1+ #1723 + Tainted: [W]=WARN + Stack : 9000000105e0bd48 0000000000000000 9000000003803944 9000000105e08000 + 9000000105e0bc70 9000000105e0bc78 0000000000000000 0000000000000000 + 9000000105e0bc78 0000000000000001 9000000185e0ba07 9000000105e0b890 + ffffffffffffffff 9000000105e0bc78 73924b81763be05b 9000000100194500 + 000000000000020c 000000000000000a 0000000000000000 0000000000000003 + 00000000000023f0 00000000000e1401 00000000072f8000 0000007ffbb0e260 + 0000000000000000 0000000000000000 9000000005437650 90000000055d5000 + 0000000000000000 0000000000000003 0000007ffbb0e1f0 0000000000000000 + 0000005567b00490 0000000000000000 9000000003803964 0000007ffbb0dfec + 00000000000000b0 0000000000000007 0000000000000003 0000000000071c1d + ... + Call Trace: + [<9000000003803964>] show_stack+0x64/0x1a0 + [<9000000004c57464>] dump_stack_lvl+0x74/0xb0 + [<9000000003861ab4>] __might_resched+0x154/0x1a0 + [<900000000380c96c>] emulate_load_store_insn+0x6c/0xf60 + [<9000000004c58118>] do_ale+0x78/0x180 + [<9000000003801bc8>] handle_ale+0x128/0x1e0 + +So enable IRQ if unaligned access exception is triggered in irq-enabled +context to fix it. + +Cc: stable@vger.kernel.org +Reported-by: Binbin Zhou +Signed-off-by: Huacai Chen +Signed-off-by: Greg Kroah-Hartman +--- + arch/loongarch/kernel/traps.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/arch/loongarch/kernel/traps.c ++++ b/arch/loongarch/kernel/traps.c +@@ -529,6 +529,9 @@ asmlinkage void noinstr do_ale(struct pt + #else + unsigned int *pc; + ++ if (regs->csr_prmd & CSR_PRMD_PIE) ++ local_irq_enable(); ++ + perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, regs, regs->csr_badvaddr); + + /* +@@ -553,6 +556,8 @@ sigbus: + die_if_kernel("Kernel ale access", regs); + force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *)regs->csr_badvaddr); + out: ++ if (regs->csr_prmd & CSR_PRMD_PIE) ++ local_irq_disable(); + #endif + irqentry_exit(regs, state); + } diff --git a/queue-6.6/loongarch-get-correct-cores_per_package-for-smt-systems.patch b/queue-6.6/loongarch-get-correct-cores_per_package-for-smt-systems.patch new file mode 100644 index 00000000000..b1f2601cba3 --- /dev/null +++ b/queue-6.6/loongarch-get-correct-cores_per_package-for-smt-systems.patch @@ -0,0 +1,58 @@ +From b7296f9d5bf99330063d4bbecc43c9b33fed0137 Mon Sep 17 00:00:00 2001 +From: Huacai Chen +Date: Mon, 21 Oct 2024 22:11:18 +0800 +Subject: LoongArch: Get correct cores_per_package for SMT systems + +From: Huacai Chen + +commit b7296f9d5bf99330063d4bbecc43c9b33fed0137 upstream. + +In loongson_sysconf, The "core" of cores_per_node and cores_per_package +stands for a logical core, which means in a SMT system it stands for a +thread indeed. This information is gotten from SMBIOS Type4 Structure, +so in order to get a correct cores_per_package for both SMT and non-SMT +systems in parse_cpu_table() we should use SMBIOS_THREAD_PACKAGE_OFFSET +instead of SMBIOS_CORE_PACKAGE_OFFSET. + +Cc: stable@vger.kernel.org +Reported-by: Chao Li +Tested-by: Chao Li +Signed-off-by: Huacai Chen +Signed-off-by: Greg Kroah-Hartman +--- + arch/loongarch/include/asm/bootinfo.h | 4 ++++ + arch/loongarch/kernel/setup.c | 3 ++- + 2 files changed, 6 insertions(+), 1 deletion(-) + +--- a/arch/loongarch/include/asm/bootinfo.h ++++ b/arch/loongarch/include/asm/bootinfo.h +@@ -24,6 +24,10 @@ struct loongson_board_info { + const char *board_vendor; + }; + ++/* ++ * The "core" of cores_per_node and cores_per_package stands for a ++ * logical core, which means in a SMT system it stands for a thread. ++ */ + struct loongson_system_configuration { + int nr_cpus; + int nr_nodes; +--- a/arch/loongarch/kernel/setup.c ++++ b/arch/loongarch/kernel/setup.c +@@ -55,6 +55,7 @@ + #define SMBIOS_FREQHIGH_OFFSET 0x17 + #define SMBIOS_FREQLOW_MASK 0xFF + #define SMBIOS_CORE_PACKAGE_OFFSET 0x23 ++#define SMBIOS_THREAD_PACKAGE_OFFSET 0x25 + #define LOONGSON_EFI_ENABLE (1 << 3) + + #ifdef CONFIG_EFI +@@ -129,7 +130,7 @@ static void __init parse_cpu_table(const + cpu_clock_freq = freq_temp * 1000000; + + loongson_sysconf.cpuname = (void *)dmi_string_parse(dm, dmi_data[16]); +- loongson_sysconf.cores_per_package = *(dmi_data + SMBIOS_CORE_PACKAGE_OFFSET); ++ loongson_sysconf.cores_per_package = *(dmi_data + SMBIOS_THREAD_PACKAGE_OFFSET); + + pr_info("CpuClock = %llu\n", cpu_clock_freq); + } diff --git a/queue-6.6/loongarch-make-kasan-usable-for-variable-cpu_vabits.patch b/queue-6.6/loongarch-make-kasan-usable-for-variable-cpu_vabits.patch new file mode 100644 index 00000000000..ef86cfd6874 --- /dev/null +++ b/queue-6.6/loongarch-make-kasan-usable-for-variable-cpu_vabits.patch @@ -0,0 +1,36 @@ +From 3c252263be801f937f56b4bcd8e8e2b5307c1ce5 Mon Sep 17 00:00:00 2001 +From: Huacai Chen +Date: Wed, 23 Oct 2024 22:15:30 +0800 +Subject: LoongArch: Make KASAN usable for variable cpu_vabits + +From: Huacai Chen + +commit 3c252263be801f937f56b4bcd8e8e2b5307c1ce5 upstream. + +Currently, KASAN on LoongArch assume the CPU VA bits is 48, which is +true for Loongson-3 series, but not for Loongson-2 series (only 40 or +lower), this patch fix that issue and make KASAN usable for variable +cpu_vabits. + +Solution is very simple: Just define XRANGE_SHADOW_SHIFT which means +valid address length from VA_BITS to min(cpu_vabits, VA_BITS). + +Cc: stable@vger.kernel.org +Signed-off-by: Kanglong Wang +Signed-off-by: Huacai Chen +Signed-off-by: Greg Kroah-Hartman +--- + arch/loongarch/include/asm/kasan.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/loongarch/include/asm/kasan.h ++++ b/arch/loongarch/include/asm/kasan.h +@@ -16,7 +16,7 @@ + #define XRANGE_SHIFT (48) + + /* Valid address length */ +-#define XRANGE_SHADOW_SHIFT (PGDIR_SHIFT + PAGE_SHIFT - 3) ++#define XRANGE_SHADOW_SHIFT min(cpu_vabits, VA_BITS) + /* Used for taking out the valid address */ + #define XRANGE_SHADOW_MASK GENMASK_ULL(XRANGE_SHADOW_SHIFT - 1, 0) + /* One segment whole address space size */ diff --git a/queue-6.6/nilfs2-fix-kernel-bug-due-to-missing-clearing-of-buffer-delay-flag.patch b/queue-6.6/nilfs2-fix-kernel-bug-due-to-missing-clearing-of-buffer-delay-flag.patch new file mode 100644 index 00000000000..cf1f8173dc0 --- /dev/null +++ b/queue-6.6/nilfs2-fix-kernel-bug-due-to-missing-clearing-of-buffer-delay-flag.patch @@ -0,0 +1,55 @@ +From 6ed469df0bfbef3e4b44fca954a781919db9f7ab Mon Sep 17 00:00:00 2001 +From: Ryusuke Konishi +Date: Wed, 16 Oct 2024 06:32:07 +0900 +Subject: nilfs2: fix kernel bug due to missing clearing of buffer delay flag + +From: Ryusuke Konishi + +commit 6ed469df0bfbef3e4b44fca954a781919db9f7ab upstream. + +Syzbot reported that after nilfs2 reads a corrupted file system image +and degrades to read-only, the BUG_ON check for the buffer delay flag +in submit_bh_wbc() may fail, causing a kernel bug. + +This is because the buffer delay flag is not cleared when clearing the +buffer state flags to discard a page/folio or a buffer head. So, fix +this. + +This became necessary when the use of nilfs2's own page clear routine +was expanded. This state inconsistency does not occur if the buffer +is written normally by log writing. + +Signed-off-by: Ryusuke Konishi +Link: https://lore.kernel.org/r/20241015213300.7114-1-konishi.ryusuke@gmail.com +Fixes: 8c26c4e2694a ("nilfs2: fix issue with flush kernel thread after remount in RO mode because of driver's internal error or metadata corruption") +Reported-by: syzbot+985ada84bf055a575c07@syzkaller.appspotmail.com +Closes: https://syzkaller.appspot.com/bug?extid=985ada84bf055a575c07 +Cc: stable@vger.kernel.org +Signed-off-by: Christian Brauner +Signed-off-by: Greg Kroah-Hartman +--- + fs/nilfs2/page.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/fs/nilfs2/page.c ++++ b/fs/nilfs2/page.c +@@ -77,7 +77,8 @@ void nilfs_forget_buffer(struct buffer_h + const unsigned long clear_bits = + (BIT(BH_Uptodate) | BIT(BH_Dirty) | BIT(BH_Mapped) | + BIT(BH_Async_Write) | BIT(BH_NILFS_Volatile) | +- BIT(BH_NILFS_Checked) | BIT(BH_NILFS_Redirected)); ++ BIT(BH_NILFS_Checked) | BIT(BH_NILFS_Redirected) | ++ BIT(BH_Delay)); + + lock_buffer(bh); + set_mask_bits(&bh->b_state, clear_bits, 0); +@@ -410,7 +411,8 @@ void nilfs_clear_dirty_page(struct page + const unsigned long clear_bits = + (BIT(BH_Uptodate) | BIT(BH_Dirty) | BIT(BH_Mapped) | + BIT(BH_Async_Write) | BIT(BH_NILFS_Volatile) | +- BIT(BH_NILFS_Checked) | BIT(BH_NILFS_Redirected)); ++ BIT(BH_NILFS_Checked) | BIT(BH_NILFS_Redirected) | ++ BIT(BH_Delay)); + + bh = head = page_buffers(page); + do { diff --git a/queue-6.6/openat2-explicitly-return-e2big-for-usize-page_size.patch b/queue-6.6/openat2-explicitly-return-e2big-for-usize-page_size.patch new file mode 100644 index 00000000000..7cd3ecbc621 --- /dev/null +++ b/queue-6.6/openat2-explicitly-return-e2big-for-usize-page_size.patch @@ -0,0 +1,35 @@ +From f92f0a1b05698340836229d791b3ffecc71b265a Mon Sep 17 00:00:00 2001 +From: Aleksa Sarai +Date: Thu, 10 Oct 2024 07:40:36 +1100 +Subject: openat2: explicitly return -E2BIG for (usize > PAGE_SIZE) + +From: Aleksa Sarai + +commit f92f0a1b05698340836229d791b3ffecc71b265a upstream. + +While we do currently return -EFAULT in this case, it seems prudent to +follow the behaviour of other syscalls like clone3. It seems quite +unlikely that anyone depends on this error code being EFAULT, but we can +always revert this if it turns out to be an issue. + +Cc: stable@vger.kernel.org # v5.6+ +Fixes: fddb5d430ad9 ("open: introduce openat2(2) syscall") +Signed-off-by: Aleksa Sarai +Link: https://lore.kernel.org/r/20241010-extensible-structs-check_fields-v3-3-d2833dfe6edd@cyphar.com +Signed-off-by: Christian Brauner +Signed-off-by: Greg Kroah-Hartman +--- + fs/open.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/fs/open.c ++++ b/fs/open.c +@@ -1461,6 +1461,8 @@ SYSCALL_DEFINE4(openat2, int, dfd, const + + if (unlikely(usize < OPEN_HOW_SIZE_VER0)) + return -EINVAL; ++ if (unlikely(usize > PAGE_SIZE)) ++ return -E2BIG; + + err = copy_struct_from_user(&tmp, sizeof(tmp), how, usize); + if (err) diff --git a/queue-6.6/series b/queue-6.6/series index ffe134c010d..ecd92938553 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -174,3 +174,23 @@ alsa-hda-realtek-update-default-depop-procedure.patch smb-client-handle-kstrdup-failures-for-passwords.patch cpufreq-cppc-move-and-rename-cppc_cpufreq_-perf_to_k.patch cpufreq-cppc-fix-perf_to_khz-khz_to_perf-conversion-.patch +btrfs-fix-passing-0-to-err_ptr-in-btrfs_search_dir_index_item.patch +btrfs-zoned-fix-zone-unusable-accounting-for-freed-reserved-extent.patch +drm-amd-guard-against-bad-data-for-atif-acpi-method.patch +acpi-resource-add-lg-16t90sp-to-irq1_level_low_skip_override.patch +acpi-prm-find-efi_memory_runtime-block-for-prm-handler-and-context.patch +acpi-button-add-dmi-quirk-for-samsung-galaxy-book2-to-fix-initial-lid-detection-issue.patch +nilfs2-fix-kernel-bug-due-to-missing-clearing-of-buffer-delay-flag.patch +openat2-explicitly-return-e2big-for-usize-page_size.patch +kvm-nsvm-ignore-ncr3-when-loading-pdptes-from-memory.patch +kvm-arm64-fix-shift-out-of-bounds-bug.patch +kvm-arm64-don-t-eagerly-teardown-the-vgic-on-init-error.patch +x86-lam-disable-address_masking-in-most-cases.patch +alsa-hda-tas2781-select-crc32-instead-of-crc32_sarwate.patch +alsa-hda-realtek-add-subwoofer-quirk-for-acer-predator-g9-593.patch +loongarch-get-correct-cores_per_package-for-smt-systems.patch +loongarch-enable-irq-if-do_ale-triggered-in-irq-enabled-context.patch +loongarch-make-kasan-usable-for-variable-cpu_vabits.patch +xfrm-fix-one-more-kernel-infoleak-in-algo-dumping.patch +hv_netvsc-fix-vf-namespace-also-in-synthetic-nic-netdev_register-event.patch +drm-amd-display-disable-psr-su-on-parade-08-01-tcon-too.patch diff --git a/queue-6.6/x86-lam-disable-address_masking-in-most-cases.patch b/queue-6.6/x86-lam-disable-address_masking-in-most-cases.patch new file mode 100644 index 00000000000..8d090b24c7f --- /dev/null +++ b/queue-6.6/x86-lam-disable-address_masking-in-most-cases.patch @@ -0,0 +1,46 @@ +From 3267cb6d3a174ff83d6287dcd5b0047bbd912452 Mon Sep 17 00:00:00 2001 +From: Pawan Gupta +Date: Tue, 23 Jan 2024 19:55:21 -0800 +Subject: x86/lam: Disable ADDRESS_MASKING in most cases + +From: Pawan Gupta + +commit 3267cb6d3a174ff83d6287dcd5b0047bbd912452 upstream. + +Linear Address Masking (LAM) has a weakness related to transient +execution as described in the SLAM paper[1]. Unless Linear Address +Space Separation (LASS) is enabled this weakness may be exploitable. + +Until kernel adds support for LASS[2], only allow LAM for COMPILE_TEST, +or when speculation mitigations have been disabled at compile time, +otherwise keep LAM disabled. + +There are no processors in market that support LAM yet, so currently +nobody is affected by this issue. + +[1] SLAM: https://download.vusec.net/papers/slam_sp24.pdf +[2] LASS: https://lore.kernel.org/lkml/20230609183632.48706-1-alexander.shishkin@linux.intel.com/ + +[ dhansen: update SPECULATION_MITIGATIONS -> CPU_MITIGATIONS ] + +Signed-off-by: Pawan Gupta +Signed-off-by: Dave Hansen +Reviewed-by: Sohil Mehta +Acked-by: Kirill A. Shutemov +Cc:stable@vger.kernel.org +Link: https://lore.kernel.org/all/5373262886f2783f054256babdf5a98545dc986b.1706068222.git.pawan.kumar.gupta%40linux.intel.com +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig +@@ -2217,6 +2217,7 @@ config RANDOMIZE_MEMORY_PHYSICAL_PADDING + config ADDRESS_MASKING + bool "Linear Address Masking support" + depends on X86_64 ++ depends on COMPILE_TEST || !CPU_MITIGATIONS # wait for LASS + help + Linear Address Masking (LAM) modifies the checking that is applied + to 64-bit linear addresses, allowing software to use of the diff --git a/queue-6.6/xfrm-fix-one-more-kernel-infoleak-in-algo-dumping.patch b/queue-6.6/xfrm-fix-one-more-kernel-infoleak-in-algo-dumping.patch new file mode 100644 index 00000000000..98c70ccad4b --- /dev/null +++ b/queue-6.6/xfrm-fix-one-more-kernel-infoleak-in-algo-dumping.patch @@ -0,0 +1,101 @@ +From 6889cd2a93e1e3606b3f6e958aa0924e836de4d2 Mon Sep 17 00:00:00 2001 +From: Petr Vaganov +Date: Tue, 8 Oct 2024 14:02:58 +0500 +Subject: xfrm: fix one more kernel-infoleak in algo dumping + +From: Petr Vaganov + +commit 6889cd2a93e1e3606b3f6e958aa0924e836de4d2 upstream. + +During fuzz testing, the following issue was discovered: + +BUG: KMSAN: kernel-infoleak in _copy_to_iter+0x598/0x2a30 + _copy_to_iter+0x598/0x2a30 + __skb_datagram_iter+0x168/0x1060 + skb_copy_datagram_iter+0x5b/0x220 + netlink_recvmsg+0x362/0x1700 + sock_recvmsg+0x2dc/0x390 + __sys_recvfrom+0x381/0x6d0 + __x64_sys_recvfrom+0x130/0x200 + x64_sys_call+0x32c8/0x3cc0 + do_syscall_64+0xd8/0x1c0 + entry_SYSCALL_64_after_hwframe+0x79/0x81 + +Uninit was stored to memory at: + copy_to_user_state_extra+0xcc1/0x1e00 + dump_one_state+0x28c/0x5f0 + xfrm_state_walk+0x548/0x11e0 + xfrm_dump_sa+0x1e0/0x840 + netlink_dump+0x943/0x1c40 + __netlink_dump_start+0x746/0xdb0 + xfrm_user_rcv_msg+0x429/0xc00 + netlink_rcv_skb+0x613/0x780 + xfrm_netlink_rcv+0x77/0xc0 + netlink_unicast+0xe90/0x1280 + netlink_sendmsg+0x126d/0x1490 + __sock_sendmsg+0x332/0x3d0 + ____sys_sendmsg+0x863/0xc30 + ___sys_sendmsg+0x285/0x3e0 + __x64_sys_sendmsg+0x2d6/0x560 + x64_sys_call+0x1316/0x3cc0 + do_syscall_64+0xd8/0x1c0 + entry_SYSCALL_64_after_hwframe+0x79/0x81 + +Uninit was created at: + __kmalloc+0x571/0xd30 + attach_auth+0x106/0x3e0 + xfrm_add_sa+0x2aa0/0x4230 + xfrm_user_rcv_msg+0x832/0xc00 + netlink_rcv_skb+0x613/0x780 + xfrm_netlink_rcv+0x77/0xc0 + netlink_unicast+0xe90/0x1280 + netlink_sendmsg+0x126d/0x1490 + __sock_sendmsg+0x332/0x3d0 + ____sys_sendmsg+0x863/0xc30 + ___sys_sendmsg+0x285/0x3e0 + __x64_sys_sendmsg+0x2d6/0x560 + x64_sys_call+0x1316/0x3cc0 + do_syscall_64+0xd8/0x1c0 + entry_SYSCALL_64_after_hwframe+0x79/0x81 + +Bytes 328-379 of 732 are uninitialized +Memory access of size 732 starts at ffff88800e18e000 +Data copied to user address 00007ff30f48aff0 + +CPU: 2 PID: 18167 Comm: syz-executor.0 Not tainted 6.8.11 #1 +Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 + +Fixes copying of xfrm algorithms where some random +data of the structure fields can end up in userspace. +Padding in structures may be filled with random (possibly sensitve) +data and should never be given directly to user-space. + +A similar issue was resolved in the commit +8222d5910dae ("xfrm: Zero padding when dumping algos and encap") + +Found by Linux Verification Center (linuxtesting.org) with Syzkaller. + +Fixes: c7a5899eb26e ("xfrm: redact SA secret with lockdown confidentiality") +Cc: stable@vger.kernel.org +Co-developed-by: Boris Tonofa +Signed-off-by: Boris Tonofa +Signed-off-by: Petr Vaganov +Signed-off-by: Steffen Klassert +Signed-off-by: Greg Kroah-Hartman +--- + net/xfrm/xfrm_user.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/net/xfrm/xfrm_user.c ++++ b/net/xfrm/xfrm_user.c +@@ -1098,7 +1098,9 @@ static int copy_to_user_auth(struct xfrm + if (!nla) + return -EMSGSIZE; + ap = nla_data(nla); +- memcpy(ap, auth, sizeof(struct xfrm_algo_auth)); ++ strscpy_pad(ap->alg_name, auth->alg_name, sizeof(ap->alg_name)); ++ ap->alg_key_len = auth->alg_key_len; ++ ap->alg_trunc_len = auth->alg_trunc_len; + if (redact_secret && auth->alg_key_len) + memset(ap->alg_key, 0, (auth->alg_key_len + 7) / 8); + else -- 2.47.2