From patchwork Sat Oct 22 07:20:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7250 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091484wrr; Sat, 22 Oct 2022 00:50:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4RgtSLWgBqQDik/ZI/G0XWmdr8V0iGsRrY3R/umY9hf6utH4TDjCLS3nockFh+OjuWCdVH X-Received: by 2002:a17:90b:38d1:b0:212:510b:e5e6 with SMTP id nn17-20020a17090b38d100b00212510be5e6mr14073888pjb.116.1666425047818; Sat, 22 Oct 2022 00:50:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425047; cv=none; d=google.com; s=arc-20160816; b=qO6YHrCxWkcRnkWxD3FZ3s9M08XLZDBB2Qp0elsddL7VUW4oU91gm29vLfB+nHGspq HrDpmyGWPV5I4ysqPM0ycTYMN/MZH8Z5bsx+fW2bnck6e4eIAUcn74sgdSDNzoLbykqZ lQpQVQbdjha01u2Rd2XIfm8ye8Tc0gOpCYz9QF0UJi6ySxP3Y9dU2yoQXfMuExpB1ZP+ 1NhOyX/21tZTGV3tWT2ZI2MyTOkZ6ZHX9uMsrLAol0pcSfdKAZH1Z6ypY4pWzDg3dOag g45gJnayQkd82MY03KaSyTUY2MI7FweQ5cBFGNZ2Cyft4ogfEjjyoaHbgGHzPT8TmGQ2 /JYw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ht4lAs2HD0gBAYk79TKdPrvWP51ndiBagm2a8trD7Gk=; b=YZ3m7dzLtnQfngvbRtsCRy7mNUFCLnJjm6Q5nJ7QIwHxCkdQMAe/3T260+w0tWA0cd hlJ81ILsArHEv9hUpNvYdJ/hrV8qIXl0eJx1/XmUaGw93V1rh0f+7XwcQ5MwVmPxVyyx zvFJgf9ERFvwud4fyDX2EVyJWT4Fsr3NWKJkQxfpElxz9lNhCIHzztYPrOCFI2cVbemS LBHgI/O8YNWpEZEZ+pcv9sMx7iXJ+r+ElVLj82wbw/bze3vh95tRMHi5CsJ0xjZ83Gno oDSF0EyQ6q2F+z4xLgi66M5KF7juuTBE0XFPXwEvxHuP7DqeM3fs6g5aNB7r2RRD/S/n MbDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hTGBxYbg; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q24-20020a635c18000000b004589dfd10e2si26549989pgb.38.2022.10.22.00.50.35; Sat, 22 Oct 2022 00:50:47 -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=@linuxfoundation.org header.s=korg header.b=hTGBxYbg; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231651AbiJVHuI (ORCPT + 99 others); Sat, 22 Oct 2022 03:50:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231397AbiJVHso (ORCPT ); Sat, 22 Oct 2022 03:48:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F35ED1D4DD0; Sat, 22 Oct 2022 00:45:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E863D60AFA; Sat, 22 Oct 2022 07:41:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AA41C433D6; Sat, 22 Oct 2022 07:41:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424498; bh=APosRWLMWXRR23CdEQKkKNR6lfRUIpIXd8OHjaqegVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hTGBxYbgJoKS99uLqaMAdKTWeMuwDj5x0vFkxlR/YD3Q9/eFp47/0IRlEIllRb3aW uO+tJATFa4zYeI/mfWLpeBcNqUj7F+l3PJLEM3Xc+Y7mBTGpCS3VIVOfxeNwCVn6CK bzrt6PcG/1+eyBTSyR7vL/NM6V1SQ1YHX6du7VLk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, mingo@redhat.com, Zheng Yejian , "Steven Rostedt (Google)" Subject: [PATCH 5.19 138/717] ftrace: Properly unset FTRACE_HASH_FL_MOD Date: Sat, 22 Oct 2022 09:20:17 +0200 Message-Id: <20221022072439.964516610@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747373310819507988?= X-GMAIL-MSGID: =?utf-8?q?1747373310819507988?= From: Zheng Yejian commit 0ce0638edf5ec83343302b884fa208179580700a upstream. When executing following commands like what document said, but the log "#### all functions enabled ####" was not shown as expect: 1. Set a 'mod' filter: $ echo 'write*:mod:ext3' > /sys/kernel/tracing/set_ftrace_filter 2. Invert above filter: $ echo '!write*:mod:ext3' >> /sys/kernel/tracing/set_ftrace_filter 3. Read the file: $ cat /sys/kernel/tracing/set_ftrace_filter By some debugging, I found that flag FTRACE_HASH_FL_MOD was not unset after inversion like above step 2 and then result of ftrace_hash_empty() is incorrect. Link: https://lkml.kernel.org/r/20220926152008.2239274-1-zhengyejian1@huawei.com Cc: Cc: stable@vger.kernel.org Fixes: 8c08f0d5c6fb ("ftrace: Have cached module filters be an active filter") Signed-off-by: Zheng Yejian Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/ftrace.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -6037,8 +6037,12 @@ int ftrace_regex_release(struct inode *i if (filter_hash) { orig_hash = &iter->ops->func_hash->filter_hash; - if (iter->tr && !list_empty(&iter->tr->mod_trace)) - iter->hash->flags |= FTRACE_HASH_FL_MOD; + if (iter->tr) { + if (list_empty(&iter->tr->mod_trace)) + iter->hash->flags &= ~FTRACE_HASH_FL_MOD; + else + iter->hash->flags |= FTRACE_HASH_FL_MOD; + } } else orig_hash = &iter->ops->func_hash->notrace_hash;