Skip to content

Commit 8ebf6da

Browse files
Philipp RudoVasily Gorbik
authored andcommitted
s390/ftrace: fix potential crashes when switching tracers
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: 1ec2772 ("s390/diag: add a statistic for diagnose calls") Fixes: 38f2c69 ("s390: improve wait logic of stop_machine") Fixes: 4ecf0a4 ("processor: get rid of cpu_relax_yield") Signed-off-by: Philipp Rudo <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent ae83d0b commit 8ebf6da

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

arch/s390/kernel/diag.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void diag_stat_inc(enum diag_stat_enum nr)
133133
}
134134
EXPORT_SYMBOL(diag_stat_inc);
135135

136-
void diag_stat_inc_norecursion(enum diag_stat_enum nr)
136+
void notrace diag_stat_inc_norecursion(enum diag_stat_enum nr)
137137
{
138138
this_cpu_inc(diag_stat.counter[nr]);
139139
trace_s390_diagnose_norecursion(diag_map[nr].code);

arch/s390/kernel/smp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ int smp_find_processor_id(u16 address)
403403
return -1;
404404
}
405405

406-
bool arch_vcpu_is_preempted(int cpu)
406+
bool notrace arch_vcpu_is_preempted(int cpu)
407407
{
408408
if (test_cpu_flag_of(CIF_ENABLED_WAIT, cpu))
409409
return false;
@@ -413,7 +413,7 @@ bool arch_vcpu_is_preempted(int cpu)
413413
}
414414
EXPORT_SYMBOL(arch_vcpu_is_preempted);
415415

416-
void smp_yield_cpu(int cpu)
416+
void notrace smp_yield_cpu(int cpu)
417417
{
418418
if (!MACHINE_HAS_DIAG9C)
419419
return;

arch/s390/kernel/trace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ EXPORT_TRACEPOINT_SYMBOL(s390_diagnose);
1414

1515
static DEFINE_PER_CPU(unsigned int, diagnose_trace_depth);
1616

17-
void trace_s390_diagnose_norecursion(int diag_nr)
17+
void notrace trace_s390_diagnose_norecursion(int diag_nr)
1818
{
1919
unsigned long flags;
2020
unsigned int *depth;

0 commit comments

Comments
 (0)