Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5924783rwd; Mon, 5 Jun 2023 10:18:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7mTzSLcYTxR6DdRMQrOo9yzudi3kVz+1OoYziHjkW7qEvvvE4PHz0cTDtY2JR3/MoLob6j X-Received: by 2002:a17:90b:fca:b0:256:4189:2b0d with SMTP id gd10-20020a17090b0fca00b0025641892b0dmr3372037pjb.12.1685985480775; Mon, 05 Jun 2023 10:18:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685985480; cv=none; d=google.com; s=arc-20160816; b=bw+N8kfTdqv5BaOlDYtGB0YNhFqJ8hBcNZBGfpGztexea5ByYokLFmE5ljuiUE4r49 BSu/tEprWSHVMevY00EVNlmtqOefr2m2nDrHYChyvTCQxU+/SKysCdud2Vq1uzY47u2W QPR5vuLzwtrJ3eXp1cnY7gvTEwxDgNfdKbxxMDxDpy22QwZpkI2UFEZOvfVcPJ0WI70M 006Ho65QA4VTLMAGYhixDL1KxUiBb6c0J0M3qRgqW5kTR4695bB0P0AH//lYq9muxLun I193xPAcPH6u3id2awSt65w2yDVN6bvuXBn9SCVw4LUry0Mkxo0nPCadwV9jQ4051jtl iL+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-filter; bh=WNAcW4ZNKgmMTBdX8dnLj9J/dbA41pDD5x7Q9LxEEFI=; b=TcsaykrghJPlDd/ztBPNGnqsovB9RIfTBTRtsYEgAz+FC0nEjHUyImXlqIG6KLFoZa eSqdbqSgBoaUxZ6K9KiRFQ4vn0CStXiT4G9HM+hPuYm4UQz3eTbOEHiWFB+hDXXy2eCa TKPuFXp6/uODPY1u287fBumbuw6Wi/RhHO8YUuVd7EBs/6XAUrE4FQa2/qlZ6wU0jroC uQ0OwmTN1ZSfFpJggPBuQrSTA0/FDja0aHjaYdHBMSSPIcvoLs/jiY9mrW5aiRFj5lxo YMx4uoEYfkNi1YTiZmRer5H5A3F4zu+t0IuFUdhQ+0w8FO+aJpC1+E68Uz3QNHnQwPil vcog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=kgGzae1G; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f10-20020a63de0a000000b0053febd41e7esi5886579pgg.380.2023.06.05.10.17.47; Mon, 05 Jun 2023 10:18:00 -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; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=kgGzae1G; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233119AbjFEQwy (ORCPT + 99 others); Mon, 5 Jun 2023 12:52:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235161AbjFEQwx (ORCPT ); Mon, 5 Jun 2023 12:52:53 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6C862E8; Mon, 5 Jun 2023 09:52:52 -0700 (PDT) Received: from W11-BEAU-MD.localdomain (unknown [76.135.27.212]) by linux.microsoft.com (Postfix) with ESMTPSA id ABD8120BCFC0; Mon, 5 Jun 2023 09:52:51 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com ABD8120BCFC0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1685983971; bh=WNAcW4ZNKgmMTBdX8dnLj9J/dbA41pDD5x7Q9LxEEFI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kgGzae1GIuDruLlQYioh1xuNiOBwErEHYDOFjOlyR5lpzdCPdVKnkvIelxKQzIZBz 4Ymahx5CRkk4fYXxiyS+iBN+boXskz/E/S5czNBNQdQz9pirHfXiNO6bygDWpkpgRb qY5LwT3cnWMSHT7oT/syldRQ55qXKa4zKln5DcBA= Date: Mon, 5 Jun 2023 09:52:45 -0700 From: Beau Belgrave To: sunliming Cc: mhiramat@kernel.org, rostedt@goodmis.org, shuah@kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kelulanainsley@gmail.com Subject: Re: [PATCH V2 1/4] tracing/user_events: Fix the incorrect trace record for empty arguments events Message-ID: <20230605165245.GA140@W11-BEAU-MD.localdomain> References: <20230605073023.923316-1-sunliming@kylinos.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230605073023.923316-1-sunliming@kylinos.cn> X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL 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 On Mon, Jun 05, 2023 at 03:30:20PM +0800, sunliming wrote: > The user_events support events that has empty arguments. But the trace event > is discarded and not really committed when the arguments is empty. Fix this > by not attempting to copy in zero-length data. > > Signed-off-by: sunliming > --- This series looks good to me, functionally. I applied it locally and ran this code with the new test additions. Everything works well. Thank you! The only thing I ask before an ACK is patch 2 and 4 in the series only use "user_events: " prefix. Can you change these to "selftests/user_events: "? You marked 3 this way, so I'd like to stick with a consistent form: I think it would be good going forward we use "tracing/user_events" for functional changes and "selftests/user_events" for self test changes. Thanks, -Beau > kernel/trace/trace_events_user.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c > index 0d91dac206ff..698703a3d234 100644 > --- a/kernel/trace/trace_events_user.c > +++ b/kernel/trace/trace_events_user.c > @@ -1399,7 +1399,7 @@ static void user_event_ftrace(struct user_event *user, struct iov_iter *i, > if (unlikely(!entry)) > return; > > - if (unlikely(!copy_nofault(entry + 1, i->count, i))) > + if (unlikely(i->count != 0 && !copy_nofault(entry + 1, i->count, i))) > goto discard; > > if (!list_empty(&user->validators) && > @@ -1440,7 +1440,7 @@ static void user_event_perf(struct user_event *user, struct iov_iter *i, > > perf_fetch_caller_regs(regs); > > - if (unlikely(!copy_nofault(perf_entry + 1, i->count, i))) > + if (unlikely(i->count != 0 && !copy_nofault(perf_entry + 1, i->count, i))) > goto discard; > > if (!list_empty(&user->validators) && > -- > 2.25.1