diff options
Diffstat (limited to 'arch/ia64/kernel/kprobes.c')
-rw-r--r-- | arch/ia64/kernel/kprobes.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c index 51bc08bd0466..027d656664d2 100644 --- a/arch/ia64/kernel/kprobes.c +++ b/arch/ia64/kernel/kprobes.c | |||
@@ -121,6 +121,48 @@ static void update_kprobe_inst_flag(uint template, uint slot, uint major_opcode | |||
121 | 121 | ||
122 | /* | 122 | /* |
123 | * In this function we check to see if the instruction | 123 | * In this function we check to see if the instruction |
124 | * on which we are inserting kprobe is supported. | ||
125 | * Returns 0 if supported | ||
126 | * Returns -EINVAL if unsupported | ||
127 | */ | ||
128 | static int unsupported_inst(uint template, uint slot, uint major_opcode, | ||
129 | unsigned long kprobe_inst, struct kprobe *p) | ||
130 | { | ||
131 | unsigned long addr = (unsigned long)p->addr; | ||
132 | |||
133 | if (bundle_encoding[template][slot] == I) { | ||
134 | switch (major_opcode) { | ||
135 | case 0x0: //I_UNIT_MISC_OPCODE: | ||
136 | /* | ||
137 | * Check for Integer speculation instruction | ||
138 | * - Bit 33-35 to be equal to 0x1 | ||
139 | */ | ||
140 | if (((kprobe_inst >> 33) & 0x7) == 1) { | ||
141 | printk(KERN_WARNING | ||
142 | "Kprobes on speculation inst at <0x%lx> not supported\n", | ||
143 | addr); | ||
144 | return -EINVAL; | ||
145 | } | ||
146 | |||
147 | /* | ||
148 | * IP relative mov instruction | ||
149 | * - Bit 27-35 to be equal to 0x30 | ||
150 | */ | ||
151 | if (((kprobe_inst >> 27) & 0x1FF) == 0x30) { | ||
152 | printk(KERN_WARNING | ||
153 | "Kprobes on \"mov r1=ip\" at <0x%lx> not supported\n", | ||
154 | addr); | ||
155 | return -EINVAL; | ||
156 | |||
157 | } | ||
158 | } | ||
159 | } | ||
160 | return 0; | ||
161 | } | ||
162 | |||
163 | |||
164 | /* | ||
165 | * In this function we check to see if the instruction | ||
124 | * (qp) cmpx.crel.ctype p1,p2=r2,r3 | 166 | * (qp) cmpx.crel.ctype p1,p2=r2,r3 |
125 | * on which we are inserting kprobe is cmp instruction | 167 | * on which we are inserting kprobe is cmp instruction |
126 | * with ctype as unc. | 168 | * with ctype as unc. |
@@ -254,6 +296,9 @@ int arch_prepare_kprobe(struct kprobe *p) | |||
254 | /* Get kprobe_inst and major_opcode from the bundle */ | 296 | /* Get kprobe_inst and major_opcode from the bundle */ |
255 | get_kprobe_inst(bundle, slot, &kprobe_inst, &major_opcode); | 297 | get_kprobe_inst(bundle, slot, &kprobe_inst, &major_opcode); |
256 | 298 | ||
299 | if (unsupported_inst(template, slot, major_opcode, kprobe_inst, p)) | ||
300 | return -EINVAL; | ||
301 | |||
257 | prepare_break_inst(template, slot, major_opcode, kprobe_inst, p); | 302 | prepare_break_inst(template, slot, major_opcode, kprobe_inst, p); |
258 | 303 | ||
259 | return 0; | 304 | return 0; |