Blob Blame History Raw
From: Philipp Rudo <prudo@linux.ibm.com>
Date: Mon, 6 Apr 2020 14:47:48 +0200
Subject: s390/ftrace: fix potential crashes when switching tracers
Git-commit: 8ebf6da9db1b2a20bb86cc1bee2552e894d03308
Patch-mainline: v5.7-rc3
References: bsc#1171244 LTC#185785 git-fixes

Switching tracers include instruction patching. To prevent that a
instruction is patched while it's read the instruction patching is done
in stop_machine 'context'. This also means that any function called
during stop_machine must not be traced. Thus add 'notrace' to all
functions called within stop_machine.

Fixes: 1ec2772e0c3c ("s390/diag: add a statistic for diagnose calls")
Fixes: 38f2c691a4b3 ("s390: improve wait logic of stop_machine")
Fixes: 4ecf0a43e729 ("processor: get rid of cpu_relax_yield")
Signed-off-by: Philipp Rudo <prudo@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Philipp Rudo <prudo@linux.ibm.com>
[ ptesarik: Since SLE15-SP1 does not have upstream commit
  38f2c691a4b3e89d476f8e8350d1ca299974b89d, Philipp Rudo had to
  re-analyze the call graph, and the only function without a
  'notrace' marker is diag_stat_inc (via cpu_relax_yield). ]
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
 arch/s390/kernel/diag.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/s390/kernel/diag.c
+++ b/arch/s390/kernel/diag.c
@@ -121,7 +121,7 @@ static int __init show_diag_stat_init(vo
 
 device_initcall(show_diag_stat_init);
 
-void diag_stat_inc(enum diag_stat_enum nr)
+void notrace diag_stat_inc(enum diag_stat_enum nr)
 {
 	this_cpu_inc(diag_stat.counter[nr]);
 	trace_s390_diagnose(diag_map[nr].code);