From patchwork Fri Nov 3 16:05:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 161361 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp1145347vqu; Fri, 3 Nov 2023 09:06:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEJI3GkFNmouTUTHdu6WD0gkswHtRODI5QD3rc6ZFBnLtmpcaSqnFzQMYAdSUlK49w/gzYs X-Received: by 2002:a05:6830:448d:b0:6d3:1d04:54e with SMTP id r13-20020a056830448d00b006d31d04054emr8160723otv.10.1699027594660; Fri, 03 Nov 2023 09:06:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699027594; cv=none; d=google.com; s=arc-20160816; b=KJSH2fdrEhYvf8IDNuXVI1z8ckQu34WJoHiUq/xAumjhzh/KaT1qD5HB07+/hOIVE4 G0Cu7LVnjgUnxWTQXwG1Jyd0VQQyu+9Ik/uTSHeqCbjKh2VuNb/Apld5bHZMtmjDvpdE m5rx0vayCQvKMkyi05GPIAFNckeB8u1aDiBfrSE14UKKW7oFmrz1NgXRRfwhWfrmgKgZ /cwztGtpWqL70K2yLevrwdq0k9afeIluJS9Vwpnc8VWnKbrBlichKIsZabvIpWAKFmd/ /0VYMmEoaco3fDQInmbG+5C+xW/JaeqK7uiNf6usZZl7YZKIbIFC+2scLx+3ZhWdK44x jeUA== 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 :user-agent:message-id:date:subject:cc:to:from:dkim-signature; bh=8/rEBIRNDmfIa/z4iBOwVVMP674NZ3yMNAv8mH9tmI8=; fh=5bIR2BA3b4kEVsG3/1DGxfXTklUQr/q6tGBdJQraBnw=; b=HZsZYKxEx333PCXv1Nx7Qfo5W4sC6X2xKRwY58sPLWTnnyyaU4s04sm7hQ2eRsUiVT LS1qAm1iVJVurDJwvFCfXA0bVzHcOZtgVY+mGR24DljS5qcxlR98Y30ACZjfz4bxNn+P 3/te0HDw+UFwMYhuGJpA3Z9D+YZVjGtowp2/IXeFkNoCz2wShdY4WmrTch9fam7kcyOf xszg37yumE7JXDkb3DjFFzeS1IuXZ8m1WfoSBg/EXCK0FFUDNvoqfxSNO1Agr+qkABfe f8rB7kTiqCBoh+7YAk9peM2CX2yx+vwyEYlE7OzZ9g1VgT2HdB0KM33ouuEfmrbKWlVr kx6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=V+svcMXQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id w43-20020a4a97ae000000b0058141a9bd61si710767ooi.29.2023.11.03.09.06.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 09:06:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=V+svcMXQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 6252A805D542; Fri, 3 Nov 2023 09:06:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234407AbjKCQF4 (ORCPT + 35 others); Fri, 3 Nov 2023 12:05:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343808AbjKCQFx (ORCPT ); Fri, 3 Nov 2023 12:05:53 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EE4E10CB for ; Fri, 3 Nov 2023 09:05:38 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6F97C433C8; Fri, 3 Nov 2023 16:05:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699027537; bh=42XsnqbyTprpNrPutNcSPJ0ocVxY+O1eGVuizrcPzPQ=; h=From:To:Cc:Subject:Date:From; b=V+svcMXQEE59e8NPP7hQaymVRI7+VVp25l2JUTUbXDECOKKN861W2FmBlBxlKec0N oIhfNvDvozXf9p6d6mDUeEypsztSH8kiFpUle4boNbuaNWbBoQUNVvyhjCCZqDY+Dl l7fYuhH4UTA34U3ZD3eA25HO78vEYVcI27runOsQQOab01ZaVPXLcK4qnhqsDy2gKw RiuUw80Us8P/qQeLekoske5zOezrthQeuacT9iwaG71tKjB/GN6VmfHODhAxoP0CK7 benfgQGdCkfGW2Qtv+DZJpVBe9qf3FpxhiVQfxTREbUSei0reVuAqnN5j2E+v7pJ3P HkQAe2Z8p4tcg== From: "Masami Hiramatsu (Google)" To: linux-trace-kernel@vger.kernel.org, Steven Rostedt Cc: linux-kernel@vger.kernel.org, mhiramat@kernel.org Subject: [PATCH] tracing: fprobe-event: Fix to check tracepoint event and return Date: Sat, 4 Nov 2023 01:05:34 +0900 Message-Id: <169902753361.313086.6662802092416198593.stgit@devnote2> X-Mailer: git-send-email 2.34.1 User-Agent: StGit/0.19 MIME-Version: 1.0 X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 03 Nov 2023 09:06:20 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781559559028366995 X-GMAIL-MSGID: 1781559559028366995 From: Masami Hiramatsu (Google) Fix to check the tracepoint event is not valid with $retval. The commit 08c9306fc2e3 ("tracing/fprobe-event: Assume fprobe is a return event by $retval") introduced automatic return probe conversion with $retval. But since tracepoint event does not support return probe, $retval is not acceptable. Fixes: 08c9306fc2e3 ("tracing/fprobe-event: Assume fprobe is a return event by $retval") Cc: stable@vger.kernel.org Signed-off-by: Masami Hiramatsu (Google) --- kernel/trace/trace_fprobe.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kernel/trace/trace_fprobe.c b/kernel/trace/trace_fprobe.c index 8bfe23af9c73..7d2ddbcfa377 100644 --- a/kernel/trace/trace_fprobe.c +++ b/kernel/trace/trace_fprobe.c @@ -927,11 +927,12 @@ static int parse_symbol_and_return(int argc, const char *argv[], for (i = 2; i < argc; i++) { tmp = strstr(argv[i], "$retval"); if (tmp && !isalnum(tmp[7]) && tmp[7] != '_') { + if (is_tracepoint) { + trace_probe_log_set_index(i); + trace_probe_log_err(tmp - argv[i], RETVAL_ON_PROBE); + return -EINVAL; + } *is_return = true; - /* - * NOTE: Don't check is_tracepoint here, because it will - * be checked when the argument is parsed. - */ break; } }