1. 05 11月, 2019 2 次提交
  2. 22 10月, 2019 5 次提交
  3. 19 10月, 2019 1 次提交
  4. 16 10月, 2019 1 次提交
  5. 15 10月, 2019 10 次提交
  6. 13 10月, 2019 1 次提交
  7. 11 10月, 2019 1 次提交
  8. 09 10月, 2019 3 次提交
  9. 05 10月, 2019 1 次提交
  10. 03 10月, 2019 4 次提交
  11. 02 10月, 2019 6 次提交
  12. 01 10月, 2019 5 次提交
    • Y
      libbpf: handle symbol versioning properly for libbpf.a · 1bd63524
      Yonghong Song 提交于
      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: 10d30e30 ("libbpf: add flags to umem config")
      Cc: Kevin Laatz <kevin.laatz@intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Andrii Nakryiko <andriin@fb.com>
      Acked-by: NAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: NYonghong Song <yhs@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      1bd63524
    • S
      selftests: pidfd: Fix undefined reference to pthread_create() · 3969e769
      Shuah Khan 提交于
      Fix build failure:
      
      undefined reference to `pthread_create'
      collect2: error: ld returned 1 exit status
      
      Fix CFLAGS to include pthread correctly.
      
      Fixes: 740378dc ("pidfd: add polling selftests")
      Signed-off-by: NShuah Khan <skhan@linuxfoundation.org>
      Reviewed-by: NChristian Brauner <christian.brauner@ubuntu.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20190924195237.30519-1-skhan@linuxfoundation.orgSigned-off-by: NChristian Brauner <christian.brauner@ubuntu.com>
      3969e769
    • A
      perf annotate: Don't return -1 for error when doing BPF disassembly · 11aad897
      Arnaldo Carvalho de Melo 提交于
      Return errno when open_memstream() fails and add two new speciall error
      codes for when an invalid, non BPF file or one without BTF is passed to
      symbol__disassemble_bpf(), so that its callers can rely on
      symbol__strerror_disassemble() to convert that to a human readable error
      message that can help figure out what is wrong, with hints even.
      
      Cc: Russell King - ARM Linux admin <linux@armlinux.org.uk>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>,
      Cc: Will Deacon <will@kernel.org>
      Link: https://lkml.kernel.org/n/tip-usevw9r2gcipfcrbpaueurw0@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      11aad897
    • A
      perf annotate: Return appropriate error code for allocation failures · 16ed3c1e
      Arnaldo Carvalho de Melo 提交于
      We should return errno or the annotation extra range understood by
      symbol__strerror_disassemble() instead of -1, fix it, returning ENOMEM
      instead.
      Reported-by: NRussell King - ARM Linux admin <linux@armlinux.org.uk>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>,
      Cc: Will Deacon <will@kernel.org>
      Link: https://lkml.kernel.org/n/tip-8of1cmj3rz0mppfcshc9bbqq@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      16ed3c1e
    • A
      perf annotate: Fix arch specific ->init() failure errors · 42d7a910
      Arnaldo Carvalho de Melo 提交于
      They are called from symbol__annotate() and to propagate errors that can
      help understand the problem make them return what
      symbol__strerror_disassemble() known, i.e. errno codes and other
      annotation specific errors in a special, out of errnos, range.
      Reported-by: NRussell King - ARM Linux admin <linux@armlinux.org.uk>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>,
      Cc: Will Deacon <will@kernel.org>
      Link: https://lkml.kernel.org/n/tip-pqx7srcv7tixgid251aeboj6@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      42d7a910