1. 18 Jan, 2018 6 commits
    • Yonghong Song's avatar
      bpf: change fake_ip for bpf_trace_printk helper · eefa864a
      Yonghong Song authored
      Currently, for bpf_trace_printk helper, fake ip address 0x1
      is used with comments saying that fake ip will not be printed.
      This is indeed true for 4.12 and earlier version, but for
      4.13 and later version, the ip address will be printed if
      it cannot be resolved with kallsym. Running samples/bpf/tracex5
      program and you will have the following in the debugfs
      trace_pipe output:
        ...
        <...>-1819  [003] ....   443.497877: 0x00000001: mmap
        <...>-1819  [003] ....   443.498289: 0x00000001: syscall=102 (one of get/set uid/pid/gid)
        ...
      
      The kernel commit changed this behavior is:
        commit feaf1283
        Author: Steven Rostedt (VMware) <rostedt@goodmis.org>
        Date:   Thu Jun 22 17:04:55 2017 -0400
      
            tracing: Show address when function names are not found
        ...
      
      This patch changed the comment and also altered the fake ip
      address to 0x0 as users may think 0x1 has some special meaning
      while it doesn't. The new output:
        ...
        <...>-1799  [002] ....    25.953576: 0: mmap
        <...>-1799  [002] ....    25.953865: 0: read(fd=0, buf=00000000053936b5, size=512)
        ...
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      eefa864a
    • Jesper Dangaard Brouer's avatar
      samples/bpf: xdp2skb_meta comment explain why pkt-data pointers are invalidated · e2e32241
      Jesper Dangaard Brouer authored
      Improve the 'unknown reason' comment, with an actual explaination of why
      the ctx pkt-data pointers need to be loaded after the helper function
      bpf_xdp_adjust_meta().  Based on the explaination Daniel gave.
      
      Fixes: 36e04a2d ("samples/bpf: xdp2skb_meta shows transferring info from XDP to SKB")
      Reported-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      e2e32241
    • Daniel Borkmann's avatar
      Merge branch 'bpf-dump-and-disasm-nfp-jit' · cda18e97
      Daniel Borkmann authored
      Jakub Kicinski says:
      
      ====================
      Jiong says:
      
      Currently bpftool could disassemble host jited image, for example x86_64,
      using libbfd. However it couldn't disassemble offload jited image.
      
      There are two reasons:
      
        1. bpf_obj_get_info_by_fd/struct bpf_prog_info couldn't get the address
           of jited image and image's length.
      
        2. Even after issue 1 resolved, bpftool couldn't figure out what is the
           offload arch from bpf_prog_info, therefore can't drive libbfd
           disassembler correctly.
      
        This patch set resolve issue 1 by introducing two new fields "jited_len"
      and "jited_image" in bpf_dev_offload. These two fields serve as the generic
      interface to communicate the jited image address and length for all offload
      targets to higher level caller. For example, bpf_obj_get_info_by_fd could
      use them to fill the userspace visible fields jited_prog_len and
      jited_prog_insns.
      
        This patch set resolve issue 2 by getting bfd backend name through
      "ifindex", i.e network interface index.
      
      v1:
       - Deduct bfd arch name through ifindex, i.e network interface index.
         First, map ifindex to devname through ifindex_to_name_ns, then get
         pci id through /sys/class/dev/DEVNAME/device/vendor. (Daniel, Alexei)
      ====================
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      cda18e97
    • Jiong Wang's avatar
      tools: bpftool: improve architecture detection by using ifindex · e6593596
      Jiong Wang authored
      The current architecture detection method in bpftool is designed for host
      case.
      
      For offload case, we can't use the architecture of "bpftool" itself.
      Instead, we could call the existing "ifindex_to_name_ns" to get DEVNAME,
      then read pci id from /sys/class/dev/DEVNAME/device/vendor, finally we map
      vendor id to bfd arch name which will finally be used to select bfd backend
      for the disassembler.
      Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarJiong Wang <jiong.wang@netronome.com>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      e6593596
    • Jiong Wang's avatar
      nfp: bpf: set new jit info fields · eb1d7db9
      Jiong Wang authored
      This patch set those new jit info fields introduced in this patch set.
      Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarJiong Wang <jiong.wang@netronome.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      eb1d7db9
    • Jiong Wang's avatar
      bpf: add new jited info fields in bpf_dev_offload and bpf_prog_info · fcfb126d
      Jiong Wang authored
      For host JIT, there are "jited_len"/"bpf_func" fields in struct bpf_prog
      used by all host JIT targets to get jited image and it's length. While for
      offload, targets are likely to have different offload mechanisms that these
      info are kept in device private data fields.
      
      Therefore, BPF_OBJ_GET_INFO_BY_FD syscall needs an unified way to get JIT
      length and contents info for offload targets.
      
      One way is to introduce new callback to parse device private data then fill
      those fields in bpf_prog_info. This might be a little heavy, the other way
      is to add generic fields which will be initialized by all offload targets.
      
      This patch follow the second approach to introduce two new fields in
      struct bpf_dev_offload and teach bpf_prog_get_info_by_fd about them to fill
      correct jited_prog_len and jited_prog_insns in bpf_prog_info.
      Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarJiong Wang <jiong.wang@netronome.com>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      fcfb126d
  2. 17 Jan, 2018 34 commits