[v5,1/5] tracing/probes: Fix to avoid double count of the string length on the array
Message ID | 168908492917.123124.15076463491122036025.stgit@devnote2 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp524756vqm; Tue, 11 Jul 2023 07:34:20 -0700 (PDT) X-Google-Smtp-Source: APBJJlGSlBbhD5JQgnFMDyqkhVKqtDYXNqZVK0rb5O4j+/e4GhjB6ZTqjyHaCsSUk1R8Na6ml75i X-Received: by 2002:a17:906:6c87:b0:957:2e48:5657 with SMTP id s7-20020a1709066c8700b009572e485657mr14595049ejr.68.1689086060416; Tue, 11 Jul 2023 07:34:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689086060; cv=none; d=google.com; s=arc-20160816; b=Yw++QB1Krzfe1wqw6EbGZJ32WfbHZD/hKYVyoKqKZant4Cmo02+I4bmLqN4YKBjjnx ZpiUuTBUygXilF/eHmtX2PB2KpL6t3Pb+LruDXm4EWxIurljZU2w8p+KyQxkMTNzpLw6 oHn1UoD8V3hRFbI17ViACsQCU92Ym2O+h5fH17qY+ilEFOL138wEolfYS8MhcecW3ryg DAbF3BHujaQVah05/5I8nchXZf3sT9Cwal3PE911Exo3BVtam9WYnzPNwNUP7mp/pFxN gZb8w1hhicM4YjYwZcpcV8qCwRlF76+/uzVd6iCOU9B66FrjE9CUEs4r0g3TYKeKjWLd KLwg== 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=ELAaMWiZc9h+dU7lS9cL5UHtCJaBJK2f/UmP7iEJY/Y=; fh=hf24JvveL55vCfzfv0agRHDWsuhzZqIeZ7dfs5kcUjQ=; b=mwPT3izsO9YG3YpNW17/JmQC1ujoJTjOo4F8g9EzrIgJ6exCKqrcD+chEQEzEs7/BH PeVl5JvvMdwNOcNy/inn8iUkIVI6/Q+z54zyhAMUHDR8YyOhWcmO0jJTriNR24fRBUMz W0c5UAOSz0ZofZN+aJVExjPe+6Sj7xiL3fMvzxEWRvTUHWu7FoH57Mtkc9sFexpB8Hb5 gY2qCXjKEuC6XWuNEGJFG1yUsZ+J5V3lOnvDE8dVwmkB5kYf5KMde0JSyzT18o4RBL/h sPa55+oKk1wUwfyU5GTRhzTquAxP6vPdFybyEyj9hLuRK4tsb01lGdEPTRzbRTR49+/b Od3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jHrQijNu; 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 ks20-20020a170906f85400b009931a072599si1883645ejb.454.2023.07.11.07.33.55; Tue, 11 Jul 2023 07:34:20 -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=jHrQijNu; 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 S233450AbjGKOPk (ORCPT <rfc822;gnulinuxfreebsd@gmail.com> + 99 others); Tue, 11 Jul 2023 10:15:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233436AbjGKOPf (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 11 Jul 2023 10:15:35 -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 0083F1705; Tue, 11 Jul 2023 07:15:33 -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 8BF106150D; Tue, 11 Jul 2023 14:15:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2FA8C433C7; Tue, 11 Jul 2023 14:15:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689084933; bh=77y8W85i7xf9qeyXJXcSDIyy5bcBOPvmg0r6OCuWIr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jHrQijNug8+1yMpULTBzLmTy8i0AMW+NL0U/e2Us3ej9u//1v3DYXBC7a4V8tCFRo pzyk4QOXnXIYS7Bbe4mk4QRqcUlMaa0mUxgwgesOQjGgCP+i9LxMUl2QKtlAgxgeZp czdq6gFzuItu72NyNQ8nwMqKroV3rkPQS80FELKMeO1gsrb7mMElll388oU+banh8E ANvyuKqU4cNSmb3D0OBDToFcoi9pIkFOsG/nFvNWs+Knv3eMrV4qXdtYk+lLBoKv4m n+aG6k8FuzW23nRTIHmxPLKrV3lKpqabhjuZeMw+g+dcg9wMepidCyIK/6JluZHKCD EpqRXj++kRvqw== 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 v5 1/5] tracing/probes: Fix to avoid double count of the string length on the array Date: Tue, 11 Jul 2023 23:15:29 +0900 Message-Id: <168908492917.123124.15076463491122036025.stgit@devnote2> X-Mailer: git-send-email 2.25.1 In-Reply-To: <168908491977.123124.16583481716284477889.stgit@devnote2> References: <168908491977.123124.16583481716284477889.stgit@devnote2> 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=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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: INBOX X-GMAIL-THRID: 1771135104897491388 X-GMAIL-MSGID: 1771135104897491388 |
Series |
tracing/probes: Fix bugs in process_fetch_insn
|
|
Commit Message
Masami Hiramatsu (Google)
July 11, 2023, 2:15 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> --- 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: