aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2009-06-22 06:08:23 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2009-06-22 06:08:24 -0400
commitacf018004f76617dbab36ef4b5480d4351f9cdff (patch)
treea4f3da66d0f4518d99e9eeb5fd4efc944d9b4d92 /arch/s390/kernel
parent12310e9c1b9a53896e4df0459039dd125f62aa9b (diff)
[S390] kprobes: defer setting of ctlblk state
get_krobe_ctlblk returns a per cpu kprobe control block which holds the state of the current cpu wrt to kprobe. When inserting/removing a kprobe the state of the cpu which replaces the code is changed to KPROBE_SWAP_INST. This however is done when preemption is still enabled. So the state of the current cpu doesn't necessarily reflect the real state. To fix this move the code that changes the state to non-preemptible context. Reported-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel')
-rw-r--r--arch/s390/kernel/kprobes.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 9bb2f6241d9f..86783efa24ee 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -154,39 +154,35 @@ void __kprobes get_instruction_type(struct arch_specific_insn *ainsn)
154 154
155static int __kprobes swap_instruction(void *aref) 155static int __kprobes swap_instruction(void *aref)
156{ 156{
157 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
158 unsigned long status = kcb->kprobe_status;
157 struct ins_replace_args *args = aref; 159 struct ins_replace_args *args = aref;
160 int rc;
158 161
159 return probe_kernel_write(args->ptr, &args->new, sizeof(args->new)); 162 kcb->kprobe_status = KPROBE_SWAP_INST;
163 rc = probe_kernel_write(args->ptr, &args->new, sizeof(args->new));
164 kcb->kprobe_status = status;
165 return rc;
160} 166}
161 167
162void __kprobes arch_arm_kprobe(struct kprobe *p) 168void __kprobes arch_arm_kprobe(struct kprobe *p)
163{ 169{
164 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
165 unsigned long status = kcb->kprobe_status;
166 struct ins_replace_args args; 170 struct ins_replace_args args;
167 171
168 args.ptr = p->addr; 172 args.ptr = p->addr;
169 args.old = p->opcode; 173 args.old = p->opcode;
170 args.new = BREAKPOINT_INSTRUCTION; 174 args.new = BREAKPOINT_INSTRUCTION;
171
172 kcb->kprobe_status = KPROBE_SWAP_INST;
173 stop_machine(swap_instruction, &args, NULL); 175 stop_machine(swap_instruction, &args, NULL);
174 kcb->kprobe_status = status;
175} 176}
176 177
177void __kprobes arch_disarm_kprobe(struct kprobe *p) 178void __kprobes arch_disarm_kprobe(struct kprobe *p)
178{ 179{
179 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
180 unsigned long status = kcb->kprobe_status;
181 struct ins_replace_args args; 180 struct ins_replace_args args;
182 181
183 args.ptr = p->addr; 182 args.ptr = p->addr;
184 args.old = BREAKPOINT_INSTRUCTION; 183 args.old = BREAKPOINT_INSTRUCTION;
185 args.new = p->opcode; 184 args.new = p->opcode;
186
187 kcb->kprobe_status = KPROBE_SWAP_INST;
188 stop_machine(swap_instruction, &args, NULL); 185 stop_machine(swap_instruction, &args, NULL);
189 kcb->kprobe_status = status;
190} 186}
191 187
192void __kprobes arch_remove_kprobe(struct kprobe *p) 188void __kprobes arch_remove_kprobe(struct kprobe *p)