Skip to content

Commit ee07b93

Browse files
mhiramatwilldeacon
authored andcommitted
arm64: unwind: Prohibit probing on return_address()
Prohibit probing on return_address() and subroutines which is called from return_address(), since the it is invoked from trace_hardirqs_off() which is also kprobe blacklisted. Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Will Deacon <will@kernel.org>
1 parent 677379b commit ee07b93

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎arch/arm64/kernel/return_address.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <linux/export.h>
1010
#include <linux/ftrace.h>
11+
#include <linux/kprobes.h>
1112

1213
#include <asm/stack_pointer.h>
1314
#include <asm/stacktrace.h>
@@ -29,6 +30,7 @@ static int save_return_addr(struct stackframe *frame, void *d)
2930
return 0;
3031
}
3132
}
33+
NOKPROBE_SYMBOL(save_return_addr);
3234

3335
void *return_address(unsigned int level)
3436
{
@@ -49,3 +51,4 @@ void *return_address(unsigned int level)
4951
return NULL;
5052
}
5153
EXPORT_SYMBOL_GPL(return_address);
54+
NOKPROBE_SYMBOL(return_address);

‎arch/arm64/kernel/stacktrace.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <linux/kernel.h>
88
#include <linux/export.h>
99
#include <linux/ftrace.h>
10+
#include <linux/kprobes.h>
1011
#include <linux/sched.h>
1112
#include <linux/sched/debug.h>
1213
#include <linux/sched/task_stack.h>
@@ -111,6 +112,7 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame)
111112

112113
return 0;
113114
}
115+
NOKPROBE_SYMBOL(unwind_frame);
114116

115117
void notrace walk_stackframe(struct task_struct *tsk, struct stackframe *frame,
116118
int (*fn)(struct stackframe *, void *), void *data)
@@ -125,6 +127,7 @@ void notrace walk_stackframe(struct task_struct *tsk, struct stackframe *frame,
125127
break;
126128
}
127129
}
130+
NOKPROBE_SYMBOL(walk_stackframe);
128131

129132
#ifdef CONFIG_STACKTRACE
130133
struct stack_trace_data {

0 commit comments

Comments
 (0)