From: Yonghong Song <yhs@fb.com>
To: Alexei Starovoitov <ast@fb.com>,
Daniel Borkmann <daniel@iogearbox.net>, <sfr@canb.auug.org.au>,
<netdev@vger.kernel.org>
Cc: <kernel-team@fb.com>
Subject: Re: [PATCH net-next] bpf/tracing: fix kernel/events/core.c compilation error
Date: Wed, 13 Dec 2017 09:26:05 -0800 [thread overview]
Message-ID: <874e5098-6a7c-0e16-1e62-e177da656dac@fb.com> (raw)
In-Reply-To: <475c2645-01fc-7f25-da78-7ff180760b97@fb.com>
On 12/13/17 7:50 AM, Alexei Starovoitov wrote:
> On 12/13/17 7:44 AM, Daniel Borkmann wrote:
>> On 12/13/2017 08:42 AM, Yonghong Song wrote:
>>> Commit f371b304f12e ("bpf/tracing: allow user space to
>>> query prog array on the same tp") introduced a perf
>>> ioctl command to query prog array attached to the
>>> same perf tracepoint. The commit introduced a
>>> compilation error when either CONFIG_BPF_SYSCALL or
>>> CONFIG_EVENT_TRACING is not defined:
>>> kernel/events/core.o: In function `perf_ioctl':
>>> core.c:(.text+0x98c4): undefined reference to
>>> `bpf_event_query_prog_array'
>>>
>>> This patch fixed this error.
>>>
>>> Fixes: f371b304f12e ("bpf/tracing: allow user space to query prog
>>> array on the same tp")
>>> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
>>> Signed-off-by: Yonghong Song <yhs@fb.com>
>>
>> Looking at _perf_ioctl(), we also have perf_event_set_bpf_prog()
>> there. It's basically under CONFIG_EVENT_TRACING, which later calls
>> perf_event_attach_bpf_prog() which is under CONFIG_BPF_EVENTS, so
>> where we have the dummy handler returning -EOPNOTSUPP when BPF
>> events is not set. bpf_trace.c is only built when CONFIG_BPF_EVENTS
>> is set and that by itself depends on BPF_SYSCALL already. So it would
>> be more correct to do the same thing here ...
>>
>> #if defined(CONFIG_EVENT_TRACING) && defined(CONFIG_BPF_EVENTS)
>> [...]
>
> +1
> #ifdef CONFIG_BPF_EVENTS
> works, whereas CONFIG_EVENT_TRACING probably not, since kprobe
> can be disabled independently which will turn off BPF_EVENTS
> and body of bpf_event_query_prog_array() will be gone.
I tested to enable/disable uprobe/kprobe/both and my patch works.
But I did not test enable a non uprobe/kprobe tracing event
(e.g., CONFIG_FUNCTION_TRACER) where CONFIG_TRACING and
CONFIG_EVENT_TRACING is on but CONFIG_UPROBES_EVENT/CONFIG_KPROBES_EVENT
is off and then my patch breaks.
Looks like
#ifdef CONFIG_BPF_EVENTS
is suffice.
This config will enable to include bpf_trace.c with the real definition.
It will depend on KPROBE_EVENTS or UPROBE_EVENTS and either
of them will enable CONFIG_TRACING and then CONFIG_EVENT_TRACING.
Will resubmit the patch after testing.
prev parent reply other threads:[~2017-12-13 17:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-13 7:42 [PATCH net-next] bpf/tracing: fix kernel/events/core.c compilation error Yonghong Song
2017-12-13 15:44 ` Daniel Borkmann
2017-12-13 15:50 ` Alexei Starovoitov
2017-12-13 17:26 ` Yonghong Song [this message]
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=874e5098-6a7c-0e16-1e62-e177da656dac@fb.com \
--to=yhs@fb.com \
--cc=ast@fb.com \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
--cc=sfr@canb.auug.org.au \
/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;
as well as URLs for NNTP newsgroup(s).