[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1273246914.1642.359.camel@laptop>
Date: Fri, 07 May 2010 17:41:54 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Robert Richter <robert.richter@....com>
Cc: Stephane Eranian <eranian@...gle.com>, Ingo Molnar <mingo@...e.hu>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] perf: fix raw sample size if no sampling data is
attached
On Fri, 2010-05-07 at 17:28 +0200, Robert Richter wrote:
> From 6373951f1c660400650066b73c3bb2f6d232be67 Mon Sep 17 00:00:00 2001
> From: Robert Richter <robert.richter@....com>
> Date: Fri, 7 May 2010 15:49:56 +0200
> Subject: [PATCH] perf: fix raw sample size if no sampling data is
> attached
>
> The header size of a raw sample is not included in the total size of a
> raw data sample. Thus, if no data is attached the size must be
> null. In this case a buffer overflow may occur when copying the
> sampling data.
>
But there is data, a whole u32 of value 0. Your patch breaks things.
> Signed-off-by: Robert Richter <robert.richter@....com>
> ---
> kernel/perf_event.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/perf_event.c b/kernel/perf_event.c
> index 9dbe8cd..f6ddae9 100644
> --- a/kernel/perf_event.c
> +++ b/kernel/perf_event.c
> @@ -3229,7 +3229,7 @@ void perf_output_sample(struct
> perf_output_handle *handle,
> u32 size;
> u32 data;
> } raw = {
> - .size = sizeof(u32),
> + .size = 0,
> .data = 0,
> };
> perf_output_put(handle, raw);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists