Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[patch] perf/trace properly use u64 to hold event_id

0 views
Skip to first unread message

Vince Weaver

unread,
Nov 15, 2013, 12:40:01 PM11/15/13
to

The 64-bit attr.config value for perf trace events was being copied into
an "int" before doing a comparison, meaning the top 32 bits were
being truncated.

As far as I can tell this didn't cause any errors, but it did mean
it was possible to create valid aliases for all the tracepoint ids
which I don't think was intended. (For example, 0xffffffff00000018
and 0x18 both enable the same tracepoint).

Signed-off-by: Vince Weaver <vincent...@maine.edu>

diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
index 78e27e3..280c3db0 100644
--- a/kernel/trace/trace_event_perf.c
+++ b/kernel/trace/trace_event_perf.c
@@ -173,7 +173,7 @@ static int perf_trace_event_init(struct ftrace_event_call *tp_event,
int perf_trace_init(struct perf_event *p_event)
{
struct ftrace_event_call *tp_event;
- int event_id = p_event->attr.config;
+ u64 event_id = p_event->attr.config;
int ret = -EINVAL;

mutex_lock(&event_mutex);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Peter Zijlstra

unread,
Nov 18, 2013, 4:00:02 AM11/18/13
to
On Fri, Nov 15, 2013 at 12:39:45PM -0500, Vince Weaver wrote:
>
> The 64-bit attr.config value for perf trace events was being copied into
> an "int" before doing a comparison, meaning the top 32 bits were
> being truncated.
>
> As far as I can tell this didn't cause any errors, but it did mean
> it was possible to create valid aliases for all the tracepoint ids
> which I don't think was intended. (For example, 0xffffffff00000018
> and 0x18 both enable the same tracepoint).
>
> Signed-off-by: Vince Weaver <vincent...@maine.edu>

Thanks!

tip-bot for Vince Weaver

unread,
Nov 19, 2013, 2:20:03 PM11/19/13
to
Commit-ID: 0022cedd4a7d8a87841351e2b018bb6794cf2e67
Gitweb: http://git.kernel.org/tip/0022cedd4a7d8a87841351e2b018bb6794cf2e67
Author: Vince Weaver <vincent...@maine.edu>
AuthorDate: Fri, 15 Nov 2013 12:39:45 -0500
Committer: Ingo Molnar <mi...@kernel.org>
CommitDate: Tue, 19 Nov 2013 16:57:44 +0100

perf/trace: Properly use u64 to hold event_id

The 64-bit attr.config value for perf trace events was being copied into
an "int" before doing a comparison, meaning the top 32 bits were
being truncated.

As far as I can tell this didn't cause any errors, but it did mean
it was possible to create valid aliases for all the tracepoint ids
which I don't think was intended. (For example, 0xffffffff00000018
and 0x18 both enable the same tracepoint).

Signed-off-by: Vince Weaver <vincent...@maine.edu>
Signed-off-by: Peter Zijlstra <pet...@infradead.org>
Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1...@vincent-weaver-1.um.maine.edu
Signed-off-by: Ingo Molnar <mi...@kernel.org>
---
kernel/trace/trace_event_perf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
index 630889f..e854f42 100644
--- a/kernel/trace/trace_event_perf.c
+++ b/kernel/trace/trace_event_perf.c
@@ -179,7 +179,7 @@ static int perf_trace_event_init(struct ftrace_event_call *tp_event,
0 new messages