From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Alexei Starovoitov <ast@fb.com>
Cc: rostedt <rostedt@goodmis.org>,
"David S. Miller" <davem@davemloft.net>,
Daniel Borkmann <daniel@iogearbox.net>,
Linus Torvalds <torvalds@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
netdev <netdev@vger.kernel.org>, kernel-team <kernel-team@fb.com>,
linux-api <linux-api@vger.kernel.org>,
Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH v6 bpf-next 08/11] bpf: introduce BPF_RAW_TRACEPOINT
Date: Tue, 27 Mar 2018 20:44:12 -0400 (EDT) [thread overview]
Message-ID: <1513083686.1804.1522197852512.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <b0763759-3f8b-317b-5fb4-600648495462@fb.com>
----- On Mar 27, 2018, at 8:00 PM, Alexei Starovoitov ast@fb.com wrote:
> On 3/27/18 4:13 PM, Mathieu Desnoyers wrote:
>> ----- On Mar 27, 2018, at 6:48 PM, Alexei Starovoitov ast@fb.com wrote:
>>
>>> On 3/27/18 2:04 PM, Steven Rostedt wrote:
>>>>
>>>> +#ifdef CONFIG_BPF_EVENTS
>>>> +#define BPF_RAW_TP() . = ALIGN(8); \
>>
>> Given that the section consists of a 16-bytes structure elements
>> on architectures with 8 bytes pointers, this ". = ALIGN(8)" should
>> be turned into a STRUCT_ALIGN(), especially given that the compiler
>> is free to up-align the structure on 32 bytes.
>
> STRUCT_ALIGN fixed the 'off by 8' issue with kasan,
> but it fails without kasan too.
> For some reason the whole region __start__bpf_raw_tp - __stop__bpf_raw_tp
> comes inited with cccc:
> [ 22.703562] i 1 btp ffffffff8288e530 btp->tp cccccccccccccccc func
> cccccccccccccccc
> [ 22.704638] i 2 btp ffffffff8288e540 btp->tp cccccccccccccccc func
> cccccccccccccccc
> [ 22.705599] i 3 btp ffffffff8288e550 btp->tp cccccccccccccccc func
> cccccccccccccccc
> [ 22.706551] i 4 btp ffffffff8288e560 btp->tp cccccccccccccccc func
> cccccccccccccccc
> [ 22.707503] i 5 btp ffffffff8288e570 btp->tp cccccccccccccccc func
> cccccccccccccccc
> [ 22.708452] i 6 btp ffffffff8288e580 btp->tp cccccccccccccccc func
> cccccccccccccccc
> [ 22.709406] i 7 btp ffffffff8288e590 btp->tp cccccccccccccccc func
> cccccccccccccccc
> [ 22.710368] i 8 btp ffffffff8288e5a0 btp->tp cccccccccccccccc func
> cccccccccccccccc
>
> while gdb shows that everything is good inside vmlinux
> for exactly these addresses.
> Some other linker magic missing?
No, Steven's iteration code is incorrect.
+extern struct bpf_raw_event_map __start__bpf_raw_tp;
+extern struct bpf_raw_event_map __stop__bpf_raw_tp;
That should be:
extern struct bpf_raw_event_map __start__bpf_raw_tp[];
extern struct bpf_raw_event_map __stop__bpf_raw_tp[];
+
+struct bpf_raw_event_map *bpf_find_raw_tracepoint(const char *name)
+{
+ const struct bpf_raw_event_map *btp = &__start__bpf_raw_tp;
const struct bpf_raw_event_map *btp = __start__bpf_raw_tp;
+ int i = 0;
+
+ for (; btp < &__stop__bpf_raw_tp; btp++) {
for (; btp < __stop__bpf_raw_tp; btp++) {
Those start/stop symbols are given their address by the linker
automatically (this is a GNU linker extension). We don't want
pointers to the symbols, but rather the symbols per se to act
as start/stop addresses.
Thanks,
Mathieu
+ i++;
+ if (!strcmp(btp->tp->name, name))
+ return btp;
+ }
+ return NULL;
+}
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
next prev parent reply other threads:[~2018-03-28 0:44 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-27 2:46 [PATCH v6 bpf-next 00/11] bpf, tracing: introduce bpf raw tracepoints Alexei Starovoitov
2018-03-27 2:46 ` [PATCH v6 bpf-next 01/11] treewide: remove large struct-pass-by-value from tracepoint arguments Alexei Starovoitov
2018-03-27 2:46 ` [PATCH v6 bpf-next 02/11] net/mediatek: disambiguate mt76 vs mt7601u trace events Alexei Starovoitov
2018-03-27 2:46 ` [PATCH v6 bpf-next 03/11] net/mac802154: disambiguate mac80215 vs mac802154 " Alexei Starovoitov
2018-03-27 2:46 ` [PATCH v6 bpf-next 04/11] net/wireless/iwlwifi: fix iwlwifi_dev_ucode_error tracepoint Alexei Starovoitov
2018-03-27 2:47 ` [PATCH v6 bpf-next 05/11] macro: introduce COUNT_ARGS() macro Alexei Starovoitov
2018-03-27 2:47 ` [PATCH v6 bpf-next 06/11] tracepoint: compute num_args at build time Alexei Starovoitov
2018-03-27 15:15 ` Steven Rostedt
2018-03-27 2:47 ` [PATCH v6 bpf-next 07/11] tracepoint: introduce kernel_tracepoint_find_by_name Alexei Starovoitov
2018-03-27 14:07 ` Steven Rostedt
2018-03-27 14:18 ` Mathieu Desnoyers
2018-03-27 14:42 ` Steven Rostedt
2018-03-27 15:53 ` Alexei Starovoitov
2018-03-27 16:09 ` Mathieu Desnoyers
2018-03-27 16:36 ` Daniel Borkmann
2018-03-27 2:47 ` [PATCH v6 bpf-next 08/11] bpf: introduce BPF_RAW_TRACEPOINT Alexei Starovoitov
2018-03-27 17:02 ` Steven Rostedt
2018-03-27 17:11 ` Steven Rostedt
2018-03-27 18:58 ` Steven Rostedt
2018-03-27 21:04 ` Steven Rostedt
2018-03-27 22:48 ` Alexei Starovoitov
2018-03-27 23:13 ` Mathieu Desnoyers
2018-03-28 0:00 ` Alexei Starovoitov
2018-03-28 0:44 ` Mathieu Desnoyers [this message]
2018-03-28 0:51 ` Alexei Starovoitov
2018-03-28 14:06 ` Steven Rostedt
2018-03-27 18:45 ` Alexei Starovoitov
2018-03-27 19:00 ` Steven Rostedt
2018-03-27 19:07 ` Steven Rostedt
2018-03-27 19:10 ` Steven Rostedt
2018-03-27 19:10 ` Mathieu Desnoyers
2018-03-27 2:47 ` [PATCH v6 bpf-next 09/11] libbpf: add bpf_raw_tracepoint_open helper Alexei Starovoitov
2018-03-27 2:47 ` [PATCH v6 bpf-next 10/11] samples/bpf: raw tracepoint test Alexei Starovoitov
2018-03-27 2:47 ` [PATCH v6 bpf-next 11/11] selftests/bpf: test for bpf_get_stackid() from raw tracepoints Alexei Starovoitov
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=1513083686.1804.1522197852512.JavaMail.zimbra@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=ast@fb.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=keescook@chromium.org \
--cc=kernel-team@fb.com \
--cc=linux-api@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).