Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5294989rdb; Wed, 13 Dec 2023 05:01:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IFoPiWwHJMmTe/6sW3cE5lZ/8oKshxn4pL/7BhD558DI4rPC9drwbQSL5RqhVKmv1PlR9WI X-Received: by 2002:a05:6e02:156f:b0:35d:19a3:3c29 with SMTP id k15-20020a056e02156f00b0035d19a33c29mr8277442ilu.2.1702472477395; Wed, 13 Dec 2023 05:01:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702472477; cv=none; d=google.com; s=arc-20160816; b=KNtZuMN0j7NT57DRQ9Jbp8rN3Begzz8UgDGL4XL+gfnjQ6Qru6xltScXYdM+3oOe5U tpGALd9reCJyv9TN6xQ6hhPdW5yfho+XIo5iLCoYw97IVFHEbNHx2Gwu/4VnlI/PGAwj CP03ttZ2/EcJlE3dqRoTcbMr/gp8wZZqBkMRwWZfisZN3j3b33ilOteAxSDo6gfm1CDW 0JDnoc9rGwVklJn38yOXyckE+jwGu+bFtyP0HqKoQ49gkv5kgDE1IoThNzZjeTNWqbiy VCdQklezizTFfxzanPl7OfTlKq3WAL7y9VOGja4S0BUXeQaIsA/6aQTRM4l1+Abi4YoN qroA== 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=nL6NC+30In7r8pFj0J+ZoSKr1rD2gSFGLj196g2Kmjs=; fh=LIqp4MZJWacjtqs/UvyprtbzDsWAOj2mNyrunfAgXEk=; b=vynhzLMwYRySw7ayCkFBRhlAtnwnA/1hjoGERH1YWFvQJpZVhlx5CEFrPwDOK8Wb6F cUKeAbAqFTtqfQJFxX5BInuPs4pq1aaYMQjAumKYSeUKd4DJIDPdnmQdFo6A9Ms2qa1W XczLHnZo0855CLGzPcSmSvpDDLcptHfSYMPhhZEEZBVJ32xoKi+U8btDLEvpiiwnxbIx d/d9XVoXbyLAADzL0xEzhcfQp8r5fPE6qefI4wVGwiXkAwMGXLwnphNfxi/3hiOCsbhJ wnCpoDlKlYSerKqpTRd9Zt9COSVpyUr+DaMZulST0DGVE4fFWyGgsoG2Csbkfd7LxMWz V3dw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id b15-20020a630c0f000000b005c668dc2430si9318818pgl.193.2023.12.13.05.01.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 05:01:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id 22B2F80E70BE; Wed, 13 Dec 2023 05:01:13 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379016AbjLMNAx (ORCPT + 99 others); Wed, 13 Dec 2023 08:00:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379074AbjLMNAk (ORCPT ); Wed, 13 Dec 2023 08:00:40 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7149126 for ; Wed, 13 Dec 2023 05:00:44 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB0A1C433CB; Wed, 13 Dec 2023 13:00:43 +0000 (UTC) Date: Wed, 13 Dec 2023 08:01:27 -0500 From: Steven Rostedt To: Zheng Yejian Cc: , , , , Subject: Re: [PATCH v2] tracing: Fix uaf issue when open the hist or hist_debug file Message-ID: <20231213080127.6ef26247@gandalf.local.home> In-Reply-To: <20231213015138.281888-1-zhengyejian1@huawei.com> References: <20231212113546.6a51d359@gandalf.local.home> <20231213015138.281888-1-zhengyejian1@huawei.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=US-ASCII Content-Transfer-Encoding: 7bit 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 morse.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 (morse.vger.email [0.0.0.0]); Wed, 13 Dec 2023 05:01:13 -0800 (PST) On Wed, 13 Dec 2023 09:51:38 +0800 Zheng Yejian wrote: > --- > kernel/trace/trace_events_hist.c | 18 ++++++++++++++---- > 1 file changed, 14 insertions(+), 4 deletions(-) > > Steve, thanks for your review! > > v2: > - Introduce tracing_single_release_file_tr() to add the missing call for > single_release() as suggested by Steve; > Link: https://lore.kernel.org/all/20231212113546.6a51d359@gandalf.local.home/ > - Slightly modify the commit message and comments. > > v1: > Link: https://lore.kernel.org/all/20231212113317.4159890-1-zhengyejian1@huawei.com/ > > diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c > index 1abc07fba1b9..5296a08c0641 100644 > --- a/kernel/trace/trace_events_hist.c > +++ b/kernel/trace/trace_events_hist.c > @@ -5619,14 +5619,22 @@ static int hist_show(struct seq_file *m, void *v) > return ret; > } > > +static int tracing_single_release_file_tr(struct inode *inode, struct file *filp) > +{ > + tracing_release_file_tr(inode, filp); > + return single_release(inode, filp); > +} > + Hi Zheng, Could you put the tracing_single_release_file_tr() into trace.c as a non static function. Put the protocol in kernel/trace/trace.h. Even though it's only used in trace_events_hist.c, I rather not hide it there. If this issue appears for another file, I would look in trace.c and trace.h for available functions to use. Thanks, -- Steve