From nobody Sun Feb 8 06:54:42 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65C92EB64D9 for ; Thu, 15 Jun 2023 13:36:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344458AbjFONg4 (ORCPT ); Thu, 15 Jun 2023 09:36:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344351AbjFONgU (ORCPT ); Thu, 15 Jun 2023 09:36:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56FD63582 for ; Thu, 15 Jun 2023 06:35:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7EFC6633FE for ; Thu, 15 Jun 2023 13:34:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB406C433CA; Thu, 15 Jun 2023 13:34:16 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.96) (envelope-from ) id 1q9n79-000TnV-2o; Thu, 15 Jun 2023 09:34:15 -0400 Message-ID: <20230615133415.683635706@goodmis.org> User-Agent: quilt/0.66 Date: Thu, 15 Jun 2023 09:05:36 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Andrew Morton , Beau Belgrave , sunliming Subject: [for-linus][PATCH 05/15] tracing/user_events: Fix the incorrect trace record for empty arguments events References: <20230615130531.200384328@goodmis.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: sunliming 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. Link: https://lkml.kernel.org/r/20230606062027.1008398-2-sunliming@kylinos.= cn Acked-by: Beau Belgrave Acked-by: Masami Hiramatsu (Google) Signed-off-by: sunliming Signed-off-by: Steven Rostedt (Google) --- 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_u= ser.c index afe61dc86543..49914b6cb651 100644 --- a/kernel/trace/trace_events_user.c +++ b/kernel/trace/trace_events_user.c @@ -1432,7 +1432,7 @@ static void user_event_ftrace(struct user_event *user= , struct iov_iter *i, if (unlikely(!entry)) return; =20 - if (unlikely(!copy_nofault(entry + 1, i->count, i))) + if (unlikely(i->count !=3D 0 && !copy_nofault(entry + 1, i->count, i))) goto discard; =20 if (!list_empty(&user->validators) && @@ -1473,7 +1473,7 @@ static void user_event_perf(struct user_event *user, = struct iov_iter *i, =20 perf_fetch_caller_regs(regs); =20 - if (unlikely(!copy_nofault(perf_entry + 1, i->count, i))) + if (unlikely(i->count !=3D 0 && !copy_nofault(perf_entry + 1, i->count, = i))) goto discard; =20 if (!list_empty(&user->validators) && --=20 2.39.2