From patchwork Mon Oct 24 11:29:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9243 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp461215wru; Mon, 24 Oct 2022 06:43:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5oiFkGdkAgTnE5YbLOnoSGPi9PIKD9+f8NoJBXJiXRjZJGljvQclTEJdi+MLAmVFMoPdRt X-Received: by 2002:a17:907:2da7:b0:78e:4ea:dbf7 with SMTP id gt39-20020a1709072da700b0078e04eadbf7mr27043097ejc.616.1666619004120; Mon, 24 Oct 2022 06:43:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619004; cv=none; d=google.com; s=arc-20160816; b=WYo1xOv7X8K3ucPhTreCuNnq5dXmNjXQMAz0ey4tbN/MvwkOXuXkZSuH+K3V1paMDr H7t9kPn4hwXSkFiT+nh3MeuJtrXLHH4zLWyRFgORihDaNYwpnFIfyWKW2TK5thneCYXy klx1+IdYreyVyC7T4t6a8/0yJ0Duk9c7MOqP7EsofLO//vxosWqWzGaWoRRUQ9l6OFRL Wsin4kt8o3X1Vtt7/iT5fkGmniu45H02dPg00o2MBe3olv3csTEqgruHMJpMt1hzvz24 DO+V9yQ/3KEmwf/Rj2eQy9olY9+L3bavyhrdueDW/btB6+nkPx8K69X4by/5RpyXIwKz e1pQ== 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=0YzBseyDoF1h/BU5A8XERDqGrGhL8s4TjPx+gr7AZWM=; b=T3udxjS0u2mBgjosA9NAIhuY6n7fm4XBgDp60h3cN/GFB+CfoS9Ec8rLLS/KgMhkpB xkSDTtXkqoaB6QeWl6T5FAac5nALEM4zzCdmvcApsbbFs+L12CG4Ymhk8QgjY15ETwJ8 QDU8Hym0utoOTA+yt1AWP9oJm9MW2MgaUEndLuYsTwKZhLqwD+HgK4VSrC0o2Q6piVBA jjv7hBEvSJUifOU8qFS7pEhabhqr4Hg+u/SAutvd8/+37dq/ogS50Fn3j9NgOFvMHy8W T0m9kxNLr3i8qFFnCukDzCaTU5VmdI9B5276u3E97uKl5BNcJEq1fNwqlIW3OiBbAvBE wThA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B6Ckco5P; 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 k25-20020a17090632d900b007891fd91786si23356478ejk.151.2022.10.24.06.42.59; Mon, 24 Oct 2022 06:43:24 -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=B6Ckco5P; 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 S236025AbiJXNh0 (ORCPT + 99 others); Mon, 24 Oct 2022 09:37:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233520AbiJXNcp (ORCPT ); Mon, 24 Oct 2022 09:32: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 B01B51DA70; Mon, 24 Oct 2022 05:34:42 -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 3D7B1B81190; Mon, 24 Oct 2022 12:06:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91C16C433C1; Mon, 24 Oct 2022 12:06:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613200; bh=kapTbQ2ku69T4B7Gewk0shhG4KoU6HkPfCsKrGr7XUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B6Ckco5PkqMDXkPCCymZE5ylLPnpdreYzBdkXKP5WK7vQQJB2ePC69cXPN6iZQXh7 7RoYO2/2Sa0dwVhfaNDzxYqBlpepvy+my7RHfOkBT1q20M8rvPUK3WZ7FOCsodQ8qI sJUDtHCyNT0pb6CYpfslMMjq4juJ9s1farO0aR7E= 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.4 046/255] ftrace: Properly unset FTRACE_HASH_FL_MOD Date: Mon, 24 Oct 2022 13:29:16 +0200 Message-Id: <20221024113003.960842024@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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?1747576688818852522?= X-GMAIL-MSGID: =?utf-8?q?1747576688818852522?= 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 @@ -5084,8 +5084,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;