Re: [mainline]Kernel crash while running ftrace selftest
From: Steven Rostedt
Date: Wed Apr 16 2025 - 15:18:58 EST
On Wed, 16 Apr 2025 22:36:11 +0530
Venkat Rao Bagalkote <venkat88@xxxxxxxxxxxxx> wrote:
> > */
> > int ftrace_shutdown_subops(struct ftrace_ops *ops, struct ftrace_ops *subops, int command)
> > {
> > - struct ftrace_hash *filter_hash;
> > - struct ftrace_hash *notrace_hash;
> > + struct ftrace_hash *filter_hash = EMPTY_HASH;
> > + struct ftrace_hash *notrace_hash = EMPTY_HASH;
> > int ret;
> >
> > if (unlikely(ftrace_disabled))
>
>
> Hello Steve,
>
> Issue still persists with the above patch.
Ah I just noticed that your backtrace had ftrace_startup_subops() not
ftrace_shutdown_subops(). How about this patch? It initializes for both
functions:
-- Steve
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index a8a02868b435..43394445390c 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -3490,8 +3490,8 @@ static int add_next_hash(struct ftrace_hash **filter_hash, struct ftrace_hash **
*/
int ftrace_startup_subops(struct ftrace_ops *ops, struct ftrace_ops *subops, int command)
{
- struct ftrace_hash *filter_hash;
- struct ftrace_hash *notrace_hash;
+ struct ftrace_hash *filter_hash = EMPTY_HASH;
+ struct ftrace_hash *notrace_hash = EMPTY_HASH;
struct ftrace_hash *save_filter_hash;
struct ftrace_hash *save_notrace_hash;
int ret;
@@ -3625,8 +3625,8 @@ static int rebuild_hashes(struct ftrace_hash **filter_hash, struct ftrace_hash *
*/
int ftrace_shutdown_subops(struct ftrace_ops *ops, struct ftrace_ops *subops, int command)
{
- struct ftrace_hash *filter_hash;
- struct ftrace_hash *notrace_hash;
+ struct ftrace_hash *filter_hash = EMPTY_HASH;
+ struct ftrace_hash *notrace_hash = EMPTY_HASH;
int ret;
if (unlikely(ftrace_disabled))