From patchwork Mon Oct 24 11:27:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9655 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp534379wru; Mon, 24 Oct 2022 09:11:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ogtX9X+5GM7v4RcjOl2S8b5ZZoFTnT+nTbXVnoEmi4RD+Eyw5xf7WyoHqhbwYpe25JqVt X-Received: by 2002:a17:907:a47:b0:79e:56dc:5373 with SMTP id be7-20020a1709070a4700b0079e56dc5373mr13821296ejc.148.1666627861785; Mon, 24 Oct 2022 09:11:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627861; cv=none; d=google.com; s=arc-20160816; b=n+o+4h7ktl/f9komcNDnuSgOC1KbUG8/spKpbENzUh38Vr9lel63k5Ebg0XZFFnTBv LmPlNLmF5tgOQLqjpAdEYOD5Hr0d6nLNPq76wqByPbaI/NvYk7Eu3RlsCmHONz6mDSl0 3Tjx+fzUy9G8F6c1YSKdX9K+Ct07YzdG2Wh7zcNg6nymwuOxYZrYoWkILQV0KgagtRpC yY1BPjtrv+7RGU+lDz7t8a97Qalr+2impUtlDvEn5cbnBsLXnvYSP/bB7hEZqvzCJg/P sChtI+bkeWOudzsxNY3e3cGuXfiUIqRwKm9tq+bpDhhbr9BR7YHBtveLlc1TQ8VkDuHy G3ZQ== 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=WlsELkqmMdddD+14ARogECvREY6WQCKsAG+TPNFQ/gU=; b=RvE01dwZU789hIJdjoc52aLChLAMl+tT5fo8Tdvp9E3yNS9t3J3JflnMj5tfq2+Tna uQLYhvIgt1koFNzReerWlnNiJZHkWeqVwDEamhYpqKnYeqDFilOdzLUVOXBBXDy5sBev DiuYLz+lsfJioBaVyRuOuLgqc1Z9gnBkjLyD9IfR5SYRtm5qceFSpNPiIFCTIKVZTk/w cGNhIJ/R6dGt80Pv+kAwe9yE4fPuajS7urDgReXG32oi+nJGBCtZX1fH6UoZfbrM5C+g kvmS5pxXb8RS64jjEawZXt17pr0ddVSu8z/Dri/z55ONLnlz9UGvTeYQkSU9JecQPuV5 g2WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ObsFjA/D"; 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 b8-20020a056402278800b00461e3e1bc3asi183523ede.317.2022.10.24.09.10.35; Mon, 24 Oct 2022 09:11:01 -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="ObsFjA/D"; 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 S233505AbiJXQIr (ORCPT + 99 others); Mon, 24 Oct 2022 12:08:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233514AbiJXQEp (ORCPT ); Mon, 24 Oct 2022 12:04:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EAD338D; Mon, 24 Oct 2022 07:57:30 -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 ams.source.kernel.org (Postfix) with ESMTPS id 7A81CB81636; Mon, 24 Oct 2022 12:19:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2CF5C433C1; Mon, 24 Oct 2022 12:19:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613942; bh=UT5fI7Gb2UDT1kmiKJtaR8esT5aLLjyI7sXIdG9xXfI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ObsFjA/DkvhqdP+dl4UytrP6bxtCvffExgLJ0aAoimi0ZAkZHzAusQKsA1nSKC5X4 sxKVnnutY9YNI5kVTP5u6cc6NgAuXmSZY/97x+rvBfpyqpn6RjU47Ehiiz+gPNOclB QRV5oMt/2nrZDJ9oenh+IqX4LsLm6MxQGqWI2tPw= 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.10 072/390] ftrace: Properly unset FTRACE_HASH_FL_MOD Date: Mon, 24 Oct 2022 13:27:49 +0200 Message-Id: <20221024113025.663127307@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747585976717046231?= X-GMAIL-MSGID: =?utf-8?q?1747585976717046231?= 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 @@ -5662,8 +5662,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;