Skip to contentSkip to conversation

ring buffer: Propagate __rb_map_vma return value to caller

PATCH Superseded Ankit Khushwaha 2 participants 2 messages Oct 8, 2025 – Oct 9, 2025

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ring buffer: Propagate __rb_map_vma return value to caller

The return value from __rb_map_vma(), which rejects writable or executable mappings (VM_WRITE, VM_EXEC, or !VM_MAYSHARE), was being ignored. As a result the caller of __rb_map_vma always returned 0 even when the mapping had actually failed, allowing it to proceed with an invalid VMA.

Changes in v2:
* applied minor cleanup suggested by Steve in v1

---
 kernel/trace/ring_buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/ring_buffer.c +1 -1
index 43460949ad3f..1244d2c5c384 100644
@@ -7273,7 +7273,7 @@ int ring_buffer_map(struct trace_buffer *buffer, int cpu,
 		atomic_dec(&cpu_buffer->resize_disabled);
 	}
 
-	return 0;
+	return err;
 }
 
 int ring_buffer_unmap(struct trace_buffer *buffer, int cpu)
Signature · 1 line
2.51.0
maintainer
#1 lore raw
Quoted 10 lines · On Wed, 8 Oct 2025 22:55:16 +0530 Ankit Khushwaha…

The return value from __rb_map_vma(), which rejects writable or executable mappings (VM_WRITE, VM_EXEC, or !VM_MAYSHARE), was being ignored. As a result the caller of __rb_map_vma always returned 0 even when the mapping had actually failed, allowing it to proceed with an invalid VMA.

Thanks for the update.

Quoted 2 lines

Changes in v2:
* applied minor cleanup suggested by Steve in v1

Note, the "changes" should be below the "---" as that prevents it from being added to the git change log. And it's always good to include a link to the previous version.

For example:

Quoted 2 lines

---

Changes in v2: https://lore.kernel.org/linux-trace-kernel/[email protected]/
* applied minor cleanup suggested by Steve in v1

-- Steve

Quoted 16 lines
 kernel/trace/ring_buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/ring_buffer.c +1 -1
index 43460949ad3f..1244d2c5c384 100644
@@ -7273,7 +7273,7 @@ int ring_buffer_map(struct trace_buffer *buffer, int cpu,
 		atomic_dec(&cpu_buffer->resize_disabled);
 	}
 
-	return 0;
+	return err;
 }
 
 int ring_buffer_unmap(struct trace_buffer *buffer, int cpu)