* [Memory Leak] free kprobe before optimized_kprobe free
@ 2012-08-23 17:05 akhilesh kumar
2012-08-24 2:04 ` Masami Hiramatsu
0 siblings, 1 reply; 4+ messages in thread
From: akhilesh kumar @ 2012-08-23 17:05 UTC (permalink / raw)
To: ananth, anil.s.keshavamurthy, davem, masami.hiramatsu.pt; +Cc: linux-kernel
>From a77438899c7295299b59cdca8d1816ea69d6ed8e Mon Sep 17 00:00:00 2001
From: Akhilesh Kumar <akhilesh.lxr@gmail.com>
Date: Fri, 10 Aug 2012 14:02:07 +0530
Subject:[Memory Leak] free kprobe before optimized_kprobe free
Free *ap before *op otherwise ap pointer will be Dangling
Signed-off-by: Akhilesh Kumar <akhilesh.lxr@gmail.com>
---
kernel/kprobes.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index c62b854..ff0a97b 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -767,6 +767,7 @@ static __kprobes void
try_to_optimize_kprobe(struct kprobe *p)
if (!arch_prepared_optinsn(&op->optinsn)) {
/* If failed to setup optimizing, fallback to kprobe */
arch_remove_optimized_kprobe(op);
+ kfree(ap);
kfree(op);
return;
}
--
1.7.8.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Memory Leak] free kprobe before optimized_kprobe free
2012-08-23 17:05 [Memory Leak] free kprobe before optimized_kprobe free akhilesh kumar
@ 2012-08-24 2:04 ` Masami Hiramatsu
0 siblings, 0 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2012-08-24 2:04 UTC (permalink / raw)
To: akhilesh kumar
Cc: ananth, anil.s.keshavamurthy, davem, linux-kernel, yrl.pp-manager.tt
(2012/08/24 2:05), akhilesh kumar wrote:
> From a77438899c7295299b59cdca8d1816ea69d6ed8e Mon Sep 17 00:00:00 2001
> From: Akhilesh Kumar <akhilesh.lxr@gmail.com>
> Date: Fri, 10 Aug 2012 14:02:07 +0530
> Subject:[Memory Leak] free kprobe before optimized_kprobe free
>
> Free *ap before *op otherwise ap pointer will be Dangling
Nack, since ap == op, this causes double free.
/*
* Internal structure for direct jump optimized probe
*/
struct optimized_kprobe {
struct kprobe kp;
struct list_head list; /* list for optimizing queue */
struct arch_optimized_insn optinsn;
};
Please look into alloc_aggr_kprobe() which allocates
optimized_kprobe, and returns op->kp.
Thank you,
>
> Signed-off-by: Akhilesh Kumar <akhilesh.lxr@gmail.com>
> ---
> kernel/kprobes.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index c62b854..ff0a97b 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -767,6 +767,7 @@ static __kprobes void
> try_to_optimize_kprobe(struct kprobe *p)
> if (!arch_prepared_optinsn(&op->optinsn)) {
> /* If failed to setup optimizing, fallback to kprobe */
> arch_remove_optimized_kprobe(op);
> + kfree(ap);
> kfree(op);
> return;
> }
>
--
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Memory Leak] free kprobe before optimized_kprobe free
2012-08-23 17:10 Akhilesh Kumar
@ 2012-08-23 17:19 ` Rakib Mullick
0 siblings, 0 replies; 4+ messages in thread
From: Rakib Mullick @ 2012-08-23 17:19 UTC (permalink / raw)
To: Akhilesh Kumar
Cc: ananth, anil.s.keshavamurthy, davem, masami.hiramatsu.pt, linux-kernel
On 8/23/12, Akhilesh Kumar <akhilesh.lxr@gmail.com> wrote:
> From a77438899c7295299b59cdca8d1816ea69d6ed8e Mon Sep 17 00:00:00 2001
> From: Akhilesh Kumar <akhilesh.lxr@gmail.com>
> Date: Fri, 10 Aug 2012 14:02:07 +0530
> Subject:[Memory Leak] free kprobe before optimized_kprobe free
>
> Free *ap before *op otherwise ap pointer will be Dangling
>
> Signed-off-by: Akhilesh Kumar <akhilesh.lxr@gmail.com>
An usual way to submit a patch is to mark the subject line with
[patch] tag, not [memory leak].
Thanks,
Rakib
> ---
> kernel/kprobes.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index c62b854..ff0a97b 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -767,6 +767,7 @@ static __kprobes void
> try_to_optimize_kprobe(struct kprobe *p)
> if (!arch_prepared_optinsn(&op->optinsn)) {
> /* If failed to setup optimizing, fallback to kprobe */
> arch_remove_optimized_kprobe(op);
> + kfree(ap);
> kfree(op);
> return;
> }
> --
> 1.7.8.4
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Memory Leak] free kprobe before optimized_kprobe free
@ 2012-08-23 17:10 Akhilesh Kumar
2012-08-23 17:19 ` Rakib Mullick
0 siblings, 1 reply; 4+ messages in thread
From: Akhilesh Kumar @ 2012-08-23 17:10 UTC (permalink / raw)
To: ananth, anil.s.keshavamurthy, davem, masami.hiramatsu.pt; +Cc: linux-kernel
>From a77438899c7295299b59cdca8d1816ea69d6ed8e Mon Sep 17 00:00:00 2001
From: Akhilesh Kumar <akhilesh.lxr@gmail.com>
Date: Fri, 10 Aug 2012 14:02:07 +0530
Subject:[Memory Leak] free kprobe before optimized_kprobe free
Free *ap before *op otherwise ap pointer will be Dangling
Signed-off-by: Akhilesh Kumar <akhilesh.lxr@gmail.com>
---
kernel/kprobes.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index c62b854..ff0a97b 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -767,6 +767,7 @@ static __kprobes void
try_to_optimize_kprobe(struct kprobe *p)
if (!arch_prepared_optinsn(&op->optinsn)) {
/* If failed to setup optimizing, fallback to kprobe */
arch_remove_optimized_kprobe(op);
+ kfree(ap);
kfree(op);
return;
}
--
1.7.8.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-08-24 2:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-23 17:05 [Memory Leak] free kprobe before optimized_kprobe free akhilesh kumar
2012-08-24 2:04 ` Masami Hiramatsu
2012-08-23 17:10 Akhilesh Kumar
2012-08-23 17:19 ` Rakib Mullick
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).