From patchwork Mon Oct 24 11:29:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8886 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433629wru; Mon, 24 Oct 2022 05:50:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6tkZ56Ui9IjSpu2DYFhcSj4vxkPpS0lbUUNLIriqE7tAySUM7qK/Jl4bC4rv6mYDmJCG4l X-Received: by 2002:a17:90b:2803:b0:210:3b5e:62eb with SMTP id qb3-20020a17090b280300b002103b5e62ebmr30069167pjb.95.1666615793318; Mon, 24 Oct 2022 05:49:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615793; cv=none; d=google.com; s=arc-20160816; b=OqtAv+Hwrf+R9RP3R3ltm3sek9eCC43j0nVp4ItUPqyf13DyYWI0f48fZFtrzEWubs YnoplkJhFliMZSs8tl+tWVUckW4PxqOv9cqs00NE2NFmw/8YDmL0qo4erPm26hLwFD7W zvi9ob5uTy+SssqA7YoaImD1ocoQKGGDGx0miamsNn4+aC5TktUY/vUjTM0rajHYosmr d0swVfUw2JN/UTk0+eQgvLYv4uELxR6vYdzFNfzIcJ6h56+qEWglGCxHqiMw9C1K6dd0 v33gNTGMq+5LIw/z83G+vpMZoie0mpngZgy2AQtpiWQVHfFTwSkh95ODpnGkMRTjVneC 9qCw== 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=aZO250IL3GugcFCOwt4U++tedHsS1gXCyMr/wJvHSsQ=; b=aomNuzR18emCqqnQhB2TjODQHVxXrupk+fKc1OIuO5V2SKGDjHLt4bbQoQo5ijHRx/ hRNHC1k/ukyFpA7B0wRHYXTazf2JaXx89Q4AAJ1gbR+oEyfWcDkefWvSFBau7YYlqSd/ YFFDPNlL4BGFJAQy+RAXW+cSc9vv5Yur7jpXmqUAt8dcl4u1zhtwqgMC22kZqPVsZr/A H2+hPbFi06I//dfbjcV6NsQGj2cDPTmHJFdllw2sMA2boMV+ygMwRaLLzIQoJytFQ3gx coEBfZpYhqprHiHzwMZvSjx3/IZXw1E7KmNQUMn6Uax2MVKnRBN/3usOvB/R7JXuIjoH PHJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OYvpH4X9; 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 u5-20020a170903124500b0018542a1b588si38767672plh.196.2022.10.24.05.49.39; Mon, 24 Oct 2022 05:49:53 -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=OYvpH4X9; 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 S232069AbiJXMrn (ORCPT + 99 others); Mon, 24 Oct 2022 08:47:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234166AbiJXMmH (ORCPT ); Mon, 24 Oct 2022 08:42:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5312C7EFEF; Mon, 24 Oct 2022 05:08:49 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 9B7E9612DF; Mon, 24 Oct 2022 11:57:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADB27C433D6; Mon, 24 Oct 2022 11:57:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612638; bh=y84t/6twxt/53nKBnvLQ90QZ4BX1GUJC2DR1Vtf5ue8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OYvpH4X91tOUhl8c9MrHCryG1jczpVNbTrJRD9OT8QCY+B6d9WfIKRV4wYm4nWtqC IQDQUtxGaJtsyK/fq4n6JrAjHMUprNHMUqSwfAp0NQaAsOjbhufVulzQ8tLwwoXEwy zWD4DaAucHoqQa4Ln6xdHivZ7csO7rZUqOo5aMss= 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.19 063/229] ftrace: Properly unset FTRACE_HASH_FL_MOD Date: Mon, 24 Oct 2022 13:29:42 +0200 Message-Id: <20221024113001.116446241@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@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?1747573322186180056?= X-GMAIL-MSGID: =?utf-8?q?1747573322186180056?= 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 @@ -5054,8 +5054,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;