From patchwork Wed Aug 9 12:02:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Schnelle X-Patchwork-Id: 133216 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp2779022vqr; Wed, 9 Aug 2023 05:57:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFN+gsKfooMxZMzEx8dxQhEBT6Mza9Q4bEW8/kI7mzG5+29CrlvhikI9+kxgi4pkBFkRS5t X-Received: by 2002:a05:6a21:3d89:b0:13e:aede:f380 with SMTP id bj9-20020a056a213d8900b0013eaedef380mr2306137pzc.34.1691585827720; Wed, 09 Aug 2023 05:57:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691585827; cv=none; d=google.com; s=arc-20160816; b=c5ytCydb7kUp6IZ2K+Q8KcItdzOsdo09yS283/LIOazZPxRUeeJzW7HNjWydK1N9ee 18U2aHwd5FgtRPyaNHygbt4ZUU6SzhWhdguhARzzugd/XNgS7Ow3PqXHlNhwH2gaT93F JAKOPwFr+L+6jvBdfXWotFuezjryJ5fgGwfySHEHUVIPDrP/cAly+nttNwJVrYtofFGv SlRzz/fwG6jT7XrTwy0hZkiSHR0LgmV7J7A3wxyke98xOkMSLs0du4XdLIIlb/tuPdW/ 533u9F26sefIjVFCSR3T5CF/WMMYA5Jt8CGT8oYGEHRkclr5fOBfFGalh7u8uHz5VvvC 1Bcg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=Mw+vT/vprGVjVsvyLN5x9N+BUpJpZRVbJjgOxjWcfIw=; fh=GJrZ9BytDhSFvlRtxPE8EBx/shzHOh4Na+O7DzDM7Ac=; b=Y/oo90L9AWFxSiXIo8fiQi2t4Y7SivMAF54g5lBL+4capqPadnqNKqNl1zOpsOjbx5 7ZbfU5+pI5acsFjv8fDV0yUTOFiODXaYw1rnCPsPkZB7gG3JpDIu3cPSJoaKU8MngRHL yjSC3HkOsCaoITGSNYp7qx5yoKkj9xaSnBtZnxW2mL43dP+OH1GDSB7iv5o44jxwWADp Y+1Zpa3WWx4PBOj3HhMv4TAJGKRVHzvB69mHUrfsiwCaYeuG4a34RbQ27VRZAjBPCOkY ToPQL9cdNPG0A9Y+ZDLB2Re4ybgYAwumFtV0EfxokQZTQNkDwHv07X1glAIZzyOYOMDh QUIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=DgfUCNJ6; 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 o16-20020aa79790000000b00687480b7b2csi9173136pfp.105.2023.08.09.05.56.55; Wed, 09 Aug 2023 05:57:07 -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=DgfUCNJ6; 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 S231636AbjHIMDV (ORCPT + 99 others); Wed, 9 Aug 2023 08:03:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230079AbjHIMDU (ORCPT ); Wed, 9 Aug 2023 08:03:20 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1891C10FE for ; Wed, 9 Aug 2023 05:03:20 -0700 (PDT) Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 379Bx2eu008332; Wed, 9 Aug 2023 12:02:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=Mw+vT/vprGVjVsvyLN5x9N+BUpJpZRVbJjgOxjWcfIw=; b=DgfUCNJ6BtsL98lstUblDe8c7wcIO+Ha5urLZZHcaWiEc5dLJWUEN1XyUqdwKSC85jOl uvycYvkaJt/XvZeKKDtTf0hAkmXRireTzqY9N7Qlz6bQrhuPS4fIbApz4JMYYcRSgxLD jd+iq3mUK62K6+QJ6FjiejohLkFHgoriTM7bmLGKeMsm0qsexRjEEiHAN7wkWpeiJTou NaRTL0SzmoVp4g0sHOO4U51Riu3eSeU3WTOaLhJmuB9bkvLkniD60HprtH3LNLG5wAZ5 dedMdNPLSvOOoIvtPLYhFm0ymj/sny8ppt3EcmI5By3LmEgCOmA+NbmhQ7qYAPk4yu9y pg== 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 3scade83pe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 09 Aug 2023 12:02:51 +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 379BodjU000403; Wed, 9 Aug 2023 12:02:45 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3sa28kqs39-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 09 Aug 2023 12:02:45 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 379C2hJX28967320 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 9 Aug 2023 12:02:43 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3F80220043; Wed, 9 Aug 2023 12:02:43 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2CD9B20040; Wed, 9 Aug 2023 12:02:43 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav01.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 B3732E0331; Wed, 9 Aug 2023 14:02:42 +0200 (CEST) From: Sven Schnelle To: Steven Rostedt Cc: linux-kernel@vger.kernel.org Subject: [PATCH 1/2] tracing/synthetic: skip first entry for stack traces Date: Wed, 9 Aug 2023 14:02:32 +0200 Message-Id: <20230809120233.890987-1-svens@linux.ibm.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: RAXd9mPEdADiq518uO-2OtFbhtFy3DSC X-Proofpoint-GUID: RAXd9mPEdADiq518uO-2OtFbhtFy3DSC 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 impostorscore=0 suspectscore=0 mlxscore=0 lowpriorityscore=0 priorityscore=1501 mlxlogscore=999 phishscore=0 adultscore=0 spamscore=0 malwarescore=0 clxscore=1015 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308090102 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: 1773756300644450150 X-GMAIL-MSGID: 1773756300644450150 While debugging another issue i noticed that the stack trace output contains the number of entries on top: -0 [000] d..4. 203.322502: wake_lat: pid=0 delta=2268270616 stack=STACK: => 0x10 => __schedule+0xac6/0x1a98 => schedule+0x126/0x2c0 => schedule_timeout+0x242/0x2c0 => __wait_for_common+0x434/0x680 => __wait_rcu_gp+0x198/0x3e0 => synchronize_rcu+0x112/0x138 => ring_buffer_reset_online_cpus+0x140/0x2e0 => tracing_reset_online_cpus+0x15c/0x1d0 => tracing_set_clock+0x180/0x1d8 => hist_register_trigger+0x486/0x670 => event_hist_trigger_parse+0x494/0x1318 => trigger_process_regex+0x1d4/0x258 => event_trigger_write+0xb4/0x170 => vfs_write+0x210/0xad0 => ksys_write+0x122/0x208 Fix this by skipping the first element. Also replace the pointer logic with an index variable which is easier to read. Fixes: 00cf3d672a9d ("tracing: Allow synthetic events to pass around stacktraces") Signed-off-by: Sven Schnelle --- kernel/trace/trace_events_synth.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c index 57beba49c888..cf5d0e352810 100644 --- a/kernel/trace/trace_events_synth.c +++ b/kernel/trace/trace_events_synth.c @@ -350,7 +350,7 @@ static enum print_line_t print_synth_event(struct trace_iterator *iter, struct trace_seq *s = &iter->seq; struct synth_trace_event *entry; struct synth_event *se; - unsigned int i, n_u64; + unsigned int i, j, n_u64; char print_fmt[32]; const char *fmt; @@ -389,18 +389,13 @@ static enum print_line_t print_synth_event(struct trace_iterator *iter, n_u64 += STR_VAR_LEN_MAX / sizeof(u64); } } else if (se->fields[i]->is_stack) { - unsigned long *p, *end; struct trace_dynamic *data = &entry->fields[n_u64]; - - p = (void *)entry + data->as_dynamic.offset; - end = (void *)p + data->as_dynamic.len - (sizeof(long) - 1); + unsigned long *p = (void *)entry + data->as_dynamic.offset; trace_seq_printf(s, "%s=STACK:\n", se->fields[i]->name); - - for (; *p && p < end; p++) - trace_seq_printf(s, "=> %pS\n", (void *)*p); + for (j = 1; j < data->as_dynamic.len / sizeof(long); j++) + trace_seq_printf(s, "=> %pS\n", (void *)p[j]); n_u64++; - } else { struct trace_print_flags __flags[] = { __def_gfpflag_names, {-1, NULL} }; @@ -490,10 +485,6 @@ static unsigned int trace_stack(struct synth_trace_event *entry, break; } - /* Include the zero'd element if it fits */ - if (len < HIST_STACKTRACE_DEPTH) - len++; - len *= sizeof(long); /* Find the dynamic section to copy the stack into. */ 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);