mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>, Jiri Olsa <jolsa@kernel.org>
Subject: PERF_EVENT_IOC_SET_FILTER has different values based on bitness
Date: Tue, 07 Oct 2014 17:07:36 -0600	[thread overview]
Message-ID: <54347238.2060908@gmail.com> (raw)


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

             reply	other threads:[~2014-10-07 23:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-07 23:07 David Ahern [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54347238.2060908@gmail.com \
    --to=dsahern@gmail.com \
    --cc=acme@kernel.org \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome