Files
linux-stable-mirror/include/linux
Qing Wang 91f3e8d84c tracing: Fix WARN_ON in tracing_buffers_mmap_close
commit e39bb9e02b upstream.

When a process forks, the child process copies the parent's VMAs but the
user_mapped reference count is not incremented. As a result, when both the
parent and child processes exit, tracing_buffers_mmap_close() is called
twice. On the second call, user_mapped is already 0, causing the function to
return -ENODEV and triggering a WARN_ON.

Normally, this isn't an issue as the memory is mapped with VM_DONTCOPY set.
But this is only a hint, and the application can call
madvise(MADVISE_DOFORK) which resets the VM_DONTCOPY flag. When the
application does that, it can trigger this issue on fork.

Fix it by incrementing the user_mapped reference count without re-mapping
the pages in the VMA's open callback.

Cc: stable@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Vincent Donnefort <vdonnefort@google.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Link: https://patch.msgid.link/20260227025842.1085206-1-wangqing7171@gmail.com
Fixes: cf9f0f7c4c ("tracing: Allow user-space mapping of the ring-buffer")
Reported-by: syzbot+3b5dd2030fe08afdf65d@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=3b5dd2030fe08afdf65d
Tested-by: syzbot+3b5dd2030fe08afdf65d@syzkaller.appspotmail.com
Signed-off-by: Qing Wang <wangqing7171@gmail.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-03-13 17:20:35 +01:00
..
2026-03-04 07:19:39 -05:00
2026-03-04 07:20:22 -05:00
2026-03-04 07:19:26 -05:00
2025-11-02 22:15:22 +09:00
2025-10-15 12:00:03 +02:00
2025-03-07 18:25:35 +01:00
2025-09-11 17:21:46 +02:00
2025-12-18 13:55:17 +01:00
2025-05-29 11:03:25 +02:00
2026-01-08 10:13:54 +01:00
2026-01-08 10:14:34 +01:00
2025-09-09 18:58:04 +02:00
2025-05-29 11:03:25 +02:00
2025-05-29 11:02:23 +02:00
2025-03-28 22:03:30 +01:00
2025-01-17 13:40:50 +01:00
2025-02-08 09:57:23 +01:00
2025-12-18 13:55:18 +01:00
2025-06-19 15:32:18 +02:00
2026-02-11 13:40:25 +01:00
2025-05-29 11:02:20 +02:00
2025-08-15 12:13:35 +02:00
2025-01-23 17:22:53 +01:00
2026-01-08 10:14:11 +01:00
2025-02-01 18:39:35 +01:00
2026-02-11 13:40:25 +01:00
2026-03-04 07:19:35 -05:00
2025-08-01 09:48:43 +01:00
2025-07-10 16:05:11 +02:00