lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250905223029.4fee615b@gandalf.local.home>
Date: Fri, 5 Sep 2025 22:30:29 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Guenter Roeck <linux@...ck-us.net>
Cc: Ye Weihua <yeweihua4@...wei.com>, Masami Hiramatsu
 <mhiramat@...nel.org>, Mark Rutland <mark.rutland@....com>, Mathieu
 Desnoyers <mathieu.desnoyers@...icios.com>,
 linux-trace-kernel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH -next] trace/fgraph: Fix the warning caused by missing
 unregister notifier

On Fri, 5 Sep 2025 16:19:02 -0700
Guenter Roeck <linux@...ck-us.net> wrote:

> > +++ b/kernel/trace/fgraph.c
> > @@ -1391,10 +1391,11 @@ int register_ftrace_graph(struct fgraph_ops *gops)
> >  error:
> >  	if (ret) {
> >  		ftrace_graph_active--;
> >  		gops->saved_func = NULL;
> >  		fgraph_lru_release_index(i);
> > +		unregister_pm_notifier(&ftrace_suspend_notifier);  
> 
> Is this really correct ? The pm notifier is only registered if
> ftrace_graph_active==1, but not if it is larger than that.
> The above code unregisters it unconditionally, even if
> ftrace_graph_active > 1. I can see that the resulting double
> unregistration in unregister_ftrace_graph() doesn't really
> matter since the error return will be ignored, but is it really
> irrelevant for the successful registered graphs no longer get the
> benefit of the pm notifier callback ?

Ah right, it should be:

error:
	if (ret) {
		ftrace_graph_active--;
		gops->saved_func = NULL;
		fgraph_lru_release_index(i);
		if (!ftrace_graph_active)
			unregister_pm_notifier(&ftrace_suspend_notifier);
	}
	return ret;

I missed that there's a:

	ret = ftrace_startup_subops(&graph_ops, &gops->ops, command);
	if (!ret)
		fgraph_array[i] = gops;

Just before the error label, so the goto error isn't the only path there
that can affect the ret variable.

I could add a patch or you could send one.

-- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ