Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2475374rdf; Mon, 6 Nov 2023 15:55:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IG7CHYQ6T/I6kDy3sEkXkr5nGFraDJ7BKiwuTv4RhK7leG1PwHbgdfvg7I63Bh0j4+pqCh4 X-Received: by 2002:a17:902:ec8f:b0:1cc:55d4:a715 with SMTP id x15-20020a170902ec8f00b001cc55d4a715mr1397322plg.3.1699314939828; Mon, 06 Nov 2023 15:55:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699314939; cv=none; d=google.com; s=arc-20160816; b=041M3zd8m8cJ4ik7QN60V/hYl43RJXZ+QEOuh8PA3Vn2nLJpKyyT59g8/W5o1up0rJ K1IHGXRyB2wnxnvAzC2ppfnOqBhD1QlB4OIhquvkMeEABGx1cCbZZ4pQvnyw0Jdd3rJP 6UJ+oCelbALsyFYmFGlG6/ZFhlGhnW0kCITVmhWBps82QXVaTZeMNcKesMXAvb5Tpo2s m3EJ4lYs3sgYzybBTdxWRD42Tsh2yA8ibNuExcCDriCFz03eNjYz82DCfLCqAVdEZZ8A ct7cT1pWSW8TfuA04cFJVCeNRHWlazcrL9J1fuAPj1r4nVWJcj0qoIBn+88eg+F++CvQ AJWQ== 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:subject:cc:to:from:date; bh=lwNZpyu8CXfa7n4Avsb4eeOvOO5nvBiMP7jZDTHFvc8=; fh=KxKPX7akoqM5P0Fnfjcd/Qn1roqWg9d05oyLGcyeNBY=; b=gxfRHGlpidwgmj1PQzX/Ay7uKdm1b19Z9IEHQUmejRP9FVEDWDuweyzqxFvAdZfMkU lgPwJRQzTp9Mq1kjmgZ6PrdIYMCsFrCpRog6cSLdvQeHxP/CtRTqUzf2Z1bc37SXR0n2 rz2yI75e/V/xQASZyMD6AlEFL7IIrawZz60X2vRlGLwv0dt9da4g+robUVk3Cfck0jNM vkpgorGPZFrgxK7OiKOR80HGTlysoH9orgz/y342IUS1vdqx9JzMwDPzYVQcehurO6iv mAJLPEUeBe+V5KAojdQ77Et2dUxS5eeg+muZEOceSo/frv7qcQXQnVXqfkL0Ji3tGRvC xDiw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id j20-20020a170902f25400b001ca4e2a35efsi8831760plc.45.2023.11.06.15.55.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 15:55:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 9047F8077FFC; Mon, 6 Nov 2023 15:55:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233087AbjKFXzR convert rfc822-to-8bit (ORCPT + 99 others); Mon, 6 Nov 2023 18:55:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233065AbjKFXzQ (ORCPT ); Mon, 6 Nov 2023 18:55:16 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0B98BD for ; Mon, 6 Nov 2023 15:55:13 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD3B7C433C8; Mon, 6 Nov 2023 23:55:11 +0000 (UTC) Date: Mon, 6 Nov 2023 18:55:13 -0500 From: Steven Rostedt To: =?UTF-8?B?xYF1a2Fzeg==?= Bartosik Cc: Jason Baron , Jim Cromie , Andrew Morton , Kees Cook , Douglas Anderson , Guenter Roeck , Yaniv Tzoreff , Benson Leung , Vincent Whitchurch , Pekka Paalanen , Sean Paul , Daniel Vetter , linux-kernel@vger.kernel.org, upstream@semihalf.com Subject: Re: [PATCH v1 04/12] dyndbg: add 2 trace-events: pr_debug, dev_dbg Message-ID: <20231106185513.79411f9a@gandalf.local.home> In-Reply-To: <20231103131011.1316396-5-lb@semihalf.com> References: <20231103131011.1316396-1-lb@semihalf.com> <20231103131011.1316396-5-lb@semihalf.com> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 06 Nov 2023 15:55:29 -0800 (PST) On Fri, 3 Nov 2023 14:10:03 +0100 Ɓukasz Bartosik wrote: > +/* capture pr_debug() callsite descriptor and message */ > +TRACE_EVENT(prdbg, > + TP_PROTO(const struct _ddebug *desc, const char *text, size_t len), > + > + TP_ARGS(desc, text, len), > + > + TP_STRUCT__entry( > + __field(const struct _ddebug *, desc) > + __dynamic_array(char, msg, len + 1) > + ), > + > + TP_fast_assign( > + __entry->desc = desc; > + /* > + * Each trace entry is printed in a new line. > + * If the msg finishes with '\n', cut it off > + * to avoid blank lines in the trace. > + */ > + if (len > 0 && (text[len - 1] == '\n')) > + len -= 1; > + > + memcpy(__get_str(msg), text, len); > + __get_str(msg)[len] = 0; > + ), > + > + TP_printk("%s.%s %s", __entry->desc->modname, > + __entry->desc->function, __get_str(msg)) > +); > + That TP_printk() is dangerous. How do you know __entry->desc still exists when reading the buffer? Is the struct _ddebug permanent? Can it be freed? If so, the above can easily cause a crash. -- Steve