Skip to content

Commit afacda5

Browse files
author
Vasily Gorbik
committed
s390/test_unwind: verify __kretprobe_trampoline is replaced
Reviewed-by: Tobias Huschle <huschle@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
1 parent 708b137 commit afacda5

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

arch/s390/lib/test_unwind.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static void print_backtrace(char *bt)
4747
static noinline int test_unwind(struct task_struct *task, struct pt_regs *regs,
4848
unsigned long sp)
4949
{
50-
int frame_count, prev_is_func2, seen_func2_func1;
50+
int frame_count, prev_is_func2, seen_func2_func1, seen_kretprobe_trampoline;
5151
const int max_frames = 128;
5252
struct unwind_state state;
5353
size_t bt_pos = 0;
@@ -63,6 +63,7 @@ static noinline int test_unwind(struct task_struct *task, struct pt_regs *regs,
6363
frame_count = 0;
6464
prev_is_func2 = 0;
6565
seen_func2_func1 = 0;
66+
seen_kretprobe_trampoline = 0;
6667
unwind_for_each_frame(&state, task, regs, sp) {
6768
unsigned long addr = unwind_get_return_address(&state);
6869
char sym[KSYM_SYMBOL_LEN];
@@ -88,6 +89,8 @@ static noinline int test_unwind(struct task_struct *task, struct pt_regs *regs,
8889
if (prev_is_func2 && str_has_prefix(sym, "unwindme_func1"))
8990
seen_func2_func1 = 1;
9091
prev_is_func2 = str_has_prefix(sym, "unwindme_func2");
92+
if (str_has_prefix(sym, "__kretprobe_trampoline+0x0/"))
93+
seen_kretprobe_trampoline = 1;
9194
}
9295

9396
/* Check the results. */
@@ -103,6 +106,10 @@ static noinline int test_unwind(struct task_struct *task, struct pt_regs *regs,
103106
kunit_err(current_test, "Maximum number of frames exceeded\n");
104107
ret = -EINVAL;
105108
}
109+
if (seen_kretprobe_trampoline) {
110+
kunit_err(current_test, "__kretprobe_trampoline+0x0 in unwinding results\n");
111+
ret = -EINVAL;
112+
}
106113
if (ret || force_bt)
107114
print_backtrace(bt);
108115
kfree(bt);

0 commit comments

Comments
 (0)