Skip to content

Commit 4941a17

Browse files
committed
Merge tag 'trace-ringbuffer-v6.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull ring-buffer fix from Steven Rostedt: - Do not allow mmapped ring buffer to be split When the ring buffer VMA is split by a partial munmap or a MAP_FIXED, the kernel calls vm_ops->close() on each portion. This causes the ring_buffer_unmap() to be called multiple times. This causes subsequent calls to return -ENODEV and triggers a warning. There's no reason to allow user space to split up memory mapping of the ring buffer. Have it return -EINVAL when that happens. * tag 'trace-ringbuffer-v6.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: tracing: Fix WARN_ON in tracing_buffers_mmap_close for split VMAs
2 parents 9eb220e + b042fdf commit 4941a17

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

kernel/trace/trace.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8781,8 +8781,18 @@ static void tracing_buffers_mmap_close(struct vm_area_struct *vma)
87818781
put_snapshot_map(iter->tr);
87828782
}
87838783

8784+
static int tracing_buffers_may_split(struct vm_area_struct *vma, unsigned long addr)
8785+
{
8786+
/*
8787+
* Trace buffer mappings require the complete buffer including
8788+
* the meta page. Partial mappings are not supported.
8789+
*/
8790+
return -EINVAL;
8791+
}
8792+
87848793
static const struct vm_operations_struct tracing_buffers_vmops = {
87858794
.close = tracing_buffers_mmap_close,
8795+
.may_split = tracing_buffers_may_split,
87868796
};
87878797

87888798
static int tracing_buffers_mmap(struct file *filp, struct vm_area_struct *vma)

0 commit comments

Comments
 (0)