From: Greg Kroah-Hartman Date: Tue, 18 Jun 2024 13:37:19 +0000 (+0200) Subject: 5.10-stable patches X-Git-Tag: v6.1.95~83 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9efcf691c351bccf11017de646fd70eba2d19100;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: irqchip-gic-v3-its-fix-potential-race-condition-in-its_vlpi_prop_update.patch null_blk-print-correct-max-open-zones-limit-in-null_init_zoned_dev.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 --- diff --git a/queue-5.10/irqchip-gic-v3-its-fix-potential-race-condition-in-its_vlpi_prop_update.patch b/queue-5.10/irqchip-gic-v3-its-fix-potential-race-condition-in-its_vlpi_prop_update.patch new file mode 100644 index 00000000000..78d43ae77c1 --- /dev/null +++ b/queue-5.10/irqchip-gic-v3-its-fix-potential-race-condition-in-its_vlpi_prop_update.patch @@ -0,0 +1,141 @@ +From b97e8a2f7130a4b30d1502003095833d16c028b3 Mon Sep 17 00:00:00 2001 +From: Hagar Hemdan +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 + +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 +Signed-off-by: Hagar Hemdan +Signed-off-by: Thomas Gleixner +Cc: stable@vger.kernel.org +Reviewed-by: Marc Zyngier +Link: https://lore.kernel.org/r/20240531162144.28650-1-hagarhem@amazon.com +Signed-off-by: Greg Kroah-Hartman +--- + 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 +@@ -1826,28 +1826,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 */ +@@ -1879,46 +1873,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); +@@ -1942,9 +1922,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) +@@ -1972,6 +1950,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-5.10/null_blk-print-correct-max-open-zones-limit-in-null_init_zoned_dev.patch b/queue-5.10/null_blk-print-correct-max-open-zones-limit-in-null_init_zoned_dev.patch new file mode 100644 index 00000000000..04be96de308 --- /dev/null +++ b/queue-5.10/null_blk-print-correct-max-open-zones-limit-in-null_init_zoned_dev.patch @@ -0,0 +1,34 @@ +From 233e27b4d21c3e44eb863f03e566d3a22e81a7ae Mon Sep 17 00:00:00 2001 +From: Damien Le Moal +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 + +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 +Reviewed-by: Niklas Cassel +Link: https://lore.kernel.org/r/20240528062852.437599-1-dlemoal@kernel.org +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman +--- + 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 +@@ -81,7 +81,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-5.10/series b/queue-5.10/series index 919b359fe68..73ca3cdf692 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -1,3 +1,6 @@ +irqchip-gic-v3-its-fix-potential-race-condition-in-its_vlpi_prop_update.patch +tracing-selftests-fix-kprobe-event-name-test-for-.isra.-functions.patch +null_blk-print-correct-max-open-zones-limit-in-null_init_zoned_dev.patch wifi-mac80211-mesh-fix-leak-of-mesh_preq_queue-objec.patch wifi-mac80211-fix-deadlock-in-ieee80211_sta_ps_deliv.patch wifi-cfg80211-pmsr-use-correct-nla_get_ux-functions.patch @@ -106,3 +109,5 @@ drivers-core-synchronize-really_probe-and-dev_uevent.patch x86-mm-numa-use-numa_no_node-when-calling-memblock_set_node.patch drm-exynos-vidi-fix-memory-leak-in-.get_modes.patch drm-exynos-hdmi-report-safe-640x480-mode-as-a-fallback-when-no-edid-found.patch +tracing-add-module_description-to-preemptirq_delay_test.patch +vmci-prevent-speculation-leaks-by-sanitizing-event-in-event_deliver.patch diff --git a/queue-5.10/tracing-add-module_description-to-preemptirq_delay_test.patch b/queue-5.10/tracing-add-module_description-to-preemptirq_delay_test.patch new file mode 100644 index 00000000000..45e0568aed4 --- /dev/null +++ b/queue-5.10/tracing-add-module_description-to-preemptirq_delay_test.patch @@ -0,0 +1,34 @@ +From 23748e3e0fbfe471eff5ce439921629f6a427828 Mon Sep 17 00:00:00 2001 +From: Jeff Johnson +Date: Sat, 18 May 2024 15:54:49 -0700 +Subject: tracing: Add MODULE_DESCRIPTION() to preemptirq_delay_test + +From: Jeff Johnson + +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 +Fixes: f96e8577da10 ("lib: Add module for testing preemptoff/irqsoff latency tracers") +Acked-by: Masami Hiramatsu (Google) +Signed-off-by: Jeff Johnson +Signed-off-by: Steven Rostedt (Google) +Signed-off-by: Greg Kroah-Hartman +--- + 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 +@@ -201,4 +201,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-5.10/tracing-selftests-fix-kprobe-event-name-test-for-.isra.-functions.patch b/queue-5.10/tracing-selftests-fix-kprobe-event-name-test-for-.isra.-functions.patch new file mode 100644 index 00000000000..18c3db0ca2f --- /dev/null +++ b/queue-5.10/tracing-selftests-fix-kprobe-event-name-test-for-.isra.-functions.patch @@ -0,0 +1,50 @@ +From 23a4b108accc29a6125ed14de4a044689ffeda78 Mon Sep 17 00:00:00 2001 +From: "Steven Rostedt (Google)" +Date: Mon, 20 May 2024 20:57:37 -0400 +Subject: tracing/selftests: Fix kprobe event name test for .isra. functions + +From: Steven Rostedt (Google) + +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) +Acked-by: Masami Hiramatsu (Google) +Signed-off-by: Shuah Khan +Signed-off-by: Greg Kroah-Hartman +--- + 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-5.10/vmci-prevent-speculation-leaks-by-sanitizing-event-in-event_deliver.patch b/queue-5.10/vmci-prevent-speculation-leaks-by-sanitizing-event-in-event_deliver.patch new file mode 100644 index 00000000000..bec9e30cacd --- /dev/null +++ b/queue-5.10/vmci-prevent-speculation-leaks-by-sanitizing-event-in-event_deliver.patch @@ -0,0 +1,56 @@ +From 8003f00d895310d409b2bf9ef907c56b42a4e0f4 Mon Sep 17 00:00:00 2001 +From: Hagar Gamal Halim Hemdan +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 + +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 +Signed-off-by: Hagar Gamal Halim Hemdan +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 +Signed-off-by: Greg Kroah-Hartman +--- + 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 + #include + #include ++#include + #include + #include + #include +@@ -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);