Skip to contentSkip to conversation

FAILED: patch "[PATCH] tracing: Fix logged instance name on creation failure" failed to apply to 6.6-stable tree

PATCH New [email protected] 2 participants 3 messages Sep 3 – Sep 4

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x a9a01be2834a529cbd490ccbab02643f0c1735f2
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090305-creole-floral-cc49@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..'

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From a9a01be2834a529cbd490ccbab02643f0c1735f2 Mon Sep 17 00:00:00 2001
From: Vincent Donnefort <[email protected]>
Date: Fri, 7 Aug 2026 09:54:23 +0100
Subject: [PATCH] tracing: Fix logged instance name on creation failure

When boot instance creation fails, the kernel incorrectly logs "(null)" as the instance name because strsep() consumes curr_str entirely during parsing.

Print the properly parsed name variable instead. And while at it log the error code.

kernel/trace/trace.c +2 -1
index 89dc1c0ebb90..740c5f358b75 100644
@@ -9726,7 +9726,8 @@ __init static void enable_instances(void)
 
 		tr = trace_array_create_systems(name, NULL, addr, size);
 		if (IS_ERR(tr)) {
-			pr_warn("Tracing: Failed to create instance buffer %s\n", curr_str);
+			pr_warn("Tracing: Failed to create instance buffer '%s' (%ld)\n", name,
+				PTR_ERR(tr));
 			continue;
 		}
 
maintainer
#1 lore raw

PATCH 1/2 tracing: Fix NULL vs IS_ERR() check in enable_instances()

From: Dan Carpenter <[email protected]>

[ Upstream commit 94dfa500e7deddceff22768bb994f0fa67bd2fd0 ]

The trace_array_create_systems() function returns error pointers, not NULL. Fix the check to match.

Cc Masami Hiramatsu <[email protected]>
Cc Mathieu Desnoyers <[email protected]>
Fixes e645535a954a ("tracing: Add option to use memmapped memory for trace boot instance")

Stable-dep-of: a9a01be2834a ("tracing: Fix logged instance name on creation failure")

---
 kernel/trace/trace.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)
kernel/trace/trace.c +18 -7
index f57baf67726da..61e7c857a4652 100644
@@ -9416,11 +9416,17 @@ static int trace_array_create_dir(struct trace_array *tr)
 }
 
 static struct trace_array *
-trace_array_create_systems(const char *name, const char *systems)
+trace_array_create_systems(const char *name, const char *systems,
+			   unsigned long range_addr_start,
+			   unsigned long range_addr_size)
 {
 	struct trace_array *tr;
 	int ret;
 
+	/* Reserved-memory trace buffers are not supported by this kernel. */
+	(void)range_addr_start;
+	(void)range_addr_size;
+
 	ret = -ENOMEM;
 	tr = kzalloc(sizeof(*tr), GFP_KERNEL);
 	if (!tr)
@@ -9494,7 +9500,7 @@ trace_array_create_systems(const char *name, const char *systems)
 
 static struct trace_array *trace_array_create(const char *name)
 {
-	return trace_array_create_systems(name, NULL);
+	return trace_array_create_systems(name, NULL, 0, 0);
 }
 
 static int instance_mkdir(const char *name)
@@ -9548,7 +9554,7 @@ struct trace_array *trace_array_get_by_name(const char *name, const char *system
 			goto out_unlock;
 	}
 
-	tr = trace_array_create_systems(name, systems);
+	tr = trace_array_create_systems(name, systems, 0, 0);
 
 	if (IS_ERR(tr))
 		tr = NULL;
@@ -10300,6 +10306,7 @@ __init static void enable_instances(void)
 {
 	struct trace_array *tr;
 	char *curr_str;
+	char *name;
 	char *str;
 	char *tok;
 
@@ -10308,17 +10315,21 @@ __init static void enable_instances(void)
 	str = boot_instance_info;
 
 	while ((curr_str = strsep(&str, "\t"))) {
+		unsigned long addr = 0;
+		unsigned long size = 0;
 
 		tok = strsep(&curr_str, ",");
+		name = tok;
 
 		if (IS_ENABLED(CONFIG_TRACER_MAX_TRACE))
-			do_allocate_snapshot(tok);
+			do_allocate_snapshot(name);
 
-		tr = trace_array_get_by_name(tok, NULL);
-		if (!tr) {
-			pr_warn("Failed to create instance buffer %s\n", curr_str);
+		tr = trace_array_create_systems(name, NULL, addr, size);
+		if (IS_ERR(tr)) {
+			pr_warn("Tracing: Failed to create instance buffer %s\n", curr_str);
 			continue;
 		}
+
 		/* Allow user space to delete it */
 		trace_array_put(tr);
 
Signature · 1 line
2.53.0
maintainer
#2 lore raw

PATCH 2/2 tracing: Fix logged instance name on creation failure

From: Vincent Donnefort <[email protected]>

[ Upstream commit a9a01be2834a529cbd490ccbab02643f0c1735f2 ]

When boot instance creation fails, the kernel incorrectly logs "(null)" as the instance name because strsep() consumes curr_str entirely during parsing.

Print the properly parsed name variable instead. And while at it log the error code.

---
 kernel/trace/trace.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/trace/trace.c +2 -1
index 61e7c857a4652..535e47b5c40ad 100644
@@ -10326,7 +10326,8 @@ __init static void enable_instances(void)
 
 		tr = trace_array_create_systems(name, NULL, addr, size);
 		if (IS_ERR(tr)) {
-			pr_warn("Tracing: Failed to create instance buffer %s\n", curr_str);
+			pr_warn("Tracing: Failed to create instance buffer '%s' (%ld)\n", name,
+				PTR_ERR(tr));
 			continue;
 		}
 
Signature · 1 line
2.53.0