* [PATCH]Fix the order of atomic operations in restore_previous_kprobes
@ 2008-01-18 16:20 Masami Hiramatsu
2008-01-22 1:07 ` [PATCH]Fix the order of atomic operations in Shaohua Li
0 siblings, 1 reply; 2+ messages in thread
From: Masami Hiramatsu @ 2008-01-18 16:20 UTC (permalink / raw)
To: tony.luck, Shaohua Li; +Cc: ia64, LKML, systemtap-ml
From: Masami Hiramatsu <mhiramat@redhat.com>
Fix the order of atomic operations to prevent overwriting prev_kprobe[0].
To pop values from stack, we must decrement stack index right AFTER
reading values.
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
---
Details of this issue was reported to
http://sources.redhat.com/bugzilla/show_bug.cgi?id 71
arch/ia64/kernel/kprobes.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
Index: 2.6.24-rc8/arch/ia64/kernel/kprobes.c
=================================--- 2.6.24-rc8.orig/arch/ia64/kernel/kprobes.c 2008-01-17 21:14:01.000000000 -0500
+++ 2.6.24-rc8/arch/ia64/kernel/kprobes.c 2008-01-17 21:14:01.000000000 -0500
@@ -381,9 +381,10 @@
static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb)
{
unsigned int i;
- i = atomic_sub_return(1, &kcb->prev_kprobe_index);
- __get_cpu_var(current_kprobe) = kcb->prev_kprobe[i].kp;
- kcb->kprobe_status = kcb->prev_kprobe[i].status;
+ i = atomic_read(&kcb->prev_kprobe_index);
+ __get_cpu_var(current_kprobe) = kcb->prev_kprobe[i-1].kp;
+ kcb->kprobe_status = kcb->prev_kprobe[i-1].status;
+ atomic_sub(1, &kcb->prev_kprobe_index);
}
static void __kprobes set_current_kprobe(struct kprobe *p,
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division
e-mail: mhiramat@redhat.com, masami.hiramatsu.pt@hitachi.com
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH]Fix the order of atomic operations in
2008-01-18 16:20 [PATCH]Fix the order of atomic operations in restore_previous_kprobes Masami Hiramatsu
@ 2008-01-22 1:07 ` Shaohua Li
0 siblings, 0 replies; 2+ messages in thread
From: Shaohua Li @ 2008-01-22 1:07 UTC (permalink / raw)
To: Masami Hiramatsu; +Cc: Luck, Tony, ia64, LKML, systemtap-ml
On Sat, 2008-01-19 at 00:20 +0800, Masami Hiramatsu wrote:
> From: Masami Hiramatsu <mhiramat@redhat.com>
>
> Fix the order of atomic operations to prevent overwriting
> prev_kprobe[0].
> To pop values from stack, we must decrement stack index right AFTER
> reading values.
>
> Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
> ---
> Details of this issue was reported to
> http://sources.redhat.com/bugzilla/show_bug.cgi?id 71
>
> arch/ia64/kernel/kprobes.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> Index: 2.6.24-rc8/arch/ia64/kernel/kprobes.c
> =================================> --- 2.6.24-rc8.orig/arch/ia64/kernel/kprobes.c 2008-01-17
> 21:14:01.000000000 -0500
> +++ 2.6.24-rc8/arch/ia64/kernel/kprobes.c 2008-01-17
> 21:14:01.000000000 -0500
> @@ -381,9 +381,10 @@
> static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk
> *kcb)
> {
> unsigned int i;
> - i = atomic_sub_return(1, &kcb->prev_kprobe_index);
> - __get_cpu_var(current_kprobe) = kcb->prev_kprobe[i].kp;
> - kcb->kprobe_status = kcb->prev_kprobe[i].status;
> + i = atomic_read(&kcb->prev_kprobe_index);
> + __get_cpu_var(current_kprobe) = kcb->prev_kprobe[i-1].kp;
> + kcb->kprobe_status = kcb->prev_kprobe[i-1].status;
> + atomic_sub(1, &kcb->prev_kprobe_index);
> }
>
> static void __kprobes set_current_kprobe(struct kprobe *p,
Acked. Thanks for the patch.
Thanks,
Shaohua
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-01-22 1:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-18 16:20 [PATCH]Fix the order of atomic operations in restore_previous_kprobes Masami Hiramatsu
2008-01-22 1:07 ` [PATCH]Fix the order of atomic operations in Shaohua Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox