All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH net] bpf: fix samples to add fake KBUILD_MODNAME
Date: Wed, 26 Oct 2016 09:01:48 +0200	[thread overview]
Message-ID: <581054DC.5000904@iogearbox.net> (raw)
In-Reply-To: <20161026011713.GA35732@ast-mbp.thefacebook.com>

[-- Attachment #1: Type: text/plain, Size: 1884 bytes --]

On 10/26/2016 03:17 AM, Alexei Starovoitov wrote:
> On Wed, Oct 26, 2016 at 12:37:53AM +0200, Daniel Borkmann wrote:
>> Some of the sample files are causing issues when they are loaded with tc
>> and cls_bpf, meaning tc bails out while trying to parse the resulting ELF
>> file as program/map/etc sections are not present, which can be easily
>> spotted with readelf(1).
>>
>> Currently, BPF samples are including some of the kernel headers and mid
>> term we should change them to refrain from this, really. When dynamic
>> debugging is enabled, we bail out due to undeclared KBUILD_MODNAME, which
>> is easily overlooked in the build as clang spills this along with other
>> noisy warnings from various header includes, and llc still generates an
>> ELF file with mentioned characteristics. For just playing around with BPF
>> examples, this can be a bit of a hurdle to take.
>>
>> Just add a fake KBUILD_MODNAME as a band-aid to fix the issue, same is
>> done in xdp*_kern samples already.
>>
>> Fixes: 65d472fb007d ("samples/bpf: add 'pointer to packet' tests")
>> Fixes: 6afb1e28b859 ("samples/bpf: Add tunnel set/get tests.")
>> Fixes: a3f74617340b ("cgroup: bpf: Add an example to do cgroup checking in BPF")
>> Reported-by: Chandrasekar Kannan <ckannan@console.to>
>> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
>> ---
>>   samples/bpf/parse_ldabs.c        | 1 +
>>   samples/bpf/parse_simple.c       | 1 +
>>   samples/bpf/parse_varlen.c       | 1 +
>>   samples/bpf/tcbpf1_kern.c        | 1 +
>>   samples/bpf/tcbpf2_kern.c        | 1 +
>>   samples/bpf/test_cgrp2_tc_kern.c | 1 +
>>   6 files changed, 6 insertions(+)
>
> It's also needed for all of tracex*_kern.c, right?

Rest compiles just fine for me and readelf output looks good on all
tracex*_kern.o, too.

I see just warnings coming from various kernel header inclusions (see
log), but no errors anymore.

[-- Attachment #2: log --]
[-- Type: text/plain, Size: 19109 bytes --]

/home/darkstar/net/samples/bpf/trace_output_user.c:64:6: warning: no previous prototype for ‘perf_event_read’ [-Wmissing-prototypes]
 void perf_event_read(print_fn fn)
      ^
In file included from /home/darkstar/net/samples/bpf/sockex2_kern.c:8:
In file included from ./include/uapi/linux/if_tunnel.h:6:
In file included from ./include/linux/ip.h:20:
In file included from ./include/linux/skbuff.h:29:
In file included from ./include/linux/net.h:28:
./include/linux/fs.h:2693:9: warning: comparison of unsigned enum expression < 0 is always false [-Wtautological-compare]
        if (id < 0 || id >= READING_MAX_ID)
            ~~ ^ ~
In file included from /home/darkstar/net/samples/bpf/sockex2_kern.c:8:
In file included from ./include/uapi/linux/if_tunnel.h:6:
In file included from ./include/linux/ip.h:20:
In file included from ./include/linux/skbuff.h:30:
In file included from ./include/linux/textsearch.h:8:
In file included from ./include/linux/slab.h:118:
In file included from ./include/linux/kasan.h:4:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
2 warnings generated.
In file included from /home/darkstar/net/samples/bpf/sockex3_kern.c:14:
In file included from ./include/uapi/linux/if_tunnel.h:6:
In file included from ./include/linux/ip.h:20:
In file included from ./include/linux/skbuff.h:29:
In file included from ./include/linux/net.h:28:
./include/linux/fs.h:2693:9: warning: comparison of unsigned enum expression < 0 is always false [-Wtautological-compare]
        if (id < 0 || id >= READING_MAX_ID)
            ~~ ^ ~
In file included from /home/darkstar/net/samples/bpf/sockex3_kern.c:14:
In file included from ./include/uapi/linux/if_tunnel.h:6:
In file included from ./include/linux/ip.h:20:
In file included from ./include/linux/skbuff.h:30:
In file included from ./include/linux/textsearch.h:8:
In file included from ./include/linux/slab.h:118:
In file included from ./include/linux/kasan.h:4:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
2 warnings generated.
In file included from /home/darkstar/net/samples/bpf/tracex1_kern.c:7:
In file included from ./include/linux/skbuff.h:29:
In file included from ./include/linux/net.h:28:
./include/linux/fs.h:2693:9: warning: comparison of unsigned enum expression < 0 is always false [-Wtautological-compare]
        if (id < 0 || id >= READING_MAX_ID)
            ~~ ^ ~
In file included from /home/darkstar/net/samples/bpf/tracex1_kern.c:7:
In file included from ./include/linux/skbuff.h:30:
In file included from ./include/linux/textsearch.h:8:
In file included from ./include/linux/slab.h:118:
In file included from ./include/linux/kasan.h:4:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
2 warnings generated.
In file included from /home/darkstar/net/samples/bpf/tracex2_kern.c:7:
In file included from ./include/linux/skbuff.h:29:
In file included from ./include/linux/net.h:28:
./include/linux/fs.h:2693:9: warning: comparison of unsigned enum expression < 0 is always false [-Wtautological-compare]
        if (id < 0 || id >= READING_MAX_ID)
            ~~ ^ ~
In file included from /home/darkstar/net/samples/bpf/tracex2_kern.c:7:
In file included from ./include/linux/skbuff.h:30:
In file included from ./include/linux/textsearch.h:8:
In file included from ./include/linux/slab.h:118:
In file included from ./include/linux/kasan.h:4:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
2 warnings generated.
In file included from /home/darkstar/net/samples/bpf/tracex3_kern.c:7:
In file included from ./include/linux/skbuff.h:29:
In file included from ./include/linux/net.h:28:
./include/linux/fs.h:2693:9: warning: comparison of unsigned enum expression < 0 is always false [-Wtautological-compare]
        if (id < 0 || id >= READING_MAX_ID)
            ~~ ^ ~
In file included from /home/darkstar/net/samples/bpf/tracex3_kern.c:7:
In file included from ./include/linux/skbuff.h:30:
In file included from ./include/linux/textsearch.h:8:
In file included from ./include/linux/slab.h:118:
In file included from ./include/linux/kasan.h:4:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
2 warnings generated.
In file included from /home/darkstar/net/samples/bpf/tracex4_kern.c:7:
In file included from ./include/linux/ptrace.h:5:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
1 warning generated.
In file included from /home/darkstar/net/samples/bpf/tracex5_kern.c:7:
In file included from ./include/linux/ptrace.h:5:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
1 warning generated.
In file included from /home/darkstar/net/samples/bpf/tracex6_kern.c:1:
In file included from ./include/linux/ptrace.h:5:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
1 warning generated.
In file included from /home/darkstar/net/samples/bpf/test_probe_write_user_kern.c:7:
In file included from ./include/linux/skbuff.h:29:
In file included from ./include/linux/net.h:28:
./include/linux/fs.h:2693:9: warning: comparison of unsigned enum expression < 0 is always false [-Wtautological-compare]
        if (id < 0 || id >= READING_MAX_ID)
            ~~ ^ ~
In file included from /home/darkstar/net/samples/bpf/test_probe_write_user_kern.c:7:
In file included from ./include/linux/skbuff.h:30:
In file included from ./include/linux/textsearch.h:8:
In file included from ./include/linux/slab.h:118:
In file included from ./include/linux/kasan.h:4:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
2 warnings generated.
In file included from /home/darkstar/net/samples/bpf/trace_output_kern.c:1:
In file included from ./include/linux/ptrace.h:5:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
1 warning generated.
In file included from /home/darkstar/net/samples/bpf/tcbpf2_kern.c:18:
In file included from ./include/net/ipv6.h:16:
In file included from ./include/linux/ipv6.h:76:
In file included from ./include/linux/icmpv6.h:4:
In file included from ./include/linux/skbuff.h:29:
In file included from ./include/linux/net.h:28:
./include/linux/fs.h:2693:9: warning: comparison of unsigned enum expression < 0 is always false [-Wtautological-compare]
        if (id < 0 || id >= READING_MAX_ID)
            ~~ ^ ~
In file included from /home/darkstar/net/samples/bpf/tcbpf2_kern.c:18:
In file included from ./include/net/ipv6.h:16:
In file included from ./include/linux/ipv6.h:76:
In file included from ./include/linux/icmpv6.h:4:
In file included from ./include/linux/skbuff.h:30:
In file included from ./include/linux/textsearch.h:8:
In file included from ./include/linux/slab.h:118:
In file included from ./include/linux/kasan.h:4:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
2 warnings generated.
In file included from /home/darkstar/net/samples/bpf/lathist_kern.c:9:
In file included from ./include/linux/ptrace.h:5:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
1 warning generated.
In file included from /home/darkstar/net/samples/bpf/offwaketime_kern.c:12:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
1 warning generated.
In file included from /home/darkstar/net/samples/bpf/spintest_kern.c:7:
In file included from ./include/linux/skbuff.h:29:
In file included from ./include/linux/net.h:28:
./include/linux/fs.h:2693:9: warning: comparison of unsigned enum expression < 0 is always false [-Wtautological-compare]
        if (id < 0 || id >= READING_MAX_ID)
            ~~ ^ ~
In file included from /home/darkstar/net/samples/bpf/spintest_kern.c:7:
In file included from ./include/linux/skbuff.h:30:
In file included from ./include/linux/textsearch.h:8:
In file included from ./include/linux/slab.h:118:
In file included from ./include/linux/kasan.h:4:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
2 warnings generated.
In file included from /home/darkstar/net/samples/bpf/map_perf_test_kern.c:7:
In file included from ./include/linux/skbuff.h:29:
In file included from ./include/linux/net.h:28:
./include/linux/fs.h:2693:9: warning: comparison of unsigned enum expression < 0 is always false [-Wtautological-compare]
        if (id < 0 || id >= READING_MAX_ID)
            ~~ ^ ~
In file included from /home/darkstar/net/samples/bpf/map_perf_test_kern.c:7:
In file included from ./include/linux/skbuff.h:30:
In file included from ./include/linux/textsearch.h:8:
In file included from ./include/linux/slab.h:118:
In file included from ./include/linux/kasan.h:4:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
2 warnings generated.
In file included from /home/darkstar/net/samples/bpf/test_overhead_kprobe_kern.c:8:
In file included from ./include/linux/ptrace.h:5:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
1 warning generated.
In file included from /home/darkstar/net/samples/bpf/parse_varlen.c:8:
In file included from ./include/linux/if_ether.h:23:
In file included from ./include/linux/skbuff.h:29:
In file included from ./include/linux/net.h:28:
./include/linux/fs.h:2693:9: warning: comparison of unsigned enum expression < 0 is always false [-Wtautological-compare]
        if (id < 0 || id >= READING_MAX_ID)
            ~~ ^ ~
In file included from /home/darkstar/net/samples/bpf/parse_varlen.c:8:
In file included from ./include/linux/if_ether.h:23:
In file included from ./include/linux/skbuff.h:30:
In file included from ./include/linux/textsearch.h:8:
In file included from ./include/linux/slab.h:118:
In file included from ./include/linux/kasan.h:4:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
2 warnings generated.
In file included from /home/darkstar/net/samples/bpf/parse_simple.c:8:
In file included from ./include/linux/ip.h:20:
In file included from ./include/linux/skbuff.h:29:
In file included from ./include/linux/net.h:28:
./include/linux/fs.h:2693:9: warning: comparison of unsigned enum expression < 0 is always false [-Wtautological-compare]
        if (id < 0 || id >= READING_MAX_ID)
            ~~ ^ ~
In file included from /home/darkstar/net/samples/bpf/parse_simple.c:8:
In file included from ./include/linux/ip.h:20:
In file included from ./include/linux/skbuff.h:30:
In file included from ./include/linux/textsearch.h:8:
In file included from ./include/linux/slab.h:118:
In file included from ./include/linux/kasan.h:4:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
2 warnings generated.
In file included from /home/darkstar/net/samples/bpf/parse_ldabs.c:8:
In file included from ./include/linux/ip.h:20:
In file included from ./include/linux/skbuff.h:29:
In file included from ./include/linux/net.h:28:
./include/linux/fs.h:2693:9: warning: comparison of unsigned enum expression < 0 is always false [-Wtautological-compare]
        if (id < 0 || id >= READING_MAX_ID)
            ~~ ^ ~
In file included from /home/darkstar/net/samples/bpf/parse_ldabs.c:8:
In file included from ./include/linux/ip.h:20:
In file included from ./include/linux/skbuff.h:30:
In file included from ./include/linux/textsearch.h:8:
In file included from ./include/linux/slab.h:118:
In file included from ./include/linux/kasan.h:4:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
2 warnings generated.
In file included from /home/darkstar/net/samples/bpf/xdp1_kern.c:10:
In file included from ./include/linux/if_ether.h:23:
In file included from ./include/linux/skbuff.h:29:
In file included from ./include/linux/net.h:28:
./include/linux/fs.h:2693:9: warning: comparison of unsigned enum expression < 0 is always false [-Wtautological-compare]
        if (id < 0 || id >= READING_MAX_ID)
            ~~ ^ ~
In file included from /home/darkstar/net/samples/bpf/xdp1_kern.c:10:
In file included from ./include/linux/if_ether.h:23:
In file included from ./include/linux/skbuff.h:30:
In file included from ./include/linux/textsearch.h:8:
In file included from ./include/linux/slab.h:118:
In file included from ./include/linux/kasan.h:4:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
2 warnings generated.
In file included from /home/darkstar/net/samples/bpf/xdp2_kern.c:10:
In file included from ./include/linux/if_ether.h:23:
In file included from ./include/linux/skbuff.h:29:
In file included from ./include/linux/net.h:28:
./include/linux/fs.h:2693:9: warning: comparison of unsigned enum expression < 0 is always false [-Wtautological-compare]
        if (id < 0 || id >= READING_MAX_ID)
            ~~ ^ ~
In file included from /home/darkstar/net/samples/bpf/xdp2_kern.c:10:
In file included from ./include/linux/if_ether.h:23:
In file included from ./include/linux/skbuff.h:30:
In file included from ./include/linux/textsearch.h:8:
In file included from ./include/linux/slab.h:118:
In file included from ./include/linux/kasan.h:4:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
2 warnings generated.
In file included from /home/darkstar/net/samples/bpf/test_current_task_under_cgroup_kern.c:8:
In file included from ./include/linux/ptrace.h:5:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
1 warning generated.
In file included from /home/darkstar/net/samples/bpf/trace_event_kern.c:7:
In file included from ./include/linux/ptrace.h:5:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
1 warning generated.
In file included from /home/darkstar/net/samples/bpf/sampleip_kern.c:8:
In file included from ./include/linux/ptrace.h:5:
In file included from ./include/linux/sched.h:61:
./include/linux/cgroup-defs.h:322:16: warning: field 'cgrp' with variable sized type 'struct cgroup' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
        struct cgroup cgrp;
                      ^
1 warning generated.

  reply	other threads:[~2016-10-26  7:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-25 22:37 [PATCH net] bpf: fix samples to add fake KBUILD_MODNAME Daniel Borkmann
2016-10-26  1:17 ` Alexei Starovoitov
2016-10-26  7:01   ` Daniel Borkmann [this message]
2016-10-26 16:44     ` Alexei Starovoitov
2016-10-29 18:46 ` David Miller

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=581054DC.5000904@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=alexei.starovoitov@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.