From patchwork Thu Aug 10 06:05:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Schnelle X-Patchwork-Id: 133726 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp248761vqi; Thu, 10 Aug 2023 00:39:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEXxzODZNG/sb3pghnXH28Rq0g6c2J0fxGvS9lwiShwG3Jq2cD7npeiqEhUTolj3rvA1y1e X-Received: by 2002:a17:90b:1b0b:b0:268:1b7f:257b with SMTP id nu11-20020a17090b1b0b00b002681b7f257bmr1157733pjb.24.1691653193744; Thu, 10 Aug 2023 00:39:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691653193; cv=none; d=google.com; s=arc-20160816; b=RZxYsfRd+BoKhH4jq2KPGk2zd7UTpF+rSAxf5Bk6g2KEPhjZ6121fpAkmsgyNmUoMl jUFX58xZdKC8hpp+oByqbwGRpFyWr/TVsb5JIioHmgcQ1HTGAeaMZg+0A9KEcW7pQXud ddjbRd3gY1uCiXL8lOuHkgCddACFgNGicAjyq9eHEJoVL2IOpUZ2BSmsOVXdoRJhpedO TsaOr+BrN+K4YDdwXFrqTFJyn8T/pdaFb+NbROv/uINSw49kHEbUbxliEA3jOeW8+Acv HXD9dEeVFQOE7x2uuAVfxQ18pZOAzoUR1o3FCGa+NqK6a5Fk4N5g2FHfQV2fLP8mcreL FW8A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FJZYLStsj55jSIlYlDgwpbg7S5EBCrJAiAQRw3GAopw=; fh=GJrZ9BytDhSFvlRtxPE8EBx/shzHOh4Na+O7DzDM7Ac=; b=uw3XkOdU5vc4ACy/csTE5wVguVQlqQ396IxAo1HUB7nAjLTlY6znDnM9emqtTHCa/W iAw4oTu2MX+MJ98joKppWDgfOR/uZTnLM+iqKR+X650gBBrZwn6ksoDOWQSiBzn3Ol+j W3uGT1a5CPZaERyiDLTLRIB3u5/9Q7N30QZnT7kQABADN3jyF9py0jDsRhezDLJz1WOK /H1dKadWHEBahUqEIqAOdf9Fe8CnDdiR+gaGOgNxH+cyRChQg4/IJpREOKpFp88NKNpf gp8sSUzuQoJJxST08aziKlZW8YNnZYKXEPJ2IgpPQr6JHlUb9Rpw5OlNm9PZN4qettYs 9ULw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=iz33t3ik; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b10-20020a17090a9bca00b002682498d8c0si3018432pjw.187.2023.08.10.00.39.40; Thu, 10 Aug 2023 00:39:53 -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=@ibm.com header.s=pp1 header.b=iz33t3ik; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232046AbjHJGG2 (ORCPT + 99 others); Thu, 10 Aug 2023 02:06:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231437AbjHJGG1 (ORCPT ); Thu, 10 Aug 2023 02:06:27 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B177B171D for ; Wed, 9 Aug 2023 23:06:26 -0700 (PDT) Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37A5r8hL017531; Thu, 10 Aug 2023 06:05:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=FJZYLStsj55jSIlYlDgwpbg7S5EBCrJAiAQRw3GAopw=; b=iz33t3ikQPTz4i1tZzKFJpInlneVWuXvHDI2jpMRS6bJQGtFBgWR3yUByArnYr71b44O X3WJu/QHvCjj9y4GlFsfp95vfXP++n16ruJ/2b2WRgxBZIpD1znA8TZ4tAkZu8FoWhlD DiW9L19XCenhu8H3pnYtweCuHUgpOwWhwU39RxK3DDuTq5Wtqo9fXEti+3EPkcJrXrnt qoS5rEbKuTGWp9o0zOAeIZChf5u8dZifmuZysuz68chen/RZdW0HRQeaq6zq6bsGzoD4 1lVdmAgWl0TTsavfRmi4Fv+q4XeObJ7Ar097lkvTSYm00CI+7iTkqqA2FiHK5bQMr7GT EQ== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3sct4wg89f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Aug 2023 06:05:58 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 37A5jTmg000403; Thu, 10 Aug 2023 06:05:43 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3sa28kxtqd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Aug 2023 06:05:43 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 37A65fHe17433126 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 Aug 2023 06:05:41 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AE26E20043; Thu, 10 Aug 2023 06:05:41 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9D94720040; Thu, 10 Aug 2023 06:05:41 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTPS; Thu, 10 Aug 2023 06:05:41 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 55390) id 59780E139E; Thu, 10 Aug 2023 08:05:41 +0200 (CEST) From: Sven Schnelle To: Steven Rostedt Cc: linux-kernel@vger.kernel.org Subject: [PATCH v3 3/3] tracing/synthetic: allocate one additional element for size Date: Thu, 10 Aug 2023 08:05:38 +0200 Message-Id: <20230810060538.1350348-4-svens@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230810060538.1350348-1-svens@linux.ibm.com> References: <20230810060538.1350348-1-svens@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: u2b6sn5_mjtwERo64EW8XuO2_bdgHERB X-Proofpoint-ORIG-GUID: u2b6sn5_mjtwERo64EW8XuO2_bdgHERB X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-10_04,2023-08-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 lowpriorityscore=0 adultscore=0 suspectscore=0 phishscore=0 impostorscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 priorityscore=1501 spamscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308100051 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773826939159520148 X-GMAIL-MSGID: 1773826939159520148 While debugging another issue i noticed that the stack trace contains one invalid entry at the end: -0 [008] d..4. 26.484201: wake_lat: pid=0 delta=2629976084 000000009cc24024 stack=STACK: => __schedule+0xac6/0x1a98 => schedule+0x126/0x2c0 => schedule_timeout+0x150/0x2c0 => kcompactd+0x9ca/0xc20 => kthread+0x2f6/0x3d8 => __ret_from_fork+0x8a/0xe8 => 0x6b6b6b6b6b6b6b6b This is because the code failed to add the one element containing the number of entries to field_size. Fixes: 00cf3d672a9d ("tracing: Allow synthetic events to pass around stacktraces") Signed-off-by: Sven Schnelle --- kernel/trace/trace_events_synth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c index 80a2a832f857..9897d0bfcab7 100644 --- a/kernel/trace/trace_events_synth.c +++ b/kernel/trace/trace_events_synth.c @@ -528,7 +528,8 @@ static notrace void trace_event_raw_event_synth(void *__data, str_val = (char *)(long)var_ref_vals[val_idx]; if (event->dynamic_fields[i]->is_stack) { - len = *((unsigned long *)str_val); + /* reserve one extra element for size */ + len = *((unsigned long *)str_val) + 1; len *= sizeof(unsigned long); } else { len = fetch_store_strlen((unsigned long)str_val);