1 Star 0 Fork 0

lcy/os-patch

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-kprobes-arm64-Blacklist-sdei-watchdog-callback-funct.patch 2.96 KB
一键复制 编辑 原始数据 按行查看 历史
lcy 提交于 2024-10-29 10:09 . commit-OpenCloudOS-kernel
From df3569a55b604287d10d59407aa8726ea8c17b26 Mon Sep 17 00:00:00 2001
From: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Date: Sat, 20 Feb 2021 11:01:02 +0800
Subject: [PATCH] kprobes/arm64: Blacklist sdei watchdog callback functions
Functions called in sdei_handler are not allowed to be kprobed, so
marked them as NOKPROBE_SYMBOL. There are so many functions in
'watchdog_check_timestamp()'. Luckily, we don't need
'CONFIG_HARDLOCKUP_CHECK_TIMESTAMP' now. So just make
CONFIG_SDEI_WATCHDOG depends on !CONFIG_HARDLOCKUP_CHECK_TIMESTAMP
in case someone add 'CONFIG_HARDLOCKUP_CHECK_TIMESTAMP' in the future.
Signed-off-by: huwentao <huwentao19@h-partners.com>
---
arch/arm64/kernel/watchdog_sdei.c | 2 ++
kernel/watchdog.c | 2 ++
kernel/watchdog_hld.c | 2 ++
lib/Kconfig.debug | 2 +-
4 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/watchdog_sdei.c b/arch/arm64/kernel/watchdog_sdei.c
index c342f86560d5..6352b589e02a 100644
--- a/arch/arm64/kernel/watchdog_sdei.c
+++ b/arch/arm64/kernel/watchdog_sdei.c
@@ -14,6 +14,7 @@
#include <asm/sdei.h>
#include <asm/virt.h>
#include <linux/arm_sdei.h>
+#include <linux/kprobes.h>
#include <linux/nmi.h>
/* We use the secure physical timer as SDEI NMI watchdog timer */
@@ -66,6 +67,7 @@ static int sdei_watchdog_callback(u32 event,
return 0;
}
+NOKPROBE_SYMBOL(sdei_watchdog_callback);
static void sdei_nmi_watchdog_bind(void *data)
{
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index a3d0e928305c..273bb4c5646c 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -16,6 +16,7 @@
#include <linux/cpu.h>
#include <linux/nmi.h>
#include <linux/init.h>
+#include <linux/kprobes.h>
#include <linux/module.h>
#include <linux/sysctl.h>
#include <linux/tick.h>
@@ -333,6 +334,7 @@ bool is_hardlockup(void)
__this_cpu_write(hrtimer_interrupts_saved, hrint);
return false;
}
+NOKPROBE_SYMBOL(is_hardlockup);
static void watchdog_interrupt_count(void)
{
diff --git a/kernel/watchdog_hld.c b/kernel/watchdog_hld.c
index 88f5c314a1df..a3f35067b4d0 100644
--- a/kernel/watchdog_hld.c
+++ b/kernel/watchdog_hld.c
@@ -14,6 +14,7 @@
#include <linux/nmi.h>
#include <linux/atomic.h>
+#include <linux/kprobes.h>
#include <linux/module.h>
#include <linux/sched/debug.h>
@@ -155,6 +156,7 @@ void watchdog_hardlockup_check(struct pt_regs *regs)
__this_cpu_write(hard_watchdog_warn, false);
return;
}
+NOKPROBE_SYMBOL(watchdog_hardlockup_check);
#ifdef CONFIG_HARDLOCKUP_DETECTOR_PERF
static DEFINE_PER_CPU(struct perf_event *, watchdog_ev);
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 47e3ba8fedcc..74a7a2077c51 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -855,7 +855,7 @@ config HARDLOCKUP_DETECTOR_PERF
config SDEI_WATCHDOG
bool "SDEI NMI Watchdog support"
- depends on ARM_SDE_INTERFACE
+ depends on ARM_SDE_INTERFACE && !HARDLOCKUP_CHECK_TIMESTAMP
select HAVE_HARDLOCKUP_DETECTOR_ARCH
select HARDLOCKUP_DETECTOR
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lcy48/os-patch.git
git@gitee.com:lcy48/os-patch.git
lcy48
os-patch
os-patch
master

搜索帮助