From: Greg Kroah-Hartman Date: Mon, 11 Sep 2023 06:46:40 +0000 (+0200) Subject: 5.15-stable patches X-Git-Tag: v6.1.53~20 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7314258c5ce9f440f17f0d5f1e5da73d3b68af0e;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: tracing-zero-the-pipe-cpumask-on-alloc-to-avoid-spurious-ebusy.patch --- diff --git a/queue-5.15/series b/queue-5.15/series index 08deae85fda..ecb45226ddb 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -373,3 +373,4 @@ usb-core-fix-oversight-in-superspeed-initialization.patch x86-sgx-break-up-long-non-preemptible-delays-in-sgx_vepc_release.patch perf-x86-uncore-correct-the-number-of-chas-on-emr.patch net-remove-duplicate-indirect_callable_declare-of-udp_ehashfn.patch +tracing-zero-the-pipe-cpumask-on-alloc-to-avoid-spurious-ebusy.patch diff --git a/queue-5.15/tracing-zero-the-pipe-cpumask-on-alloc-to-avoid-spurious-ebusy.patch b/queue-5.15/tracing-zero-the-pipe-cpumask-on-alloc-to-avoid-spurious-ebusy.patch new file mode 100644 index 00000000000..42ecd7ae527 --- /dev/null +++ b/queue-5.15/tracing-zero-the-pipe-cpumask-on-alloc-to-avoid-spurious-ebusy.patch @@ -0,0 +1,53 @@ +From 3d07fa1dd19035eb0b13ae6697efd5caa9033e74 Mon Sep 17 00:00:00 2001 +From: Brian Foster +Date: Thu, 31 Aug 2023 08:55:00 -0400 +Subject: tracing: Zero the pipe cpumask on alloc to avoid spurious -EBUSY + +From: Brian Foster + +commit 3d07fa1dd19035eb0b13ae6697efd5caa9033e74 upstream. + +The pipe cpumask used to serialize opens between the main and percpu +trace pipes is not zeroed or initialized. This can result in +spurious -EBUSY returns if underlying memory is not fully zeroed. +This has been observed by immediate failure to read the main +trace_pipe file on an otherwise newly booted and idle system: + + # cat /sys/kernel/debug/tracing/trace_pipe + cat: /sys/kernel/debug/tracing/trace_pipe: Device or resource busy + +Zero the allocation of pipe_cpumask to avoid the problem. + +Link: https://lore.kernel.org/linux-trace-kernel/20230831125500.986862-1-bfoster@redhat.com + +Cc: stable@vger.kernel.org +Fixes: c2489bb7e6be ("tracing: Introduce pipe_cpumask to avoid race on trace_pipes") +Reviewed-by: Zheng Yejian +Reviewed-by: Masami Hiramatsu (Google) +Signed-off-by: Brian Foster +Signed-off-by: Steven Rostedt (Google) +Signed-off-by: Greg Kroah-Hartman +--- + kernel/trace/trace.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/kernel/trace/trace.c ++++ b/kernel/trace/trace.c +@@ -9350,7 +9350,7 @@ static struct trace_array *trace_array_c + if (!alloc_cpumask_var(&tr->tracing_cpumask, GFP_KERNEL)) + goto out_free_tr; + +- if (!alloc_cpumask_var(&tr->pipe_cpumask, GFP_KERNEL)) ++ if (!zalloc_cpumask_var(&tr->pipe_cpumask, GFP_KERNEL)) + goto out_free_tr; + + tr->trace_flags = global_trace.trace_flags & ~ZEROED_TRACE_FLAGS; +@@ -10208,7 +10208,7 @@ __init static int tracer_alloc_buffers(v + if (trace_create_savedcmd() < 0) + goto out_free_temp_buffer; + +- if (!alloc_cpumask_var(&global_trace.pipe_cpumask, GFP_KERNEL)) ++ if (!zalloc_cpumask_var(&global_trace.pipe_cpumask, GFP_KERNEL)) + goto out_free_savedcmd; + + /* TODO: make the number of buffers hot pluggable with CPUS */