* [PATCH] racing/user_events: Prevent same address and bit per process
@ 2023-05-19 8:10 sunliming
2023-05-22 14:32 ` Steven Rostedt
0 siblings, 1 reply; 2+ messages in thread
From: sunliming @ 2023-05-19 8:10 UTC (permalink / raw)
To: rostedt, mhiramat, sunliming; +Cc: linux-trace-kernel, linux-kernel
User processes register name_args for events. If the same name are registered
multiple times in the same process, it can cause undefined behavior. Because
the same name may be used for a diffrent event. If this event has the same
format as the original event, it is impossible to distinguish the trace output
of these two events. If the event has a different format from the original event,
the trace output of the new event is incorrect.
Return EADDRINUSE back to the user process if the same event has being registered
in the same process.
Signed-off-by: sunliming <sunliming@kylinos.cn>
---
kernel/trace/trace_events_user.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index b1ecd7677642..4ef6bdb5c07c 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -1996,7 +1996,7 @@ static int user_events_ref_add(struct user_event_file_info *info,
for (i = 0; i < count; ++i)
if (refs->events[i] == user)
- return i;
+ return -EADDRINUSE;
}
size = struct_size(refs, events, count + 1);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] racing/user_events: Prevent same address and bit per process
2023-05-19 8:10 [PATCH] racing/user_events: Prevent same address and bit per process sunliming
@ 2023-05-22 14:32 ` Steven Rostedt
0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2023-05-22 14:32 UTC (permalink / raw)
To: sunliming; +Cc: mhiramat, linux-trace-kernel, linux-kernel, Beau Belgrave
Is the subject a Freudian slip?
Added Beau. I need to add him to the maintainers file for user events ;-)
On Fri, 19 May 2023 16:10:35 +0800
sunliming <sunliming@kylinos.cn> wrote:
> User processes register name_args for events. If the same name are registered
> multiple times in the same process, it can cause undefined behavior. Because
> the same name may be used for a diffrent event. If this event has the same
> format as the original event, it is impossible to distinguish the trace output
> of these two events. If the event has a different format from the original event,
> the trace output of the new event is incorrect.
>
> Return EADDRINUSE back to the user process if the same event has being registered
> in the same process.
I'll let Beau ack this or not.
-- Steve
>
> Signed-off-by: sunliming <sunliming@kylinos.cn>
> ---
> kernel/trace/trace_events_user.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
> index b1ecd7677642..4ef6bdb5c07c 100644
> --- a/kernel/trace/trace_events_user.c
> +++ b/kernel/trace/trace_events_user.c
> @@ -1996,7 +1996,7 @@ static int user_events_ref_add(struct user_event_file_info *info,
>
> for (i = 0; i < count; ++i)
> if (refs->events[i] == user)
> - return i;
> + return -EADDRINUSE;
> }
>
> size = struct_size(refs, events, count + 1);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-22 14:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-19 8:10 [PATCH] racing/user_events: Prevent same address and bit per process sunliming
2023-05-22 14:32 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox