From 2a045f2560bca9a221ac710d33a012ddd1432329 Mon Sep 17 00:00:00 2001 From: Xiongfeng Wang Date: Sat, 6 Apr 2019 16:55:40 +0800 Subject: [PATCH 2798/2944] openeuler: stop_machine: mask sdei before running the callback commit e8afb6b46b9fc9f62d3232062c32f7d43b6a38bf openEuler-1.0. Kprobes use 'stop_machine' to modify code which could be ran in the sdei_handler at the same time. This patch mask sdei before running the stop_machine callback to avoid this race condition. Signed-off-by: Xiongfeng Wang Reviewed-by: Yang Yingliang Signed-off-by: Yang Yingliang Signed-off-by: Xin Hao Reviewed-by: Baolin Wang --- kernel/stop_machine.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c index 067cb83..3a2fdef 100644 --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c @@ -23,6 +23,10 @@ #include #include +#ifdef CONFIG_ARM64 +#include +#endif + /* * Structure to determine completion condition and record errors. May * be shared by works on different cpus. @@ -208,6 +212,9 @@ static int multi_cpu_stop(void *data) case MULTI_STOP_DISABLE_IRQ: local_irq_disable(); hard_irq_disable(); +#ifdef CONFIG_ARM64 + sdei_mask_local_cpu(); +#endif break; case MULTI_STOP_RUN: if (is_active) @@ -227,6 +234,9 @@ static int multi_cpu_stop(void *data) } } while (curstate != MULTI_STOP_EXIT); +#ifdef CONFIG_ARM64 + sdei_unmask_local_cpu(); +#endif local_irq_restore(flags); return err; } -- 1.8.3.1