From patchwork Wed Aug 9 12:02:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Schnelle X-Patchwork-Id: 133214 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp2776843vqr; Wed, 9 Aug 2023 05:52:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGgspf3kdKbDMmwwx7XpawJvvWQ59HiGeTrNP+X0f8+iIdD35hXTBOxSwggDMohiEJghRFZ X-Received: by 2002:a05:6a20:7f92:b0:13e:99c0:fe6e with SMTP id d18-20020a056a207f9200b0013e99c0fe6emr16975333pzj.5.1691585547628; Wed, 09 Aug 2023 05:52:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691585547; cv=none; d=google.com; s=arc-20160816; b=p4IT6k1SiJWGaPunzZF5JGCxgI/BAD9Ps5kX56XPvPoDRfc5basEEZCfGQ0g/YwLjG QRrAH//vhv/xbtol55Wwdv3R9ZL+FvVPpuonr1Oigv8e/bzeduB0f/kIO8Yvg/yIS8Dz /XSfcMR2D9KisIszeYdHbmk9wiVSWcC9bR1v8GoAAu15YfJ778jVMP9uJccDI6PgZM3L hMvSyu+UtFo0AtBx1T+y0akDXb9ejxWEi1rBnNuR2pTahgoVXAeV1fnU6v59PnAF2dp8 JFwP/5IyLP3tVKzCoqWnD569CCEvxHFhpISdoRsnz6mcd6vnWiTTW8sXCNga5wSosH6q anDA== 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=cjvj7wettouj98grKd+w/rGibdES+jbkVOMsKs2jBMs=; fh=GJrZ9BytDhSFvlRtxPE8EBx/shzHOh4Na+O7DzDM7Ac=; b=ICfd9l4NBkG0AKq9o7AHPECbq/YSoAb36LcCar0ASSNyD91lOBej63hAeSdKiPAel5 Bst0b6Olxvyg+rUqC0UsVmSnQpbYpIcx9qpRPDXqMEprX6Jh5u0HxPQ7l/FXz5NWH+ZL dCanDT/Z0tk266Pfo2ZJtypmKsszASv8YhqDZHQKtdy4SVFfwGPFD2tKlEdJMu2d0hzD aH/VVi0YZ7GyBf4E/LR+9Cx2FMSwe7QiV38tNii0OxHaGOUcCABvHbp5pcD9IyJWA6Nf EObJGrWDJSDE5MbWGe4fZKyq9lUYBaUMmNp/Y1d2OEGUIOUZz0pe2GTY7exhe2am/SIF LhWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Nt7kzGIV; 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 n22-20020a63e056000000b0053fbb36fc65si9607787pgj.382.2023.08.09.05.52.14; Wed, 09 Aug 2023 05:52:27 -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=Nt7kzGIV; 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 S230502AbjHIMIj (ORCPT + 99 others); Wed, 9 Aug 2023 08:08:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230403AbjHIMIV (ORCPT ); Wed, 9 Aug 2023 08:08:21 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E41FDF for ; Wed, 9 Aug 2023 05:08:21 -0700 (PDT) Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 379Bx5C6027338; Wed, 9 Aug 2023 12:08:19 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=cjvj7wettouj98grKd+w/rGibdES+jbkVOMsKs2jBMs=; b=Nt7kzGIVlDBVXMVfXTdT76U7OgP6qGN9gF4dsa0AtkoT9S5OVA8x3nPpsDkWqM/aHY8j 8WTUz/p7Z3S3O3fS4bFiuL9yLV6+1f2yA0MKPgpIHilr1fFLtJ9VCNUY+l0g2GbkSxPi kSLIYiKBAWkRZMsrwNubHJ+PsbcucQzxdgO9yKX/m8Bwe4MyWiyd0WtWgXfIfXPzzGsV gvGeFAgRa3tCXXTVRChPgir5OJGumODDNCe9cJC7PwX6oRexW9Y6uFLPtPhlSQbcqsx3 oK7zvlKiKCjZJgviQ/9aVK3mL9BHxp1G9P0NKS9Eyn/ZPV9Yw1cTxaFHVulFy35uW9fS Pg== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3scad9rebw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 09 Aug 2023 12:08:18 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 379AvjwO030348; Wed, 9 Aug 2023 12:02:46 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3sa1rnfxkc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 09 Aug 2023 12:02:46 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 379C2ipd27460248 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 9 Aug 2023 12:02:44 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0336E20043; Wed, 9 Aug 2023 12:02:44 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E6E9A20040; Wed, 9 Aug 2023 12:02:43 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTPS; Wed, 9 Aug 2023 12:02:43 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 55390) id 981C6E0331; Wed, 9 Aug 2023 14:02:43 +0200 (CEST) From: Sven Schnelle To: Steven Rostedt Cc: linux-kernel@vger.kernel.org Subject: [PATCH 2/2] tracing/synthetic: allocate one additional element for size Date: Wed, 9 Aug 2023 14:02:33 +0200 Message-Id: <20230809120233.890987-2-svens@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230809120233.890987-1-svens@linux.ibm.com> References: <20230809120233.890987-1-svens@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: rhDL3YZNrF5FIFtqNSgosWY5TSNpN9ss X-Proofpoint-ORIG-GUID: rhDL3YZNrF5FIFtqNSgosWY5TSNpN9ss 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-09_10,2023-08-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxlogscore=999 suspectscore=0 phishscore=0 malwarescore=0 priorityscore=1501 impostorscore=0 clxscore=1015 adultscore=0 spamscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308090106 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: 1773756006900764135 X-GMAIL-MSGID: 1773756006900764135 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 cf5d0e352810..780ac934058c 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);