From patchwork Mon Oct 24 11:29:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8597 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419414wru; Mon, 24 Oct 2022 05:16:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM69VsQOrgvnCdf0Z1KRAgXLm9F53OpJ/4VktvgaUkvWlDA83nNWTKEK8wsR2FVeQRYU4Cts X-Received: by 2002:a17:906:58cc:b0:78d:ce9c:3787 with SMTP id e12-20020a17090658cc00b0078dce9c3787mr27008149ejs.715.1666613764480; Mon, 24 Oct 2022 05:16:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613764; cv=none; d=google.com; s=arc-20160816; b=vm/7iLdkS/DOYjtK+V8jzHz3AXzBMTE8cBz5t4c3VajTLR+LBDRzDxeC4/crO9lpNf btun3kXgyBo97lPiDE2d0VITSQWxEI3CwA4QHZ8I40sbUGj633gvOhDv7eE5aUbCwEl2 jTJVwx4z7aJcbKIqeSeCH9po4rqXcAVLa/T0dG1L+BMC/4v8ad/Q1k5r4fyrH77zwHBf dp/tcTUslvsut1UQp0nlQeQgqB4H8LOI2r4+xzhBHLlcPEp/Elc35VTxt1D7DdglsSnJ BY8DGyfKr6qXQn3JDt3JIPoIv+FELISQkvjvoeXRjXDVgJjU4VahwNslvT6gzPmlu6w4 lvmg== 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=RSAX87CGkMRZ/iVReg9Qz+0NulyzlHAtc79+ULSNHnw=; b=ztQKcF33UwrfzLy6Kx9rViizfNIPimYOpf031nePOT3mP0mnDX/RlF+WrV80h0XzqL n7Q6MO/q3qdeKzX+qhOXVkp+spnj6yXlZ6LwnRnuQp7NdRla49Nirln7Sl+kgrt1aM1m HnPaQayfxjPSZ2WM6W7vkrvDlkXGUF14umlAM+PSJReEyRFAqY0DqipfQhTDD15+6qvb 0jC1nkMt2qX/kbPXIIWXYG3S87CEn1+DoWnWBCUtGa2Ey3VPv+Z9Xq0grwv8ubCUteGG E2IXZ0uut+T2ssurT9CPwRrgOYPjBPRmLQcvscXyV9tIixTv2IHu67s0a5NpIa+Vqmzj aUcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="d/DOJJBu"; 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 qb26-20020a1709077e9a00b0078db3762061si29385176ejc.439.2022.10.24.05.15.40; Mon, 24 Oct 2022 05:16:04 -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="d/DOJJBu"; 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 S232491AbiJXMH0 (ORCPT + 99 others); Mon, 24 Oct 2022 08:07:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232975AbiJXMEr (ORCPT ); Mon, 24 Oct 2022 08:04:47 -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 DA8427CB7C; Mon, 24 Oct 2022 04:51:05 -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 3F01EB811B2; Mon, 24 Oct 2022 11:49:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 965FFC433C1; Mon, 24 Oct 2022 11:49:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612192; bh=mXfUfUMNJxS2BzRQ6KR9PDjAr0TpVUooJu+qILoXLsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d/DOJJBulW+YwMo1/gNd6Bp1hDW8qU2enm70MJm18OA6dV6HQnQs4Kjm5eP7s3r0m ZZ0Pf1FAb29cXga1BPD4EV3i/nIvU5a5utnG9gkv1z5qajwyYaGdJbCeLU6JCa7YR7 bNudLTnGaohvSPwVlCAeAs1FLN0tEt2NdFmU+/ZY= 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 4.14 073/210] ftrace: Properly unset FTRACE_HASH_FL_MOD Date: Mon, 24 Oct 2022 13:29:50 +0200 Message-Id: <20221024112959.430185592@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@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?1747571194716852200?= X-GMAIL-MSGID: =?utf-8?q?1747571194716852200?= 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 @@ -5128,8 +5128,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;