linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* PERF_EVENT_IOC_SET_FILTER has different values based on bitness
@ 2014-10-07 23:07 David Ahern
  2014-10-07 23:17 ` David Ahern
  2014-10-08  7:23 ` Peter Zijlstra
  0 siblings, 2 replies; 10+ messages in thread
From: David Ahern @ 2014-10-07 23:07 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Frederic Weisbecker,
	Arnaldo Carvalho de Melo, LKML, Jiri Olsa


32-bit perf binaries are not able to set filters on 64-bit kernels.

    $ perf record -e  net:netif_receive_skb --filter 'name == "eth1"
    Error: failed to set filter with 25 (Inappropriate ioctl for device)

The reason is that the definition of PERF_EVENT_IOC_SET_FILTER contains 
a pointer:

#define PERF_EVENT_IOC_SET_FILTER       _IOW('$', 6, char *)

the size of which of course differs for 32-bit and 64-bit. This has been 
there since the original commit (6fb2915df7f07) back in 2009.

Thoughts on how to fix this? Changing the definition of SET_FILTER 
breaks existing setups so that rules it out. What about something like this:

#define PERF_EVENT_IOC_SET_FILTER_32       _IOW('$', 6, u32)

and then

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 963bf139e2b2..c805132ac1cf 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3714,6 +3714,7 @@ static long perf_ioctl(struct file *file, unsigned 
int cmd, unsigned long arg)
     }

     case PERF_EVENT_IOC_SET_FILTER:
+   case PERF_EVENT_IOC_SET_FILTER_32:
         return perf_event_set_filter(event, (void __user *)arg);

     default:

David

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

end of thread, other threads:[~2014-10-09  6:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-07 23:07 PERF_EVENT_IOC_SET_FILTER has different values based on bitness David Ahern
2014-10-07 23:17 ` David Ahern
2014-10-08  0:50   ` Andi Kleen
2014-10-08  0:53     ` David Ahern
2014-10-08  0:54       ` Andi Kleen
2014-10-08  7:23 ` Peter Zijlstra
2014-10-08 15:17   ` David Ahern
2014-10-08 15:22     ` Arnaldo Carvalho de Melo
2014-10-08 15:25       ` David Ahern
2014-10-09  6:54         ` Ingo Molnar

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