* Re: [PATCH] ftrace: Properly unset FTRACE_HASH_FL_MOD
2022-09-26 15:20 [PATCH] ftrace: Properly unset FTRACE_HASH_FL_MOD Zheng Yejian
@ 2022-09-26 14:32 ` Steven Rostedt
0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2022-09-26 14:32 UTC (permalink / raw)
To: Zheng Yejian; +Cc: mingo, linux-kernel
On Mon, 26 Sep 2022 15:20:08 +0000
Zheng Yejian <zhengyejian1@huawei.com> wrote:
> 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.
>
> Cc: stable@vger.kernel.org
> Fixes: 8c08f0d5c6fb ("ftrace: Have cached module filters be an active filter")
> Signed-off-by: Zheng Yejian <zhengyejian1@huawei.com>
Thanks, this definitely looks like a bug.
I'll be reviewing these patches later this week.
-- Steve
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] ftrace: Properly unset FTRACE_HASH_FL_MOD
@ 2022-09-26 15:20 Zheng Yejian
2022-09-26 14:32 ` Steven Rostedt
0 siblings, 1 reply; 2+ messages in thread
From: Zheng Yejian @ 2022-09-26 15:20 UTC (permalink / raw)
To: rostedt, mingo, linux-kernel; +Cc: zhengyejian1
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.
Cc: stable@vger.kernel.org
Fixes: 8c08f0d5c6fb ("ftrace: Have cached module filters be an active filter")
Signed-off-by: Zheng Yejian <zhengyejian1@huawei.com>
---
kernel/trace/ftrace.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 439e2ab6905e..5a1ec7e1af33 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -6081,8 +6081,12 @@ int ftrace_regex_release(struct inode *inode, struct file *file)
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;
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-26 15:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-26 15:20 [PATCH] ftrace: Properly unset FTRACE_HASH_FL_MOD Zheng Yejian
2022-09-26 14:32 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®