Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3025707rwd; Mon, 22 May 2023 07:41:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4l7T+dYaaalkeYk+qtMaJqNZLjscLLsG+Zwk2MUkqRxZzBzrG0ZILCs3UWVXXMy1BZUFFg X-Received: by 2002:a17:90b:30ce:b0:255:7588:c8fa with SMTP id hi14-20020a17090b30ce00b002557588c8famr2480722pjb.6.1684766500857; Mon, 22 May 2023 07:41:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684766500; cv=none; d=google.com; s=arc-20160816; b=LOQBowyHhSTDMbTZMYbjAYZD4X2oyTTb6bSRaNYmRn0iaNZ0nxhJJGnDqcXn9buNhW TKUg4Kzk6nLJB2TInzKWwvlhtqfr/1gJVLcLSF/s+Jct3j45yfLYLbdkefNFLiDlXs3Y I/6R6qk0alKOh5jYC+iM/sWk7hGi7PnMi2p4kQJavRXMTkZqqeWI0IEnPgUao0PHHaZG dtnC1hbL2utEe2/WSw+QheVCTjX0KE138N16nXoKjSujgirIfifpeQQkt7iV8yRc0Pv4 9VRhCSmAsEW0iKOAEQL0+/wLoIG2xFbubMS3kUUsI4RZlS0881fdcVYgY58IX4c/jEJ8 7uag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=tSC4FiBWnqGXg4N3Aeo/MBih4B3wQYqEVTFTnpkB2as=; b=OlNl4/mgS0bHGm2qsXQZPvWeN3LwFsnMsAMEmqblRI9e6kKc+CNkbWaVpVVB5+53Xo W+3iWSxL2lDHfZn4B+kLFHnuBYdnPFB68mkej9wkRkMMub7Vl9NVGnjGIKd4cK8y0H6r Jyjtw5SOYz6C9mU+lgGoSuvsWsN5UEzFGC599A5FWNzCHNg+a75TwVh87mX5Z4mnhuPN b+XSdJvhY0N9zRLJXQjFrcDu09CN2wNpNJY7yqIMDt3z3t/0wh98XnTmI3+AzaLHG9Tv PyP9A8ZWtLRnVKEoKLudooX4RmyS9swNEwodOLxgijhogvsfGmd9yBmumH5xQJs8mCo7 QXtg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j4-20020a633c04000000b0052875a200fesi496637pga.215.2023.05.22.07.41.28; Mon, 22 May 2023 07:41:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233733AbjEVOcc (ORCPT + 99 others); Mon, 22 May 2023 10:32:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233644AbjEVOc2 (ORCPT ); Mon, 22 May 2023 10:32:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5D5399; Mon, 22 May 2023 07:32:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 83940613F7; Mon, 22 May 2023 14:32:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85AB2C433EF; Mon, 22 May 2023 14:32:26 +0000 (UTC) Date: Mon, 22 May 2023 10:32:24 -0400 From: Steven Rostedt To: sunliming Cc: mhiramat@kernel.org, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, Beau Belgrave Subject: Re: [PATCH] racing/user_events: Prevent same address and bit per process Message-ID: <20230522103224.032ec78f@rorschach.local.home> In-Reply-To: <20230519081035.228891-1-sunliming@kylinos.cn> References: <20230519081035.228891-1-sunliming@kylinos.cn> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 > --- > 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);