24 Feb, 2020

1 commit

  • [ Upstream commit 6794200fa3c9c3e6759dae099145f23e4310f4f7 ]

    GCC9 introduced string hardening mechanisms, which exhibits the error
    during fs api compilation:

    error: '__builtin_strncpy' specified bound 4096 equals destination size
    [-Werror=stringop-truncation]

    This comes when the length of copy passed to strncpy is is equal to
    destination size, which could potentially lead to buffer overflow.

    There is a need to mitigate this potential issue by limiting the size of
    destination by 1 and explicitly terminate the destination with NULL.

    Signed-off-by: Andrey Zhizhikin
    Reviewed-by: Petr Mladek
    Acked-by: Jiri Olsa
    Cc: Alexei Starovoitov
    Cc: Andrii Nakryiko
    Cc: Daniel Borkmann
    Cc: Kefeng Wang
    Cc: Martin KaFai Lau
    Cc: Petr Mladek
    Cc: Sergey Senozhatsky
    Cc: Song Liu
    Cc: Yonghong Song
    Cc: bpf@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Link: http://lore.kernel.org/lkml/20191211080109.18765-1-andrey.zhizhikin@leica-geosystems.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Andrey Zhizhikin
     

11 Feb, 2020

1 commit

  • commit 35b9211c0a2427e8f39e534f442f43804fc8d5ca upstream.

    Fix bug requesting invalid size of reallocated array when constructing CO-RE
    relocation candidate list. This can cause problems if there are many potential
    candidates and a very fine-grained memory allocator bucket sizes are used.

    Fixes: ddc7c3042614 ("libbpf: implement BPF CO-RE offset relocation algorithm")
    Reported-by: William Smith
    Signed-off-by: Andrii Nakryiko
    Signed-off-by: Daniel Borkmann
    Acked-by: Yonghong Song
    Link: https://lore.kernel.org/bpf/20200124201847.212528-1-andriin@fb.com
    Signed-off-by: Greg Kroah-Hartman

    Andrii Nakryiko
     

06 Feb, 2020

2 commits

  • [ Upstream commit f84ae29a6169318f9c929720c49d96323d2bbab9 ]

    It is necessary to call free_arg(arg) when add_filter_type() returns NULL
    in filter_event().

    Signed-off-by: Hewenliang
    Reviewed-by: Steven Rostedt (VMware)
    Cc: Feilong Lin
    Cc: Tzvetomir Stoyanov
    Link: http://lore.kernel.org/lkml/20191209063549.59941-1-hewenliang4@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Hewenliang
     
  • commit 6c4798d3f08b81c2c52936b10e0fa872590c96ae upstream.

    Disable a couple of compilation warnings (which are treated as errors)
    on strlcpy() definition and declaration, allowing users to compile perf
    and kernel (objtool) when:

    1. glibc have strlcpy() (such as in ALT Linux since 2004) objtool and
    perf build fails with this (in gcc):

    In file included from exec-cmd.c:3:
    tools/include/linux/string.h:20:15: error: redundant redeclaration of ‘strlcpy’ [-Werror=redundant-decls]
    20 | extern size_t strlcpy(char *dest, const char *src, size_t size);

    2. clang ignores `-Wredundant-decls', but produces another warning when
    building perf:

    CC util/string.o
    ../lib/string.c:99:8: error: attribute declaration must precede definition [-Werror,-Wignored-attributes]
    size_t __weak strlcpy(char *dest, const char *src, size_t size)
    ../../tools/include/linux/compiler.h:66:34: note: expanded from macro '__weak'
    # define __weak __attribute__((weak))
    /usr/include/bits/string_fortified.h:151:8: note: previous definition is here
    __NTH (strlcpy (char *__restrict __dest, const char *__restrict __src,

    Committer notes:

    The

    #pragma GCC diagnostic

    directive was introduced in gcc 4.6, so check for that as well.

    Fixes: ce99091 ("perf tools: Move strlcpy() from perf to tools/lib/string.c")
    Fixes: 0215d59 ("tools lib: Reinstate strlcpy() header guard with __UCLIBC__")
    Resolves: https://bugzilla.kernel.org/show_bug.cgi?id=118481
    Signed-off-by: Vitaly Chikunov
    Reviewed-by: Dmitry Levin
    Cc: Dmitry Levin
    Cc: Josh Poimboeuf
    Cc: kbuild test robot
    Cc: Peter Zijlstra
    Cc: stable@vger.kernel.org
    Cc: Vineet Gupta
    Link: http://lore.kernel.org/lkml/20191224172029.19690-1-vt@altlinux.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Vitaly Chikunov
     

26 Jan, 2020

6 commits

  • [ Upstream commit a566e35f1e8b4b3be1e96a804d1cca38b578167c ]

    u32 is a kernel-side typedef. User-space library is supposed to use __u32.
    This breaks Github's projection of libbpf. Do u32 -> __u32 fix.

    Fixes: 94ff9ebb49a5 ("libbpf: Fix compatibility for kernels without need_wakeup")
    Signed-off-by: Andrii Nakryiko
    Signed-off-by: Alexei Starovoitov
    Acked-by: Björn Töpel
    Cc: Magnus Karlsson
    Link: https://lore.kernel.org/bpf/20191029055953.2461336-1-andriin@fb.com
    Signed-off-by: Sasha Levin

    Andrii Nakryiko
     
  • commit 994021a7e08477f7e51285920aac99fc967fae8a upstream.

    Perform size check always in btf__resolve_size. Makes the logic a bit more
    robust against corrupted BTF and silences LGTM/Coverity complaining about
    always true (size < 0) check.

    Fixes: 69eaab04c675 ("btf: extract BTF type size calculation")
    Signed-off-by: Andrii Nakryiko
    Signed-off-by: Daniel Borkmann
    Link: https://lore.kernel.org/bpf/20191107020855.3834758-5-andriin@fb.com
    Signed-off-by: Greg Kroah-Hartman

    Andrii Nakryiko
     
  • commit dd3ab126379ec040b3edab8559f9c72de6ef9d29 upstream.

    Fix few issues found by Coverity and LGTM.

    Fixes: b053b439b72a ("bpf: libbpf: bpftool: Print bpf_line_info during prog dump")
    Signed-off-by: Andrii Nakryiko
    Signed-off-by: Daniel Borkmann
    Link: https://lore.kernel.org/bpf/20191107020855.3834758-4-andriin@fb.com
    Signed-off-by: Greg Kroah-Hartman

    Andrii Nakryiko
     
  • commit 4ee1135615713387b869dfd099ffdf8656be6784 upstream.

    Fix a potential overflow issue found by LGTM analysis, based on Github libbpf
    source code.

    Fixes: 3d65014146c6 ("bpf: libbpf: Add btf_line_info support to libbpf")
    Signed-off-by: Andrii Nakryiko
    Signed-off-by: Daniel Borkmann
    Link: https://lore.kernel.org/bpf/20191107020855.3834758-3-andriin@fb.com
    Signed-off-by: Greg Kroah-Hartman

    Andrii Nakryiko
     
  • commit 3dc5e059821376974177cc801d377e3fcdac6712 upstream.

    Coverity scan against Github libbpf code found the issue of not freeing memory and
    leaving already freed memory still referenced from bpf_program. Fix it by
    re-assigning successfully reallocated memory sooner.

    Fixes: 2993e0515bb4 ("tools/bpf: add support to read .BTF.ext sections")
    Signed-off-by: Andrii Nakryiko
    Signed-off-by: Daniel Borkmann
    Link: https://lore.kernel.org/bpf/20191107020855.3834758-2-andriin@fb.com
    Signed-off-by: Greg Kroah-Hartman

    Andrii Nakryiko
     
  • commit 94ff9ebb49a546b7f009ed840bafa235c96d4c4b upstream.

    When the need_wakeup flag was added to AF_XDP, the format of the
    XDP_MMAP_OFFSETS getsockopt was extended. Code was added to the
    kernel to take care of compatibility issues arrising from running
    applications using any of the two formats. However, libbpf was
    not extended to take care of the case when the application/libbpf
    uses the new format but the kernel only supports the old
    format. This patch adds support in libbpf for parsing the old
    format, before the need_wakeup flag was added, and emulating a
    set of static need_wakeup flags that will always work for the
    application.

    v2 -> v3:
    * Incorporated code improvements suggested by Jonathan Lemon

    v1 -> v2:
    * Rebased to bpf-next
    * Rewrote the code as the previous version made you blind

    Fixes: a4500432c2587cb2a ("libbpf: add support for need_wakeup flag in AF_XDP part")
    Reported-by: Eloy Degen
    Signed-off-by: Magnus Karlsson
    Signed-off-by: Alexei Starovoitov
    Acked-by: Jonathan Lemon
    Link: https://lore.kernel.org/bpf/1571995035-21889-1-git-send-email-magnus.karlsson@intel.com
    Signed-off-by: Greg Kroah-Hartman

    Magnus Karlsson
     

18 Jan, 2020

1 commit

  • commit b568405856906ee4d9ba6284fd36f2928653a623 upstream.

    Fix Makefile's diagnostic diff output when there is LIBBPF_API-versioned
    symbols mismatch.

    Fixes: 1bd63524593b ("libbpf: handle symbol versioning properly for libbpf.a")
    Signed-off-by: Andrii Nakryiko
    Signed-off-by: Daniel Borkmann
    Acked-by: Yonghong Song
    Link: https://lore.kernel.org/bpf/20191127200134.1360660-1-andriin@fb.com
    Signed-off-by: Greg Kroah-Hartman

    Andrii Nakryiko
     

12 Jan, 2020

2 commits

  • [ Upstream commit 15b3904f8e884e0d34d5f09906cf6526d0b889a2 ]

    When we use 'O=' with make to build libtraceevent in a separate folder
    it still copies 'libtraceevent.pc' to its source folder. Modify the
    Makefile so that it uses the output folder to copy the pkg-config file
    and install from there.

    Signed-off-by: Sudipm Mukherjee
    Reviewed-by: Steven Rostedt (VMware)
    Cc: linux-trace-devel@vger.kernel.org
    Link: http://lore.kernel.org/lkml/20191115113610.21493-2-sudipm.mukherjee@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Sudip Mukherjee
     
  • [ Upstream commit 587db8ebdac2c5eb3a8851e16b26f2e2711ab797 ]

    When we use 'O=' with make to build libtraceevent in a separate folder
    it fails to install libtraceevent.a and libtraceevent.so.1.1.0 with the
    error:

    INSTALL /home/sudip/linux/obj-trace/libtraceevent.a
    INSTALL /home/sudip/linux/obj-trace/libtraceevent.so.1.1.0

    cp: cannot stat 'libtraceevent.a': No such file or directory
    Makefile:225: recipe for target 'install_lib' failed
    make: *** [install_lib] Error 1

    I used the command:

    make O=../../../obj-trace DESTDIR=~/test prefix==/usr install

    It turns out libtraceevent Makefile, even though it builds in a separate
    folder, searches for libtraceevent.a and libtraceevent.so.1.1.0 in its
    source folder.

    So, add the 'OUTPUT' prefix to the source path so that 'make' looks for
    the files in the correct place.

    Signed-off-by: Sudipm Mukherjee
    Reviewed-by: Steven Rostedt (VMware)
    Cc: linux-trace-devel@vger.kernel.org
    Link: http://lore.kernel.org/lkml/20191115113610.21493-1-sudipm.mukherjee@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Sudip Mukherjee
     

31 Dec, 2019

7 commits

  • [ Upstream commit 10992af6bf46a2048ad964985a5b77464e5563b1 ]

    It is necessary to free the memory that we have allocated when error occurs.

    Fixes: ef3072cd1d5c ("tools lib traceevent: Get rid of die in add_filter_type()")
    Signed-off-by: Hewenliang
    Reviewed-by: Steven Rostedt (VMware)
    Cc: Tzvetomir Stoyanov
    Link: http://lore.kernel.org/lkml/20191119014415.57210-1-hewenliang4@huawei.com
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Hewenliang
     
  • [ Upstream commit 3de88c9113f88c04abda339f1aa629397bf89e02 ]

    Drivers use different fields to report the number of channels, so take
    the maximum of all data channels (rx, tx, combined) when determining the
    size of the xsk map. The current code used only 'combined' which was set
    to 0 in some drivers e.g. mlx4.

    Tested: compiled and run xdpsock -q 3 -r -S on mlx4

    Signed-off-by: Luigi Rizzo
    Signed-off-by: Alexei Starovoitov
    Reviewed-by: Jakub Kicinski
    Acked-by: Magnus Karlsson
    Link: https://lore.kernel.org/bpf/20191119001951.92930-1-lrizzo@google.com
    Signed-off-by: Sasha Levin

    Luigi Rizzo
     
  • [ Upstream commit 9656b346b280c3e49c8a116c3a715f966633b161 ]

    Fix issue reported by static analysis (Coverity). If bpf_prog_get_fd_by_id()
    fails, xsk_lookup_bpf_maps() will fail as well and clean-up code will attempt
    close() with fd=-1. Fix by checking bpf_prog_get_fd_by_id() return result and
    exiting early.

    Fixes: 10a13bb40e54 ("libbpf: remove qidconf and better support external bpf programs.")
    Signed-off-by: Andrii Nakryiko
    Signed-off-by: Daniel Borkmann
    Link: https://lore.kernel.org/bpf/20191107054059.313884-1-andriin@fb.com
    Signed-off-by: Sasha Levin

    Andrii Nakryiko
     
  • [ Upstream commit 22bd8f1b5a1dd168ba4eba27cb17643a11012f5d ]

    When a 'make DEBUG=1' build is done, the command parser is still built
    with -O6 and is hard to step through, fix it making it use -O0 in that
    case.

    Signed-off-by: James Clark
    Cc: Adrian Hunter
    Cc: Ian Rogers
    Cc: Jiri Olsa
    Cc: Josh Poimboeuf
    Cc: Namhyung Kim
    Cc: nd
    Link: http://lore.kernel.org/lkml/20191028113340.4282-1-james.clark@arm.com
    [ split from a larger patch ]
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    James Clark
     
  • [ Upstream commit d1b4574a4b86565325ef2e545eda8dfc9aa07c60 ]

    bpf_map__reuse_fd() was calling close() in the error path before returning
    an error value based on errno. However, close can change errno, so that can
    lead to potentially misleading error messages. Instead, explicitly store
    errno in the err variable before each goto.

    Signed-off-by: Toke Høiland-Jørgensen
    Signed-off-by: Alexei Starovoitov
    Acked-by: Andrii Nakryiko
    Link: https://lore.kernel.org/bpf/157269297769.394725.12634985106772698611.stgit@toke.dk
    Signed-off-by: Sasha Levin

    Toke Høiland-Jørgensen
     
  • [ Upstream commit 25bfef430e960e695403b5d9c8dcc11b9f5d62be ]

    'struct xdp_umem_reg' has 4 bytes of padding at the end that makes
    valgrind complain about passing uninitialized stack memory to the
    syscall:

    Syscall param socketcall.setsockopt() points to uninitialised byte(s)
    at 0x4E7AB7E: setsockopt (in /usr/lib64/libc-2.29.so)
    by 0x4BDE035: xsk_umem__create@@LIBBPF_0.0.4 (xsk.c:172)
    Uninitialised value was created by a stack allocation
    at 0x4BDDEBA: xsk_umem__create@@LIBBPF_0.0.4 (xsk.c:140)

    Padding bytes appeared after introducing of a new 'flags' field.
    memset() is required to clear them.

    Fixes: 10d30e301732 ("libbpf: add flags to umem config")
    Signed-off-by: Ilya Maximets
    Signed-off-by: Alexei Starovoitov
    Acked-by: Andrii Nakryiko
    Link: https://lore.kernel.org/bpf/20191009164929.17242-1-i.maximets@ovn.org
    Signed-off-by: Sasha Levin

    Ilya Maximets
     
  • [ Upstream commit b4099769f3321a8d258a47a8b4b9d278dad28a73 ]

    Fix a case where explicit padding at the end of a struct is necessary
    due to non-standart alignment requirements of fields (which BTF doesn't
    capture explicitly).

    Fixes: 351131b51c7a ("libbpf: add btf_dump API for BTF-to-C conversion")
    Reported-by: John Fastabend
    Signed-off-by: Andrii Nakryiko
    Signed-off-by: Alexei Starovoitov
    Tested-by: John Fastabend
    Link: https://lore.kernel.org/bpf/20191008231009.2991130-2-andriin@fb.com
    Signed-off-by: Sasha Levin

    Andrii Nakryiko
     

20 Oct, 2019

1 commit

  • Pull networking fixes from David Miller:
    "I was battling a cold after some recent trips, so quite a bit piled up
    meanwhile, sorry about that.

    Highlights:

    1) Fix fd leak in various bpf selftests, from Brian Vazquez.

    2) Fix crash in xsk when device doesn't support some methods, from
    Magnus Karlsson.

    3) Fix various leaks and use-after-free in rxrpc, from David Howells.

    4) Fix several SKB leaks due to confusion of who owns an SKB and who
    should release it in the llc code. From Eric Biggers.

    5) Kill a bunc of KCSAN warnings in TCP, from Eric Dumazet.

    6) Jumbo packets don't work after resume on r8169, as the BIOS resets
    the chip into non-jumbo mode during suspend. From Heiner Kallweit.

    7) Corrupt L2 header during MPLS push, from Davide Caratti.

    8) Prevent possible infinite loop in tc_ctl_action, from Eric
    Dumazet.

    9) Get register bits right in bcmgenet driver, based upon chip
    version. From Florian Fainelli.

    10) Fix mutex problems in microchip DSA driver, from Marek Vasut.

    11) Cure race between route lookup and invalidation in ipv4, from Wei
    Wang.

    12) Fix performance regression due to false sharing in 'net'
    structure, from Eric Dumazet"

    * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (145 commits)
    net: reorder 'struct net' fields to avoid false sharing
    net: dsa: fix switch tree list
    net: ethernet: dwmac-sun8i: show message only when switching to promisc
    net: aquantia: add an error handling in aq_nic_set_multicast_list
    net: netem: correct the parent's backlog when corrupted packet was dropped
    net: netem: fix error path for corrupted GSO frames
    macb: propagate errors when getting optional clocks
    xen/netback: fix error path of xenvif_connect_data()
    net: hns3: fix mis-counting IRQ vector numbers issue
    net: usb: lan78xx: Connect PHY before registering MAC
    vsock/virtio: discard packets if credit is not respected
    vsock/virtio: send a credit update when buffer size is changed
    mlxsw: spectrum_trap: Push Ethernet header before reporting trap
    net: ensure correct skb->tstamp in various fragmenters
    net: bcmgenet: reset 40nm EPHY on energy detect
    net: bcmgenet: soft reset 40nm EPHYs before MAC init
    net: phy: bcm7xxx: define soft_reset for 40nm EPHY
    net: bcmgenet: don't set phydev->link from MAC
    net: Update address for MediaTek ethernet driver in MAINTAINERS
    ipv4: fix race condition between route lookup and invalidation
    ...

    Linus Torvalds
     

07 Oct, 2019

1 commit

  • …inux/kernel/git/acme/linux into perf/urgent

    Pull perf/urgent fixes from Arnaldo Carvalho de Melo:

    perf script:

    Andi Kleen:

    - Fix recovery from LBR/binary mismatch in the "brstackinsn" --field.

    perf annotate:

    Arnaldo Carvalho de Melo:

    - Propagate errors so that meaningful messages can be presented to the
    user in case of problems.

    perf map:

    Steve MacLean:

    - Fix handling of maps partially overlapped, resolving symbols in the
    ranges not replaced by new mmaps.

    perf tests:

    Ian Rogers:

    - Use raise() instead of NULL derefs to avoid causing a SIGILL rather than a
    SIGSEGV for optimized builds that turn NULL derefs into ud2 instructions.

    perf LLVM:

    Ian Rogers:

    - Don't access out-of-scope array.

    perf inject:

    Steve MacLean:

    - Fix JIT_CODE_MOVE filename, that was having a u64 truncaded into a 32-bit
    snprintf format and also a missing ".so" suffix in another case.

    libsubcmd:

    Ian Rogers:

    - Make _FORTIFY_SOURCE defines dependent on the feature, avoiding
    false positives with with memory sanitizers such as LLVM's ASan.

    Vendor specific events:

    Intel:

    Andi Kleen:

    - Fix period for Intel fixed counters.

    s390:

    Thomas Richter (2):

    - Fix some event details transaction for machine type 8561.

    tools headers UAPI:

    Arnaldo Carvalho de Melo:

    - Sync headers with the kernel, catching new usbdevfs ioctls and
    madvise behaviours to properly decode in 'perf trace' output.

    Documentation:

    Steve MacLean:

    - Correct and clarify jitdump spec.

    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Ingo Molnar
     

01 Oct, 2019

1 commit

  • bcc uses libbpf repo as a submodule. It brings in libbpf source
    code and builds everything together to produce shared libraries.
    With latest libbpf, I got the following errors:
    /bin/ld: libbcc_bpf.so.0.10.0: version node not found for symbol xsk_umem__create@LIBBPF_0.0.2
    /bin/ld: failed to set dynamic section sizes: Bad value
    collect2: error: ld returned 1 exit status
    make[2]: *** [src/cc/libbcc_bpf.so.0.10.0] Error 1

    In xsk.c, we have
    asm(".symver xsk_umem__create_v0_0_2, xsk_umem__create@LIBBPF_0.0.2");
    asm(".symver xsk_umem__create_v0_0_4, xsk_umem__create@@LIBBPF_0.0.4");
    The linker thinks the built is for LIBBPF but cannot find proper version
    LIBBPF_0.0.2/4, so emit errors.

    I also confirmed that using libbpf.a to produce a shared library also
    has issues:
    -bash-4.4$ cat t.c
    extern void *xsk_umem__create;
    void * test() { return xsk_umem__create; }
    -bash-4.4$ gcc -c -fPIC t.c
    -bash-4.4$ gcc -shared t.o libbpf.a -o t.so
    /bin/ld: t.so: version node not found for symbol xsk_umem__create@LIBBPF_0.0.2
    /bin/ld: failed to set dynamic section sizes: Bad value
    collect2: error: ld returned 1 exit status
    -bash-4.4$

    Symbol versioning does happens in commonly used libraries, e.g., elfutils
    and glibc. For static libraries, for a versioned symbol, the old definitions
    will be ignored, and the symbol will be an alias to the latest definition.
    For example, glibc sched_setaffinity is versioned.
    -bash-4.4$ readelf -s /usr/lib64/libc.so.6 | grep sched_setaffinity
    756: 000000000013d3d0 13 FUNC GLOBAL DEFAULT 13 sched_setaffinity@GLIBC_2.3.3
    757: 00000000000e2e70 455 FUNC GLOBAL DEFAULT 13 sched_setaffinity@@GLIBC_2.3.4
    1800: 0000000000000000 0 FILE LOCAL DEFAULT ABS sched_setaffinity.c
    4228: 00000000000e2e70 455 FUNC LOCAL DEFAULT 13 __sched_setaffinity_new
    4648: 000000000013d3d0 13 FUNC LOCAL DEFAULT 13 __sched_setaffinity_old
    7338: 000000000013d3d0 13 FUNC GLOBAL DEFAULT 13 sched_setaffinity@GLIBC_2
    7380: 00000000000e2e70 455 FUNC GLOBAL DEFAULT 13 sched_setaffinity@@GLIBC_
    -bash-4.4$
    For static library, the definition of sched_setaffinity aliases to the new definition.
    -bash-4.4$ readelf -s /usr/lib64/libc.a | grep sched_setaffinity
    File: /usr/lib64/libc.a(sched_setaffinity.o)
    8: 0000000000000000 455 FUNC GLOBAL DEFAULT 1 __sched_setaffinity_new
    12: 0000000000000000 455 FUNC WEAK DEFAULT 1 sched_setaffinity

    For both elfutils and glibc, additional macros are used to control different handling
    of symbol versioning w.r.t static and shared libraries.
    For elfutils, the macro is SYMBOL_VERSIONING
    (https://sourceware.org/git/?p=elfutils.git;a=blob;f=lib/eu-config.h).
    For glibc, the macro is SHARED
    (https://sourceware.org/git/?p=glibc.git;a=blob;f=include/shlib-compat.h;hb=refs/heads/master)

    This patch used SHARED as the macro name. After this patch, the libbpf.a has
    -bash-4.4$ readelf -s libbpf.a | grep xsk_umem__create
    372: 0000000000017145 1190 FUNC GLOBAL DEFAULT 1 xsk_umem__create_v0_0_4
    405: 0000000000017145 1190 FUNC GLOBAL DEFAULT 1 xsk_umem__create
    499: 00000000000175eb 103 FUNC GLOBAL DEFAULT 1 xsk_umem__create_v0_0_2
    -bash-4.4$
    No versioned symbols for xsk_umem__create.
    The libbpf.a can be used to build a shared library succesfully.
    -bash-4.4$ cat t.c
    extern void *xsk_umem__create;
    void * test() { return xsk_umem__create; }
    -bash-4.4$ gcc -c -fPIC t.c
    -bash-4.4$ gcc -shared t.o libbpf.a -o t.so
    -bash-4.4$

    Fixes: 10d30e301732 ("libbpf: add flags to umem config")
    Cc: Kevin Laatz
    Cc: Arnaldo Carvalho de Melo
    Cc: Andrii Nakryiko
    Acked-by: Andrii Nakryiko
    Signed-off-by: Yonghong Song
    Signed-off-by: Alexei Starovoitov

    Yonghong Song
     

30 Sep, 2019

1 commit

  • make TARGETS=bpf kselftest fails with:

    Makefile:127: tools/build/Makefile.include: No such file or directory

    When the bpf tool make is invoked from tools Makefile, srctree is
    cleared and the current logic check for srctree equals to empty
    string to determine srctree location from CURDIR.

    When the build in invoked from selftests/bpf Makefile, the srctree
    is set to "." and the same logic used for srctree equals to empty is
    needed to determine srctree.

    Check building_out_of_srctree undefined as the condition for both
    cases to fix "make TARGETS=bpf kselftest" build failure.

    Signed-off-by: Shuah Khan
    Signed-off-by: Daniel Borkmann
    Acked-by: Song Liu
    Link: https://lore.kernel.org/bpf/20190927011344.4695-1-skhan@linuxfoundation.org

    Shuah Khan
     

29 Sep, 2019

1 commit

  • Pull networking fixes from David Miller:

    1) Sanity check URB networking device parameters to avoid divide by
    zero, from Oliver Neukum.

    2) Disable global multicast filter in NCSI, otherwise LLDP and IPV6
    don't work properly. Longer term this needs a better fix tho. From
    Vijay Khemka.

    3) Small fixes to selftests (use ping when ping6 is not present, etc.)
    from David Ahern.

    4) Bring back rt_uses_gateway member of struct rtable, it's semantics
    were not well understood and trying to remove it broke things. From
    David Ahern.

    5) Move usbnet snaity checking, ignore endpoints with invalid
    wMaxPacketSize. From Bjørn Mork.

    6) Missing Kconfig deps for sja1105 driver, from Mao Wenan.

    7) Various small fixes to the mlx5 DR steering code, from Alaa Hleihel,
    Alex Vesker, and Yevgeny Kliteynik

    8) Missing CAP_NET_RAW checks in various places, from Ori Nimron.

    9) Fix crash when removing sch_cbs entry while offloading is enabled,
    from Vinicius Costa Gomes.

    10) Signedness bug fixes, generally in looking at the result given by
    of_get_phy_mode() and friends. From Dan Crapenter.

    11) Disable preemption around BPF_PROG_RUN() calls, from Eric Dumazet.

    12) Don't create VRF ipv6 rules if ipv6 is disabled, from David Ahern.

    13) Fix quantization code in tcp_bbr, from Kevin Yang.

    * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (127 commits)
    net: tap: clean up an indentation issue
    nfp: abm: fix memory leak in nfp_abm_u32_knode_replace
    tcp: better handle TCP_USER_TIMEOUT in SYN_SENT state
    sk_buff: drop all skb extensions on free and skb scrubbing
    tcp_bbr: fix quantization code to not raise cwnd if not probing bandwidth
    mlxsw: spectrum_flower: Fail in case user specifies multiple mirror actions
    Documentation: Clarify trap's description
    mlxsw: spectrum: Clear VLAN filters during port initialization
    net: ena: clean up indentation issue
    NFC: st95hf: clean up indentation issue
    net: phy: micrel: add Asym Pause workaround for KSZ9021
    net: socionext: ave: Avoid using netdev_err() before calling register_netdev()
    ptp: correctly disable flags on old ioctls
    lib: dimlib: fix help text typos
    net: dsa: microchip: Always set regmap stride to 1
    nfp: flower: fix memory leak in nfp_flower_spawn_vnic_reprs
    nfp: flower: prevent memory leak in nfp_flower_spawn_phy_reprs
    net/sched: Set default of CONFIG_NET_TC_SKB_EXT to N
    vrf: Do not attempt to create IPv6 mcast rule if IPv6 is disabled
    net: sched: sch_sfb: don't call qdisc_put() while holding tree lock
    ...

    Linus Torvalds
     

27 Sep, 2019

2 commits

  • Unconditionally defining _FORTIFY_SOURCE can break tools that don't work
    with it, such as memory sanitizers:

    https://github.com/google/sanitizers/wiki/AddressSanitizer#faq

    Fixes: 4b6ab94eabe4 ("perf subcmd: Create subcmd library")
    Signed-off-by: Ian Rogers
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Jiri Olsa
    Cc: Josh Poimboeuf
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lore.kernel.org/lkml/20190925195924.152834-1-irogers@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Ian Rogers
     
  • Pull more perf updates from Ingo Molnar:
    "The only kernel change is comment typo fixes.

    The rest is mostly tooling fixes, but also new vendor event additions
    and updates, a bigger libperf/libtraceevent library and a header files
    reorganization that came in a bit late"

    * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (108 commits)
    perf unwind: Fix libunwind build failure on i386 systems
    perf parser: Remove needless include directives
    perf build: Add detection of java-11-openjdk-devel package
    perf jvmti: Include JVMTI support for s390
    perf vendor events: Remove P8 HW events which are not supported
    perf evlist: Fix access of freed id arrays
    perf stat: Fix free memory access / memory leaks in metrics
    perf tools: Replace needless mmap.h with what is needed, event.h
    perf evsel: Move config terms to a separate header
    perf evlist: Remove unused perf_evlist__fprintf() method
    perf evsel: Introduce evsel_fprintf.h
    perf evsel: Remove need for symbol_conf in evsel_fprintf.c
    perf copyfile: Move copyfile routines to separate files
    libperf: Add perf_evlist__poll() function
    libperf: Add perf_evlist__add_pollfd() function
    libperf: Add perf_evlist__alloc_pollfd() function
    libperf: Add libperf_init() call to the tests
    libperf: Merge libperf_set_print() into libperf_init()
    libperf: Add libperf dependency for tests targets
    libperf: Use sys/types.h to get ssize_t, not unistd.h
    ...

    Linus Torvalds
     

26 Sep, 2019

3 commits

  • BTF-to-C converter previously skipped anonymous enums in an assumption
    that those are embedded in struct's field definitions. This is not
    always the case and a lot of kernel constants are defined as part of
    anonymous enums. This change fixes the logic by eagerly marking all
    types as either referenced by any other type or not. This is enough to
    distinguish two classes of anonymous enums and emit previously omitted
    enum definitions.

    Signed-off-by: Andrii Nakryiko
    Signed-off-by: Daniel Borkmann
    Link: https://lore.kernel.org/bpf/20190925203745.3173184-1-andriin@fb.com

    Andrii Nakryiko
     
  • As was already noted in rbtree.h, the logic to cache rb_first (or
    rb_last) can easily be implemented externally to the core rbtree api.

    This commit takes the changes applied to the include/linux/ and lib/
    rbtree files in 9f973cb38088 ("lib/rbtree: avoid generating code twice
    for the cached versions"), and applies these to the
    tools/include/linux/ and tools/lib/ files as well to keep them
    synchronized.

    Link: http://lkml.kernel.org/r/20190703034812.53002-1-walken@google.com
    Signed-off-by: Michel Lespinasse
    Cc: David Howells
    Cc: Davidlohr Bueso
    Cc: Peter Zijlstra (Intel)
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michel Lespinasse
     
  • Some compilers emit warning for potential uninitialized next_id usage.
    The code is correct, but control flow is too complicated for some
    compilers to figure this out. Re-initialize next_id to satisfy
    compiler.

    Signed-off-by: Andrii Nakryiko
    Signed-off-by: Daniel Borkmann

    Andrii Nakryiko
     

25 Sep, 2019

7 commits

  • Create man pages for libtraceevent APIs:

    tep_load_plugins(),
    tep_unload_plugin()

    Signed-off-by: Tzvetomir Stoyanov
    Cc: Andrew Morton
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: linux-trace-devel@vger.kernel.org
    Link: http://lore.kernel.org/linux-trace-devel/20190903133434.30417-1-tz.stoyanov@gmail.com
    Link: http://lore.kernel.org/lkml/20190919212542.216189588@goodmis.org
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Arnaldo Carvalho de Melo

    Tzvetomir Stoyanov
     
  • All traceevent plugins code is moved to tools/lib/traceevent/plugins
    subdirectory. It makes traceevent implementation in trace-cmd and in
    kernel tree consistent. There is no changes in the way libtraceevent and
    plugins are compiled and installed.

    Committer notes:

    Applied fixup provided by Steven, fixing the tools/perf/Makefile.perf
    target for the plugin dynamic list file. Problem noticed when cross
    building to aarch64 from a Ubuntu 19.04 container.

    Suggested-by: Steven Rostedt (VMware)
    Signed-off-by: Tzvetomir Stoyanov (VMware)
    Cc: Andrew Morton
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Tzvetomir Stoyanov (VMware)
    Cc: linux-trace-devel@vger.kernel.org
    Link: http://lore.kernel.org/lkml/20190923115929.453b68f1@oasis.local.home
    Link: http://lore.kernel.org/lkml/20190919212542.377333393@goodmis.org
    Link: http://lore.kernel.org/linux-trace-devel/20190917105055.18983-1-tz.stoyanov@gmail.com
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Arnaldo Carvalho de Melo

    Tzvetomir Stoyanov (VMware)
     
  • The tep_get_event() function is an official libtracevent API, described
    in the library man pages. However, it cannot be used by the library users because
    it is not declared in the event-parse.h file, where all libtracevent APIs are.
    The function declaration is added in event-parse.h file.

    Signed-off-by: Tzvetomir Stoyanov (VMware)
    Cc: Andrew Morton
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Tzvetomir Stoyanov (VMware)
    Cc: linux-trace-devel@vger.kernel.org
    Link: http://lore.kernel.org/linux-trace-devel/20190808113721.13539-1-tz.stoyanov@gmail.com
    Link: http://lore.kernel.org/lkml/20190919212542.058025937@goodmis.org
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Arnaldo Carvalho de Melo

    Tzvetomir Stoyanov (VMware)
     
  • APIs for printing various trace event information were redesigned to be
    more simple. However, the main libtraceevent man page was not updated
    with those changes. The documentation is updated to describe the new
    event print API.

    Signed-off-by: Tzvetomir Stoyanov (VMware)
    Cc: Andrew Morton
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Tzvetomir Stoyanov (VMware)
    Cc: linux-trace-devel@vger.kernel.org
    Link: http://lore.kernel.org/linux-trace-devel/20190808113636.13299-3-tz.stoyanov@gmail.com
    Link: http://lore.kernel.org/lkml/20190919212541.869643036@goodmis.org
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Arnaldo Carvalho de Melo

    Tzvetomir Stoyanov (VMware)
     
  • The tep_ref_get() was renamed to tep_get_ref(), to be more consistent
    with the other tep_ref_* APIs. However, in the man pages the API is
    still with the old name. The documentation is fixed to reflect the
    actual name of the API.

    Signed-off-by: Tzvetomir Stoyanov (VMware)
    Cc: Andrew Morton
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Tzvetomir Stoyanov (VMware)
    Cc: linux-trace-devel@vger.kernel.org
    Link: http://lore.kernel.org/linux-trace-devel/20190808113636.13299-2-tz.stoyanov@gmail.com
    Link: http://lore.kernel.org/lkml/20190919212541.697034573@goodmis.org
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Arnaldo Carvalho de Melo

    Tzvetomir Stoyanov (VMware)
     
  • Added new man page, describing tep_print_event() libtraceevent API.

    Signed-off-by: Tzvetomir Stoyanov
    Cc: Andrew Morton
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: linux-trace-devel@vger.kernel.org
    Link: http://lore.kernel.org/linux-trace-devel/20190801075012.22098-1-tz.stoyanov@gmail.com
    Link: http://lore.kernel.org/lkml/20190919212541.553160178@goodmis.org
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Arnaldo Carvalho de Melo

    Tzvetomir Stoyanov
     
  • When testing the output of the old trace-cmd compared to the one that
    uses the updated tep_print_event() logic, it was different in that the
    time stamp precision in the old format would round up to the nearest
    precision, where as the new logic truncates. Bring back the old method
    of rounding up.

    Signed-off-by: Steven Rostedt (VMware)
    Cc: Jiri Olsa
    Cc: Tzvetomir Stoyanov
    Cc: linux trace devel
    Link: http://lore.kernel.org/lkml/20190919165119.5efa5de6@gandalf.local.home
    Signed-off-by: Arnaldo Carvalho de Melo

    Steven Rostedt (VMware)
     

20 Sep, 2019

1 commit

  • There are no in-kernel %p[fF] users left. Convert the traceevent tool,
    too, to align with the kernel.

    Signed-off-by: Sakari Ailus
    Cc: Andy Shevchenko
    Cc: devicetree@vger.kernel.org
    Cc: Heikki Krogerus
    Cc: Jiri Olsa
    Cc: Joe Perches
    Cc: linux-acpi@vger.kernel.org
    Cc: linux-trace-devel@vger.kernel.org
    Cc: Namhyung Kim
    Cc: Petr Mladek
    Cc: Rafael J. Wysocki
    Cc: Rob Herring
    Cc: Steven Rostedt (VMware)
    Cc: Tzvetomir Stoyanov
    Link: http://lore.kernel.org/lkml/20190918133419.7969-2-sakari.ailus@linux.intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Sakari Ailus
     

19 Sep, 2019

2 commits

  • The xsk_socket__create() function fails and returns an error if it cannot
    get the XDP_OPTIONS through getsockopt(). However, support for XDP_OPTIONS
    was not added until kernel 5.3, so this means that creating XSK sockets
    always fails on older kernels.

    Since the option is just used to set the zero-copy flag in the xsk struct,
    and that flag is not really used for anything yet, just remove the
    getsockopt() call until a proper use for it is introduced.

    Suggested-by: Yonghong Song
    Signed-off-by: Toke Høiland-Jørgensen
    Acked-by: Andrii Nakryiko
    Signed-off-by: Daniel Borkmann

    Toke Høiland-Jørgensen
     
  • Pull networking updates from David Miller:

    1) Support IPV6 RA Captive Portal Identifier, from Maciej Żenczykowski.

    2) Use bio_vec in the networking instead of custom skb_frag_t, from
    Matthew Wilcox.

    3) Make use of xmit_more in r8169 driver, from Heiner Kallweit.

    4) Add devmap_hash to xdp, from Toke Høiland-Jørgensen.

    5) Support all variants of 5750X bnxt_en chips, from Michael Chan.

    6) More RTNL avoidance work in the core and mlx5 driver, from Vlad
    Buslov.

    7) Add TCP syn cookies bpf helper, from Petar Penkov.

    8) Add 'nettest' to selftests and use it, from David Ahern.

    9) Add extack support to drop_monitor, add packet alert mode and
    support for HW drops, from Ido Schimmel.

    10) Add VLAN offload to stmmac, from Jose Abreu.

    11) Lots of devm_platform_ioremap_resource() conversions, from
    YueHaibing.

    12) Add IONIC driver, from Shannon Nelson.

    13) Several kTLS cleanups, from Jakub Kicinski.

    * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next: (1930 commits)
    mlxsw: spectrum_buffers: Add the ability to query the CPU port's shared buffer
    mlxsw: spectrum: Register CPU port with devlink
    mlxsw: spectrum_buffers: Prevent changing CPU port's configuration
    net: ena: fix incorrect update of intr_delay_resolution
    net: ena: fix retrieval of nonadaptive interrupt moderation intervals
    net: ena: fix update of interrupt moderation register
    net: ena: remove all old adaptive rx interrupt moderation code from ena_com
    net: ena: remove ena_restore_ethtool_params() and relevant fields
    net: ena: remove old adaptive interrupt moderation code from ena_netdev
    net: ena: remove code duplication in ena_com_update_nonadaptive_moderation_interval _*()
    net: ena: enable the interrupt_moderation in driver_supported_features
    net: ena: reimplement set/get_coalesce()
    net: ena: switch to dim algorithm for rx adaptive interrupt moderation
    net: ena: add intr_moder_rx_interval to struct ena_com_dev and use it
    net: phy: adin: implement Energy Detect Powerdown mode via phy-tunable
    ethtool: implement Energy Detect Powerdown support via phy-tunable
    xen-netfront: do not assume sk_buff_head list is empty in error handling
    s390/ctcm: Delete unnecessary checks before the macro call “dev_kfree_skb”
    net: ena: don't wake up tx queue when down
    drop_monitor: Better sanitize notified packets
    ...

    Linus Torvalds