Skip to content

Commit 860dba4

Browse files
Martin SchwidefskyMartin Schwidefsky
authored andcommitted
[S390] add kprobes annotations
Add kprobes annotations to get the massive 'probe kernel.function("*") {}' stress test working. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
1 parent 4a18863 commit 860dba4

8 files changed

Lines changed: 26 additions & 9 deletions

File tree

‎arch/s390/kernel/entry.S‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ STACK_SIZE = 1 << STACK_SHIFT
188188
ssm __SF_EMPTY(%r15)
189189
.endm
190190

191+
.section .kprobes.text, "ax"
192+
191193
/*
192194
* Scheduler resume function, called by switch_to
193195
* gpr2 = (task_struct *) prev
@@ -861,6 +863,8 @@ restart_crash:
861863
restart_go:
862864
#endif
863865

866+
.section .kprobes.text, "ax"
867+
864868
#ifdef CONFIG_CHECK_STACK
865869
/*
866870
* The synchronous or the asynchronous stack overflowed. We are dead.

‎arch/s390/kernel/entry64.S‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ _TIF_SYSCALL = (_TIF_SYSCALL_TRACE>>8 | _TIF_SYSCALL_AUDIT>>8 | \
197197
ssm __SF_EMPTY(%r15)
198198
.endm
199199

200+
.section .kprobes.text, "ax"
201+
200202
/*
201203
* Scheduler resume function, called by switch_to
202204
* gpr2 = (task_struct *) prev
@@ -868,6 +870,8 @@ restart_crash:
868870
restart_go:
869871
#endif
870872

873+
.section .kprobes.text, "ax"
874+
871875
#ifdef CONFIG_CHECK_STACK
872876
/*
873877
* The synchronous or the asynchronous stack overflowed. We are dead.

‎arch/s390/kernel/mcount.S‎

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

88
#include <asm/asm-offsets.h>
99

10+
.section .kprobes.text, "ax"
11+
1012
.globl ftrace_stub
1113
ftrace_stub:
1214
br %r14

‎arch/s390/kernel/mcount64.S‎

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

88
#include <asm/asm-offsets.h>
99

10+
.section .kprobes.text, "ax"
11+
1012
.globl ftrace_stub
1113
ftrace_stub:
1214
br %r14

‎arch/s390/kernel/process.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <linux/kernel_stat.h>
3333
#include <linux/syscalls.h>
3434
#include <linux/compat.h>
35+
#include <linux/kprobes.h>
3536
#include <asm/compat.h>
3637
#include <asm/uaccess.h>
3738
#include <asm/pgtable.h>
@@ -116,15 +117,17 @@ void cpu_idle(void)
116117
}
117118
}
118119

119-
extern void kernel_thread_starter(void);
120+
extern void __kprobes kernel_thread_starter(void);
120121

121122
asm(
122-
".align 4\n"
123+
".section .kprobes.text, \"ax\"\n"
124+
".global kernel_thread_starter\n"
123125
"kernel_thread_starter:\n"
124126
" la 2,0(10)\n"
125127
" basr 14,9\n"
126128
" la 2,0\n"
127-
" br 11\n");
129+
" br 11\n"
130+
".previous\n");
128131

129132
int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
130133
{

‎arch/s390/kernel/time.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include <linux/clocksource.h>
3838
#include <linux/clockchips.h>
3939
#include <linux/gfp.h>
40+
#include <linux/kprobes.h>
4041
#include <asm/uaccess.h>
4142
#include <asm/delay.h>
4243
#include <asm/s390_ext.h>
@@ -60,7 +61,7 @@ static DEFINE_PER_CPU(struct clock_event_device, comparators);
6061
/*
6162
* Scheduler clock - returns current time in nanosec units.
6263
*/
63-
unsigned long long notrace sched_clock(void)
64+
unsigned long long notrace __kprobes sched_clock(void)
6465
{
6566
return (get_clock_monotonic() * 125) >> 9;
6667
}

‎arch/s390/kernel/traps.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,8 @@ static inline void do_fp_trap(struct pt_regs *regs, void __user *location,
451451
"floating point exception", regs, &si);
452452
}
453453

454-
static void illegal_op(struct pt_regs *regs, long pgm_int_code,
455-
unsigned long trans_exc_code)
454+
static void __kprobes illegal_op(struct pt_regs *regs, long pgm_int_code,
455+
unsigned long trans_exc_code)
456456
{
457457
siginfo_t info;
458458
__u8 opcode[6];
@@ -688,7 +688,7 @@ static void space_switch_exception(struct pt_regs *regs, long pgm_int_code,
688688
do_trap(pgm_int_code, SIGILL, "space switch event", regs, &info);
689689
}
690690

691-
asmlinkage void kernel_stack_overflow(struct pt_regs * regs)
691+
asmlinkage void __kprobes kernel_stack_overflow(struct pt_regs * regs)
692692
{
693693
bust_spinlocks(1);
694694
printk("Kernel stack overflow.\n");

‎arch/s390/kernel/vtime.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/rcupdate.h>
2121
#include <linux/posix-timers.h>
2222
#include <linux/cpu.h>
23+
#include <linux/kprobes.h>
2324

2425
#include <asm/s390_ext.h>
2526
#include <asm/timer.h>
@@ -122,7 +123,7 @@ void account_system_vtime(struct task_struct *tsk)
122123
}
123124
EXPORT_SYMBOL_GPL(account_system_vtime);
124125

125-
void vtime_start_cpu(__u64 int_clock, __u64 enter_timer)
126+
void __kprobes vtime_start_cpu(__u64 int_clock, __u64 enter_timer)
126127
{
127128
struct s390_idle_data *idle = &__get_cpu_var(s390_idle);
128129
struct vtimer_queue *vq = &__get_cpu_var(virt_cpu_timer);
@@ -162,7 +163,7 @@ void vtime_start_cpu(__u64 int_clock, __u64 enter_timer)
162163
idle->sequence++;
163164
}
164165

165-
void vtime_stop_cpu(void)
166+
void __kprobes vtime_stop_cpu(void)
166167
{
167168
struct s390_idle_data *idle = &__get_cpu_var(s390_idle);
168169
struct vtimer_queue *vq = &__get_cpu_var(virt_cpu_timer);

0 commit comments

Comments
 (0)