[v2,1/4] tracing/probes: Fix to avoid double count of the string length on the array
Message ID | 168873725438.2687993.9530647538314564885.stgit@mhiramat.roam.corp.google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp3289781vqx; Fri, 7 Jul 2023 07:02:20 -0700 (PDT) X-Google-Smtp-Source: APBJJlEZ6sFxNTA++s3JOsqr6VxjMqXDt39cpdf8FEo+KXINkOdc2KnIBw9YRF0mkqSJ8bmCAwtD X-Received: by 2002:a05:6808:605:b0:3a3:7193:2a6b with SMTP id y5-20020a056808060500b003a371932a6bmr4449248oih.49.1688738539881; Fri, 07 Jul 2023 07:02:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688738539; cv=none; d=google.com; s=arc-20160816; b=QeqRMkkwmE3f9EN+/znkyQ5032nD15G4wAgu5G3cwdwp5WL67TJc87SeTBwXZ2VSD/ 96kWZ2FJ3C4GrqUv3AfqM3ODRW301OdVD828947AViF5HfERBJeLmyJDp7KiCukWunut 3Slk8XvvUvReuvgeFPkzuqdjTV++bJIzxY1vSjSZds29QGAExMjUrtvVP0RdpFarR+C3 Xn+76GEbf0wuJl0DnrC2akct0Fwypuo9mLrmwxGlfGEITnb/y0PyveXQQ9Mzyzn3/t9b WkLxL3boAuuFKu7BboMEwO7gadkPz0Iu0eElwAjkDeU4efgetShYGruHpp2Vt4AizU0e qFZw== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WH/D6moMhfq7Wty+9IXECmMgcbR77jt2lkbVyrgwC0s=; fh=hf24JvveL55vCfzfv0agRHDWsuhzZqIeZ7dfs5kcUjQ=; b=D/Oq47bdO7IHvaIXgcZ0YxZoOc8BjXcdTm2fMy8Qd+Lq2AqFA0ovLMGrLAVyMIoMUp xu5KW21WiU40uWgSWvKqOvVnkIoktPVggftSDEQt/JQmW3I6Bx37EMPPcQ+HJ+/z/gA4 cL1pc1g/gzuoqnCV1opZIgfWhFdGSUVOHbUFRPnlioXdlNmy4JLjSJbqKN0vEEF0IFpC JxB/mrGMJRbCwwUitPnhf2RUYl1qIUHIZwnjjEAz8syZ1aJi4+twHKARSvO0cRdlHG0T dG0XX2EizGeS3zg+sWUtrcqRNjAVYha+MnhSHw0kSWspv768Zw5WzGWyR2Exo2Hxnll+ zMpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZWm0UKoK; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 187-20020aca06c4000000b0039ee0d60286si1691732oig.252.2023.07.07.07.02.01; Fri, 07 Jul 2023 07:02:19 -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=@kernel.org header.s=k20201202 header.b=ZWm0UKoK; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230098AbjGGNlD (ORCPT <rfc822;daweilics@gmail.com> + 99 others); Fri, 7 Jul 2023 09:41:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230166AbjGGNlB (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 7 Jul 2023 09:41:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEFE02119; Fri, 7 Jul 2023 06:40:58 -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 5AEAF619AB; Fri, 7 Jul 2023 13:40:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DBD8C433C8; Fri, 7 Jul 2023 13:40:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688737257; bh=zwpa7syMeSYhTZBa9ItWWjpkC7dz4g0aJQWZT5Tc5g8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZWm0UKoKPO+iKHdiVOKfGSMpBCnguPRrOUOZ2mtN0mmJ/n1svC2gSEC5BQf4G+e6N C2qWZM1vqdhu2maaFqrUzTAljaLKQfzJH+hVt5qMUSQzgSyX4mau8swuxz2bLd1lQN w8L5SHydC14vXPZ02X1R50llhAR/7Lo1xtAtA52K/P+nrcaMpEY6PIeT2qqwZ9WQPX JZ1w3w0ttV0lFCwoTdaVFWPBC2NrAvmuoWr9NLtunQPqmOT7fKDDh0qRtizsCFEX+z XMumuQrqWWLXNm+Fl/PP5VmEdjmUQFlWr8M7SoMhxuOmpBd9wF1uRoyyvYC7wZBBzH IEapctPwaewQA== From: "Masami Hiramatsu (Google)" <mhiramat@kernel.org> To: Steven Rostedt <rostedt@goodmis.org> Cc: Dan Carpenter <dan.carpenter@linaro.org>, linux-trace-kernel@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>, Masami Hiramatsu <mhiramat@kernel.org> Subject: [PATCH v2 1/4] tracing/probes: Fix to avoid double count of the string length on the array Date: Fri, 7 Jul 2023 22:40:54 +0900 Message-ID: <168873725438.2687993.9530647538314564885.stgit@mhiramat.roam.corp.google.com> X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog In-Reply-To: <168873724526.2687993.15242662075324919195.stgit@mhiramat.roam.corp.google.com> References: <168873724526.2687993.15242662075324919195.stgit@mhiramat.roam.corp.google.com> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770770702953577968?= X-GMAIL-MSGID: =?utf-8?q?1770770702953577968?= |
Series |
tracing/probes: Fix bugs in process_fetch_insn
|
|
Commit Message
Masami Hiramatsu (Google)
July 7, 2023, 1:40 p.m. UTC
From: Masami Hiramatsu (Google) <mhiramat@kernel.org> If an array is specified with the ustring or symstr, the length of the strings are accumlated on both of 'ret' and 'total', which means the length is double counted. Just set the length to the 'ret' value for avoiding double counting. Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/all/8819b154-2ba1-43c3-98a2-cbde20892023@moroto.mountain/ Fixes: 88903c464321 ("tracing/probe: Add ustring type for user-space string") Cc: stable@vger.kernel.org Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org> --- Changes in v2: - Fix patch description. --- kernel/trace/trace_probe_tmpl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/trace_probe_tmpl.h b/kernel/trace/trace_probe_tmpl.h index 00707630788d..4735c5cb76fa 100644 --- a/kernel/trace/trace_probe_tmpl.h +++ b/kernel/trace/trace_probe_tmpl.h @@ -156,11 +156,11 @@ process_fetch_insn_bottom(struct fetch_insn *code, unsigned long val, code++; goto array; case FETCH_OP_ST_USTRING: - ret += fetch_store_strlen_user(val + code->offset); + ret = fetch_store_strlen_user(val + code->offset); code++; goto array; case FETCH_OP_ST_SYMSTR: - ret += fetch_store_symstrlen(val + code->offset); + ret = fetch_store_symstrlen(val + code->offset); code++; goto array; default: