24 Sep, 2020

2 commits

  • Alexei Starovoitov says:

    ====================
    pull-request: bpf-next 2020-09-23

    The following pull-request contains BPF updates for your *net-next* tree.

    We've added 95 non-merge commits during the last 22 day(s) which contain
    a total of 124 files changed, 4211 insertions(+), 2040 deletions(-).

    The main changes are:

    1) Full multi function support in libbpf, from Andrii.

    2) Refactoring of function argument checks, from Lorenz.

    3) Make bpf_tail_call compatible with functions (subprograms), from Maciej.

    4) Program metadata support, from YiFei.

    5) bpf iterator optimizations, from Yonghong.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • Seth reported problem with cross builds, that fail
    on resolve_btfids build, because we are trying to
    build it on cross build arch.

    Fixing this by always forcing the host arch.

    Reported-by: Seth Forshee
    Signed-off-by: Jiri Olsa
    Signed-off-by: Alexei Starovoitov
    Acked-by: Andrii Nakryiko
    Link: https://lore.kernel.org/bpf/20200923185735.3048198-2-jolsa@kernel.org

    Jiri Olsa
     

23 Sep, 2020

1 commit

  • Two minor conflicts:

    1) net/ipv4/route.c, adding a new local variable while
    moving another local variable and removing it's
    initial assignment.

    2) drivers/net/dsa/microchip/ksz9477.c, overlapping changes.
    One pretty prints the port mode differently, whilst another
    changes the driver to try and obtain the port mode from
    the port node rather than the switch node.

    Signed-off-by: David S. Miller

    David S. Miller
     

02 Sep, 2020

2 commits

  • Daniel Borkmann says:

    ====================
    pull-request: bpf-next 2020-09-01

    The following pull-request contains BPF updates for your *net-next* tree.

    There are two small conflicts when pulling, resolve as follows:

    1) Merge conflict in tools/lib/bpf/libbpf.c between 88a82120282b ("libbpf: Factor
    out common ELF operations and improve logging") in bpf-next and 1e891e513e16
    ("libbpf: Fix map index used in error message") in net-next. Resolve by taking
    the hunk in bpf-next:

    [...]
    scn = elf_sec_by_idx(obj, obj->efile.btf_maps_shndx);
    data = elf_sec_data(obj, scn);
    if (!scn || !data) {
    pr_warn("elf: failed to get %s map definitions for %s\n",
    MAPS_ELF_SEC, obj->path);
    return -EINVAL;
    }
    [...]

    2) Merge conflict in drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c between
    9647c57b11e5 ("xsk: i40e: ice: ixgbe: mlx5: Test for dma_need_sync earlier for
    better performance") in bpf-next and e20f0dbf204f ("net/mlx5e: RX, Add a prefetch
    command for small L1_CACHE_BYTES") in net-next. Resolve the two locations by retaining
    net_prefetch() and taking xsk_buff_dma_sync_for_cpu() from bpf-next. Should look like:

    [...]
    xdp_set_data_meta_invalid(xdp);
    xsk_buff_dma_sync_for_cpu(xdp, rq->xsk_pool);
    net_prefetch(xdp->data);
    [...]

    We've added 133 non-merge commits during the last 14 day(s) which contain
    a total of 246 files changed, 13832 insertions(+), 3105 deletions(-).

    The main changes are:

    1) Initial support for sleepable BPF programs along with bpf_copy_from_user() helper
    for tracing to reliably access user memory, from Alexei Starovoitov.

    2) Add BPF infra for writing and parsing TCP header options, from Martin KaFai Lau.

    3) bpf_d_path() helper for returning full path for given 'struct path', from Jiri Olsa.

    4) AF_XDP support for shared umems between devices and queues, from Magnus Karlsson.

    5) Initial prep work for full BPF-to-BPF call support in libbpf, from Andrii Nakryiko.

    6) Generalize bpf_sk_storage map & add local storage for inodes, from KP Singh.

    7) Implement sockmap/hash updates from BPF context, from Lorenz Bauer.

    8) BPF xor verification for scalar types & add BPF link iterator, from Yonghong Song.

    9) Use target's prog type for BPF_PROG_TYPE_EXT prog verification, from Udip Pant.

    10) Rework BPF tracing samples to use libbpf loader, from Daniel T. Lee.

    11) Fix xdpsock sample to really cycle through all buffers, from Weqaar Janjua.

    12) Improve type safety for tun/veth XDP frame handling, from Maciej Żenczykowski.

    13) Various smaller cleanups and improvements all over the place.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • The new resolve_btfids tool did not clean up the feature detection folder
    on 'make clean', and also was not called properly from the clean rule in
    tools/make/ folder on its 'make clean'. This lead to stale objects being
    left around, which could cause feature detection to fail on subsequent
    builds.

    Fixes: fbbb68de80a4 ("bpf: Add resolve_btfids tool to resolve BTF IDs in ELF object")
    Signed-off-by: Toke Høiland-Jørgensen
    Signed-off-by: Daniel Borkmann
    Acked-by: Jiri Olsa
    Link: https://lore.kernel.org/bpf/20200901144343.179552-1-toke@redhat.com

    Toke Høiland-Jørgensen
     

26 Aug, 2020

2 commits

  • The set symbol does not have the unique number suffix,
    so we need to give it a special parsing function.

    This was omitted in the first batch, because there was
    no set support yet, so it slipped in the testing.

    Signed-off-by: Jiri Olsa
    Signed-off-by: Alexei Starovoitov
    Acked-by: Andrii Nakryiko
    Link: https://lore.kernel.org/bpf/20200825192124.710397-3-jolsa@kernel.org

    Jiri Olsa
     
  • To make sure we don't crash on malformed symbols.

    Signed-off-by: Jiri Olsa
    Signed-off-by: Alexei Starovoitov
    Acked-by: Andrii Nakryiko
    Link: https://lore.kernel.org/bpf/20200825192124.710397-2-jolsa@kernel.org

    Jiri Olsa
     

21 Aug, 2020

1 commit

  • The data of compressed section should be aligned to 4
    (for 32bit) or 8 (for 64 bit) bytes.

    The binutils ld sets sh_addralign to 1, which makes libelf
    fail with misaligned section error during the update as
    reported by Jesper:

    FAILED elf_update(WRITE): invalid section alignment

    While waiting for ld fix, we can fix compressed sections
    sh_addralign value manually.

    Adding warning in -vv mode when the fix is triggered:

    $ ./tools/bpf/resolve_btfids/resolve_btfids -vv vmlinux
    ...
    section(36) .comment, size 44, link 0, flags 30, type=1
    section(37) .debug_aranges, size 45684, link 0, flags 800, type=1
    - fixing wrong alignment sh_addralign 16, expected 8
    section(38) .debug_info, size 129104957, link 0, flags 800, type=1
    - fixing wrong alignment sh_addralign 1, expected 8
    section(39) .debug_abbrev, size 1152583, link 0, flags 800, type=1
    - fixing wrong alignment sh_addralign 1, expected 8
    section(40) .debug_line, size 7374522, link 0, flags 800, type=1
    - fixing wrong alignment sh_addralign 1, expected 8
    section(41) .debug_frame, size 702463, link 0, flags 800, type=1
    section(42) .debug_str, size 1017571, link 0, flags 830, type=1
    - fixing wrong alignment sh_addralign 1, expected 8
    section(43) .debug_loc, size 3019453, link 0, flags 800, type=1
    - fixing wrong alignment sh_addralign 1, expected 8
    section(44) .debug_ranges, size 1744583, link 0, flags 800, type=1
    - fixing wrong alignment sh_addralign 16, expected 8
    section(45) .symtab, size 2955888, link 46, flags 0, type=2
    section(46) .strtab, size 2613072, link 0, flags 0, type=3
    ...
    update ok for vmlinux

    Another workaround is to disable compressed debug info data
    CONFIG_DEBUG_INFO_COMPRESSED kernel option.

    Fixes: fbbb68de80a4 ("bpf: Add resolve_btfids tool to resolve BTF IDs in ELF object")
    Reported-by: Jesper Dangaard Brouer
    Signed-off-by: Jiri Olsa
    Signed-off-by: Alexei Starovoitov
    Acked-by: Jesper Dangaard Brouer
    Acked-by: Yonghong Song
    Cc: Mark Wielaard
    Cc: Nick Clifton
    Link: https://lore.kernel.org/bpf/20200819092342.259004-1-jolsa@kernel.org

    Jiri Olsa
     

07 Aug, 2020

1 commit

  • int sets_patch(struct object *obj) doesn't have a 'return 0' at the end.

    Fixes: fbbb68de80a4 ("bpf: Add resolve_btfids tool to resolve BTF IDs in ELF object")
    Signed-off-by: Stanislav Fomichev
    Signed-off-by: Alexei Starovoitov
    Link: https://lore.kernel.org/bpf/20200806155225.637202-1-sdf@google.com

    Stanislav Fomichev
     

03 Aug, 2020

1 commit


15 Jul, 2020

1 commit

  • Stephen and 0-DAY CI Kernel Test Service reported broken cross build
    for arm (arm-linux-gnueabi-gcc (GCC) 9.3.0), with following output:

    /tmp/ccMS5uth.s: Assembler messages:
    /tmp/ccMS5uth.s:69: Error: unrecognized symbol type ""
    /tmp/ccMS5uth.s:82: Error: unrecognized symbol type ""

    Having '@object' for .type diretive is wrong because '@' is comment
    character for some architectures. Using STT_OBJECT instead that should
    work everywhere.

    Also using HOST* variables to build resolve_btfids so it's properly
    build in crossbuilds (stolen from objtool's Makefile).

    Reported-by: kernel test robot
    Reported-by: Stephen Rothwell
    Signed-off-by: Jiri Olsa
    Signed-off-by: Alexei Starovoitov
    Tested-by: Geert Uytterhoeven
    Link: https://lore.kernel.org/bpf/20200714102534.299280-2-jolsa@kernel.org

    Jiri Olsa
     

14 Jul, 2020

1 commit

  • The resolve_btfids tool scans elf object for .BTF_ids section
    and resolves its symbols with BTF ID values.

    It will be used to during linking time to resolve arrays of BTF
    ID values used in verifier, so these IDs do not need to be
    resolved in runtime.

    The expected layout of .BTF_ids section is described in main.c
    header. Related kernel changes are coming in following changes.

    Build issue reported by 0-DAY CI Kernel Test Service.

    Signed-off-by: Jiri Olsa
    Signed-off-by: Alexei Starovoitov
    Link: https://lore.kernel.org/bpf/20200711215329.41165-2-jolsa@kernel.org

    Jiri Olsa