Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1170634rwi; Wed, 19 Oct 2022 07:29:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5u++PLOwGYoOCbk8IyKUn07t7FHZgfs9EIq9z9evWrgsg3D3DtUKuR6J0mJ4MmI5zEE/Xf X-Received: by 2002:a05:6402:1d4a:b0:45c:98a9:7ba3 with SMTP id dz10-20020a0564021d4a00b0045c98a97ba3mr7852012edb.418.1666189781594; Wed, 19 Oct 2022 07:29:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666189781; cv=none; d=google.com; s=arc-20160816; b=PTSIcorM1AZjO5ruGk8foWQH+Sc+Z5j++nmjZoXS97eA0W2cp9wX+M+Q9jnt68pZV+ Aw7oTFwWpUiioBMIPvuIph8a6hfnx45+sfe90o+LsAthjUZCrlao0Ikkf5m8lecPlsf0 Vxouo8aJT2YQIj4yE4fjMFAvOpaH7gx56Q0IvxF3bFFsNb4NrfKSI8gK/Uz54qqPyKca j7p0pRfMAsL7bmSJ7f+kHPnwcDX50Xt7Nxhhy+Uwj12Y2o7nbdMGBRbkinsPayns/izu xhBcVNorvHuIGEpei2c6mrrIwfMs/iJvR/c9FrsPpYmcqDRm501NqEYMOBFdL5aPg7Wo f/pA== 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=+d6T6VgacFxGfySBqO6C1MgabZN6vRYdTB8dQF/c83s=; b=QLySa5TmCohIcYQRFdxx7wQ7sP244uT71I8OMLAoLqGOE6CQJPVtXc7tgoRLIOr9/U i5OCKnHx6eWjPS1Y2LdIC0/KebZih9L1YI/UBPrX6l1ukmmztyURaygUzCbzAoHsQRSD BghCH34YHR3F7MrexCAsYmoYmKD1p6pxeaQZK4cxXsKAHBeWVh8uoU6QvL18qaDsH/AA XL0Q2lrGgfi4DDerQbwJiBzgbodglyZa0oUnaATYddJHl77R0/M2Z4o6ZK8w/MfQALGX f+0NubCuPX520XshpzY1eRUjnZCjdndrlTbvdVaCiWVTvysPGfkQ9wfS2EmeMIzuGuJs lEKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=s305VvN5; 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 u19-20020a17090617d300b00711da52c6e4si12884991eje.309.2022.10.19.07.29.16; Wed, 19 Oct 2022 07:29:41 -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=s305VvN5; 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 S230399AbiJSNq2 (ORCPT + 99 others); Wed, 19 Oct 2022 09:46:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233033AbiJSNp3 (ORCPT ); Wed, 19 Oct 2022 09:45:29 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F137104532; Wed, 19 Oct 2022 06:31:54 -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 sin.source.kernel.org (Postfix) with ESMTPS id BA1F2CE20F5; Wed, 19 Oct 2022 08:46:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87646C433B5; Wed, 19 Oct 2022 08:46:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169216; bh=d/SGE19nr370Fuxre5//z2/HMCF2Sb8iPSnavHuAhUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s305VvN5ojmqORP9tLKoaVnx7IPfvvwAHmUBsvOD3HT9421eIFMWy/JWZqxHSoW4r E0dBTCgkGgcwyCSCnt/+dwXoCyeitzoglrp0d1wC9mwpLE19312DZoQD3Q7hZPETbN GxgyLtWHd7JFzbLNaFOaxLfpy8i4ekX5uz13VbnQ= 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 6.0 150/862] ftrace: Properly unset FTRACE_HASH_FL_MOD Date: Wed, 19 Oct 2022 10:23:57 +0200 Message-Id: <20221019083256.616233624@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@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.4 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 @@ -6081,8 +6081,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;