Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6819081rwi; Mon, 24 Oct 2022 06:32:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Rs4vEiSiYGgqJtZXZFai2Q82+PT551afLEFAB5/dLQMYhJQeOcEm5smztZ+AxnLDI7/sQ X-Received: by 2002:a17:907:9713:b0:78d:8e23:892c with SMTP id jg19-20020a170907971300b0078d8e23892cmr27355855ejc.449.1666618360505; Mon, 24 Oct 2022 06:32:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618360; cv=none; d=google.com; s=arc-20160816; b=BEQB1Eaznh4kWl2qLtWUX4d8prnbFg+Lyp1O1cyym6nrvsIOBIGlWgaWRfUfNRndhz FpEsIaV6P9QTZNfmGevPtV2zsQKJxsmRxRV9SBKo/xg+wVKFcpE8yynSa9+sLdC7LLRX nQQotAtVkpQe6H4hiPhcwZajTiaYRDrY7t91gyVBcnd4N5Azp+LVEmICX8sKM4JdEGiR r6fm5OaB6ASa8C2snmn+kPw2wvvw4L0M+YiIa4jPdiLrS3jITShGQB7I7TeOsHbwigx0 KlLZoYBvoDajIc5TjUSRos5epwfiROjRER5OZBiZUWUenppVUUMOxE7z47dzOx9fdbSx jkLQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn28-20020a1709070d1c00b0078db6b965c7si29281050ejc.782.2022.10.24.06.32.14; Mon, 24 Oct 2022 06:32:40 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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;