From patchwork Wed Oct 19 08:23:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5507 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp336526wrs; Wed, 19 Oct 2022 06:47:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4FGLt6pRCrQnYybdunMOKgUujBEfXIsi0CjzOm8Iy0ZTPYFudUA0RwXSZMxKmOfod/oWCC X-Received: by 2002:a63:e806:0:b0:44b:d45b:b8a2 with SMTP id s6-20020a63e806000000b0044bd45bb8a2mr7223478pgh.14.1666187232066; Wed, 19 Oct 2022 06:47:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187232; cv=none; d=google.com; s=arc-20160816; b=TUOc5UsZN9XG4GODzXCREEzPnZ5axZHbRJS6NcG3FVW6rSEt9zO6oqnxhmvHSrbWIN OfZEezCTByz/el8TPa2hq1HGB24ja9VVdismiep/PP9aUoHi79/xEDBRBAgNAqC97LDB g4rN5s3iqbWhE/ryJkmAeHMmOfjzcz+04FmTvrWLupJYbrfjDkWiAkSwnbNHFnu0J6Qh zQYJpGOpED3TQqzsGEf6cipav4+AmODots1cNJi7lBR+DKSaNu4aNsP+NkVOdlMZ92FP rq0ziNrmo68NFHW/S1cibqJtpLzEe/4RhY3QTlPwgDWJKwkHKWQoX6K9GtZ17srZFCNU 0e5A== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c195-20020a6335cc000000b00462da7a1de0si18515392pga.301.2022.10.19.06.46.58; Wed, 19 Oct 2022 06:47:12 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123942856577225?= X-GMAIL-MSGID: =?utf-8?q?1747123942856577225?= 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;