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>] [day] [month] [year] [list]
Message-ID: <0152510c-a9ac-4990-b062-c56204e42c1a@stanley.mountain>
Date: Mon, 21 Oct 2024 20:59:10 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: oe-kbuild@...ts.linux.dev, Steven Rostedt <rostedt@...dmis.org>
Cc: lkp@...el.com, oe-kbuild-all@...ts.linux.dev,
	linux-kernel@...r.kernel.org
Subject: kernel/trace/fgraph.c:1317 register_ftrace_graph() warn:
 inconsistent returns '&ftrace_lock'.

Hi Steven,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   42f7652d3eb527d03665b09edac47f85fb600924
commit: 2c02f7375e658ae93d57a31a66f91b62754ef8f1 fgraph: Use CPU hotplug mechanism to initialize idle shadow stacks
config: x86_64-randconfig-161-20241020 (https://download.01.org/0day-ci/archive/20241022/202410220121.wxg0olfd-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
| Closes: https://lore.kernel.org/r/202410220121.wxg0olfd-lkp@intel.com/

smatch warnings:
kernel/trace/fgraph.c:1317 register_ftrace_graph() warn: inconsistent returns '&ftrace_lock'.

vim +1317 kernel/trace/fgraph.c

688f7089d8851b1 Steven Rostedt (VMware    2018-11-15  1247) int register_ftrace_graph(struct fgraph_ops *gops)
e73e679f656e678 Steven Rostedt (VMware    2018-11-15  1248) {
2c02f7375e658ae Steven Rostedt            2024-10-18  1249  	static bool fgraph_initialized;
c132be2c4fcc115 Steven Rostedt (VMware    2024-06-03  1250) 	int command = 0;
e73e679f656e678 Steven Rostedt (VMware    2018-11-15  1251) 	int ret = 0;
6d4786592ac88aa Masami Hiramatsu (Google  2024-06-03  1252) 	int i = -1;
e73e679f656e678 Steven Rostedt (VMware    2018-11-15  1253) 
e73e679f656e678 Steven Rostedt (VMware    2018-11-15  1254) 	mutex_lock(&ftrace_lock);
e73e679f656e678 Steven Rostedt (VMware    2018-11-15  1255) 
2c02f7375e658ae Steven Rostedt            2024-10-18  1256  	if (!fgraph_initialized) {
2c02f7375e658ae Steven Rostedt            2024-10-18  1257  		ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "fgraph_idle_init",
2c02f7375e658ae Steven Rostedt            2024-10-18  1258  					fgraph_cpu_init, NULL);
2c02f7375e658ae Steven Rostedt            2024-10-18  1259  		if (ret < 0) {
2c02f7375e658ae Steven Rostedt            2024-10-18  1260  			pr_warn("fgraph: Error to init cpu hotplug support\n");
2c02f7375e658ae Steven Rostedt            2024-10-18  1261  			return ret;

goto out;

2c02f7375e658ae Steven Rostedt            2024-10-18  1262  		}
2c02f7375e658ae Steven Rostedt            2024-10-18  1263  		fgraph_initialized = true;
2c02f7375e658ae Steven Rostedt            2024-10-18  1264  		ret = 0;
2c02f7375e658ae Steven Rostedt            2024-10-18  1265  	}
2c02f7375e658ae Steven Rostedt            2024-10-18  1266  
518d6804a865772 Steven Rostedt (VMware    2024-06-03  1267) 	if (!fgraph_array[0]) {
518d6804a865772 Steven Rostedt (VMware    2024-06-03  1268) 		/* The array must always have real data on it */
518d6804a865772 Steven Rostedt (VMware    2024-06-03  1269) 		for (i = 0; i < FGRAPH_ARRAY_SIZE; i++)
518d6804a865772 Steven Rostedt (VMware    2024-06-03  1270) 			fgraph_array[i] = &fgraph_stub;
6d4786592ac88aa Masami Hiramatsu (Google  2024-06-03  1271) 		fgraph_lru_init();
518d6804a865772 Steven Rostedt (VMware    2024-06-03  1272) 	}
518d6804a865772 Steven Rostedt (VMware    2024-06-03  1273) 
6d4786592ac88aa Masami Hiramatsu (Google  2024-06-03  1274) 	i = fgraph_lru_alloc_index();
6d4786592ac88aa Masami Hiramatsu (Google  2024-06-03  1275) 	if (i < 0 || WARN_ON_ONCE(fgraph_array[i] != &fgraph_stub)) {
c132be2c4fcc115 Steven Rostedt (VMware    2024-06-03  1276) 		ret = -ENOSPC;
e73e679f656e678 Steven Rostedt (VMware    2018-11-15  1277) 		goto out;
e73e679f656e678 Steven Rostedt (VMware    2018-11-15  1278) 	}
7aa1eaef9f4282c Steven Rostedt (VMware    2024-06-03  1279) 	gops->idx = i;
e73e679f656e678 Steven Rostedt (VMware    2018-11-15  1280) 
e73e679f656e678 Steven Rostedt (VMware    2018-11-15  1281) 	ftrace_graph_active++;
518d6804a865772 Steven Rostedt (VMware    2024-06-03  1282) 
cc60ee813b50334 Steven Rostedt (Google    2024-06-03  1283) 	if (ftrace_graph_active == 2)
cc60ee813b50334 Steven Rostedt (Google    2024-06-03  1284) 		ftrace_graph_disable_direct(true);
cc60ee813b50334 Steven Rostedt (Google    2024-06-03  1285) 
518d6804a865772 Steven Rostedt (VMware    2024-06-03  1286) 	if (ftrace_graph_active == 1) {
a069a22f391019e Masami Hiramatsu (Google  2024-08-18  1287) 		ftrace_graph_enable_direct(false, gops);
518d6804a865772 Steven Rostedt (VMware    2024-06-03  1288) 		register_pm_notifier(&ftrace_suspend_notifier);
e73e679f656e678 Steven Rostedt (VMware    2018-11-15  1289) 		ret = start_graph_tracing();
c132be2c4fcc115 Steven Rostedt (VMware    2024-06-03  1290) 		if (ret)
c132be2c4fcc115 Steven Rostedt (VMware    2024-06-03  1291) 			goto error;
e73e679f656e678 Steven Rostedt (VMware    2018-11-15  1292) 		/*
2fbb549983763b2 Steven Rostedt (VMware    2024-06-03  1293) 		 * Some archs just test to see if these are not
2fbb549983763b2 Steven Rostedt (VMware    2024-06-03  1294) 		 * the default function
e73e679f656e678 Steven Rostedt (VMware    2018-11-15  1295) 		 */
2fbb549983763b2 Steven Rostedt (VMware    2024-06-03  1296) 		ftrace_graph_return = return_run;
2fbb549983763b2 Steven Rostedt (VMware    2024-06-03  1297) 		ftrace_graph_entry = entry_run;
c132be2c4fcc115 Steven Rostedt (VMware    2024-06-03  1298) 		command = FTRACE_START_FUNC_RET;
4497412a1f7b5d9 Steven Rostedt (VMware    2024-06-03  1299) 	} else {
4497412a1f7b5d9 Steven Rostedt (VMware    2024-06-03  1300) 		init_task_vars(gops->idx);
c132be2c4fcc115 Steven Rostedt (VMware    2024-06-03  1301) 	}
df3ec5da6a1e7f6 Steven Rostedt (Google    2024-06-03  1302) 	/* Always save the function, and reset at unregistering */
df3ec5da6a1e7f6 Steven Rostedt (Google    2024-06-03  1303) 	gops->saved_func = gops->entryfunc;
df3ec5da6a1e7f6 Steven Rostedt (Google    2024-06-03  1304) 
c132be2c4fcc115 Steven Rostedt (VMware    2024-06-03  1305) 	ret = ftrace_startup_subops(&graph_ops, &gops->ops, command);
a069a22f391019e Masami Hiramatsu (Google  2024-08-18  1306) 	if (!ret)
a069a22f391019e Masami Hiramatsu (Google  2024-08-18  1307) 		fgraph_array[i] = gops;
a069a22f391019e Masami Hiramatsu (Google  2024-08-18  1308) 
c132be2c4fcc115 Steven Rostedt (VMware    2024-06-03  1309) error:
c132be2c4fcc115 Steven Rostedt (VMware    2024-06-03  1310) 	if (ret) {
c132be2c4fcc115 Steven Rostedt (VMware    2024-06-03  1311) 		ftrace_graph_active--;
df3ec5da6a1e7f6 Steven Rostedt (Google    2024-06-03  1312) 		gops->saved_func = NULL;
6d4786592ac88aa Masami Hiramatsu (Google  2024-06-03  1313) 		fgraph_lru_release_index(i);
518d6804a865772 Steven Rostedt (VMware    2024-06-03  1314) 	}
e73e679f656e678 Steven Rostedt (VMware    2018-11-15  1315) out:
e73e679f656e678 Steven Rostedt (VMware    2018-11-15  1316) 	mutex_unlock(&ftrace_lock);
e73e679f656e678 Steven Rostedt (VMware    2018-11-15 @1317) 	return ret;
e73e679f656e678 Steven Rostedt (VMware    2018-11-15  1318) }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ