linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] perf/trace properly use u64 to hold event_id
@ 2013-11-15 17:39 Vince Weaver
  2013-11-18  8:53 ` Peter Zijlstra
  2013-11-19 19:19 ` [tip:perf/urgent] perf/trace: Properly " tip-bot for Vince Weaver
  0 siblings, 2 replies; 3+ messages in thread
From: Vince Weaver @ 2013-11-15 17:39 UTC (permalink / raw)
  To: LKML; +Cc: Steven Rostedt, Peter Zijlstra, Frederic Weisbecker, Ingo Molnar


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.weaver@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);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] perf/trace properly use u64 to hold event_id
  2013-11-15 17:39 [patch] perf/trace properly use u64 to hold event_id Vince Weaver
@ 2013-11-18  8:53 ` Peter Zijlstra
  2013-11-19 19:19 ` [tip:perf/urgent] perf/trace: Properly " tip-bot for Vince Weaver
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2013-11-18  8:53 UTC (permalink / raw)
  To: Vince Weaver; +Cc: LKML, Steven Rostedt, Frederic Weisbecker, Ingo Molnar

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.weaver@maine.edu>

Thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip:perf/urgent] perf/trace: Properly use u64 to hold event_id
  2013-11-15 17:39 [patch] perf/trace properly use u64 to hold event_id Vince Weaver
  2013-11-18  8:53 ` Peter Zijlstra
@ 2013-11-19 19:19 ` tip-bot for Vince Weaver
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Vince Weaver @ 2013-11-19 19:19 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, vincent.weaver, peterz, tglx

Commit-ID:  0022cedd4a7d8a87841351e2b018bb6794cf2e67
Gitweb:     http://git.kernel.org/tip/0022cedd4a7d8a87841351e2b018bb6794cf2e67
Author:     Vince Weaver <vincent.weaver@maine.edu>
AuthorDate: Fri, 15 Nov 2013 12:39:45 -0500
Committer:  Ingo Molnar <mingo@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.weaver@maine.edu>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1311151236100.11932@vincent-weaver-1.um.maine.edu
Signed-off-by: Ingo Molnar <mingo@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,
 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);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-19 19:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-15 17:39 [patch] perf/trace properly use u64 to hold event_id Vince Weaver
2013-11-18  8:53 ` Peter Zijlstra
2013-11-19 19:19 ` [tip:perf/urgent] perf/trace: Properly " tip-bot for Vince Weaver

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).