OSDN Git Service

tracing/user_events: Use refcount instead of atomic for ref tracking
authorBeau Belgrave <beaub@linux.microsoft.com>
Thu, 28 Jul 2022 23:33:07 +0000 (16:33 -0700)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Thu, 29 Sep 2022 14:17:36 +0000 (10:17 -0400)
commitd401b72458562c2f2a81dad162de5c1b8e191e17
tree441439a70813cb956e32d1d4c75254bfc12bcadc
parente6f89a149872ab0e03cfded97983df74dfb0ef21
tracing/user_events: Use refcount instead of atomic for ref tracking

User processes could open up enough event references to cause rollovers.
These could cause use after free scenarios, which we do not want.
Switching to refcount APIs prevent this, but will leak memory once
saturated.

Once saturated, user processes can still use the events. This prevents
a bad user process from stopping existing telemetry from being emitted.

Link: https://lkml.kernel.org/r/20220728233309.1896-5-beaub@linux.microsoft.com
Link: https://lore.kernel.org/all/2059213643.196683.1648499088753.JavaMail.zimbra@efficios.com/
Reported-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/trace_events_user.c