1. 20 12月, 2019 1 次提交
    • A
      libbpf: Introduce bpf_prog_attach_xattr · cdbee383
      Andrey Ignatov 提交于
      Introduce a new bpf_prog_attach_xattr function that, in addition to
      program fd, target fd and attach type, accepts an extendable struct
      bpf_prog_attach_opts.
      
      bpf_prog_attach_opts relies on DECLARE_LIBBPF_OPTS macro to maintain
      backward and forward compatibility and has the following "optional"
      attach attributes:
      
      * existing attach_flags, since it's not required when attaching in NONE
        mode. Even though it's quite often used in MULTI and OVERRIDE mode it
        seems to be a good idea to reduce number of arguments to
        bpf_prog_attach_xattr;
      
      * newly introduced attribute of BPF_PROG_ATTACH command: replace_prog_fd
        that is fd of previously attached cgroup-bpf program to replace if
        BPF_F_REPLACE flag is used.
      
      The new function is named to be consistent with other xattr-functions
      (bpf_prog_test_run_xattr, bpf_create_map_xattr, bpf_load_program_xattr).
      
      The struct bpf_prog_attach_opts is supposed to be used with
      DECLARE_LIBBPF_OPTS macro.
      Signed-off-by: NAndrey Ignatov <rdna@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NAndrii Nakryiko <andriin@fb.com>
      Link: https://lore.kernel.org/bpf/bd6e0732303eb14e4b79cb128268d9e9ad6db208.1576741281.git.rdna@fb.com
      cdbee383
  2. 19 12月, 2019 7 次提交
  3. 18 12月, 2019 3 次提交
  4. 17 12月, 2019 2 次提交
  5. 16 12月, 2019 18 次提交
  6. 14 12月, 2019 3 次提交
  7. 13 12月, 2019 1 次提交
  8. 11 12月, 2019 1 次提交
  9. 05 12月, 2019 1 次提交
  10. 02 12月, 2019 1 次提交
  11. 28 11月, 2019 2 次提交
    • A
      libbpf: Fix sym->st_value print on 32-bit arches · 7c3977d1
      Alexei Starovoitov 提交于
      The st_value field is a 64-bit value and causing this error on 32-bit arches:
      
      In file included from libbpf.c:52:
      libbpf.c: In function 'bpf_program__record_reloc':
      libbpf_internal.h:59:22: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'Elf64_Addr' {aka 'const long long unsigned int'} [-Werror=format=]
      
      Fix it with (__u64) cast.
      
      Fixes: 1f8e2bcb ("libbpf: Refactor relocation handling")
      Reported-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      7c3977d1
    • A
      libbpf: Fix up generation of bpf_helper_defs.h · 1fd450f9
      Arnaldo Carvalho de Melo 提交于
        $ make -C tools/perf build-test
      
      does, ends up with these two problems:
      
        make[3]: *** No rule to make target '/tmp/tmp.zq13cHILGB/perf-5.3.0/include/uapi/linux/bpf.h', needed by 'bpf_helper_defs.h'.  Stop.
        make[3]: *** Waiting for unfinished jobs....
        make[2]: *** [Makefile.perf:757: /tmp/tmp.zq13cHILGB/perf-5.3.0/tools/lib/bpf/libbpf.a] Error 2
        make[2]: *** Waiting for unfinished jobs....
      
      Because $(srcdir) points to the /tmp/tmp.zq13cHILGB/perf-5.3.0 directory
      and we need '/tools/ after that variable, and after fixing this then we
      get to another problem:
      
        /bin/sh: /home/acme/git/perf/tools/scripts/bpf_helpers_doc.py: No such file or directory
        make[3]: *** [Makefile:184: bpf_helper_defs.h] Error 127
        make[3]: *** Deleting file 'bpf_helper_defs.h'
          LD       /tmp/build/perf/libapi-in.o
        make[2]: *** [Makefile.perf:778: /tmp/build/perf/libbpf.a] Error 2
        make[2]: *** Waiting for unfinished jobs....
      
      Because this requires something outside the tools/ directories that gets
      collected into perf's detached tarballs, to fix it just add it to
      tools/perf/MANIFEST, which this patch does, now it works for that case
      and also for all these other cases.
      
      Fixes: e01a75c1 ("libbpf: Move bpf_{helpers, helper_defs, endian, tracing}.h into libbpf")
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andriin@fb.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-4pnkg2vmdvq5u6eivc887wen@git.kernel.org
      Link: https://lore.kernel.org/bpf/20191126151045.GB19483@kernel.org
      1fd450f9